Skip to content

Commit

Permalink
Rename "GPU" macros to be explicitly for Ganesh backends.
Browse files Browse the repository at this point in the history
Basically a big find/replace of DEF_GPUTEST -> DEF_GANESH_TEST

Then I ran git clang-format <parent CL branch>. I had to install
the git-clang-format script, but it was worth it. I documented
how to install it in .clang-format.

Note some updated docs in TestTest.cpp

Change-Id: I778955de6e5a07100a96aaa042542bda47a9da6f
Bug: skia:13758
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/583237
Reviewed-by: Greg Daniel <[email protected]>
  • Loading branch information
kjlubick authored and SkCQ committed Sep 21, 2022
1 parent 2baabb4 commit eed3b01
Show file tree
Hide file tree
Showing 109 changed files with 1,300 additions and 1,196 deletions.
7 changes: 6 additions & 1 deletion .clang-format
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
---
# Typical usage is to apply this to the lines you've modified in a local
# change. Stage your changes with "git add" and then run:
# change. Make sure to install git-clang-format [1] by adding it to your
# path and make it executable.
#
# Stage your changes with "git add" and then run:
# $ git clang-format
# You can optionally use the "--" file filter to restrict formatting to certain
# files or directories. The tool will display the list of files that were
Expand All @@ -13,6 +16,8 @@
# - bin/clang-format: clang-format 11
# - brew: clang-format 14
#
# [1] https://raw.githubusercontent.com/llvm-mirror/clang/master/tools/clang-format/git-clang-format
#
# IF YOU UPDATE THE CPP SECTION ALSO UPDATE THE OBJECTIVE-C SECTION. IF YOU
# KNOW HOW TO SHARE SETTINGS BETWEEN THE TWO YOU'RE A TRUE HERO.

Expand Down
8 changes: 4 additions & 4 deletions tests/AdvancedBlendTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@

#include <utility>

