diff options
author | Brian <[email protected]> | 2007-01-08 15:58:14 -0700 |
---|---|---|
committer | Brian <[email protected]> | 2007-01-08 15:58:14 -0700 |
commit | 42153d7858686cfd88e919c0889a56d3a13a603e (patch) | |
tree | 3fe760df42a2f1eb963866b6bbb86dc98525fd37 /src/mesa/shader | |
parent | 483ca39bca3c4a125e725e4711abde3f86a84b9e (diff) |
Implement projective texture sampling, 3D textures. Disable some debug output.
Diffstat (limited to 'src/mesa/shader')
-rw-r--r-- | src/mesa/shader/slang/library/slang_common_builtin.gc | 46 | ||||
-rw-r--r-- | src/mesa/shader/slang/library/slang_common_builtin_gc.h | 158 | ||||
-rw-r--r-- | src/mesa/shader/slang/slang_assemble.c | 4 | ||||
-rw-r--r-- | src/mesa/shader/slang/slang_codegen.c | 40 | ||||
-rw-r--r-- | src/mesa/shader/slang/slang_emit.c | 9 | ||||
-rw-r--r-- | src/mesa/shader/slang/slang_ir.h | 1 | ||||
-rw-r--r-- | src/mesa/shader/slang/slang_link2.c | 4 |
7 files changed, 143 insertions, 119 deletions
diff --git a/src/mesa/shader/slang/library/slang_common_builtin.gc b/src/mesa/shader/slang/library/slang_common_builtin.gc index 52f5b96d888..184a92ce340 100644 --- a/src/mesa/shader/slang/library/slang_common_builtin.gc +++ b/src/mesa/shader/slang/library/slang_common_builtin.gc @@ -1633,38 +1633,42 @@ vec4 texture1DProj(const sampler1D sampler, const vec4 coord) vec4 texture2D(const sampler2D sampler, const vec2 coord) { - __asm vec4_tex2d __retVal, sampler, coord; // XXX sampler + __asm vec4_tex2d __retVal, sampler, coord; } -//vec4 texture2DProj(const sampler2D sampler, const vec3 coord) -//{ -// vec2 pcoord = coord.st / coord.p; -// __asm vec4_tex2d __retVal, pcoord; // XXX sampler -//} +vec4 texture2DProj(const sampler2D sampler, const vec3 coord) +{ + // new coord with .z moved to .w + vec4 coord4; + coord4.xy = coord.xy; + coord4.w = coord.z; + __asm vec4_texp2d __retVal, sampler, coord4; +} -//vec4 texture2DProj(const sampler2D sampler, const vec4 coord) -//{ -// vec2 pcoord = coord.st / coord.q; -// __asm vec4_tex2d __retVal, pcoord; // XXX sampler -//} +vec4 texture2DProj(const sampler2D sampler, const vec4 coord) +{ + __asm vec4_texp2d __retVal, coord; +} -vec4 texture3D (sampler3D sampler, vec3 coord) { - vec4 texel; - __asm vec4_tex3d texel, sampler, coord, 0.0; - return texel; +vec4 texture3D(const sampler3D sampler, const vec3 coord) +{ + __asm vec4_tex3d __retVal, sampler, coord; } -vec4 texture3DProj (sampler3D sampler, vec4 coord) { - return texture3D (sampler, vec3 (coord.s / coord.q, coord.t / coord.q, coord.p / coord.q)); +vec4 texture3DProj(const sampler3D sampler, const vec4 coord) +{ + __asm vec4_texp3d __retVal, sampler, coord; } -vec4 textureCube (samplerCube sampler, vec3 coord) { - vec4 texel; - __asm vec4_texcube texel, sampler, coord, 0.0; - return texel; + +vec4 textureCube(const samplerCube sampler, const vec3 coord) +{ + __asm vec4_texcube __retVal, sampler, coord; } + + vec4 shadow1D (sampler1DShadow sampler, vec3 coord) { vec4 texel; __asm vec4_shad1d texel, sampler, coord, 0.0; diff --git a/src/mesa/shader/slang/library/slang_common_builtin_gc.h b/src/mesa/shader/slang/library/slang_common_builtin_gc.h index e418f532139..3a089e5838e 100644 --- a/src/mesa/shader/slang/library/slang_common_builtin_gc.h +++ b/src/mesa/shader/slang/library/slang_common_builtin_gc.h @@ -682,81 +682,85 @@ 101,116,86,97,108,0,0,18,112,99,111,111,114,100,0,0,0,0,1,0,12,0,116,101,120,116,117,114,101,50,68, 0,1,1,0,17,115,97,109,112,108,101,114,0,0,1,1,0,10,99,111,111,114,100,0,0,0,1,4,118,101,99,52,95, 116,101,120,50,100,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99, -111,111,114,100,0,0,0,0,1,0,12,0,116,101,120,116,117,114,101,51,68,0,1,0,0,18,115,97,109,112,108, -101,114,0,0,1,0,0,11,99,111,111,114,100,0,0,0,1,3,2,0,12,1,116,101,120,101,108,0,0,0,4,118,101,99, -52,95,116,101,120,51,100,0,18,116,101,120,101,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111, -111,114,100,0,0,17,48,0,48,0,0,0,0,8,18,116,101,120,101,108,0,0,0,1,0,12,0,116,101,120,116,117,114, -101,51,68,80,114,111,106,0,1,0,0,18,115,97,109,112,108,101,114,0,0,1,0,0,12,99,111,111,114,100,0,0, -0,1,8,58,116,101,120,116,117,114,101,51,68,0,18,115,97,109,112,108,101,114,0,0,58,118,101,99,51,0, -18,99,111,111,114,100,0,59,115,0,18,99,111,111,114,100,0,59,113,0,49,0,18,99,111,111,114,100,0,59, -116,0,18,99,111,111,114,100,0,59,113,0,49,0,18,99,111,111,114,100,0,59,112,0,18,99,111,111,114,100, -0,59,113,0,49,0,0,0,0,0,0,1,0,12,0,116,101,120,116,117,114,101,67,117,98,101,0,1,0,0,19,115,97,109, +111,111,114,100,0,0,0,0,1,0,12,0,116,101,120,116,117,114,101,50,68,80,114,111,106,0,1,1,0,17,115, +97,109,112,108,101,114,0,0,1,1,0,11,99,111,111,114,100,0,0,0,1,3,2,0,12,1,99,111,111,114,100,52,0, +0,0,9,18,99,111,111,114,100,52,0,59,120,121,0,18,99,111,111,114,100,0,59,120,121,0,20,0,9,18,99, +111,111,114,100,52,0,59,119,0,18,99,111,111,114,100,0,59,122,0,20,0,4,118,101,99,52,95,116,101,120, +112,50,100,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111, +114,100,52,0,0,0,0,1,0,12,0,116,101,120,116,117,114,101,50,68,80,114,111,106,0,1,1,0,17,115,97,109, +112,108,101,114,0,0,1,1,0,12,99,111,111,114,100,0,0,0,1,4,118,101,99,52,95,116,101,120,112,50,100, +0,18,95,95,114,101,116,86,97,108,0,0,18,99,111,111,114,100,0,0,0,0,1,0,12,0,116,101,120,116,117, +114,101,51,68,0,1,1,0,18,115,97,109,112,108,101,114,0,0,1,1,0,11,99,111,111,114,100,0,0,0,1,4,118, +101,99,52,95,116,101,120,51,100,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114, +0,0,18,99,111,111,114,100,0,0,0,0,1,0,12,0,116,101,120,116,117,114,101,51,68,80,114,111,106,0,1,1, +0,18,115,97,109,112,108,101,114,0,0,1,1,0,12,99,111,111,114,100,0,0,0,1,4,118,101,99,52,95,116,101, +120,112,51,100,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111, +111,114,100,0,0,0,0,1,0,12,0,116,101,120,116,117,114,101,67,117,98,101,0,1,1,0,19,115,97,109,112, +108,101,114,0,0,1,1,0,11,99,111,111,114,100,0,0,0,1,4,118,101,99,52,95,116,101,120,99,117,98,101,0, +18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,0,0,0,0, +1,0,12,0,115,104,97,100,111,119,49,68,0,1,0,0,20,115,97,109,112,108,101,114,0,0,1,0,0,11,99,111, +111,114,100,0,0,0,1,3,2,0,12,1,116,101,120,101,108,0,0,0,4,118,101,99,52,95,115,104,97,100,49,100, +0,18,116,101,120,101,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,0,0,17,48,0, +48,0,0,0,0,8,18,116,101,120,101,108,0,0,0,1,0,12,0,115,104,97,100,111,119,49,68,80,114,111,106,0,1, +0,0,20,115,97,109,112,108,101,114,0,0,1,0,0,12,99,111,111,114,100,0,0,0,1,8,58,115,104,97,100,111, +119,49,68,0,18,115,97,109,112,108,101,114,0,0,58,118,101,99,51,0,18,99,111,111,114,100,0,59,115,0, +18,99,111,111,114,100,0,59,113,0,49,0,17,48,0,48,0,0,0,18,99,111,111,114,100,0,59,112,0,18,99,111, +111,114,100,0,59,113,0,49,0,0,0,0,0,0,1,0,12,0,115,104,97,100,111,119,50,68,0,1,0,0,21,115,97,109, 112,108,101,114,0,0,1,0,0,11,99,111,111,114,100,0,0,0,1,3,2,0,12,1,116,101,120,101,108,0,0,0,4,118, -101,99,52,95,116,101,120,99,117,98,101,0,18,116,101,120,101,108,0,0,18,115,97,109,112,108,101,114, -0,0,18,99,111,111,114,100,0,0,17,48,0,48,0,0,0,0,8,18,116,101,120,101,108,0,0,0,1,0,12,0,115,104, -97,100,111,119,49,68,0,1,0,0,20,115,97,109,112,108,101,114,0,0,1,0,0,11,99,111,111,114,100,0,0,0,1, -3,2,0,12,1,116,101,120,101,108,0,0,0,4,118,101,99,52,95,115,104,97,100,49,100,0,18,116,101,120,101, -108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,0,0,17,48,0,48,0,0,0,0,8,18,116, -101,120,101,108,0,0,0,1,0,12,0,115,104,97,100,111,119,49,68,80,114,111,106,0,1,0,0,20,115,97,109, -112,108,101,114,0,0,1,0,0,12,99,111,111,114,100,0,0,0,1,8,58,115,104,97,100,111,119,49,68,0,18,115, -97,109,112,108,101,114,0,0,58,118,101,99,51,0,18,99,111,111,114,100,0,59,115,0,18,99,111,111,114, -100,0,59,113,0,49,0,17,48,0,48,0,0,0,18,99,111,111,114,100,0,59,112,0,18,99,111,111,114,100,0,59, -113,0,49,0,0,0,0,0,0,1,0,12,0,115,104,97,100,111,119,50,68,0,1,0,0,21,115,97,109,112,108,101,114,0, -0,1,0,0,11,99,111,111,114,100,0,0,0,1,3,2,0,12,1,116,101,120,101,108,0,0,0,4,118,101,99,52,95,115, -104,97,100,50,100,0,18,116,101,120,101,108,0,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114, -100,0,0,17,48,0,48,0,0,0,0,8,18,116,101,120,101,108,0,0,0,1,0,12,0,115,104,97,100,111,119,50,68,80, -114,111,106,0,1,0,0,21,115,97,109,112,108,101,114,0,0,1,0,0,12,99,111,111,114,100,0,0,0,1,8,58,115, -104,97,100,111,119,50,68,0,18,115,97,109,112,108,101,114,0,0,58,118,101,99,51,0,18,99,111,111,114, -100,0,59,115,0,18,99,111,111,114,100,0,59,113,0,49,0,18,99,111,111,114,100,0,59,116,0,18,99,111, -111,114,100,0,59,113,0,49,0,18,99,111,111,114,100,0,59,112,0,18,99,111,111,114,100,0,59,113,0,49,0, -0,0,0,0,0,1,0,9,0,110,111,105,115,101,49,0,1,0,0,9,120,0,0,0,1,3,2,0,9,1,97,0,0,0,4,102,108,111,97, -116,95,110,111,105,115,101,49,0,18,97,0,0,18,120,0,0,0,8,18,97,0,0,0,1,0,9,0,110,111,105,115,101, -49,0,1,0,0,10,120,0,0,0,1,3,2,0,9,1,97,0,0,0,4,102,108,111,97,116,95,110,111,105,115,101,50,0,18, -97,0,0,18,120,0,0,0,8,18,97,0,0,0,1,0,9,0,110,111,105,115,101,49,0,1,0,0,11,120,0,0,0,1,3,2,0,9,1, -97,0,0,0,4,102,108,111,97,116,95,110,111,105,115,101,51,0,18,97,0,0,18,120,0,0,0,8,18,97,0,0,0,1,0, -9,0,110,111,105,115,101,49,0,1,0,0,12,120,0,0,0,1,3,2,0,9,1,97,0,0,0,4,102,108,111,97,116,95,110, -111,105,115,101,52,0,18,97,0,0,18,120,0,0,0,8,18,97,0,0,0,1,0,10,0,110,111,105,115,101,50,0,1,0,0, -9,120,0,0,0,1,8,58,118,101,99,50,0,58,110,111,105,115,101,49,0,18,120,0,0,0,0,58,110,111,105,115, -101,49,0,18,120,0,17,49,57,0,51,52,0,0,46,0,0,0,0,0,0,1,0,10,0,110,111,105,115,101,50,0,1,0,0,10, -120,0,0,0,1,8,58,118,101,99,50,0,58,110,111,105,115,101,49,0,18,120,0,0,0,0,58,110,111,105,115,101, -49,0,18,120,0,58,118,101,99,50,0,17,49,57,0,51,52,0,0,0,17,55,0,54,54,0,0,0,0,46,0,0,0,0,0,0,1,0, -10,0,110,111,105,115,101,50,0,1,0,0,11,120,0,0,0,1,8,58,118,101,99,50,0,58,110,111,105,115,101,49, -0,18,120,0,0,0,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,51,0,17,49,57,0,51,52,0,0,0,17, -55,0,54,54,0,0,0,17,51,0,50,51,0,0,0,0,46,0,0,0,0,0,0,1,0,10,0,110,111,105,115,101,50,0,1,0,0,12, -120,0,0,0,1,8,58,118,101,99,50,0,58,110,111,105,115,101,49,0,18,120,0,0,0,0,58,110,111,105,115,101, -49,0,18,120,0,58,118,101,99,52,0,17,49,57,0,51,52,0,0,0,17,55,0,54,54,0,0,0,17,51,0,50,51,0,0,0,17, -50,0,55,55,0,0,0,0,46,0,0,0,0,0,0,1,0,11,0,110,111,105,115,101,51,0,1,0,0,9,120,0,0,0,1,8,58,118, -101,99,51,0,58,110,111,105,115,101,49,0,18,120,0,0,0,0,58,110,111,105,115,101,49,0,18,120,0,17,49, -57,0,51,52,0,0,46,0,0,0,58,110,111,105,115,101,49,0,18,120,0,17,53,0,52,55,0,0,46,0,0,0,0,0,0,1,0, -11,0,110,111,105,115,101,51,0,1,0,0,10,120,0,0,0,1,8,58,118,101,99,51,0,58,110,111,105,115,101,49, -0,18,120,0,0,0,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,50,0,17,49,57,0,51,52,0,0,0,17, -55,0,54,54,0,0,0,0,46,0,0,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,50,0,17,53,0,52,55, -0,0,0,17,49,55,0,56,53,0,0,0,0,46,0,0,0,0,0,0,1,0,11,0,110,111,105,115,101,51,0,1,0,0,11,120,0,0,0, -1,8,58,118,101,99,51,0,58,110,111,105,115,101,49,0,18,120,0,0,0,0,58,110,111,105,115,101,49,0,18, -120,0,58,118,101,99,51,0,17,49,57,0,51,52,0,0,0,17,55,0,54,54,0,0,0,17,51,0,50,51,0,0,0,0,46,0,0,0, -58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,51,0,17,53,0,52,55,0,0,0,17,49,55,0,56,53,0,0,0, -17,49,49,0,48,52,0,0,0,0,46,0,0,0,0,0,0,1,0,11,0,110,111,105,115,101,51,0,1,0,0,12,120,0,0,0,1,8, -58,118,101,99,51,0,58,110,111,105,115,101,49,0,18,120,0,0,0,0,58,110,111,105,115,101,49,0,18,120,0, -58,118,101,99,52,0,17,49,57,0,51,52,0,0,0,17,55,0,54,54,0,0,0,17,51,0,50,51,0,0,0,17,50,0,55,55,0, -0,0,0,46,0,0,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,52,0,17,53,0,52,55,0,0,0,17,49, -55,0,56,53,0,0,0,17,49,49,0,48,52,0,0,0,17,49,51,0,49,57,0,0,0,0,46,0,0,0,0,0,0,1,0,12,0,110,111, -105,115,101,52,0,1,0,0,9,120,0,0,0,1,8,58,118,101,99,52,0,58,110,111,105,115,101,49,0,18,120,0,0,0, -0,58,110,111,105,115,101,49,0,18,120,0,17,49,57,0,51,52,0,0,46,0,0,0,58,110,111,105,115,101,49,0, -18,120,0,17,53,0,52,55,0,0,46,0,0,0,58,110,111,105,115,101,49,0,18,120,0,17,50,51,0,53,52,0,0,46,0, -0,0,0,0,0,1,0,12,0,110,111,105,115,101,52,0,1,0,0,10,120,0,0,0,1,8,58,118,101,99,52,0,58,110,111, -105,115,101,49,0,18,120,0,0,0,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,50,0,17,49,57,0, -51,52,0,0,0,17,55,0,54,54,0,0,0,0,46,0,0,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,50,0, -17,53,0,52,55,0,0,0,17,49,55,0,56,53,0,0,0,0,46,0,0,0,58,110,111,105,115,101,49,0,18,120,0,58,118, -101,99,50,0,17,50,51,0,53,52,0,0,0,17,50,57,0,49,49,0,0,0,0,46,0,0,0,0,0,0,1,0,12,0,110,111,105, -115,101,52,0,1,0,0,11,120,0,0,0,1,8,58,118,101,99,52,0,58,110,111,105,115,101,49,0,18,120,0,0,0,0, -58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,51,0,17,49,57,0,51,52,0,0,0,17,55,0,54,54,0,0,0, -17,51,0,50,51,0,0,0,0,46,0,0,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,51,0,17,53,0,52, -55,0,0,0,17,49,55,0,56,53,0,0,0,17,49,49,0,48,52,0,0,0,0,46,0,0,0,58,110,111,105,115,101,49,0,18, -120,0,58,118,101,99,51,0,17,50,51,0,53,52,0,0,0,17,50,57,0,49,49,0,0,0,17,51,49,0,57,49,0,0,0,0,46, -0,0,0,0,0,0,1,0,12,0,110,111,105,115,101,52,0,1,0,0,12,120,0,0,0,1,8,58,118,101,99,52,0,58,110,111, -105,115,101,49,0,18,120,0,0,0,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,52,0,17,49,57,0, -51,52,0,0,0,17,55,0,54,54,0,0,0,17,51,0,50,51,0,0,0,17,50,0,55,55,0,0,0,0,46,0,0,0,58,110,111,105, -115,101,49,0,18,120,0,58,118,101,99,52,0,17,53,0,52,55,0,0,0,17,49,55,0,56,53,0,0,0,17,49,49,0,48, -52,0,0,0,17,49,51,0,49,57,0,0,0,0,46,0,0,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,52,0, -17,50,51,0,53,52,0,0,0,17,50,57,0,49,49,0,0,0,17,51,49,0,57,49,0,0,0,17,51,55,0,52,56,0,0,0,0,46,0, -0,0,0,0,0,0 +101,99,52,95,115,104,97,100,50,100,0,18,116,101,120,101,108,0,0,18,115,97,109,112,108,101,114,0,0, +18,99,111,111,114,100,0,0,17,48,0,48,0,0,0,0,8,18,116,101,120,101,108,0,0,0,1,0,12,0,115,104,97, +100,111,119,50,68,80,114,111,106,0,1,0,0,21,115,97,109,112,108,101,114,0,0,1,0,0,12,99,111,111,114, +100,0,0,0,1,8,58,115,104,97,100,111,119,50,68,0,18,115,97,109,112,108,101,114,0,0,58,118,101,99,51, +0,18,99,111,111,114,100,0,59,115,0,18,99,111,111,114,100,0,59,113,0,49,0,18,99,111,111,114,100,0, +59,116,0,18,99,111,111,114,100,0,59,113,0,49,0,18,99,111,111,114,100,0,59,112,0,18,99,111,111,114, +100,0,59,113,0,49,0,0,0,0,0,0,1,0,9,0,110,111,105,115,101,49,0,1,0,0,9,120,0,0,0,1,3,2,0,9,1,97,0, +0,0,4,102,108,111,97,116,95,110,111,105,115,101,49,0,18,97,0,0,18,120,0,0,0,8,18,97,0,0,0,1,0,9,0, +110,111,105,115,101,49,0,1,0,0,10,120,0,0,0,1,3,2,0,9,1,97,0,0,0,4,102,108,111,97,116,95,110,111, +105,115,101,50,0,18,97,0,0,18,120,0,0,0,8,18,97,0,0,0,1,0,9,0,110,111,105,115,101,49,0,1,0,0,11, +120,0,0,0,1,3,2,0,9,1,97,0,0,0,4,102,108,111,97,116,95,110,111,105,115,101,51,0,18,97,0,0,18,120,0, +0,0,8,18,97,0,0,0,1,0,9,0,110,111,105,115,101,49,0,1,0,0,12,120,0,0,0,1,3,2,0,9,1,97,0,0,0,4,102, +108,111,97,116,95,110,111,105,115,101,52,0,18,97,0,0,18,120,0,0,0,8,18,97,0,0,0,1,0,10,0,110,111, +105,115,101,50,0,1,0,0,9,120,0,0,0,1,8,58,118,101,99,50,0,58,110,111,105,115,101,49,0,18,120,0,0,0, +0,58,110,111,105,115,101,49,0,18,120,0,17,49,57,0,51,52,0,0,46,0,0,0,0,0,0,1,0,10,0,110,111,105, +115,101,50,0,1,0,0,10,120,0,0,0,1,8,58,118,101,99,50,0,58,110,111,105,115,101,49,0,18,120,0,0,0,0, +58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,50,0,17,49,57,0,51,52,0,0,0,17,55,0,54,54,0,0,0, +0,46,0,0,0,0,0,0,1,0,10,0,110,111,105,115,101,50,0,1,0,0,11,120,0,0,0,1,8,58,118,101,99,50,0,58, +110,111,105,115,101,49,0,18,120,0,0,0,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,51,0,17, +49,57,0,51,52,0,0,0,17,55,0,54,54,0,0,0,17,51,0,50,51,0,0,0,0,46,0,0,0,0,0,0,1,0,10,0,110,111,105, +115,101,50,0,1,0,0,12,120,0,0,0,1,8,58,118,101,99,50,0,58,110,111,105,115,101,49,0,18,120,0,0,0,0, +58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,52,0,17,49,57,0,51,52,0,0,0,17,55,0,54,54,0,0,0, +17,51,0,50,51,0,0,0,17,50,0,55,55,0,0,0,0,46,0,0,0,0,0,0,1,0,11,0,110,111,105,115,101,51,0,1,0,0,9, +120,0,0,0,1,8,58,118,101,99,51,0,58,110,111,105,115,101,49,0,18,120,0,0,0,0,58,110,111,105,115,101, +49,0,18,120,0,17,49,57,0,51,52,0,0,46,0,0,0,58,110,111,105,115,101,49,0,18,120,0,17,53,0,52,55,0,0, +46,0,0,0,0,0,0,1,0,11,0,110,111,105,115,101,51,0,1,0,0,10,120,0,0,0,1,8,58,118,101,99,51,0,58,110, +111,105,115,101,49,0,18,120,0,0,0,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,50,0,17,49, +57,0,51,52,0,0,0,17,55,0,54,54,0,0,0,0,46,0,0,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99, +50,0,17,53,0,52,55,0,0,0,17,49,55,0,56,53,0,0,0,0,46,0,0,0,0,0,0,1,0,11,0,110,111,105,115,101,51,0, +1,0,0,11,120,0,0,0,1,8,58,118,101,99,51,0,58,110,111,105,115,101,49,0,18,120,0,0,0,0,58,110,111, +105,115,101,49,0,18,120,0,58,118,101,99,51,0,17,49,57,0,51,52,0,0,0,17,55,0,54,54,0,0,0,17,51,0,50, +51,0,0,0,0,46,0,0,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,51,0,17,53,0,52,55,0,0,0,17, +49,55,0,56,53,0,0,0,17,49,49,0,48,52,0,0,0,0,46,0,0,0,0,0,0,1,0,11,0,110,111,105,115,101,51,0,1,0, +0,12,120,0,0,0,1,8,58,118,101,99,51,0,58,110,111,105,115,101,49,0,18,120,0,0,0,0,58,110,111,105, +115,101,49,0,18,120,0,58,118,101,99,52,0,17,49,57,0,51,52,0,0,0,17,55,0,54,54,0,0,0,17,51,0,50,51, +0,0,0,17,50,0,55,55,0,0,0,0,46,0,0,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,52,0,17,53, +0,52,55,0,0,0,17,49,55,0,56,53,0,0,0,17,49,49,0,48,52,0,0,0,17,49,51,0,49,57,0,0,0,0,46,0,0,0,0,0, +0,1,0,12,0,110,111,105,115,101,52,0,1,0,0,9,120,0,0,0,1,8,58,118,101,99,52,0,58,110,111,105,115, +101,49,0,18,120,0,0,0,0,58,110,111,105,115,101,49,0,18,120,0,17,49,57,0,51,52,0,0,46,0,0,0,58,110, +111,105,115,101,49,0,18,120,0,17,53,0,52,55,0,0,46,0,0,0,58,110,111,105,115,101,49,0,18,120,0,17, +50,51,0,53,52,0,0,46,0,0,0,0,0,0,1,0,12,0,110,111,105,115,101,52,0,1,0,0,10,120,0,0,0,1,8,58,118, +101,99,52,0,58,110,111,105,115,101,49,0,18,120,0,0,0,0,58,110,111,105,115,101,49,0,18,120,0,58,118, +101,99,50,0,17,49,57,0,51,52,0,0,0,17,55,0,54,54,0,0,0,0,46,0,0,0,58,110,111,105,115,101,49,0,18, +120,0,58,118,101,99,50,0,17,53,0,52,55,0,0,0,17,49,55,0,56,53,0,0,0,0,46,0,0,0,58,110,111,105,115, +101,49,0,18,120,0,58,118,101,99,50,0,17,50,51,0,53,52,0,0,0,17,50,57,0,49,49,0,0,0,0,46,0,0,0,0,0, +0,1,0,12,0,110,111,105,115,101,52,0,1,0,0,11,120,0,0,0,1,8,58,118,101,99,52,0,58,110,111,105,115, +101,49,0,18,120,0,0,0,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,51,0,17,49,57,0,51,52,0, +0,0,17,55,0,54,54,0,0,0,17,51,0,50,51,0,0,0,0,46,0,0,0,58,110,111,105,115,101,49,0,18,120,0,58,118, +101,99,51,0,17,53,0,52,55,0,0,0,17,49,55,0,56,53,0,0,0,17,49,49,0,48,52,0,0,0,0,46,0,0,0,58,110, +111,105,115,101,49,0,18,120,0,58,118,101,99,51,0,17,50,51,0,53,52,0,0,0,17,50,57,0,49,49,0,0,0,17, +51,49,0,57,49,0,0,0,0,46,0,0,0,0,0,0,1,0,12,0,110,111,105,115,101,52,0,1,0,0,12,120,0,0,0,1,8,58, +118,101,99,52,0,58,110,111,105,115,101,49,0,18,120,0,0,0,0,58,110,111,105,115,101,49,0,18,120,0,58, +118,101,99,52,0,17,49,57,0,51,52,0,0,0,17,55,0,54,54,0,0,0,17,51,0,50,51,0,0,0,17,50,0,55,55,0,0,0, +0,46,0,0,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,52,0,17,53,0,52,55,0,0,0,17,49,55,0, +56,53,0,0,0,17,49,49,0,48,52,0,0,0,17,49,51,0,49,57,0,0,0,0,46,0,0,0,58,110,111,105,115,101,49,0, +18,120,0,58,118,101,99,52,0,17,50,51,0,53,52,0,0,0,17,50,57,0,49,49,0,0,0,17,51,49,0,57,49,0,0,0, +17,51,55,0,52,56,0,0,0,0,46,0,0,0,0,0,0,0 diff --git a/src/mesa/shader/slang/slang_assemble.c b/src/mesa/shader/slang/slang_assemble.c index 617249487f5..89f5df1e054 100644 --- a/src/mesa/shader/slang/slang_assemble.c +++ b/src/mesa/shader/slang/slang_assemble.c @@ -746,7 +746,11 @@ static const struct {"int_to_float", slang_asm_int_to_float, slang_asm_float_copy}, {"vec4_tex1d", slang_asm_vec4_tex1d, slang_asm_none}, {"vec4_tex2d", slang_asm_vec4_tex2d, slang_asm_none}, + {"vec4_texb2d", slang_asm_vec4_tex2d, slang_asm_none}, + {"vec4_texp2d", slang_asm_vec4_tex2d, slang_asm_none}, {"vec4_tex3d", slang_asm_vec4_tex3d, slang_asm_none}, + {"vec4_texb3d", slang_asm_vec4_tex3d, slang_asm_none}, + {"vec4_texp3d", slang_asm_vec4_tex3d, slang_asm_none}, {"vec4_texcube", slang_asm_vec4_texcube, slang_asm_none}, {"vec4_shad1d", slang_asm_vec4_shad1d, slang_asm_none}, {"vec4_shad2d", slang_asm_vec4_shad2d, slang_asm_none}, diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c index 239f6a5e759..fee317b61fd 100644 --- a/src/mesa/shader/slang/slang_codegen.c +++ b/src/mesa/shader/slang/slang_codegen.c @@ -189,6 +189,7 @@ is_sampler_type(const slang_fully_specified_type *t) static GLuint _slang_sizeof_struct(const slang_struct *s) { + /* XXX TBD */ return 0; } @@ -404,6 +405,8 @@ _slang_input_index(const char *name, GLenum target) const struct input_info *inputs = (target == GL_VERTEX_PROGRAM_ARB) ? vertInputs : fragInputs; + ASSERT(MAX_TEXTURE_UNITS == 8); /* if this fails, fix vertInputs above */ + for (i = 0; inputs[i].Name; i++) { if (strcmp(inputs[i].Name, name) == 0) { /* found */ @@ -476,6 +479,7 @@ _slang_codegen_global_variable(slang_variable *var, struct gl_program *prog, const char *varName = (char *) var->a_name; GLint texIndex; slang_ir_storage *store = NULL; + int dbg = 0; texIndex = sampler_to_texture_index(var->type.specifier.type); @@ -487,7 +491,7 @@ _slang_codegen_global_variable(slang_variable *var, struct gl_program *prog, */ GLint samplerUniform = _mesa_add_sampler(prog->Parameters, varName); store = _slang_new_ir_storage(PROGRAM_SAMPLER, samplerUniform, texIndex); - printf("SAMPLER "); + if (dbg) printf("SAMPLER "); } else if (var->type.qualifier == slang_qual_uniform) { /* Uniform variable */ @@ -506,7 +510,7 @@ _slang_codegen_global_variable(slang_variable *var, struct gl_program *prog, store = _slang_new_ir_storage(PROGRAM_STATE_VAR, -1, size); } - printf("UNIFORM "); + if (dbg) printf("UNIFORM "); } else if (var->type.qualifier == slang_qual_varying) { const GLint size = 4; /* XXX fix */ @@ -530,9 +534,9 @@ _slang_codegen_global_variable(slang_variable *var, struct gl_program *prog, store = _slang_new_ir_storage(PROGRAM_OUTPUT, index, size); assert(index < VERT_RESULT_MAX); } - printf("V/F "); + if (dbg) printf("V/F "); } - printf("VARYING "); + if (dbg) printf("VARYING "); } else if (var->type.qualifier == slang_qual_const) { if (prog) { @@ -543,7 +547,7 @@ _slang_codegen_global_variable(slang_variable *var, struct gl_program *prog, GLint size = -1; store = _slang_new_ir_storage(PROGRAM_CONSTANT, -1, size); } - printf("CONST "); + if (dbg) printf("CONST "); } else if (var->type.qualifier == slang_qual_attribute) { /* Vertex attribute */ @@ -551,13 +555,13 @@ _slang_codegen_global_variable(slang_variable *var, struct gl_program *prog, GLint size = 4; /* XXX? */ assert(index >= 0); store = _slang_new_ir_storage(PROGRAM_INPUT, index, size); - printf("ATTRIB "); + if (dbg) printf("ATTRIB "); } else if (var->type.qualifier == slang_qual_fixedinput) { GLint index = _slang_input_index(varName, GL_FRAGMENT_PROGRAM_ARB); GLint size = 4; /* XXX? */ store = _slang_new_ir_storage(PROGRAM_INPUT, index, size); - printf("INPUT "); + if (dbg) printf("INPUT "); } else if (var->type.qualifier == slang_qual_fixedoutput) { if (type == slang_unit_vertex_builtin) { @@ -571,20 +575,16 @@ _slang_codegen_global_variable(slang_variable *var, struct gl_program *prog, GLint size = 4; /* XXX? */ store = _slang_new_ir_storage(PROGRAM_OUTPUT, index, size); } - printf("OUTPUT "); + if (dbg) printf("OUTPUT "); } else { - printf("other "); + if (dbg) printf("other "); } - printf("GLOBAL VAR %s idx %d\n", (char*) var->a_name, store?store->Index:-2); + if (dbg) printf("GLOBAL VAR %s idx %d\n", (char*) var->a_name, store?store->Index:-2); assert(!var->aux); -#if 1 + var->aux = store; -#endif - /** - XXX allocate variable storage (aux), at least the register file. - */ } @@ -627,9 +627,15 @@ static slang_asm_info AsmInfo[] = { { "float_power", IR_POW, 1, 2 }, /* texture / sampler */ { "vec4_tex1d", IR_TEX, 1, 1 }, - { "vec4_texb1d", IR_TEXB, 1, 3 }, + { "vec4_texb1d", IR_TEXB, 1, 3 }, /* 1d w/ bias */ + { "vec4_texp1d", IR_TEXP, 1, 2 }, /* 1d w/ projection */ { "vec4_tex2d", IR_TEX, 1, 2 }, - { "vec4_texb2d", IR_TEXB, 1, 3 }, + { "vec4_texb2d", IR_TEXB, 1, 3 }, /* 2d w/ bias */ + { "vec4_texp2d", IR_TEXP, 1, 2 }, /* 2d w/ projection */ + { "vec4_tex3d", IR_TEX, 1, 2 }, + { "vec4_texb3d", IR_TEXB, 1, 3 }, /* 3d w/ bias */ + { "vec4_texp3d", IR_TEXP, 1, 2 }, /* 3d w/ projection */ + /* unary op */ { "int_to_float", IR_I_TO_F, 1, 1 }, { "float_exp", IR_EXP, 1, 1 }, diff --git a/src/mesa/shader/slang/slang_emit.c b/src/mesa/shader/slang/slang_emit.c index 65a356050f2..aee3fb2ceb6 100644 --- a/src/mesa/shader/slang/slang_emit.c +++ b/src/mesa/shader/slang/slang_emit.c @@ -92,6 +92,7 @@ static slang_ir_info IrInfo[] = { { IR_VAR_DECL, "IR_VAR_DECL", 0, 0, 0 }, { IR_TEX, "IR_TEX", OPCODE_TEX, 4, 1 }, { IR_TEXB, "IR_TEXB", OPCODE_TXB, 4, 2 }, + { IR_TEXP, "IR_TEXP", OPCODE_TXP, 4, 2 }, { IR_FLOAT, "IR_FLOAT", 0, 0, 0 }, { IR_FIELD, "IR_FIELD", 0, 0, 0 }, { IR_NOP, NULL, OPCODE_NOP, 0, 0 } @@ -564,10 +565,13 @@ emit_tex(slang_gen_context *gc, slang_ir_node *n, struct gl_program *prog) if (n->Opcode == IR_TEX) { inst = new_instruction(prog, OPCODE_TEX); } - else { - assert(n->Opcode == IR_TEXB); + else if (n->Opcode == IR_TEXB) { inst = new_instruction(prog, OPCODE_TXB); } + else { + assert(n->Opcode == IR_TEXP); + inst = new_instruction(prog, OPCODE_TXP); + } if (!n->Store) slang_alloc_temp_storage(gc, n, 4); @@ -700,6 +704,7 @@ emit(slang_gen_context *gc, slang_ir_node *n, struct gl_program *prog) return emit_unop(gc, n, prog); case IR_TEX: case IR_TEXB: + case IR_TEXP: return emit_tex(gc, n, prog); case IR_NEG: return emit_negation(gc, n, prog); diff --git a/src/mesa/shader/slang/slang_ir.h b/src/mesa/shader/slang/slang_ir.h index 0613121b989..273964a8f06 100644 --- a/src/mesa/shader/slang/slang_ir.h +++ b/src/mesa/shader/slang/slang_ir.h @@ -81,6 +81,7 @@ typedef enum IR_VAR_DECL,/* var declaration */ IR_TEX, /* texture lookup */ IR_TEXB, /* texture lookup with LOD bias */ + IR_TEXP, /* texture lookup with projection */ IR_FLOAT, IR_FIELD, IR_I_TO_F diff --git a/src/mesa/shader/slang/slang_link2.c b/src/mesa/shader/slang/slang_link2.c index 8b59d7f76a9..3a5bce00995 100644 --- a/src/mesa/shader/slang/slang_link2.c +++ b/src/mesa/shader/slang/slang_link2.c @@ -257,7 +257,7 @@ link_uniform_vars(struct gl_shader_program *shProg, struct gl_program *prog) if (inst->Opcode == OPCODE_TEX || inst->Opcode == OPCODE_TXB || - inst->Opcode == OPCODE_TXB) { + inst->Opcode == OPCODE_TXP) { printf("====== remap sampler from %d to %d\n", inst->Sampler, map[ inst->Sampler ]); inst->Sampler = map[ inst->Sampler ]; @@ -328,7 +328,7 @@ _slang_resolve_samplers(struct gl_shader_program *shProg, struct prog_instruction *inst = prog->Instructions + i; if (inst->Opcode == OPCODE_TEX || inst->Opcode == OPCODE_TXB || - inst->Opcode == OPCODE_TXB) { + inst->Opcode == OPCODE_TXP) { GLint sampleUnit = (GLint) shProg->Uniforms->ParameterValues[inst->Sampler][0]; assert(sampleUnit < MAX_TEXTURE_IMAGE_UNITS); inst->TexSrcUnit = sampleUnit; |