aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sksl/SkSLContext.h
diff options
context:
space:
mode:
authorGravatar Ethan Nicholas <ethannicholas@google.com>2017-08-02 10:52:54 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-08-02 18:47:00 +0000
commitdcba08e891f1766b047cf0dbe8bbd275d9f55d2b (patch)
treec53822e53f595ea7c886f1efb22a2835da368b79 /src/sksl/SkSLContext.h
parentd9971c0c20d9937f6eabbf03b7638916d8dd57d7 (diff)
Revert "Revert "support for 'half' types in sksl, plus general numeric type improvements""
This reverts commit 0e9605542444a7653359f4fc610f7620df9f6313. Bug: skia: Change-Id: Id45d091c1950887316c901ed9c9281181f346bcf Reviewed-on: https://skia-review.googlesource.com/29602 Reviewed-by: Ethan Nicholas <ethannicholas@google.com> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Diffstat (limited to 'src/sksl/SkSLContext.h')
-rw-r--r--src/sksl/SkSLContext.h108
1 files changed, 85 insertions, 23 deletions
diff --git a/src/sksl/SkSLContext.h b/src/sksl/SkSLContext.h
index 2de584fab2..b132cec33d 100644
--- a/src/sksl/SkSLContext.h
+++ b/src/sksl/SkSLContext.h
@@ -21,45 +21,65 @@ public:
Context()
: fInvalid_Type(new Type(String("<INVALID>")))
, fVoid_Type(new Type(String("void")))
- , fDouble_Type(new Type(String("double"), true))
+ , fDouble_Type(new Type(String("double"), Type::kFloat_NumberKind))
, fDouble2_Type(new Type(String("double2"), *fDouble_Type, 2))
, fDouble3_Type(new Type(String("double3"), *fDouble_Type, 3))
, fDouble4_Type(new Type(String("double4"), *fDouble_Type, 4))
- , fFloat_Type(new Type(String("float"), true, { fDouble_Type.get() }))
+ , fFloat_Type(new Type(String("float"), Type::kFloat_NumberKind))
, fFloat2_Type(new Type(String("float2"), *fFloat_Type, 2))
, fFloat3_Type(new Type(String("float3"), *fFloat_Type, 3))
, fFloat4_Type(new Type(String("float4"), *fFloat_Type, 4))
- , fUInt_Type(new Type(String("uint"), true, { fFloat_Type.get(), fDouble_Type.get() }))
+ , fHalf_Type(new Type(String("half"), Type::kFloat_NumberKind))
+ , fHalf2_Type(new Type(String("half2"), *fHalf_Type, 2))
+ , fHalf3_Type(new Type(String("half3"), *fHalf_Type, 3))
+ , fHalf4_Type(new Type(String("half4"), *fHalf_Type, 4))
+ , fUInt_Type(new Type(String("uint"), Type::kUnsigned_NumberKind))
, fUInt2_Type(new Type(String("uint2"), *fUInt_Type, 2))
, fUInt3_Type(new Type(String("uint3"), *fUInt_Type, 3))
, fUInt4_Type(new Type(String("uint4"), *fUInt_Type, 4))
- , fInt_Type(new Type(String("int"), true, { fUInt_Type.get(), fFloat_Type.get(),
- fDouble_Type.get() }))
+ , fInt_Type(new Type(String("int"), Type::kSigned_NumberKind))
, fInt2_Type(new Type(String("int2"), *fInt_Type, 2))
, fInt3_Type(new Type(String("int3"), *fInt_Type, 3))
, fInt4_Type(new Type(String("int4"), *fInt_Type, 4))
- , fBool_Type(new Type(String("bool"), false))
+ , fUShort_Type(new Type(String("ushort"), Type::kUnsigned_NumberKind))
+ , fUShort2_Type(new Type(String("ushort2"), *fUShort_Type, 2))
+ , fUShort3_Type(new Type(String("ushort3"), *fUShort_Type, 3))
+ , fUShort4_Type(new Type(String("ushort4"), *fUShort_Type, 4))
+ , fShort_Type(new Type(String("short"), Type::kSigned_NumberKind))
+ , fShort2_Type(new Type(String("short2"), *fShort_Type, 2))
+ , fShort3_Type(new Type(String("short3"), *fShort_Type, 3))
+ , fShort4_Type(new Type(String("short4"), *fShort_Type, 4))
+ , fBool_Type(new Type(String("bool"), Type::kNonnumeric_NumberKind))
, fBool2_Type(new Type(String("bool2"), *fBool_Type, 2))
, fBool3_Type(new Type(String("bool3"), *fBool_Type, 3))
, fBool4_Type(new Type(String("bool4"), *fBool_Type, 4))
- , fFloat2x2_Type(new Type(String("float2x2"), *fFloat_Type, 2, 2))
+ , fFloat2x2_Type(new Type(String("float2x2"), *fFloat_Type, 2, 2))
, fFloat2x3_Type(new Type(String("float2x3"), *fFloat_Type, 2, 3))
, fFloat2x4_Type(new Type(String("float2x4"), *fFloat_Type, 2, 4))
, fFloat3x2_Type(new Type(String("float3x2"), *fFloat_Type, 3, 2))
- , fFloat3x3_Type(new Type(String("float3x3"), *fFloat_Type, 3, 3))
+ , fFloat3x3_Type(new Type(String("float3x3"), *fFloat_Type, 3, 3))
, fFloat3x4_Type(new Type(String("float3x4"), *fFloat_Type, 3, 4))
, fFloat4x2_Type(new Type(String("float4x2"), *fFloat_Type, 4, 2))
, fFloat4x3_Type(new Type(String("float4x3"), *fFloat_Type, 4, 3))
- , fFloat4x4_Type(new Type(String("float4x4"), *fFloat_Type, 4, 4))
- , fDouble2x2_Type(new Type(String("double2x2"), *fFloat_Type, 2, 2))
- , fDouble2x3_Type(new Type(String("double2x3"), *fFloat_Type, 2, 3))
- , fDouble2x4_Type(new Type(String("double2x4"), *fFloat_Type, 2, 4))
- , fDouble3x2_Type(new Type(String("double3x2"), *fFloat_Type, 3, 2))
- , fDouble3x3_Type(new Type(String("double3x3"), *fFloat_Type, 3, 3))
- , fDouble3x4_Type(new Type(String("double3x4"), *fFloat_Type, 3, 4))
- , fDouble4x2_Type(new Type(String("double4x2"), *fFloat_Type, 4, 2))
- , fDouble4x3_Type(new Type(String("double4x3"), *fFloat_Type, 4, 3))
- , fDouble4x4_Type(new Type(String("double4x4"), *fFloat_Type, 4, 4))
+ , fFloat4x4_Type(new Type(String("float4x4"), *fFloat_Type, 4, 4))
+ , fHalf2x2_Type(new Type(String("half2x2"), *fHalf_Type, 2, 2))
+ , fHalf2x3_Type(new Type(String("half2x3"), *fHalf_Type, 2, 3))
+ , fHalf2x4_Type(new Type(String("half2x4"), *fHalf_Type, 2, 4))
+ , fHalf3x2_Type(new Type(String("half3x2"), *fHalf_Type, 3, 2))
+ , fHalf3x3_Type(new Type(String("half3x3"), *fHalf_Type, 3, 3))
+ , fHalf3x4_Type(new Type(String("half3x4"), *fHalf_Type, 3, 4))
+ , fHalf4x2_Type(new Type(String("half4x2"), *fHalf_Type, 4, 2))
+ , fHalf4x3_Type(new Type(String("half4x3"), *fHalf_Type, 4, 3))
+ , fHalf4x4_Type(new Type(String("half4x4"), *fHalf_Type, 4, 4))
+ , fDouble2x2_Type(new Type(String("double2x2"), *fDouble_Type, 2, 2))
+ , fDouble2x3_Type(new Type(String("double2x3"), *fDouble_Type, 2, 3))
+ , fDouble2x4_Type(new Type(String("double2x4"), *fDouble_Type, 2, 4))
+ , fDouble3x2_Type(new Type(String("double3x2"), *fDouble_Type, 3, 2))
+ , fDouble3x3_Type(new Type(String("double3x3"), *fDouble_Type, 3, 3))
+ , fDouble3x4_Type(new Type(String("double3x4"), *fDouble_Type, 3, 4))
+ , fDouble4x2_Type(new Type(String("double4x2"), *fDouble_Type, 4, 2))
+ , fDouble4x3_Type(new Type(String("double4x3"), *fDouble_Type, 4, 3))
+ , fDouble4x4_Type(new Type(String("double4x4"), *fDouble_Type, 4, 4))
, fSampler1D_Type(new Type(String("sampler1D"), SpvDim1D, false, false, false, true))
, fSampler2D_Type(new Type(String("sampler2D"), SpvDim2D, false, false, false, true))
, fSampler3D_Type(new Type(String("sampler3D"), SpvDim3D, false, false, false, true))
@@ -118,6 +138,8 @@ public:
static_type(*fSamplerCubeArrayShadow_Type)))
, fGenType_Type(new Type(String("$genType"), { fFloat_Type.get(), fFloat2_Type.get(),
fFloat3_Type.get(), fFloat4_Type.get() }))
+ , fGenHType_Type(new Type(String("$genHType"), { fHalf_Type.get(), fHalf2_Type.get(),
+ fHalf3_Type.get(), fHalf4_Type.get() }))
, fGenDType_Type(new Type(String("$genDType"), { fDouble_Type.get(), fDouble2_Type.get(),
fDouble3_Type.get(), fDouble4_Type.get() }))
, fGenIType_Type(new Type(String("$genIType"), { fInt_Type.get(), fInt2_Type.get(),
@@ -130,23 +152,34 @@ public:
fFloat2x4_Type.get(), fFloat3x2_Type.get(),
fFloat3x3_Type.get(), fFloat3x4_Type.get(),
fFloat4x2_Type.get(), fFloat4x3_Type.get(),
- fFloat4x4_Type.get(), fDouble2x2_Type.get(),
- fDouble2x3_Type.get(), fDouble2x4_Type.get(),
- fDouble3x2_Type.get(), fDouble3x3_Type.get(),
- fDouble3x4_Type.get(), fDouble4x2_Type.get(),
- fDouble4x3_Type.get(), fDouble4x4_Type.get() }))
+ fFloat4x4_Type.get(), fHalf2x2_Type.get(),
+ fHalf2x3_Type.get(), fHalf2x4_Type.get(),
+ fHalf3x2_Type.get(), fHalf3x3_Type.get(),
+ fHalf3x4_Type.get(), fHalf4x2_Type.get(),
+ fHalf4x3_Type.get(), fHalf4x4_Type.get(),
+ fDouble2x2_Type.get(), fDouble2x3_Type.get(),
+ fDouble2x4_Type.get(), fDouble3x2_Type.get(),
+ fDouble3x3_Type.get(), fDouble3x4_Type.get(),
+ fDouble4x2_Type.get(), fDouble4x3_Type.get(),
+ fDouble4x4_Type.get() }))
, fVec_Type(new Type(String("$vec"), { fInvalid_Type.get(), fFloat2_Type.get(),
fFloat3_Type.get(), fFloat4_Type.get() }))
, fGVec_Type(new Type(String("$gvec")))
, fGVec2_Type(new Type(String("$gfloat2")))
, fGVec3_Type(new Type(String("$gfloat3")))
, fGVec4_Type(new Type(String("$gfloat4"), static_type(*fFloat4_Type)))
+ , fHVec_Type(new Type(String("$hvec"), { fInvalid_Type.get(), fHalf2_Type.get(),
+ fHalf3_Type.get(), fHalf4_Type.get() }))
, fDVec_Type(new Type(String("$dvec"), { fInvalid_Type.get(), fDouble2_Type.get(),
fDouble3_Type.get(), fDouble4_Type.get() }))
, fIVec_Type(new Type(String("$ivec"), { fInvalid_Type.get(), fInt2_Type.get(),
fInt3_Type.get(), fInt4_Type.get() }))
, fUVec_Type(new Type(String("$uvec"), { fInvalid_Type.get(), fUInt2_Type.get(),
fUInt3_Type.get(), fUInt4_Type.get() }))
+ , fSVec_Type(new Type(String("$svec"), { fInvalid_Type.get(), fShort2_Type.get(),
+ fShort3_Type.get(), fShort4_Type.get() }))
+ , fUSVec_Type(new Type(String("$usvec"), { fInvalid_Type.get(), fUShort2_Type.get(),
+ fUShort3_Type.get(), fUShort4_Type.get() }))
, fBVec_Type(new Type(String("$bvec"), { fInvalid_Type.get(), fBool2_Type.get(),
fBool3_Type.get(), fBool4_Type.get() }))
, fSkCaps_Type(new Type(String("$sk_Caps")))
@@ -171,6 +204,11 @@ public:
const std::unique_ptr<Type> fFloat3_Type;
const std::unique_ptr<Type> fFloat4_Type;
+ const std::unique_ptr<Type> fHalf_Type;
+ const std::unique_ptr<Type> fHalf2_Type;
+ const std::unique_ptr<Type> fHalf3_Type;
+ const std::unique_ptr<Type> fHalf4_Type;
+
const std::unique_ptr<Type> fUInt_Type;
const std::unique_ptr<Type> fUInt2_Type;
const std::unique_ptr<Type> fUInt3_Type;
@@ -181,6 +219,16 @@ public:
const std::unique_ptr<Type> fInt3_Type;
const std::unique_ptr<Type> fInt4_Type;
+ const std::unique_ptr<Type> fUShort_Type;
+ const std::unique_ptr<Type> fUShort2_Type;
+ const std::unique_ptr<Type> fUShort3_Type;
+ const std::unique_ptr<Type> fUShort4_Type;
+
+ const std::unique_ptr<Type> fShort_Type;
+ const std::unique_ptr<Type> fShort2_Type;
+ const std::unique_ptr<Type> fShort3_Type;
+ const std::unique_ptr<Type> fShort4_Type;
+
const std::unique_ptr<Type> fBool_Type;
const std::unique_ptr<Type> fBool2_Type;
const std::unique_ptr<Type> fBool3_Type;
@@ -196,6 +244,16 @@ public:
const std::unique_ptr<Type> fFloat4x3_Type;
const std::unique_ptr<Type> fFloat4x4_Type;
+ const std::unique_ptr<Type> fHalf2x2_Type;
+ const std::unique_ptr<Type> fHalf2x3_Type;
+ const std::unique_ptr<Type> fHalf2x4_Type;
+ const std::unique_ptr<Type> fHalf3x2_Type;
+ const std::unique_ptr<Type> fHalf3x3_Type;
+ const std::unique_ptr<Type> fHalf3x4_Type;
+ const std::unique_ptr<Type> fHalf4x2_Type;
+ const std::unique_ptr<Type> fHalf4x3_Type;
+ const std::unique_ptr<Type> fHalf4x4_Type;
+
const std::unique_ptr<Type> fDouble2x2_Type;
const std::unique_ptr<Type> fDouble2x3_Type;
const std::unique_ptr<Type> fDouble2x4_Type;
@@ -249,6 +307,7 @@ public:
const std::unique_ptr<Type> fGSamplerCubeArrayShadow_Type;
const std::unique_ptr<Type> fGenType_Type;
+ const std::unique_ptr<Type> fGenHType_Type;
const std::unique_ptr<Type> fGenDType_Type;
const std::unique_ptr<Type> fGenIType_Type;
const std::unique_ptr<Type> fGenUType_Type;
@@ -262,9 +321,12 @@ public:
const std::unique_ptr<Type> fGVec2_Type;
const std::unique_ptr<Type> fGVec3_Type;
const std::unique_ptr<Type> fGVec4_Type;
+ const std::unique_ptr<Type> fHVec_Type;
const std::unique_ptr<Type> fDVec_Type;
const std::unique_ptr<Type> fIVec_Type;
const std::unique_ptr<Type> fUVec_Type;
+ const std::unique_ptr<Type> fSVec_Type;
+ const std::unique_ptr<Type> fUSVec_Type;
const std::unique_ptr<Type> fBVec_Type;