DEF_GPUTEST_FOR_RENDERING_CONTEXTS(AdvancedBlendTest,
reporter,
ctxInfo,
CtsEnforcement::kApiLevel_T) {
DEF_GANESH_TEST_FOR_RENDERING_CONTEXTS(AdvancedBlendTest,
reporter,
ctxInfo,
CtsEnforcement::kApiLevel_T) {
static constexpr auto opaque = GrProcessorAnalysisColor::Opaque::kYes;
static constexpr auto coverage = GrProcessorAnalysisCoverage::kSingleChannel;
const GrCaps& caps = *ctxInfo.directContext()->priv().caps();
Expand Down
2 changes: 1 addition & 1 deletion tests/ApplyGammaTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ bool check_gamma(uint32_t src, uint32_t dst, bool toSRGB, float error,
return result;
}

DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ApplyGamma, reporter, ctxInfo, CtsEnforcement::kNever) {
DEF_GANESH_TEST_FOR_RENDERING_CONTEXTS(ApplyGamma, reporter, ctxInfo, CtsEnforcement::kNever) {
auto context = ctxInfo.directContext();
static constexpr SkISize kBaseSize{256, 256};
static const size_t kRowBytes = sizeof(uint32_t) * kBaseSize.fWidth;
Expand Down
18 changes: 9 additions & 9 deletions tests/BackendAllocationTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ void color_type_backend_allocation_test(const sk_gpu_test::ContextInfo& ctxInfo,
}
}

DEF_GPUTEST(ColorTypeBackendAllocationTest, reporter, options, CtsEnforcement::kApiLevel_T) {
DEF_GANESH_TEST(ColorTypeBackendAllocationTest, reporter, options, CtsEnforcement::kApiLevel_T) {
for (int t = 0; t < sk_gpu_test::GrContextFactory::kContextTypeCnt; ++t) {
auto type = static_cast<sk_gpu_test::GrContextFactory::ContextType>(t);
if (!sk_gpu_test::GrContextFactory::IsRenderingContext(type)) {
Expand Down Expand Up @@ -747,10 +747,10 @@ DEF_GPUTEST(ColorTypeBackendAllocationTest, reporter, options, CtsEnforcement::k
///////////////////////////////////////////////////////////////////////////////
#ifdef SK_GL

DEF_GPUTEST_FOR_ALL_GL_CONTEXTS(GLBackendAllocationTest,
reporter,
ctxInfo,
CtsEnforcement::kApiLevel_T) {
DEF_GANESH_TEST_FOR_ALL_GL_CONTEXTS(GLBackendAllocationTest,
reporter,
ctxInfo,
CtsEnforcement::kApiLevel_T) {
sk_gpu_test::GLTestContext* glCtx = ctxInfo.glContext();
GrGLStandard standard = glCtx->gl()->fStandard;
auto context = ctxInfo.directContext();
Expand Down Expand Up @@ -905,10 +905,10 @@ DEF_GPUTEST_FOR_ALL_GL_CONTEXTS(GLBackendAllocationTest,

#include "src/gpu/ganesh/vk/GrVkCaps.h"

DEF_GPUTEST_FOR_VULKAN_CONTEXT(VkBackendAllocationTest,
reporter,
ctxInfo,
CtsEnforcement::kApiLevel_T) {
DEF_GANESH_TEST_FOR_VULKAN_CONTEXT(VkBackendAllocationTest,
reporter,
ctxInfo,
CtsEnforcement::kApiLevel_T) {
auto context = ctxInfo.directContext();
const GrVkCaps* vkCaps = static_cast<const GrVkCaps*>(context->priv().caps());

Expand Down
8 changes: 4 additions & 4 deletions tests/BackendSurfaceMutableStateTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
#include "src/gpu/ganesh/vk/GrVkGpu.h"
#include "src/gpu/ganesh/vk/GrVkTexture.h"

DEF_GPUTEST_FOR_VULKAN_CONTEXT(VkBackendSurfaceMutableStateTest,
reporter,
ctxInfo,
CtsEnforcement::kApiLevel_T) {
DEF_GANESH_TEST_FOR_VULKAN_CONTEXT(VkBackendSurfaceMutableStateTest,
reporter,
ctxInfo,
CtsEnforcement::kApiLevel_T) {
auto dContext = ctxInfo.directContext();

GrBackendFormat format = GrBackendFormat::MakeVk(VK_FORMAT_R8G8B8A8_UNORM);
Expand Down
8 changes: 4 additions & 4 deletions tests/BlendTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ DEF_TEST(Blend_byte_multiply, r) {
}

// Tests blending to a surface with no texture available.
DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ES2BlendWithNoTexture,
reporter,
ctxInfo,
CtsEnforcement::kApiLevel_T) {
DEF_GANESH_TEST_FOR_GL_RENDERING_CONTEXTS(ES2BlendWithNoTexture,
reporter,
ctxInfo,
CtsEnforcement::kApiLevel_T) {
auto context = ctxInfo.directContext();
static constexpr SkISize kDimensions{10, 10};
const SkColorType kColorType = kRGBA_8888_SkColorType;
Expand Down
10 changes: 5 additions & 5 deletions tests/BlurTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ DEF_TEST(BlurAsABlur, reporter) {

// This exercises the problem discovered in crbug.com/570232. The return value from
// SkBlurMask::BoxBlur wasn't being checked in SkBlurMaskFilter.cpp::GrRRectBlurEffect::Create
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SmallBoxBlurBug, reporter, ctxInfo, CtsEnforcement::kNever) {
DEF_GANESH_TEST_FOR_RENDERING_CONTEXTS(SmallBoxBlurBug, reporter, ctxInfo, CtsEnforcement::kNever) {
SkImageInfo info = SkImageInfo::MakeN32Premul(128, 128);
auto surface(SkSurface::MakeRenderTarget(ctxInfo.directContext(), SkBudgeted::kNo, info));
SkCanvas* canvas = surface->getCanvas();
Expand Down Expand Up @@ -541,10 +541,10 @@ DEF_TEST(BlurZeroSigma, reporter) {

///////////////////////////////////////////////////////////////////////////////////////////

DEF_GPUTEST_FOR_RENDERING_CONTEXTS(BlurMaskBiggerThanDest,
reporter,
ctxInfo,
CtsEnforcement::kApiLevel_T) {
DEF_GANESH_TEST_FOR_RENDERING_CONTEXTS(BlurMaskBiggerThanDest,
reporter,
ctxInfo,
CtsEnforcement::kApiLevel_T) {
auto context = ctxInfo.directContext();

SkImageInfo ii = SkImageInfo::Make(32, 32, kRGBA_8888_SkColorType, kPremul_SkAlphaType);
Expand Down
16 changes: 8 additions & 8 deletions tests/BulkRectTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,16 +313,16 @@ static void run_test(GrDirectContext* dContext, skiatest::Reporter* reporter, Bu

}

DEF_GPUTEST_FOR_RENDERING_CONTEXTS(BulkFillRectTest,
reporter,
ctxInfo,
CtsEnforcement::kApiLevel_T) {
DEF_GANESH_TEST_FOR_RENDERING_CONTEXTS(BulkFillRectTest,
reporter,
ctxInfo,
CtsEnforcement::kApiLevel_T) {
run_test(ctxInfo.directContext(), reporter, fillrectop_creation_test);
}

DEF_GPUTEST_FOR_RENDERING_CONTEXTS(BulkTextureRectTest,
reporter,
ctxInfo,
CtsEnforcement::kApiLevel_T) {
DEF_GANESH_TEST_FOR_RENDERING_CONTEXTS(BulkTextureRectTest,
reporter,
ctxInfo,
CtsEnforcement::kApiLevel_T) {
run_test(ctxInfo.directContext(), reporter, textureop_creation_test);
}
10 changes: 5 additions & 5 deletions tests/ClearTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ static void clear_op_test(skiatest::Reporter* reporter, GrDirectContext* dContex
}
}

DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ClearOp, reporter, ctxInfo, CtsEnforcement::kApiLevel_T) {
DEF_GANESH_TEST_FOR_RENDERING_CONTEXTS(ClearOp, reporter, ctxInfo, CtsEnforcement::kApiLevel_T) {
// Regular clear
clear_op_test(reporter, ctxInfo.directContext());

Expand Down Expand Up @@ -359,10 +359,10 @@ void fullscreen_clear_with_layer_test(skiatest::Reporter* reporter, GrRecordingC
REPORTER_ASSERT(reporter, isCorrect);
}
// From crbug.com/768134
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(FullScreenClearWithLayers,
reporter,
ctxInfo,
CtsEnforcement::kApiLevel_T) {
DEF_GANESH_TEST_FOR_RENDERING_CONTEXTS(FullScreenClearWithLayers,
reporter,
ctxInfo,
CtsEnforcement::kApiLevel_T) {
// Regular clear
fullscreen_clear_with_layer_test(reporter, ctxInfo.directContext());

Expand Down
8 changes: 4 additions & 4 deletions tests/ColorFilterTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,10 @@ struct FailureColorFilter final : public SkColorFilterBase {
const char* getTypeName() const override { return "FailureColorFilter"; }
};

DEF_GPUTEST_FOR_ALL_CONTEXTS(ComposeFailureWithInputElision,
r,
ctxInfo,
CtsEnforcement::kApiLevel_T) {
DEF_GANESH_TEST_FOR_ALL_CONTEXTS(ComposeFailureWithInputElision,
r,
ctxInfo,
CtsEnforcement::kApiLevel_T) {
SkImageInfo info = SkImageInfo::MakeN32Premul(8, 8);
auto surface = SkSurface::MakeRenderTarget(ctxInfo.directContext(), SkBudgeted::kNo, info);
SkPaint paint;
Expand Down
8 changes: 4 additions & 4 deletions tests/CompressedBackendAllocationTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,10 +279,10 @@ static void test_compressed_data_init(GrDirectContext* dContext,
dContext->deleteBackendTexture(backendTex);
}

DEF_GPUTEST_FOR_RENDERING_CONTEXTS(CompressedBackendAllocationTest,
reporter,
ctxInfo,
CtsEnforcement::kApiLevel_T) {
DEF_GANESH_TEST_FOR_RENDERING_CONTEXTS(CompressedBackendAllocationTest,
reporter,
ctxInfo,
CtsEnforcement::kApiLevel_T) {
auto dContext = ctxInfo.directContext();
const GrCaps* caps = dContext->priv().caps();

Expand Down
5 changes: 4 additions & 1 deletion tests/CopySurfaceTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@
#include <initializer_list>
#include <utility>

DEF_GPUTEST_FOR_RENDERING_CONTEXTS(CopySurface, reporter, ctxInfo, CtsEnforcement::kApiLevel_T) {
DEF_GANESH_TEST_FOR_RENDERING_CONTEXTS(CopySurface,
reporter,
ctxInfo,
CtsEnforcement::kApiLevel_T) {
auto dContext = ctxInfo.directContext();

static const int kW = 10;
Expand Down
56 changes: 28 additions & 28 deletions tests/DMSAATest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ static void check_sdc_color(skiatest::Reporter* reporter,
}
}

DEF_GPUTEST_FOR_CONTEXTS(DMSAA_preserve_contents,
&sk_gpu_test::GrContextFactory::IsRenderingContext,
reporter,
ctxInfo,
nullptr,
CtsEnforcement::kApiLevel_T) {
DEF_GANESH_TEST_FOR_CONTEXTS(DMSAA_preserve_contents,
&sk_gpu_test::GrContextFactory::IsRenderingContext,
reporter,
ctxInfo,
nullptr,
CtsEnforcement::kApiLevel_T) {
auto dContext = ctxInfo.directContext();
auto sdc = skgpu::v1::SurfaceDrawContext::Make(dContext, GrColorType::kRGBA_8888, nullptr,
SkBackingFit::kApprox, {kWidth, kHeight},
Expand Down Expand Up @@ -119,12 +119,12 @@ static void require_dst_reads(GrContextOptions* options) {
options->fSuppressFramebufferFetch = true;
}

DEF_GPUTEST_FOR_CONTEXTS(DMSAA_dst_read,
&sk_gpu_test::GrContextFactory::IsRenderingContext,
reporter,
ctxInfo,
require_dst_reads,
CtsEnforcement::kApiLevel_T) {
DEF_GANESH_TEST_FOR_CONTEXTS(DMSAA_dst_read,
&sk_gpu_test::GrContextFactory::IsRenderingContext,
reporter,
ctxInfo,
require_dst_reads,
CtsEnforcement::kApiLevel_T) {
auto dContext = ctxInfo.directContext();
auto sdc = skgpu::v1::SurfaceDrawContext::Make(dContext, GrColorType::kRGBA_8888, nullptr,
SkBackingFit::kApprox, {kWidth, kHeight},
Expand All @@ -146,12 +146,12 @@ DEF_GPUTEST_FOR_CONTEXTS(DMSAA_dst_read,
check_sdc_color(reporter, sdc.get(), dContext, dstColor);
}

DEF_GPUTEST_FOR_CONTEXTS(DMSAA_aa_dst_read_after_dmsaa,
&sk_gpu_test::GrContextFactory::IsRenderingContext,
reporter,
ctxInfo,
require_dst_reads,
CtsEnforcement::kApiLevel_T) {
DEF_GANESH_TEST_FOR_CONTEXTS(DMSAA_aa_dst_read_after_dmsaa,
&sk_gpu_test::GrContextFactory::IsRenderingContext,
reporter,
ctxInfo,
require_dst_reads,
CtsEnforcement::kApiLevel_T) {
auto dContext = ctxInfo.directContext();
auto sdc = skgpu::v1::SurfaceDrawContext::Make(dContext, GrColorType::kRGBA_8888, nullptr,
SkBackingFit::kApprox, {kWidth, kHeight},
Expand All @@ -174,12 +174,12 @@ DEF_GPUTEST_FOR_CONTEXTS(DMSAA_aa_dst_read_after_dmsaa,
check_sdc_color(reporter, sdc.get(), dContext, dstColor);
}

DEF_GPUTEST_FOR_CONTEXTS(DMSAA_dst_read_with_existing_barrier,
&sk_gpu_test::GrContextFactory::IsRenderingContext,
reporter,
ctxInfo,
require_dst_reads,
CtsEnforcement::kApiLevel_T) {
DEF_GANESH_TEST_FOR_CONTEXTS(DMSAA_dst_read_with_existing_barrier,
&sk_gpu_test::GrContextFactory::IsRenderingContext,
reporter,
ctxInfo,
require_dst_reads,
CtsEnforcement::kApiLevel_T) {
auto dContext = ctxInfo.directContext();
auto sdc = skgpu::v1::SurfaceDrawContext::Make(dContext, GrColorType::kRGBA_8888, nullptr,
SkBackingFit::kApprox, {kWidth, kHeight},
Expand Down Expand Up @@ -208,10 +208,10 @@ DEF_GPUTEST_FOR_CONTEXTS(DMSAA_dst_read_with_existing_barrier,
// This test is used to test for crbug.com/1241134. The bug appears on Adreno5xx devices with OS
// PQ3A. It does not repro on the earlier PPR1 version since the extend blend func extension was not
// present on the older driver.
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DMSAA_dual_source_blend_disable,
reporter,
ctxInfo,
CtsEnforcement::kApiLevel_T) {
DEF_GANESH_TEST_FOR_RENDERING_CONTEXTS(DMSAA_dual_source_blend_disable,
reporter,
ctxInfo,
CtsEnforcement::kApiLevel_T) {
SkISize surfaceDims = {100, 100};
SkISize texDims = {50, 50};
auto context = ctxInfo.directContext();
Expand Down
12 changes: 6 additions & 6 deletions tests/DefaultPathRendererTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,12 @@ static void run_test(GrDirectContext* dContext, skiatest::Reporter* reporter) {
}
}

DEF_GPUTEST_FOR_CONTEXTS(DefaultPathRendererTest,
sk_gpu_test::GrContextFactory::IsRenderingContext,
reporter,
ctxInfo,
only_allow_default,
CtsEnforcement::kApiLevel_T) {
DEF_GANESH_TEST_FOR_CONTEXTS(DefaultPathRendererTest,
sk_gpu_test::GrContextFactory::IsRenderingContext,
reporter,
ctxInfo,
only_allow_default,
CtsEnforcement::kApiLevel_T) {
auto ctx = ctxInfo.directContext();

run_test(ctx, reporter);
Expand Down
Loading

0 comments on commit eed3b01

Please sign in to comment.