Remove all layout(ctype=...) from runtime SkSKL

Most of these did nothing, and I'd like to remove the feature. Also, the
benchmark was using 'in uniform' which isn't supported (it asserts in
debug build).

Change-Id: I671ca69fdd50811a2090c7a03f5f23e6b38e6f96
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/260043
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
This commit is contained in:
Brian Osman 2019-12-13 16:31:40 -05:00 committed by Skia Commit-Bot
parent 6d50a097f4
commit 9d10abe300
6 changed files with 21 additions and 17 deletions

View File

@ -148,10 +148,10 @@ void RuntimeColorMatrix_CPU(float colors[4], const void* ctx) {
const char RuntimeColorMatrix_GPU_SRC[] = R"(
// WTB matrix/vector inputs.
layout(ctype=float) in uniform half m0 , m1 , m2 , m3 , m4 ,
m5 , m6 , m7 , m8 , m9 ,
m10, m11, m12, m13, m14,
m15, m16, m17, m18, m19;
uniform half m0 , m1 , m2 , m3 , m4 ,
m5 , m6 , m7 , m8 , m9 ,
m10, m11, m12, m13, m14,
m15, m16, m17, m18, m19;
void main(inout half4 c) {
half nonZeroAlpha = max(c.a, 0.0001);
c = half4(c.rgb / nonZeroAlpha, nonZeroAlpha);

View File

@ -26,7 +26,7 @@ class GrContext;
class GrRenderTargetContext;
const char* SKSL_TEST_SRC = R"(
layout(ctype=float) uniform half b;
uniform half b;
void main(inout half4 color) {
color.a = color.r*0.3 + color.g*0.6 + color.b*0.1;

View File

@ -23,7 +23,7 @@
#include <stddef.h>
static const char* RUNTIME_FUNCTIONS_SRC = R"(
layout(ctype=SkRect) uniform half4 gColor;
uniform half4 gColor;
half scale(float x) {
return half(x) / 255;

View File

@ -362,7 +362,7 @@ const curves = {
}
const prog = `
layout(ctype=SkRect) uniform half4 gColor;
uniform half4 gColor;
void main(float x, float y, inout half4 color) {
color = half4(half(x)*(1.0/255), half(y)*(1.0/255), gColor.b, 1);

View File

@ -16,12 +16,12 @@
#include "src/gpu/effects/GrSkSLFP.h"
GR_FP_SRC_STRING SKSL_OVERDRAW_SRC = R"(
layout(ctype=SkPMColor) uniform half4 color0;
layout(ctype=SkPMColor) uniform half4 color1;
layout(ctype=SkPMColor) uniform half4 color2;
layout(ctype=SkPMColor) uniform half4 color3;
layout(ctype=SkPMColor) uniform half4 color4;
layout(ctype=SkPMColor) uniform half4 color5;
uniform half4 color0;
uniform half4 color1;
uniform half4 color2;
uniform half4 color3;
uniform half4 color4;
uniform half4 color5;
void main(inout half4 color) {
half alpha = 255.0 * color.a;
@ -91,8 +91,12 @@ void SkOverdrawColorFilter::RegisterFlattenables() {
std::unique_ptr<GrFragmentProcessor> SkOverdrawColorFilter::asFragmentProcessor(
GrRecordingContext* context, const GrColorInfo&) const {
static int overdrawIndex = GrSkSLFP::NewIndex();
return GrSkSLFP::Make(context, overdrawIndex, "Overdraw", SKSL_OVERDRAW_SRC, fColors,
sizeof(fColors));
SkColor4f floatColors[kNumColors];
for (int i = 0; i < kNumColors; ++i) {
floatColors[i] = SkColor4f::FromBytes_RGBA(fColors[i]);
}
return GrSkSLFP::Make(context, overdrawIndex, "Overdraw", SKSL_OVERDRAW_SRC,
floatColors, sizeof(floatColors));
}
#endif

View File

@ -632,9 +632,9 @@ std::unique_ptr<GrFragmentProcessor> GrSkSLFP::TestCreate(GrProcessorTestData* d
}
case 2: {
static int overdrawIndex = NewIndex();
SkPMColor inputs[6];
SkColor4f inputs[6];
for (int i = 0; i < 6; ++i) {
inputs[i] = d->fRandom->nextU();
inputs[i] = SkColor4f::FromBytes_RGBA(d->fRandom->nextU());
}
std::unique_ptr<GrSkSLFP> result = GrSkSLFP::Make(d->context(), overdrawIndex,
"Overdraw", SKSL_OVERDRAW_SRC,