SkSL: Remove all $gsamplerFoo types

These are GLSL-isms that weren't really implemented - each one was a
"generic" type that only resolved to a single underlying type. We've
got along just fine without them for years, so update our sample()
declarations to take the actual underlying type. (Note that we had
worked around this by declaring an integer version of sample where
necessary, so we can presumably keep doing that in the future).

Change-Id: I4c46a2fa0c1f19e6278298c8005a2760329e7abf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/347040
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
This commit is contained in:
Brian Osman 2020-12-23 11:03:09 -05:00 committed by Skia Commit-Bot
parent 33c64a4473
commit 21ee1c0200
6 changed files with 1350 additions and 1403 deletions

View File

@ -143,18 +143,10 @@ Compiler::Compiler(const ShaderCapsClass* caps, Flags flags)
TYPE(Image2D), TYPE(IImage2D),
TYPE(SubpassInput), TYPE(SubpassInputMS),
TYPE(GSampler1D), TYPE(GSampler2D), TYPE(GSampler3D),
TYPE(GSamplerCube),
TYPE(GSampler2DRect),
TYPE(GSampler1DArray), TYPE(GSampler2DArray), TYPE(GSamplerCubeArray),
TYPE(GSamplerBuffer),
TYPE(GSampler2DMS), TYPE(GSampler2DMSArray),
TYPE(Sampler1DShadow), TYPE(Sampler2DShadow), TYPE(SamplerCubeShadow),
TYPE(Sampler2DRectShadow),
TYPE(Sampler1DArrayShadow), TYPE(Sampler2DArrayShadow), TYPE(SamplerCubeArrayShadow),
TYPE(GSampler2DArrayShadow), TYPE(GSamplerCubeArrayShadow),
TYPE(Sampler),
TYPE(Texture2D),
};

View File

@ -197,30 +197,6 @@ public:
/*isMultisampled=*/true,
/*isSampled=*/false))
// FIXME figure out what we're supposed to do with the gsampler et al. types)
, fGSampler1D_Type(Type::MakeGenericType("$gsampler1D", static_type(*fSampler1D_Type)))
, fGSampler2D_Type(Type::MakeGenericType("$gsampler2D", static_type(*fSampler2D_Type)))
, fGSampler3D_Type(Type::MakeGenericType("$gsampler3D", static_type(*fSampler3D_Type)))
, fGSamplerCube_Type(
Type::MakeGenericType("$gsamplerCube", static_type(*fSamplerCube_Type)))
, fGSampler2DRect_Type(
Type::MakeGenericType("$gsampler2DRect", static_type(*fSampler2DRect_Type)))
, fGSampler1DArray_Type(
Type::MakeGenericType("$gsampler1DArray", static_type(*fSampler1DArray_Type)))
, fGSampler2DArray_Type(
Type::MakeGenericType("$gsampler2DArray", static_type(*fSampler2DArray_Type)))
, fGSamplerCubeArray_Type(Type::MakeGenericType("$gsamplerCubeArray",
static_type(*fSamplerCubeArray_Type)))
, fGSamplerBuffer_Type(
Type::MakeGenericType("$gsamplerBuffer", static_type(*fSamplerBuffer_Type)))
, fGSampler2DMS_Type(
Type::MakeGenericType("$gsampler2DMS", static_type(*fSampler2DMS_Type)))
, fGSampler2DMSArray_Type(Type::MakeGenericType("$gsampler2DMSArray",
static_type(*fSampler2DMSArray_Type)))
, fGSampler2DArrayShadow_Type(Type::MakeGenericType(
"$gsampler2DArrayShadow", static_type(*fSampler2DArrayShadow_Type)))
, fGSamplerCubeArrayShadow_Type(Type::MakeGenericType(
"$gsamplerCubeArrayShadow", static_type(*fSamplerCubeArrayShadow_Type)))
, fGenType_Type(Type::MakeGenericType("$genType",
{fFloat_Type.get(), fFloat2_Type.get(),
fFloat3_Type.get(), fFloat4_Type.get()}))
@ -283,10 +259,6 @@ public:
, fFragmentProcessor_Type(fp_type(fInt_Type.get(), fBool_Type.get()))
, fDefined_Expression(new Defined(fInvalid_Type.get())) {}
static std::vector<const Type*> static_type(const Type& t) {
return { &t, &t, &t, &t };
}
const std::unique_ptr<Type> fInvalid_Type;
const std::unique_ptr<Type> fVoid_Type;
const std::unique_ptr<Type> fFloatLiteral_Type;
@ -395,20 +367,6 @@ public:
const std::unique_ptr<Type> fSubpassInput_Type;
const std::unique_ptr<Type> fSubpassInputMS_Type;
const std::unique_ptr<Type> fGSampler1D_Type;
const std::unique_ptr<Type> fGSampler2D_Type;
const std::unique_ptr<Type> fGSampler3D_Type;
const std::unique_ptr<Type> fGSamplerCube_Type;
const std::unique_ptr<Type> fGSampler2DRect_Type;
const std::unique_ptr<Type> fGSampler1DArray_Type;
const std::unique_ptr<Type> fGSampler2DArray_Type;
const std::unique_ptr<Type> fGSamplerCubeArray_Type;
const std::unique_ptr<Type> fGSamplerBuffer_Type;
const std::unique_ptr<Type> fGSampler2DMS_Type;
const std::unique_ptr<Type> fGSampler2DMSArray_Type;
const std::unique_ptr<Type> fGSampler2DArrayShadow_Type;
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> fGenIType_Type;

