Commit 2adc256a by Nicolas Capens

Implement textureProjLod and textureProjLodOffset.

BUG=angle:564 Change-Id: I547c69908d0aa1809f844a50230bc019e6dd5893 Reviewed-on: https://chromium-review.googlesource.com/186685Tested-by: 's avatarNicolas Capens <nicolascapens@chromium.org> Reviewed-by: 's avatarShannon Woods <shannonwoods@chromium.org>
parent df86c6b9
...@@ -493,6 +493,16 @@ void InsertBuiltInFunctions(ShShaderType type, ShShaderSpec spec, const ShBuiltI ...@@ -493,6 +493,16 @@ void InsertBuiltInFunctions(ShShaderType type, ShShaderSpec spec, const ShBuiltI
symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureLodOffset", sampler2DShadow, float3, float1, int2); symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureLodOffset", sampler2DShadow, float3, float1, int2);
symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureLodOffset", gsampler2DArray, float3, float1, int2); symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureLodOffset", gsampler2DArray, float3, float1, int2);
symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjLod", gsampler2D, float3, float1);
symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjLod", gsampler2D, float4, float1);
symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjLod", gsampler3D, float4, float1);
symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureProjLod", sampler2DShadow, float4, float1);
symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjLodOffset", gsampler2D, float3, float1, int2);
symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjLodOffset", gsampler2D, float4, float1, int2);
symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjLodOffset", gsampler3D, float4, float1, int3);
symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureProjLodOffset", sampler2DShadow, float4, float1, int2);
// //
// Depth range in window coordinates // Depth range in window coordinates
// //
......
...@@ -1161,6 +1161,10 @@ void OutputHLSL::header() ...@@ -1161,6 +1161,10 @@ void OutputHLSL::header()
out << " lod += bias;\n"; out << " lod += bias;\n";
} }
} }
else if (textureFunction->method == TextureFunction::LOD)
{
out << " x.GetDimensions(0, width, height, levels);\n";
}
out << " uint mip = uint(min(max(round(lod), 0), levels - 1));\n"; out << " uint mip = uint(min(max(round(lod), 0), levels - 1));\n";
} }
...@@ -2354,6 +2358,17 @@ bool OutputHLSL::visitAggregate(Visit visit, TIntermAggregate *node) ...@@ -2354,6 +2358,17 @@ bool OutputHLSL::visitAggregate(Visit visit, TIntermAggregate *node)
textureFunction.method = TextureFunction::LOD; textureFunction.method = TextureFunction::LOD;
textureFunction.offset = true; textureFunction.offset = true;
} }
else if (name == "textureProjLod")
{
textureFunction.method = TextureFunction::LOD;
textureFunction.proj = true;
}
else if (name == "textureProjLodOffset")
{
textureFunction.method = TextureFunction::LOD;
textureFunction.proj = true;
textureFunction.offset = true;
}
else UNREACHABLE(); else UNREACHABLE();
if (textureFunction.method == TextureFunction::IMPLICIT) // Could require lod 0 or have a bias argument if (textureFunction.method == TextureFunction::IMPLICIT) // Could require lod 0 or have a bias argument
...@@ -3929,7 +3944,6 @@ GLenum OutputHLSL::glVariableType(const TType &type) ...@@ -3929,7 +3944,6 @@ GLenum OutputHLSL::glVariableType(const TType &type)
default: UNREACHABLE(); default: UNREACHABLE();
} }
return GL_NONE; return GL_NONE;
} }
......
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