Commit db6b9117 by John Kessenich

Implement modern (130 and above) texturing. About 250 functions for 3.0, over…

Implement modern (130 and above) texturing. About 250 functions for 3.0, over 500 for 4.3, created programmatically. Handles all 3.0 functions, almost all 4.3 functions. git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@20698 e7fa87d3-cd2b-0410-9028-fcbf551c1848
parent 4774d5ca
#version 300 es
uniform sampler2D s2D;
uniform sampler3D s3D;
uniform samplerCube sCube;
uniform samplerCubeShadow sCubeShadow;
uniform sampler2DShadow s2DShadow;
uniform sampler2DArray s2DArray;
uniform sampler2DArrayShadow s2DArrayShadow;
uniform isampler2D is2D;
uniform isampler3D is3D;
uniform isamplerCube isCube;
uniform isampler2DArray is2DArray;
uniform usampler2D us2D;
uniform usampler3D us3D;
uniform usamplerCube usCube;
uniform usampler2DArray us2DArray;
in float c1D;
in vec2 c2D;
in vec3 c3D;
in vec4 c4D;
in int ic1D;
in ivec2 ic2D;
in ivec3 ic3D;
in ivec4 ic4D;
out vec4 FragData;
void main()
{
vec4 v = texture(s2D, c2D);
v += textureProj(s3D, c4D);
v += textureLod(s2DArray, c3D, 1.2);
v.y += textureOffset(s2DShadow, c3D, ic2D, c1D);
v += texelFetch(s3D, ic3D, ic1D);
v += texelFetchOffset(s2D, ic2D, 4, ic2D);
v.y += textureLodOffset(s2DShadow, c3D, c1D, ic2D);
v += textureProjLodOffset(s2D, c3D, c1D, ic2D);
v += textureGrad(sCube, c3D, c3D, c3D);
v.x += textureGradOffset(s2DArrayShadow, c4D, c2D, c2D, ic2D);
v += textureProjGrad(s3D, c4D, c3D, c3D);
v += textureProjGradOffset(s2D, c3D, c2D, c2D, ic2D);
ivec4 iv = texture(is2D, c2D);
iv += textureProjOffset(is2D, c4D, ic2D);
iv += textureProjLod(is2D, c3D, c1D);
iv += textureProjGrad(is2D, c3D, c2D, c2D);
iv += texture(is3D, c3D, 4.2);
iv += textureLod(isCube, c3D, c1D);
iv += texelFetch(is2DArray, ic3D, ic1D);
iv.xy += textureSize(sCubeShadow, 2);
FragData = v + vec4(iv);
}
...@@ -9,4 +9,4 @@ while read t; do ...@@ -9,4 +9,4 @@ while read t; do
b=`basename $t` b=`basename $t`
./StandAlone -i $t > $TARGETDIR/$b.out ./StandAlone -i $t > $TARGETDIR/$b.out
diff $BASEDIR/$b.out $TARGETDIR/$b.out diff $BASEDIR/$b.out $TARGETDIR/$b.out
done < testlist done < localtestlist
...@@ -120,7 +120,7 @@ struct TSampler { ...@@ -120,7 +120,7 @@ struct TSampler {
case Esd2D: s.append("2D"); break; case Esd2D: s.append("2D"); break;
case Esd3D: s.append("3D"); break; case Esd3D: s.append("3D"); break;
case EsdCube: s.append("Cube"); break; case EsdCube: s.append("Cube"); break;
case EsdRect: s.append("Rect"); break; case EsdRect: s.append("2DRect"); break;
case EsdBuffer: s.append("Buffer"); break; case EsdBuffer: s.append("Buffer"); break;
} }
if (ms) if (ms)
...@@ -411,6 +411,7 @@ public: ...@@ -411,6 +411,7 @@ public:
case EbtFloat: return "float"; case EbtFloat: return "float";
case EbtDouble: return "double"; case EbtDouble: return "double";
case EbtInt: return "int"; case EbtInt: return "int";
case EbtUint: return "uint";
case EbtBool: return "bool"; case EbtBool: return "bool";
case EbtSampler: return "sampler/image"; case EbtSampler: return "sampler/image";
case EbtStruct: return "structure"; case EbtStruct: return "structure";
......
...@@ -48,11 +48,24 @@ typedef TVector<TString> TBuiltInStrings; ...@@ -48,11 +48,24 @@ typedef TVector<TString> TBuiltInStrings;
class TBuiltIns { class TBuiltIns {
public: public:
POOL_ALLOCATOR_NEW_DELETE(GlobalPoolAllocator) POOL_ALLOCATOR_NEW_DELETE(GlobalPoolAllocator)
TBuiltIns();
virtual ~TBuiltIns();
void initialize(int version, EProfile); void initialize(int version, EProfile);
void initialize(const TBuiltInResource& resources, int version, EProfile, EShLanguage); void initialize(const TBuiltInResource& resources, int version, EProfile, EShLanguage);
TBuiltInStrings* getBuiltInStrings() { return builtInStrings; } TBuiltInStrings* getBuiltInStrings() { return builtInStrings; }
protected: protected:
void add2ndGenerationSamplingImaging(int version, EProfile profile);
void addQueryFunctions(TSampler, TString& typeName, int version, EProfile profile);
void addImageFunctions(TSampler, TString& typeName, int version, EProfile profile);
void addSamplingFunctions(TSampler, TString& typeName, int version, EProfile profile);
TBuiltInStrings builtInStrings[EShLangCount]; TBuiltInStrings builtInStrings[EShLangCount];
// Helpers for making text
const char* postfixes[5];
const char* prefixes[EbtNumTypes];
int dimMap[EsdNumDims];
}; };
void IdentifyBuiltIns(int version, EProfile profile, EShLanguage, TSymbolTable&); void IdentifyBuiltIns(int version, EProfile profile, EShLanguage, TSymbolTable&);
......
...@@ -231,18 +231,22 @@ int yy_input(char* buf, int max_size); ...@@ -231,18 +231,22 @@ int yy_input(char* buf, int max_size);
"samplerCubeShadow" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return SAMPLERCUBESHADOW; } "samplerCubeShadow" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return SAMPLERCUBESHADOW; }
"sampler1DArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return SAMPLER1DARRAY; } "sampler1DArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return SAMPLER1DARRAY; }
"sampler2DArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return SAMPLER2DARRAY; } "sampler2DArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return SAMPLER2DARRAY; }
"samplerCubeArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return SAMPLERCUBEARRAY; }
"sampler1DArrayShadow" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return SAMPLER1DARRAYSHADOW; } "sampler1DArrayShadow" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return SAMPLER1DARRAYSHADOW; }
"sampler2DArrayShadow" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return SAMPLER2DARRAYSHADOW; } "sampler2DArrayShadow" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return SAMPLER2DARRAYSHADOW; }
"samplerCubeArrayShadow" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return SAMPLERCUBEARRAYSHADOW; }
"isampler1D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return ISAMPLER1D; } "isampler1D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return ISAMPLER1D; }
"isampler2D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return ISAMPLER2D; } "isampler2D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return ISAMPLER2D; }
"isampler3D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return ISAMPLER3D; } "isampler3D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return ISAMPLER3D; }
"isamplerCube" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return ISAMPLERCUBE; } "isamplerCube" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return ISAMPLERCUBE; }
"isamplerCubeArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return ISAMPLERCUBEARRAY; }
"isampler1DArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return ISAMPLER1DARRAY; } "isampler1DArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return ISAMPLER1DARRAY; }
"isampler2DArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return ISAMPLER2DARRAY; } "isampler2DArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return ISAMPLER2DARRAY; }
"usampler1D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return USAMPLER1D; } "usampler1D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return USAMPLER1D; }
"usampler2D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return USAMPLER2D; } "usampler2D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return USAMPLER2D; }
"usampler3D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return USAMPLER3D; } "usampler3D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return USAMPLER3D; }
"usamplerCube" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return USAMPLERCUBE; } "usamplerCube" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return USAMPLERCUBE; }
"usamplerCubeArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return USAMPLERCUBEARRAY; }
"usampler1DArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return USAMPLER1DARRAY; } "usampler1DArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return USAMPLER1DARRAY; }
"usampler2DArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return USAMPLER2DARRAY; } "usampler2DArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return USAMPLER2DARRAY; }
...@@ -252,9 +256,9 @@ int yy_input(char* buf, int max_size); ...@@ -252,9 +256,9 @@ int yy_input(char* buf, int max_size);
"sampler2DMS" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(SAMPLER2DMS); } "sampler2DMS" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(SAMPLER2DMS); }
"isampler2DMS" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(ISAMPLER2DMS); } "isampler2DMS" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(ISAMPLER2DMS); }
"usampler2DMS" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(USAMPLER2DMS); } "usampler2DMS" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(USAMPLER2DMS); }
"sampler2DMSarray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(SAMPLER2DMSARRAY); } "sampler2DMSArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(SAMPLER2DMSARRAY); }
"isampler2DMSarray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(ISAMPLER2DMSARRAY); } "isampler2DMSArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(ISAMPLER2DMSARRAY); }
"usampler2DMSarray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(USAMPLER2DMSARRAY); } "usampler2DMSArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(USAMPLER2DMSARRAY); }
"image1D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(IMAGE1D); } "image1D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(IMAGE1D); }
"iimage1D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(IIMAGE1D); } "iimage1D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(IIMAGE1D); }
"uimage1D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(UIMAGE1D); } "uimage1D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(UIMAGE1D); }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment