[lunarglass] r1083 committed - GLSL -> Top IR -> GLSL: Broaden support for texelFetch and fix LOD bug...

4 views
Skip to first unread message

lunar...@googlecode.com

unread,
May 22, 2015, 10:50:13 PM5/22/15
to lunargla...@googlegroups.com
Revision: 1083
Author: jo...@lunarg.com
Date: Sat May 23 02:49:49 2015 UTC
Log: GLSL -> Top IR -> GLSL: Broaden support for texelFetch and fix
LOD bug for existing texelFetch.
https://code.google.com/p/lunarglass/source/detail?r=1083

Modified:
/trunk/Backends/GLSL/BottomToGLSL.cpp
/trunk/Core/TopBuilder.cpp
/trunk/Frontends/glslang/GlslangToTopVisitor.cpp
/trunk/test/baseResults/parallel.out
/trunk/test/newTexture.frag

=======================================
--- /trunk/Backends/GLSL/BottomToGLSL.cpp Thu May 21 01:25:46 2015 UTC
+++ /trunk/Backends/GLSL/BottomToGLSL.cpp Sat May 23 02:49:49 2015 UTC
@@ -3558,7 +3558,7 @@

if (texFlags & ETFProjected)
out << "Proj";
- if (texFlags & ETFLod)
+ if ((texFlags & ETFLod) && ! (texFlags & ETFFetch))
out << "Lod";
if (IsGradientTexInst(llvmInstruction))
out << "Grad";
=======================================
--- /trunk/Core/TopBuilder.cpp Mon May 11 01:14:44 2015 UTC
+++ /trunk/Core/TopBuilder.cpp Sat May 23 02:49:49 2015 UTC
@@ -1756,7 +1756,7 @@
} else if (texFlags & ETFOffsetArg) {
intrinsicID = (floatReturn) ?
llvm::Intrinsic::gla_fTextureSampleLodRefZOffset
:
llvm::Intrinsic::gla_textureSampleLodRefZOffset;
- } else if (texFlags & ETFBias || texFlags & ETFLod || texFlags &
ETFShadow) {
+ } else if ((texFlags & ETFBias) || (texFlags & ETFLod) || (texFlags &
ETFShadow)) {
intrinsicID = (floatReturn) ?
llvm::Intrinsic::gla_fTextureSampleLodRefZ
:
llvm::Intrinsic::gla_textureSampleLodRefZ;
} else {
@@ -1765,7 +1765,7 @@
}

// Set fields based on argument flags
- if (texFlags & ETFBiasLodArg || texFlags & ETFComponentArg)
+ if ((texFlags & ETFBiasLodArg) || (texFlags & ETFComponentArg))
texArgs[GetTextureOpIndex(ETOBiasLod)] = parameters.ETPBiasLod;

if (texFlags & ETFRefZArg)
=======================================
--- /trunk/Frontends/glslang/GlslangToTopVisitor.cpp Thu May 21 01:11:19
2015 UTC
+++ /trunk/Frontends/glslang/GlslangToTopVisitor.cpp Sat May 23 02:49:49
2015 UTC
@@ -1600,6 +1600,8 @@
gla::UnsupportedFunctionality("sampler type");
break;
}
+ if
(node->getSequence()[0]->getAsTyped()->getType().getSampler().ms)
+ samplerType = gla::ESampler2DMS;

if (node->getName().find("Size", 0) != std::string::npos) {
llvm::Value* lastArg;
@@ -1650,8 +1652,21 @@
texFlags |= gla::ETFOffsets;
}

- if (node->getName().find("Fetch", 0) != std::string::npos)
+ if (node->getName().find("Fetch", 0) != std::string::npos) {
texFlags |= gla::ETFFetch;
+ switch (samplerType) {
+ case gla::ESampler1D:
+ case gla::ESampler2D:
+ case gla::ESampler3D:
+ texFlags |= gla::ETFLod;
+ texFlags |= gla::ETFBiasLodArg;
+ break;
+ case gla::ESampler2DMS:
+ texFlags |= gla::ETFSampleArg;
+ default:
+ break;
+ }
+ }