File diff suppressed because it is too large Load Diff

View File

@ -234,29 +234,27 @@ $genIType findMSB($genIType value);
$genIType findMSB($genUType value);
sampler2D makeSampler2D(texture2D texture, sampler s);
int2 textureSize($gsampler2DRect s);
int2 textureSize(sampler2DRect s);
half4 sample($gsampler1D s, float P);
half4 sample($gsampler1D s, float P, float bias);
half4 sample($gsampler2D s, float2 P);
// The above currently only expand to handle the float/fixed case. So we also declare this integer
// version of sample().
half4 sample(sampler1D s, float P);
half4 sample(sampler1D s, float P, float bias);
half4 sample(sampler2D s, float2 P);
int4 sample(isampler2D s, float2 P);
half4 sample(samplerExternalOES s, float2 P, float bias);
half4 sample(samplerExternalOES s, float2 P);
half4 sample($gsampler2DRect s, float2 P);
half4 sample($gsampler2DRect s, float3 P);
half4 sample(sampler2DRect s, float2 P);
half4 sample(sampler2DRect s, float3 P);
// Currently we do not support the generic types of loading subpassInput so we have some explicit
// versions that we currently use
half4 subpassLoad(subpassInput subpass);
half4 subpassLoad(subpassInputMS subpass, int sample);
half4 sample($gsampler1D s, float2 P);
half4 sample($gsampler1D s, float2 P, float bias);
half4 sample($gsampler2D s, float3 P);
half4 sample($gsampler2D s, float3 P, float bias);
half4 sample(sampler1D s, float2 P);
half4 sample(sampler1D s, float2 P, float bias);
half4 sample(sampler2D s, float3 P);
half4 sample(sampler2D s, float3 P, float bias);
float4 imageLoad(image2D image, int2 P);
int4 imageLoad(iimage2D image, int2 P);

View File

@ -1,5 +1,5 @@
InterfaceBlock {
layout(set=0) $gsampler2D g;
layout(set=0) $mat g;
};
struct S {

View File

@ -1,6 +1,6 @@
### Compilation failed:
error: 2: type '$gsampler2D' is private
error: 2: type '$mat' is private
error: 5: type 'S' is private
error: 9: type '$ivec' is private
error: 10: type '$genType' is private