Commit 82cd6d82 by Nicolas Capens

Implement basic GLSL ES 3.0 texture sampling.

Bug 19331817 Change-Id: Ieb4581c62525112e0b76e94bcbbb8f9608c782ea Reviewed-on: https://swiftshader-review.googlesource.com/2371Tested-by: 's avatarNicolas Capens <capn@google.com> Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <capn@google.com>
parent f8a4cba0
...@@ -379,6 +379,39 @@ void InsertBuiltInFunctions(GLenum type, const ShBuiltInResources &resources, TS ...@@ -379,6 +379,39 @@ void InsertBuiltInFunctions(GLenum type, const ShBuiltInResources &resources, TS
symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture3DLod", sampler3D, float3, float1); symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture3DLod", sampler3D, float3, float1);
} }
TType *gvec4 = new TType(EbtGVec4);
TType *gsampler2D = new TType(EbtGSampler2D);
TType *gsamplerCube = new TType(EbtGSamplerCube);
TType *gsampler3D = new TType(EbtGSampler3D);
TType *gsampler2DArray = new TType(EbtGSampler2DArray);
//
// Texture Functions for GLSL ES 3.0
//
symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsampler2D, float2);
symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsampler3D, float3);
symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsamplerCube, float3);
symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsampler2DArray, float3);
symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProj", gsampler2D, float3);
symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProj", gsampler2D, float4);
symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProj", gsampler3D, float4);
symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureLod", gsampler2D, float2, float1);
symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureLod", gsampler3D, float3, float1);
symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureLod", gsamplerCube, float3, float1);
symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureLod", gsampler2DArray, float3, float1);
if(type == GL_FRAGMENT_SHADER)
{
symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsampler2D, float2, float1);
symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsampler3D, float3, float1);
symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsamplerCube, float3, float1);
symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsampler2DArray, float3, float1);
symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProj", gsampler2D, float3, float1);
symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProj", gsampler2D, float4, float1);
symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProj", gsampler3D, float4, float1);
}
// //
// Depth range in window coordinates // Depth range in window coordinates
// //
......
...@@ -768,10 +768,10 @@ namespace glsl ...@@ -768,10 +768,10 @@ namespace glsl
{ {
TString name = TFunction::unmangleName(node->getName()); TString name = TFunction::unmangleName(node->getName());
if(name == "texture2D" || name == "textureCube" || name == "texture3D") if(name == "texture" || name == "texture2D" || name == "textureCube" || name == "texture3D")
{ {
if(argumentCount == 2) if(argumentCount == 2)
{ {
emit(sw::Shader::OPCODE_TEX, result, arg[1], arg[0]); emit(sw::Shader::OPCODE_TEX, result, arg[1], arg[0]);
} }
else if(argumentCount == 3) // bias else if(argumentCount == 3) // bias
......
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