if
(node->getSequence()[0]->getAsTyped()->getType().getSampler().shadow)
texFlags |= gla::ETFShadow;
@@ -1661,9 +1676,6 @@
if (texFlags & gla::ETFShadow)
texFlags |= gla::ETFRefZArg;
}
-
- if
(node->getSequence()[0]->getAsTyped()->getType().getSampler().ms)
- samplerType = gla::ESampler2D;

if
(node->getSequence()[0]->getAsTyped()->getType().getSampler().arrayed)
texFlags |= gla::ETFArrayed;
=======================================
--- /trunk/test/baseResults/parallel.out Sun Jan 11 01:35:27 2015 UTC
+++ /trunk/test/baseResults/parallel.out Sat May 23 02:49:49 2015 UTC
@@ -939,8 +939,10 @@
uniform isampler3D is3D;
uniform isamplerCube isCube;
uniform isampler2DArray is2DArray;
-uniform samplerCubeShadow sCubeShadow;
uniform isampler2D is2Dms;
+uniform samplerBuffer sb;
+uniform sampler2DRect sr;
+uniform samplerCubeShadow sCubeShadow;
uniform usampler2D us2D;
uniform usampler3D us3D;
uniform usamplerCube usCube;
@@ -1013,10 +1015,18 @@
ivec4 iv6 = texelFetch(is2DArray, ic3D, ic1D);
vec4 H_3hnokl = vec4(iv6);
vec4 H_kije5n1 = H_3hnokl + H_r3pnvg1;
- ivec2 iv7 = textureSize(sCubeShadow, C_2);
- vec2 H_w4k3ff = vec2(iv7);
- vec4 H_1s1qp41 = vec4(H_w4k3ff.x, H_w4k3ff.y, C_0d0, C_0d0);
- vec4 FragData1 = H_1s1qp41 + H_kije5n1;
+ ivec4 iv7 = texelFetch(is2Dms, ic2D, ic1D);
+ ivec4 iv8 = iv6 + iv7;
+ vec4 H_5u886m1 = vec4(iv8);
+ vec4 H_hltepg1 = H_5u886m1 + H_kije5n1;
+ vec4 H_u4lqa3 = texelFetch(sb, ic1D);
+ vec4 H_rgdtlr1 = H_hltepg1 + H_u4lqa3;
+ vec4 H_77ufv6 = texelFetch(sr, ic2D);
+ vec4 H_jis6ku1 = H_77ufv6 + H_rgdtlr1;
+ ivec2 iv9 = textureSize(sCubeShadow, C_2);
+ vec2 H_iunhai1 = vec2(iv9);
+ vec4 H_duim3t = vec4(H_iunhai1.x, H_iunhai1.y, C_0d0, C_0d0);
+ vec4 FragData1 = H_duim3t + H_jis6ku1;
FragData = FragData1;

}
=======================================
--- /trunk/test/newTexture.frag Wed Nov 20 23:50:43 2013 UTC
+++ /trunk/test/newTexture.frag Sat May 23 02:49:49 2015 UTC
@@ -1,5 +1,7 @@
#version 430

+uniform samplerBuffer sb;
+uniform sampler2DRect sr;
uniform sampler2D s2D;
uniform sampler3D s3D;
uniform samplerCube sCube;
@@ -61,6 +63,11 @@
iv = texelFetch(is2DArray, ic3D, ic1D);
v += vec4(iv);

+ iv += texelFetch(is2Dms, ic2D, ic1D);
+ v += vec4(iv);
+ v += texelFetch(sb, ic1D);
+ v += texelFetch(sr, ic2D);
+
ivec2 iv2 = textureSize(sCubeShadow, 2);
// iv2 += textureSize(is2Dms);

Reply all
Reply to author
Forward
0 new messages