Revert "Remove (unused) gpuType from SkRuntimeEffect::Uniform"
This reverts commit cc80a475662e573df8a4b625cd2a4f15ff4d31c2.
Reason for revert: IWYU cleanup broke less IWYU-clean Android,
frameworks/native/libs/renderengine/skia/filters/BlurFilter.cpp:180:17: error: variable has incomplete type 'SkRRect'
SkRRect roundedRect;
^
external/skia/include/core/SkCanvas.h:58:7: note: forward declaration of 'SkRRect'
class SkRRect;
Original change's description:
> Remove (unused) gpuType from SkRuntimeEffect::Uniform
>
> Also remove some unnecessary includes, then IWYU.
>
> Change-Id: I41e88f0e661c59e75cb26e28768801b811fe8ee8
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/371140
> Commit-Queue: Brian Osman <brianosman@google.com>
> Reviewed-by: John Stiles <johnstiles@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>
TBR=bsalomon@google.com,brianosman@google.com,johnstiles@google.com
Change-Id: Id655a6835ebffdb4f5f82474c287c09a69a737df
No-Tree-Checks: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/371941
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
diff --git a/gm/runtimefunctions.cpp b/gm/runtimefunctions.cpp
index d472602..d4fbf16 100644
--- a/gm/runtimefunctions.cpp
+++ b/gm/runtimefunctions.cpp
@@ -9,7 +9,6 @@
#include "include/core/SkCanvas.h"
#include "include/core/SkData.h"
#include "include/core/SkPaint.h"
-#include "include/core/SkShader.h"
#include "include/core/SkSize.h"
#include "include/core/SkString.h"
#include "include/effects/SkRuntimeEffect.h"
diff --git a/include/effects/SkRuntimeEffect.h b/include/effects/SkRuntimeEffect.h
index c8c60eb..8093588 100644
--- a/include/effects/SkRuntimeEffect.h
+++ b/include/effects/SkRuntimeEffect.h
@@ -9,16 +9,19 @@
#define SkRuntimeEffect_DEFINED
#include "include/core/SkData.h"
-#include "include/core/SkImageInfo.h"
#include "include/core/SkMatrix.h"
#include "include/core/SkString.h"
+#include "include/private/GrTypesPriv.h"
#include "include/private/SkSLSampleUsage.h"
+#include <string>
#include <vector>
-class GrRecordingContext;
+#if SK_SUPPORT_GPU
+#include "include/gpu/GrContextOptions.h"
+#endif
+
class SkColorFilter;
-class SkImage;
class SkShader;
namespace SkSL {
@@ -55,6 +58,7 @@
SkString name;
size_t offset;
Type type;
+ GrSLType gpuType;
int count;
uint32_t flags;
uint32_t marker;
diff --git a/src/core/SkRuntimeEffect.cpp b/src/core/SkRuntimeEffect.cpp
index 868bf6d..46873b9 100644
--- a/src/core/SkRuntimeEffect.cpp
+++ b/src/core/SkRuntimeEffect.cpp
@@ -105,22 +105,29 @@
static bool init_uniform_type(const SkSL::Context& ctx,
const SkSL::Type* type,
SkRuntimeEffect::Uniform* v) {
- using Type = SkRuntimeEffect::Uniform::Type;
+#define SET_TYPES(cpu_type, gpu_type) \
+ do { \
+ v->type = SkRuntimeEffect::Uniform::Type::cpu_type; \
+ v->gpuType = gpu_type; \
+ return true; \
+ } while (false)
- if (type == ctx.fTypes.fFloat.get()) { v->type = Type::kFloat; return true; }
- if (type == ctx.fTypes.fHalf.get()) { v->type = Type::kFloat; return true; }
- if (type == ctx.fTypes.fFloat2.get()) { v->type = Type::kFloat2; return true; }
- if (type == ctx.fTypes.fHalf2.get()) { v->type = Type::kFloat2; return true; }
- if (type == ctx.fTypes.fFloat3.get()) { v->type = Type::kFloat3; return true; }
- if (type == ctx.fTypes.fHalf3.get()) { v->type = Type::kFloat3; return true; }
- if (type == ctx.fTypes.fFloat4.get()) { v->type = Type::kFloat4; return true; }
- if (type == ctx.fTypes.fHalf4.get()) { v->type = Type::kFloat4; return true; }
- if (type == ctx.fTypes.fFloat2x2.get()) { v->type = Type::kFloat2x2; return true; }
- if (type == ctx.fTypes.fHalf2x2.get()) { v->type = Type::kFloat2x2; return true; }
- if (type == ctx.fTypes.fFloat3x3.get()) { v->type = Type::kFloat3x3; return true; }
- if (type == ctx.fTypes.fHalf3x3.get()) { v->type = Type::kFloat3x3; return true; }
- if (type == ctx.fTypes.fFloat4x4.get()) { v->type = Type::kFloat4x4; return true; }
- if (type == ctx.fTypes.fHalf4x4.get()) { v->type = Type::kFloat4x4; return true; }
+ if (type == ctx.fTypes.fFloat.get()) { SET_TYPES(kFloat, kFloat_GrSLType); }
+ if (type == ctx.fTypes.fHalf.get()) { SET_TYPES(kFloat, kHalf_GrSLType); }
+ if (type == ctx.fTypes.fFloat2.get()) { SET_TYPES(kFloat2, kFloat2_GrSLType); }
+ if (type == ctx.fTypes.fHalf2.get()) { SET_TYPES(kFloat2, kHalf2_GrSLType); }
+ if (type == ctx.fTypes.fFloat3.get()) { SET_TYPES(kFloat3, kFloat3_GrSLType); }
+ if (type == ctx.fTypes.fHalf3.get()) { SET_TYPES(kFloat3, kHalf3_GrSLType); }
+ if (type == ctx.fTypes.fFloat4.get()) { SET_TYPES(kFloat4, kFloat4_GrSLType); }
+ if (type == ctx.fTypes.fHalf4.get()) { SET_TYPES(kFloat4, kHalf4_GrSLType); }
+ if (type == ctx.fTypes.fFloat2x2.get()) { SET_TYPES(kFloat2x2, kFloat2x2_GrSLType); }
+ if (type == ctx.fTypes.fHalf2x2.get()) { SET_TYPES(kFloat2x2, kHalf2x2_GrSLType); }
+ if (type == ctx.fTypes.fFloat3x3.get()) { SET_TYPES(kFloat3x3, kFloat3x3_GrSLType); }
+ if (type == ctx.fTypes.fHalf3x3.get()) { SET_TYPES(kFloat3x3, kHalf3x3_GrSLType); }
+ if (type == ctx.fTypes.fFloat4x4.get()) { SET_TYPES(kFloat4x4, kFloat4x4_GrSLType); }
+ if (type == ctx.fTypes.fHalf4x4.get()) { SET_TYPES(kFloat4x4, kHalf4x4_GrSLType); }
+
+#undef SET_TYPES
return false;
}