Fixes for primitive handling for uniforms

Updates header mapping to include bool as a primitive, restoring the
GrYUVtoRGBEffect header to its state pre-improved uniforms.

Also fixes the NaN constants specified in the uniform ctype mapping to
actually reference valid constants for SK_FloatNaN.

Bug: skia:
Change-Id: I27848d61c411f2674f66a1532876c7cf22d71be3
Reviewed-on: https://skia-review.googlesource.com/150906
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
This commit is contained in:
Michael Ludwig 2018-08-31 13:26:19 -04:00 committed by Skia Commit-Bot
parent 0b7645f6d9
commit 72efd80ab2
3 changed files with 7 additions and 7 deletions

View File

@ -24,7 +24,7 @@ public:
const SkMatrix44& uSamplerTransform() const { return fUSamplerTransform; }
const SkMatrix44& vSamplerTransform() const { return fVSamplerTransform; }
const SkMatrix44& colorSpaceMatrix() const { return fColorSpaceMatrix; }
const bool& nv12() const { return fNv12; }
bool nv12() const { return fNv12; }
static std::unique_ptr<GrFragmentProcessor> Make(
sk_sp<GrTextureProxy> ySampler, SkMatrix44 ySamplerTransform,
sk_sp<GrTextureProxy> uSampler, SkMatrix44 uSamplerTransform,

View File

@ -163,25 +163,25 @@ static const std::vector<UniformCTypeMapper>& get_mappers() {
REGISTER("SkPoint", { "half2", "float2", "double2" } ,
"${pdman}.set2f(${uniform}, ${var}.fX, ${var}.fY)", // to gpu
"SkPoint::Make(NaN, NaN)"), // default value
"SkPoint::Make(SK_FloatNaN, SK_FloatNaN)"), // default value
REGISTER("SkIPoint", { "int2", "short2", "byte2" },
"${pdman}.set2i(${uniform}, ${var}.fX, ${var}.fY)", // to gpu
"SkIPoint::Make(~0, ~0)"), // default value
"SkIPoint::Make(SK_NaN32, SK_NaN32)"), // default value
REGISTER("SkMatrix", { "half3x3", "float3x3", "double3x3" },
"${pdman}.setSkMatrix(${uniform}, ${var})", // to gpu
"SkMatrix::MakeScale(NaN)", // default value
"SkMatrix::MakeScale(SK_FloatNaN)", // default value
"!${oldVar}.cheapEqualTo(${newVar})"), // dirty check
REGISTER("SkMatrix44", { "half4x4", "float4x4", "double4x4" },
"${pdman}.setSkMatrix44(${uniform}, ${var})", // to gpu
"SkMatrix::MakeScale(NaN)", // default value
"SkMatrix::MakeScale(SK_FloatNaN)", // default value
"!${oldVar}.cheapEqualTo(${newVar})"), // dirty check
REGISTER("float", { "half", "float", "double" },
"${pdman}.set1f(${uniform}, ${var})", // to gpu
"NaN"), // default value
"SK_FloatNaN"), // default value
REGISTER("int32_t", { "int", "short", "byte" },
"${pdman}.set1i(${uniform}, ${var})", // to gpu

View File

@ -76,7 +76,7 @@ String HCodeGenerator::FieldType(const Context& context, const Type& type,
String HCodeGenerator::AccessType(const Context& context, const Type& type,
const Layout& layout) {
static const std::set<String> primitiveTypes = { "int32_t", "float", "SkPMColor" };
static const std::set<String> primitiveTypes = { "int32_t", "float", "bool", "SkPMColor" };
String fieldType = FieldType(context, type, layout);
bool isPrimitive = primitiveTypes.find(fieldType) != primitiveTypes.end();