Added Lod0 versions of texture sampling intrinsics.

TRAC #20737 Signed-off-by: Daniel Koch Author: Nicolas Capens git-svn-id: https://angleproject.googlecode.com/svn/trunk@1119 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 0e9704bc
......@@ -39,6 +39,12 @@ OutputHLSL::OutputHLSL(TParseContext &context) : TIntermTraverser(true, true, tr
mUsesTextureCube = false;
mUsesTextureCube_bias = false;
mUsesTextureCubeLod = false;
mUsesTexture2DLod0 = false;
mUsesTexture2DLod0_bias = false;
mUsesTexture2DProjLod0 = false;
mUsesTexture2DProjLod0_bias = false;
mUsesTextureCubeLod0 = false;
mUsesTextureCubeLod0_bias = false;
mUsesDepthRange = false;
mUsesFragCoord = false;
mUsesPointCoord = false;
......@@ -283,6 +289,72 @@ void OutputHLSL::header()
"}\n"
"\n";
}
// These *Lod0 intrinsics are not available in GL fragment shaders.
// They are used to sample using discontinuous texture coordinates.
if (mUsesTexture2DLod0)
{
out << "float4 gl_texture2DLod0(sampler2D s, float2 t)\n"
"{\n"
" return tex2Dlod(s, float4(t.x, 1 - t.y, 0, 0));\n"
"}\n"
"\n";
}
if (mUsesTexture2DLod0_bias)
{
out << "float4 gl_texture2DLod0(sampler2D s, float2 t, float bias)\n"
"{\n"
" return tex2Dlod(s, float4(t.x, 1 - t.y, 0, 0));\n"
"}\n"
"\n";
}
if (mUsesTexture2DProjLod0)
{
out << "float4 gl_texture2DProjLod0(sampler2D s, float3 t)\n"
"{\n"
" return tex2Dlod(s, float4(t.x / t.z, 1 - t.y / t.z, 0, 0));\n"
"}\n"
"\n"
"float4 gl_texture2DProjLod(sampler2D s, float4 t)\n"
"{\n"
" return tex2Dlod(s, float4(t.x / t.w, 1 - t.y / t.w, 0, 0));\n"
"}\n"
"\n";
}
if (mUsesTexture2DProjLod0_bias)
{
out << "float4 gl_texture2DProjLod0_bias(sampler2D s, float3 t, float bias)\n"
"{\n"
" return tex2Dlod(s, float4(t.x / t.z, 1 - t.y / t.z, 0, 0));\n"
"}\n"
"\n"
"float4 gl_texture2DProjLod_bias(sampler2D s, float4 t, float bias)\n"
"{\n"
" return tex2Dlod(s, float4(t.x / t.w, 1 - t.y / t.w, 0, 0));\n"
"}\n"
"\n";
}
if (mUsesTextureCubeLod0)
{
out << "float4 gl_textureCubeLod0(samplerCUBE s, float3 t)\n"
"{\n"
" return texCUBElod(s, float4(t.x, -t.y, t.z, 0));\n"
"}\n"
"\n";
}
if (mUsesTextureCubeLod0_bias)
{
out << "float4 gl_textureCubeLod0(samplerCUBE s, float3 t, float bias)\n"
"{\n"
" return texCUBElod(s, float4(t.x, -t.y, t.z, 0));\n"
"}\n"
"\n";
}
}
else // Vertex shader
{
......
......@@ -86,6 +86,12 @@ class OutputHLSL : public TIntermTraverser
bool mUsesTextureCube;
bool mUsesTextureCube_bias;
bool mUsesTextureCubeLod;
bool mUsesTexture2DLod0;
bool mUsesTexture2DLod0_bias;
bool mUsesTexture2DProjLod0;
bool mUsesTexture2DProjLod0_bias;
bool mUsesTextureCubeLod0;
bool mUsesTextureCubeLod0_bias;
bool mUsesDepthRange;
bool mUsesFragCoord;
bool mUsesPointCoord;
......
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