diff options
author | Brian <[email protected]> | 2007-01-05 16:02:45 -0700 |
---|---|---|
committer | Brian <[email protected]> | 2007-01-05 16:02:45 -0700 |
commit | 5cf7326132a37f11357b5cb31bcc9238fef5b54c (patch) | |
tree | 8d92595241072e8aebba501c68b544ef8b4e13eb /src/mesa/shader | |
parent | b2ab693d68f2ba1358b9c3f8bab53b9ebfb586fe (diff) |
Checkpoint glsl compiler work: sampler uniforms now implemented, linked properly.
Diffstat (limited to 'src/mesa/shader')
-rw-r--r-- | src/mesa/shader/shader_api.c | 9 | ||||
-rw-r--r-- | src/mesa/shader/slang/library/slang_common_builtin.gc | 43 | ||||
-rw-r--r-- | src/mesa/shader/slang/library/slang_common_builtin_gc.h | 179 | ||||
-rw-r--r-- | src/mesa/shader/slang/library/slang_fragment_builtin.gc | 26 | ||||
-rw-r--r-- | src/mesa/shader/slang/library/slang_fragment_builtin_gc.h | 99 | ||||
-rw-r--r-- | src/mesa/shader/slang/slang_codegen.c | 92 | ||||
-rw-r--r-- | src/mesa/shader/slang/slang_codegen.h | 3 | ||||
-rw-r--r-- | src/mesa/shader/slang/slang_compile.c | 67 | ||||
-rw-r--r-- | src/mesa/shader/slang/slang_emit.c | 42 | ||||
-rw-r--r-- | src/mesa/shader/slang/slang_ir.h | 1 | ||||
-rw-r--r-- | src/mesa/shader/slang/slang_link.h | 5 | ||||
-rw-r--r-- | src/mesa/shader/slang/slang_link2.c | 77 |
12 files changed, 359 insertions, 284 deletions
diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c index d6dacdd6793..bd258f8737b 100644 --- a/src/mesa/shader/shader_api.c +++ b/src/mesa/shader/shader_api.c @@ -741,7 +741,8 @@ _mesa_get_uniform_location(GLcontext *ctx, GLuint program, const GLchar *name) * We need to handle things like "e.c[0].b" as seen in the * GLSL orange book, page 189. */ - if (u->Type == PROGRAM_UNIFORM && !strcmp(u->Name, name)) { + if ((u->Type == PROGRAM_UNIFORM || + u->Type == PROGRAM_SAMPLER) && !strcmp(u->Name, name)) { return loc; } } @@ -925,6 +926,12 @@ _mesa_uniform(GLcontext *ctx, GLint location, GLsizei count, return; } } + + if (shProg->Uniforms->Parameters[location].Type == PROGRAM_SAMPLER) { + _slang_resolve_samplers(shProg, &shProg->VertexProgram->Base); + _slang_resolve_samplers(shProg, &shProg->FragmentProgram->Base); + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + } } diff --git a/src/mesa/shader/slang/library/slang_common_builtin.gc b/src/mesa/shader/slang/library/slang_common_builtin.gc index 44e059f5a0d..52f5b96d888 100644 --- a/src/mesa/shader/slang/library/slang_common_builtin.gc +++ b/src/mesa/shader/slang/library/slang_common_builtin.gc @@ -1611,36 +1611,43 @@ bvec4 not (const bvec4 v) -// -// 8.7 Texture Lookup Functions -// +//// Texture Lookup Functions (for both fragment and vertex shaders) -vec4 texture1D (sampler1D sampler, float coord) { - vec4 texel; - __asm vec4_tex1d texel, sampler, coord, 0.0; - return texel; +vec4 texture1D(const sampler1D sampler, const float coord) +{ + __asm vec4_tex1d __retVal, coord; // XXX sampler } -vec4 texture1DProj (sampler1D sampler, vec2 coord) { - return texture1D (sampler, coord.s / coord.t); +vec4 texture1DProj(const sampler1D sampler, const vec2 coord) +{ + float pcoord = coord.s / coord.t; + __asm vec4_tex1d __retVal, pcoord; // XXX sampler } -vec4 texture1DProj (sampler1D sampler, vec4 coord) { - return texture1D (sampler, coord.s / coord.q); +vec4 texture1DProj(const sampler1D sampler, const vec4 coord) +{ + float pcoord = coord.s / coord.q; + __asm vec4_tex1d __retVal, pcoord; // XXX sampler } + vec4 texture2D(const sampler2D sampler, const vec2 coord) { - __asm vec4_tex2d __retVal, coord; // XXX sampler + __asm vec4_tex2d __retVal, sampler, coord; // XXX sampler } -vec4 texture2DProj (sampler2D sampler, vec3 coord) { - return texture2D (sampler, vec2 (coord.s / coord.p, coord.t / coord.p)); -} +//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 vec4 coord) +//{ +// vec2 pcoord = coord.st / coord.q; +// __asm vec4_tex2d __retVal, pcoord; // XXX sampler +//} -vec4 texture2DProj (sampler2D sampler, vec4 coord) { - return texture2D (sampler, vec2 (coord.s / coord.q, coord.t / coord.q)); -} vec4 texture3D (sampler3D sampler, vec3 coord) { vec4 texel; 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 69c1960c737..e418f532139 100644 --- a/src/mesa/shader/slang/library/slang_common_builtin_gc.h +++ b/src/mesa/shader/slang/library/slang_common_builtin_gc.h @@ -670,100 +670,93 @@ 111,116,0,1,1,0,3,118,0,0,0,1,4,118,101,99,52,95,115,101,113,0,18,95,95,114,101,116,86,97,108,0,59, 120,121,122,0,0,18,118,0,0,17,48,0,48,0,0,0,0,0,1,0,4,0,110,111,116,0,1,1,0,4,118,0,0,0,1,4,118, 101,99,52,95,115,101,113,0,18,95,95,114,101,116,86,97,108,0,0,18,118,0,0,17,48,0,48,0,0,0,0,0,1,0, -12,0,116,101,120,116,117,114,101,49,68,0,1,0,0,16,115,97,109,112,108,101,114,0,0,1,0,0,9,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,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,116,101,120,116,117,114,101,49,68,80,114,111,106,0, -1,0,0,16,115,97,109,112,108,101,114,0,0,1,0,0,10,99,111,111,114,100,0,0,0,1,8,58,116,101,120,116, -117,114,101,49,68,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,0,59,115,0,18,99,111, -111,114,100,0,59,116,0,49,0,0,0,0,1,0,12,0,116,101,120,116,117,114,101,49,68,80,114,111,106,0,1,0, -0,16,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,49,68,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,0,59,115,0,18,99,111,111, -114,100,0,59,113,0,49,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,99,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,0,0,17,115,97,109,112,108,101,114,0,0,1,0,0,11,99,111,111,114,100,0,0,0,1,8, -58,116,101,120,116,117,114,101,50,68,0,18,115,97,109,112,108,101,114,0,0,58,118,101,99,50,0,18,99, -111,111,114,100,0,59,115,0,18,99,111,111,114,100,0,59,112,0,49,0,18,99,111,111,114,100,0,59,116,0, -18,99,111,111,114,100,0,59,112,0,49,0,0,0,0,0,0,1,0,12,0,116,101,120,116,117,114,101,50,68,80,114, -111,106,0,1,0,0,17,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,50,68,0,18,115,97,109,112,108,101,114,0,0,58,118,101,99,50,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,0,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,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, +12,0,116,101,120,116,117,114,101,49,68,0,1,1,0,16,115,97,109,112,108,101,114,0,0,1,1,0,9,99,111, +111,114,100,0,0,0,1,4,118,101,99,52,95,116,101,120,49,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,49,68,80,114,111,106,0,1,1,0,16, +115,97,109,112,108,101,114,0,0,1,1,0,10,99,111,111,114,100,0,0,0,1,3,2,0,9,1,112,99,111,111,114, +100,0,2,18,99,111,111,114,100,0,59,115,0,18,99,111,111,114,100,0,59,116,0,49,0,0,4,118,101,99,52, +95,116,101,120,49,100,0,18,95,95,114,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,49,68,80,114,111,106,0,1,1,0,16,115,97,109,112,108,101,114,0,0,1, +1,0,12,99,111,111,114,100,0,0,0,1,3,2,0,9,1,112,99,111,111,114,100,0,2,18,99,111,111,114,100,0,59, +115,0,18,99,111,111,114,100,0,59,113,0,49,0,0,4,118,101,99,52,95,116,101,120,49,100,0,18,95,95,114, +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,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, +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, +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,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 +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/library/slang_fragment_builtin.gc b/src/mesa/shader/slang/library/slang_fragment_builtin.gc index 373b42de1d5..474535bfb1a 100644 --- a/src/mesa/shader/slang/library/slang_fragment_builtin.gc +++ b/src/mesa/shader/slang/library/slang_fragment_builtin.gc @@ -60,19 +60,19 @@ vec4 texture1DProj (sampler1D sampler, vec4 coord, float bias) { return texture1D (sampler, coord.s / coord.q, bias); } -vec4 texture2D (sampler2D sampler, vec2 coord, float bias) { - vec4 texel; - __asm vec4_tex2d texel, sampler, coord, bias; - return texel; -} - -vec4 texture2DProj (sampler2D sampler, vec3 coord, float bias) { - return texture2D (sampler, vec2 (coord.s / coord.p, coord.t / coord.p), bias); -} - -vec4 texture2DProj (sampler2D sampler, vec4 coord, float bias) { - return texture2D (sampler, vec2 (coord.s / coord.q, coord.t / coord.q), bias); -} +//vec4 texture2D (sampler2D sampler, vec2 coord, float bias) { +// vec4 texel; +// __asm vec4_tex2d texel, sampler, coord, bias; +// return texel; +//} + +//vec4 texture2DProj (sampler2D sampler, vec3 coord, float bias) { +// return texture2D (sampler, vec2 (coord.s / coord.p, coord.t / coord.p), bias); +//} + +//vec4 texture2DProj (sampler2D sampler, vec4 coord, float bias) { +// return texture2D (sampler, vec2 (coord.s / coord.q, coord.t / coord.q), bias); +//} vec4 texture3D (sampler3D sampler, vec3 coord, float bias) { vec4 texel; diff --git a/src/mesa/shader/slang/library/slang_fragment_builtin_gc.h b/src/mesa/shader/slang/library/slang_fragment_builtin_gc.h index b7f1d3816c1..69b90fb9da9 100644 --- a/src/mesa/shader/slang/library/slang_fragment_builtin_gc.h +++ b/src/mesa/shader/slang/library/slang_fragment_builtin_gc.h @@ -20,60 +20,47 @@ 1,0,0,16,115,97,109,112,108,101,114,0,0,1,0,0,12,99,111,111,114,100,0,0,1,0,0,9,98,105,97,115,0,0, 0,1,8,58,116,101,120,116,117,114,101,49,68,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114, 100,0,59,115,0,18,99,111,111,114,100,0,59,113,0,49,0,18,98,105,97,115,0,0,0,0,0,1,0,12,0,116,101, -120,116,117,114,101,50,68,0,1,0,0,17,115,97,109,112,108,101,114,0,0,1,0,0,10,99,111,111,114,100,0, +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,1,0,0,9,98,105,97,115,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,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,18,98,105,97,115,0,0,0,8,18,116,101,120,101,108,0,0,0,1,0,12,0,116,101,120,116,117,114,101,50,68, -80,114,111,106,0,1,0,0,17,115,97,109,112,108,101,114,0,0,1,0,0,11,99,111,111,114,100,0,0,1,0,0,9, -98,105,97,115,0,0,0,1,8,58,116,101,120,116,117,114,101,50,68,0,18,115,97,109,112,108,101,114,0,0, -58,118,101,99,50,0,18,99,111,111,114,100,0,59,115,0,18,99,111,111,114,100,0,59,112,0,49,0,18,99, -111,111,114,100,0,59,116,0,18,99,111,111,114,100,0,59,112,0,49,0,0,0,18,98,105,97,115,0,0,0,0,0,1, -0,12,0,116,101,120,116,117,114,101,50,68,80,114,111,106,0,1,0,0,17,115,97,109,112,108,101,114,0,0, -1,0,0,12,99,111,111,114,100,0,0,1,0,0,9,98,105,97,115,0,0,0,1,8,58,116,101,120,116,117,114,101,50, -68,0,18,115,97,109,112,108,101,114,0,0,58,118,101,99,50,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,0,0,18,98,105,97,115,0,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,1,0,0,9,98,105,97,115,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,18,98,105,97,115,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,1,0,0,9,98,105,97,115,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,18, -98,105,97,115,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, -112,108,101,114,0,0,1,0,0,11,99,111,111,114,100,0,0,1,0,0,9,98,105,97,115,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,18,98,105,97,115,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,1,0,0,9,98,105,97,115,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,18,98,105,97,115,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,1,0,0,9,98,105,97,115,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,18,98,105,97,115,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,1,0,0,9,98,105,97,115,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,18,98,105,97,115,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,1,0,0,9,98,105,97,115,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,18,98,105,97,115,0,0,0,0,0, -1,0,9,0,100,70,100,120,0,1,0,0,9,112,0,0,0,1,8,17,48,0,48,48,49,0,0,0,0,1,0,10,0,100,70,100,120,0, -1,0,0,10,112,0,0,0,1,8,58,118,101,99,50,0,17,48,0,48,48,49,0,0,0,0,0,0,1,0,11,0,100,70,100,120,0,1, -0,0,11,112,0,0,0,1,8,58,118,101,99,51,0,17,48,0,48,48,49,0,0,0,0,0,0,1,0,12,0,100,70,100,120,0,1,0, -0,12,112,0,0,0,1,8,58,118,101,99,52,0,17,48,0,48,48,49,0,0,0,0,0,0,1,0,9,0,100,70,100,121,0,1,0,0, -9,112,0,0,0,1,8,17,48,0,48,48,49,0,0,0,0,1,0,10,0,100,70,100,121,0,1,0,0,10,112,0,0,0,1,8,58,118, -101,99,50,0,17,48,0,48,48,49,0,0,0,0,0,0,1,0,11,0,100,70,100,121,0,1,0,0,11,112,0,0,0,1,8,58,118, -101,99,51,0,17,48,0,48,48,49,0,0,0,0,0,0,1,0,12,0,100,70,100,121,0,1,0,0,12,112,0,0,0,1,8,58,118, -101,99,52,0,17,48,0,48,48,49,0,0,0,0,0,0,1,0,9,0,102,119,105,100,116,104,0,1,0,0,9,112,0,0,0,1,8, -58,97,98,115,0,58,100,70,100,120,0,18,112,0,0,0,0,0,58,97,98,115,0,58,100,70,100,121,0,18,112,0,0, -0,0,0,46,0,0,1,0,10,0,102,119,105,100,116,104,0,1,0,0,10,112,0,0,0,1,8,58,97,98,115,0,58,100,70, -100,120,0,18,112,0,0,0,0,0,58,97,98,115,0,58,100,70,100,121,0,18,112,0,0,0,0,0,46,0,0,1,0,11,0,102, -119,105,100,116,104,0,1,0,0,11,112,0,0,0,1,8,58,97,98,115,0,58,100,70,100,120,0,18,112,0,0,0,0,0, -58,97,98,115,0,58,100,70,100,121,0,18,112,0,0,0,0,0,46,0,0,1,0,12,0,102,119,105,100,116,104,0,1,0, -0,12,112,0,0,0,1,8,58,97,98,115,0,58,100,70,100,120,0,18,112,0,0,0,0,0,58,97,98,115,0,58,100,70, -100,121,0,18,112,0,0,0,0,0,46,0,0,0 +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,18,98,105,97,115,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,1,0,0,9, +98,105,97,115,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,18,98,105,97,115,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,112,108,101,114,0,0,1,0,0,11,99,111,111,114,100,0,0,1, +0,0,9,98,105,97,115,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,18,98,105,97,115,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,1,0,0,9,98,105,97,115,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,18,98,105,97,115,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,1,0,0,9,98,105,97,115,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,18,98,105,97,115,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,1,0,0,9,98, +105,97,115,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,18,98,105, +97,115,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,1,0,0,9,98,105,97,115,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,18,98,105,97,115,0,0,0,0,0,1,0,9,0,100,70,100,120,0,1,0,0,9,112,0,0,0,1,8,17,48,0, +48,48,49,0,0,0,0,1,0,10,0,100,70,100,120,0,1,0,0,10,112,0,0,0,1,8,58,118,101,99,50,0,17,48,0,48,48, +49,0,0,0,0,0,0,1,0,11,0,100,70,100,120,0,1,0,0,11,112,0,0,0,1,8,58,118,101,99,51,0,17,48,0,48,48, +49,0,0,0,0,0,0,1,0,12,0,100,70,100,120,0,1,0,0,12,112,0,0,0,1,8,58,118,101,99,52,0,17,48,0,48,48, +49,0,0,0,0,0,0,1,0,9,0,100,70,100,121,0,1,0,0,9,112,0,0,0,1,8,17,48,0,48,48,49,0,0,0,0,1,0,10,0, +100,70,100,121,0,1,0,0,10,112,0,0,0,1,8,58,118,101,99,50,0,17,48,0,48,48,49,0,0,0,0,0,0,1,0,11,0, +100,70,100,121,0,1,0,0,11,112,0,0,0,1,8,58,118,101,99,51,0,17,48,0,48,48,49,0,0,0,0,0,0,1,0,12,0, +100,70,100,121,0,1,0,0,12,112,0,0,0,1,8,58,118,101,99,52,0,17,48,0,48,48,49,0,0,0,0,0,0,1,0,9,0, +102,119,105,100,116,104,0,1,0,0,9,112,0,0,0,1,8,58,97,98,115,0,58,100,70,100,120,0,18,112,0,0,0,0, +0,58,97,98,115,0,58,100,70,100,121,0,18,112,0,0,0,0,0,46,0,0,1,0,10,0,102,119,105,100,116,104,0,1, +0,0,10,112,0,0,0,1,8,58,97,98,115,0,58,100,70,100,120,0,18,112,0,0,0,0,0,58,97,98,115,0,58,100,70, +100,121,0,18,112,0,0,0,0,0,46,0,0,1,0,11,0,102,119,105,100,116,104,0,1,0,0,11,112,0,0,0,1,8,58,97, +98,115,0,58,100,70,100,120,0,18,112,0,0,0,0,0,58,97,98,115,0,58,100,70,100,121,0,18,112,0,0,0,0,0, +46,0,0,1,0,12,0,102,119,105,100,116,104,0,1,0,0,12,112,0,0,0,1,8,58,97,98,115,0,58,100,70,100,120, +0,18,112,0,0,0,0,0,58,97,98,115,0,58,100,70,100,121,0,18,112,0,0,0,0,0,46,0,0,0 diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c index 3b96ec0a887..90d17122b66 100644 --- a/src/mesa/shader/slang/slang_codegen.c +++ b/src/mesa/shader/slang/slang_codegen.c @@ -92,7 +92,9 @@ static slang_asm_info AsmInfo[] = { { "float_divide", IR_DIV, 1, 2 }, { "float_power", IR_POW, 1, 2 }, /* texture / sampler */ - { "vec4_tex2d", IR_TEX, 1, 1 }, + { "vec4_tex1d", IR_TEX, 1, 1 }, + { "vec4_texb1d", IR_TEXB, 1, 3 }, + { "vec4_tex2d", IR_TEX, 1, 2 }, { "vec4_texb2d", IR_TEXB, 1, 3 }, /* unary op */ { "int_to_float", IR_I_TO_F, 1, 1 }, @@ -196,7 +198,7 @@ new_var(slang_assemble_ctx *A, slang_operation *oper, oper->var = v; n->Swizzle = swizzle; n->Var = v; - slang_resolve_storage(A->codegen/**NULL**/, n, A->program); + slang_resolve_storage(A->codegen, n, A->program); return n; } @@ -801,10 +803,6 @@ _slang_gen_asm(slang_assemble_ctx *A, slang_operation *oper, free(n0); } - if (info->Opcode == IR_TEX || info->Opcode == IR_TEXB) { - n->TexTarget = TEXTURE_2D_INDEX; - } - return n; } @@ -1568,8 +1566,10 @@ _slang_codegen_function(slang_assemble_ctx * A, slang_function * fun) slang_print_function(fun, 1); #endif - A->program->Parameters = _mesa_new_parameter_list(); - A->program->Varying = _mesa_new_parameter_list(); + /* should have been allocated earlier: */ + assert(A->program->Parameters ); + assert(A->program->Varying); + A->codegen = _slang_new_codegen_context(); /*printf("** Begin Simplify\n");*/ @@ -1608,3 +1608,79 @@ _slang_codegen_function(slang_assemble_ctx * A, slang_function * fun) } +static GLint +sampler_to_texture_index(const slang_type_specifier_type type) +{ + switch (type) { + case slang_spec_sampler1D: + return TEXTURE_1D_INDEX; + case slang_spec_sampler2D: + return TEXTURE_2D_INDEX; + case slang_spec_sampler3D: + return TEXTURE_3D_INDEX; + case slang_spec_samplerCube: + return TEXTURE_CUBE_INDEX; + case slang_spec_sampler1DShadow: + return TEXTURE_1D_INDEX; /* XXX fix */ + case slang_spec_sampler2DShadow: + return TEXTURE_2D_INDEX; /* XXX fix */ + default: + return -1; + } +} + + + +static GLint +slang_alloc_sampler(struct gl_program *prog, const char *name) +{ + GLint i = _mesa_add_sampler(prog->Parameters, name); + return i; +} + + +/** + * Called by compiler when a global variable has been parsed/compiled. + * Here we examine the variable's type to determine what kind of register + * storage will be used. + * + * A uniform such as "gl_Position" will become the register specification + * (PROGRAM_OUTPUT, VERT_RESULT_HPOS). Or, uniform "gl_FogFragCoord" + * will be (PROGRAM_INPUT, FRAG_ATTRIB_FOGC). + * + * Samplers are interesting. For "uniform sampler2D tex;" we'll specify + * (PROGRAM_SAMPLER, index) where index is resolved at link-time to an + * actual texture unit (as specified by the user calling glUniform1i()). + */ +void +_slang_codegen_global_variable(slang_variable *var, struct gl_program *prog) +{ + GLint texIndex; + slang_ir_storage *store = NULL; + + texIndex = sampler_to_texture_index(var->type.specifier.type); + + if (texIndex != -1) { + /* Texture sampler: + * store->File = PROGRAM_SAMPLER + * store->Index = sampler uniform location + * store->Size = texture type index (1D, 2D, 3D, cube, etc) + */ + GLint samplerUniform = slang_alloc_sampler(prog, (char *) var->a_name); + store = _slang_new_ir_storage(PROGRAM_SAMPLER, samplerUniform, texIndex); + printf("SAMPLER "); + } + else if (var->type.qualifier == slang_qual_uniform) { + printf("UNIFORM "); + } + + printf("CODEGEN VAR %s\n", (char*) var->a_name); + + assert(!var->aux); +#if 1 + var->aux = store; +#endif + /** + XXX allocate variable storage (aux), at least the register file. + */ +} diff --git a/src/mesa/shader/slang/slang_codegen.h b/src/mesa/shader/slang/slang_codegen.h index 042737b2b5c..ef2ccd4ebf1 100644 --- a/src/mesa/shader/slang/slang_codegen.h +++ b/src/mesa/shader/slang/slang_codegen.h @@ -35,5 +35,8 @@ extern struct slang_ir_node_ * _slang_codegen_function(slang_assemble_ctx *A , struct slang_function_ *fun); +extern void +_slang_codegen_global_variable(slang_variable *var, struct gl_program *prog); + #endif /* SLANG_CODEGEN_H */ diff --git a/src/mesa/shader/slang/slang_compile.c b/src/mesa/shader/slang/slang_compile.c index da77de709c3..711849d72f9 100644 --- a/src/mesa/shader/slang/slang_compile.c +++ b/src/mesa/shader/slang/slang_compile.c @@ -803,25 +803,7 @@ parse_child_operation(slang_parse_ctx * C, slang_output_ctx * O, slang_operation *ch; /* grow child array */ -#if 000 - oper->children = (slang_operation *) - slang_alloc_realloc(oper->children, - oper->num_children * sizeof(slang_operation), - (oper->num_children + 1) * sizeof(slang_operation)); - if (oper->children == NULL) { - slang_info_log_memory(C->L); - return 0; - } - - ch = &oper->children[oper->num_children]; - if (!slang_operation_construct(ch)) { - slang_info_log_memory(C->L); - return 0; - } - oper->num_children++; -#else ch = slang_operation_grow(&oper->num_children, &oper->children); -#endif if (statement) return parse_statement(C, O, ch); return parse_expression(C, O, ch); @@ -860,44 +842,6 @@ parse_statement(slang_parse_ctx * C, slang_output_ctx * O, /* local variable declaration, individual declarators are stored as * children identifiers */ -#if 000 - oper->type = slang_oper_variable_decl; - { - const unsigned int first_var = O->vars->num_variables; - - /* parse the declaration, note that there can be zero or more - * than one declarators - */ - if (!parse_declaration(C, O)) - return 0; - if (first_var < O->vars->num_variables) { - const unsigned int num_vars = O->vars->num_variables - first_var; - unsigned int i; - - oper->children = (slang_operation *) - slang_alloc_malloc(num_vars * sizeof(slang_operation)); - if (oper->children == NULL) { - slang_info_log_memory(C->L); - return 0; - } - for (oper->num_children = 0; oper->num_children < num_vars; - oper->num_children++) { - if (!slang_operation_construct - (&oper->children[oper->num_children])) { - slang_info_log_memory(C->L); - return 0; - } - } - for (i = first_var; i < O->vars->num_variables; i++) { - slang_operation *o = &oper->children[i - first_var]; - o->type = slang_oper_identifier; - o->locals->outer_scope = O->vars; - o->a_id = O->vars->variables[i].a_name; - } - } - } -#else - oper->type = slang_oper_block_no_new_scope; { const unsigned int first_var = O->vars->num_variables; @@ -925,9 +869,6 @@ parse_statement(slang_parse_ctx * C, slang_output_ctx * O, } } } - - -#endif break; case OP_ASM: /* the __asm statement, parse the mnemonic and all its arguments @@ -1776,6 +1717,11 @@ parse_init_declarator(slang_parse_ctx * C, slang_output_ctx * O, return 0; } +#if 1 + if (C->global_scope && O->program) + _slang_codegen_global_variable(var, O->program); +#endif + /* allocate global address space for a variable with a known size */ if (C->global_scope && !(var->type.specifier.type == slang_spec_array @@ -2309,6 +2255,9 @@ _slang_compile(GLcontext *ctx, struct gl_shader *shader) = (struct gl_program **) malloc(sizeof(struct gl_program*)); shader->Programs[0] = _mesa_new_program(ctx, progTarget, 1); shader->NumPrograms = 1; + + shader->Programs[0]->Parameters = _mesa_new_parameter_list(); + shader->Programs[0]->Varying = _mesa_new_parameter_list(); } slang_info_log_construct(&info_log); diff --git a/src/mesa/shader/slang/slang_emit.c b/src/mesa/shader/slang/slang_emit.c index a3d970694f9..3f1f1373c61 100644 --- a/src/mesa/shader/slang/slang_emit.c +++ b/src/mesa/shader/slang/slang_emit.c @@ -184,6 +184,7 @@ storage_string(const slang_ir_storage *st) "UNIFORM", "WRITE_ONLY", "ADDRESS", + "SAMPLER", "UNDEFINED" }; static char s[100]; @@ -194,10 +195,8 @@ storage_string(const slang_ir_storage *st) sprintf(s, "%s[%d..%d]", files[st->File], st->Index, st->Index + st->Size - 1); #endif - if (st->File == 1000) - sprintf(s, "sampler"); - else - sprintf(s, "%s[%d]", files[st->File], st->Index); + assert(st->File < sizeof(files) / sizeof(files[0])); + sprintf(s, "%s[%d]", files[st->File], st->Index); return s; } @@ -680,10 +679,12 @@ slang_resolve_storage(slang_gen_context *gc, slang_ir_node *n, assert(n->Var); if (is_sampler_type(&n->Var->type)) { /* i.e. "uniform sampler2D tex;" */ -#define PROGRAM_SAMPLER 1000 n->Store->File = PROGRAM_SAMPLER; n->Store->Size = 1; /* never used */ n->Store->Index = alloc_sampler(gc); + n->Store->Index = slang_alloc_uniform(prog, (char *) n->Var->a_name, 1); + printf("********** Alloc sampler uniform %d\n", n->Store->Index); + abort(); /* this is a locally-declared sampler */ } else if (n->Store->Index < 0) { /* XXX assert this? */ assert(gc); @@ -701,12 +702,18 @@ slang_resolve_storage(slang_gen_context *gc, slang_ir_node *n, return; } + /* + assert(!is_sampler_type(&n->Var->type)); + */ + if (n->Opcode == IR_VAR && n->Store->File == PROGRAM_UNDEFINED) { /* try to determine the storage for this variable */ GLint i; assert(n->Var); + /*if (is_sampler(*/ + if (n->Store->Size < 0) { /* determine var/storage size now */ n->Store->Size = sizeof_type(&n->Var->type); @@ -766,14 +773,7 @@ slang_resolve_storage(slang_gen_context *gc, slang_ir_node *n, else if (n->Var->type.qualifier == slang_qual_varying) { i = slang_alloc_varying(prog, (char *) n->Var->a_name); if (i >= 0) { -#ifdef OLD_LINK - if (prog->Target == GL_VERTEX_PROGRAM_ARB) - n->Store->File = PROGRAM_OUTPUT; - else - n->Store->File = PROGRAM_INPUT; -#else n->Store->File = PROGRAM_VARYING; -#endif n->Store->Index = i; return; } @@ -1023,14 +1023,24 @@ emit_tex(slang_gen_context *gc, slang_ir_node *n, struct gl_program *prog) inst = new_instruction(prog, OPCODE_TXB); } + if (!n->Store) + slang_alloc_temp_storage(gc, n, 4); + storage_to_dst_reg(&inst->DstReg, n->Store, n->Writemask); - storage_to_src_reg(&inst->SrcReg[0], n->Children[0]->Store, - n->Children[0]->Swizzle); + /* Child[1] is the coord */ + storage_to_src_reg(&inst->SrcReg[0], n->Children[1]->Store, + n->Children[1]->Swizzle); - inst->TexSrcTarget = n->TexTarget; - inst->TexSrcUnit = 0; /* XXX temp */ + /* Child[0] is the sampler (a uniform which'll indicate the texture unit) */ + assert(n->Children[0]->Store); + assert(n->Children[0]->Store->Size >= TEXTURE_1D_INDEX); + inst->Sampler = n->Children[0]->Store->Index; /* i.e. uniform's index */ + inst->TexSrcTarget = n->Children[0]->Store->Size; + inst->TexSrcUnit = 27; /* Dummy value; the TexSrcUnit will be computed at + * link time, using the sampler uniform's value. + */ return inst; } diff --git a/src/mesa/shader/slang/slang_ir.h b/src/mesa/shader/slang/slang_ir.h index b43ff1db618..0613121b989 100644 --- a/src/mesa/shader/slang/slang_ir.h +++ b/src/mesa/shader/slang/slang_ir.h @@ -112,7 +112,6 @@ typedef struct slang_ir_node_ GLfloat Value[4]; /**< If Opcode == IR_FLOAT */ slang_variable *Var; slang_ir_storage *Store; - GLuint TexTarget; /**< If Opcode == IR_TEX or IR_TEXB */ } slang_ir_node; diff --git a/src/mesa/shader/slang/slang_link.h b/src/mesa/shader/slang/slang_link.h index f56d717873b..2fc5525000f 100644 --- a/src/mesa/shader/slang/slang_link.h +++ b/src/mesa/shader/slang/slang_link.h @@ -353,6 +353,11 @@ extern void _slang_link2(GLcontext *ctx, GLhandleARB h, struct gl_shader_program *shProg); +extern void +_slang_resolve_samplers(struct gl_shader_program *shProg, + struct gl_program *prog); + + #ifdef __cplusplus } #endif diff --git a/src/mesa/shader/slang/slang_link2.c b/src/mesa/shader/slang/slang_link2.c index 33813fecc4a..8b59d7f76a9 100644 --- a/src/mesa/shader/slang/slang_link2.c +++ b/src/mesa/shader/slang/slang_link2.c @@ -138,6 +138,7 @@ is_uniform(enum register_file file) file == PROGRAM_STATE_VAR || file == PROGRAM_NAMED_PARAM || file == PROGRAM_CONSTANT || + file == PROGRAM_SAMPLER || file == PROGRAM_UNIFORM); } @@ -148,7 +149,8 @@ link_uniform_vars(struct gl_shader_program *shProg, struct gl_program *prog) GLuint *map, i; #if 0 - _mesa_print_parameter_list(prog->Parameters); + printf("================ pre link uniforms ===============\n"); + _mesa_print_parameter_list(shProg->Uniforms); #endif map = (GLuint *) malloc(prog->Parameters->NumParameters * sizeof(GLuint)); @@ -201,6 +203,9 @@ link_uniform_vars(struct gl_shader_program *shProg, struct gl_program *prog) case PROGRAM_UNIFORM: j = _mesa_add_uniform(shProg->Uniforms, p->Name, p->Size); break; + case PROGRAM_SAMPLER: + j = _mesa_add_sampler(shProg->Uniforms, p->Name); + break; default: abort(); } @@ -219,6 +224,11 @@ link_uniform_vars(struct gl_shader_program *shProg, struct gl_program *prog) } #if 0 + printf("================ post link uniforms ===============\n"); + _mesa_print_parameter_list(shProg->Uniforms); +#endif + +#if 0 { GLuint i; for (i = 0; i < prog->Parameters->NumParameters; i++) { @@ -244,7 +254,14 @@ link_uniform_vars(struct gl_shader_program *shProg, struct gl_program *prog) inst->SrcReg[j].Index = map[ inst->SrcReg[j].Index ]; } } - /* XXX update program OutputsWritten, InputsRead */ + + if (inst->Opcode == OPCODE_TEX || + inst->Opcode == OPCODE_TXB || + inst->Opcode == OPCODE_TXB) { + printf("====== remap sampler from %d to %d\n", + inst->Sampler, map[ inst->Sampler ]); + inst->Sampler = map[ inst->Sampler ]; + } } free(map); @@ -257,7 +274,7 @@ link_uniform_vars(struct gl_shader_program *shProg, struct gl_program *prog) * XXX Temporary */ static void -slang_resolve_branches(struct gl_program *prog) +_slang_resolve_branches(struct gl_program *prog) { struct target { const char *Name; @@ -294,21 +311,46 @@ slang_resolve_branches(struct gl_program *prog) /** + * Scan program for texture instructions, lookup sampler/uniform's value + * to determine which texture unit to use. + * Also, update the program's TexturesUsed[] array. + */ +void +_slang_resolve_samplers(struct gl_shader_program *shProg, + struct gl_program *prog) +{ + GLuint i; + + for (i = 0; i < MAX_TEXTURE_IMAGE_UNITS; i++) + prog->TexturesUsed[i] = 0; + + for (i = 0; i < prog->NumInstructions; i++) { + struct prog_instruction *inst = prog->Instructions + i; + if (inst->Opcode == OPCODE_TEX || + inst->Opcode == OPCODE_TXB || + inst->Opcode == OPCODE_TXB) { + GLint sampleUnit = (GLint) shProg->Uniforms->ParameterValues[inst->Sampler][0]; + assert(sampleUnit < MAX_TEXTURE_IMAGE_UNITS); + inst->TexSrcUnit = sampleUnit; + + prog->TexturesUsed[inst->TexSrcUnit] |= (1 << inst->TexSrcTarget); + } + } +} + + +/** * Scan program instructions to update the program's InputsRead and * OutputsWritten fields. - * Also, update the program's TexturesUsed[] array. */ static void -slang_update_inputs_outputs(struct gl_program *prog) +_slang_update_inputs_outputs(struct gl_program *prog) { GLuint i, j; prog->InputsRead = 0x0; prog->OutputsWritten = 0x0; - for (i = 0; i < MAX_TEXTURE_IMAGE_UNITS; i++) - prog->TexturesUsed[i] = 0; - for (i = 0; i < prog->NumInstructions; i++) { const struct prog_instruction *inst = prog->Instructions + i; const GLuint numSrc = _mesa_num_inst_src_regs(inst->Opcode); @@ -320,12 +362,6 @@ slang_update_inputs_outputs(struct gl_program *prog) if (inst->DstReg.File == PROGRAM_OUTPUT) { prog->OutputsWritten |= 1 << inst->DstReg.Index; } - - if (inst->Opcode == OPCODE_TEX || - inst->Opcode == OPCODE_TXB || - inst->Opcode == OPCODE_TXP) { - prog->TexturesUsed[inst->TexSrcUnit] |= (1 << inst->TexSrcTarget); - } } } @@ -425,11 +461,14 @@ _slang_link2(GLcontext *ctx, shProg->VertexProgram->Base.Parameters = shProg->Uniforms; shProg->FragmentProgram->Base.Parameters = shProg->Uniforms; - slang_resolve_branches(&shProg->VertexProgram->Base); - slang_resolve_branches(&shProg->FragmentProgram->Base); - - slang_update_inputs_outputs(&shProg->VertexProgram->Base); - slang_update_inputs_outputs(&shProg->FragmentProgram->Base); + _slang_resolve_branches(&shProg->VertexProgram->Base); + _slang_resolve_branches(&shProg->FragmentProgram->Base); +#if 1 + _slang_resolve_samplers(shProg, &shProg->VertexProgram->Base); + _slang_resolve_samplers(shProg, &shProg->FragmentProgram->Base); +#endif + _slang_update_inputs_outputs(&shProg->VertexProgram->Base); + _slang_update_inputs_outputs(&shProg->FragmentProgram->Base); #if 1 printf("************** original fragment program\n"); |