From: Brian Date: Mon, 12 Mar 2007 23:29:50 +0000 (-0600) Subject: Implement GL_ARB_texture_rectangle support X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b3a22d0ed61afa9df4d3a02962884d49bc5760a4;p=mesa.git Implement GL_ARB_texture_rectangle support This includes the sampler2DRect and sampler2DRectShadow types and the texture2DRect(), texture2DRectProj(), etc. built-in functions. --- 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 0bf1371c0b2..417f1fce86a 100644 --- a/src/mesa/shader/slang/library/slang_common_builtin_gc.h +++ b/src/mesa/shader/slang/library/slang_common_builtin_gc.h @@ -41,25 +41,25 @@ 73,110,118,101,114,115,101,84,114,97,110,115,112,111,115,101,0,0,0,2,2,4,15,1,103,108,95,84,101, 120,116,117,114,101,77,97,116,114,105,120,73,110,118,101,114,115,101,84,114,97,110,115,112,111,115, 101,0,3,18,103,108,95,77,97,120,84,101,120,116,117,114,101,67,111,111,114,100,115,0,0,0,2,2,4,9,1, -103,108,95,78,111,114,109,97,108,83,99,97,108,101,0,0,0,2,2,0,22,103,108,95,68,101,112,116,104,82, +103,108,95,78,111,114,109,97,108,83,99,97,108,101,0,0,0,2,2,0,24,103,108,95,68,101,112,116,104,82, 97,110,103,101,80,97,114,97,109,101,116,101,114,115,0,9,110,101,97,114,0,0,0,1,9,102,97,114,0,0,0, -1,9,100,105,102,102,0,0,0,0,0,0,2,2,4,23,103,108,95,68,101,112,116,104,82,97,110,103,101,80,97,114, +1,9,100,105,102,102,0,0,0,0,0,0,2,2,4,25,103,108,95,68,101,112,116,104,82,97,110,103,101,80,97,114, 97,109,101,116,101,114,115,0,1,103,108,95,68,101,112,116,104,82,97,110,103,101,0,0,0,2,2,4,12,1, 103,108,95,67,108,105,112,80,108,97,110,101,0,3,18,103,108,95,77,97,120,67,108,105,112,80,108,97, -110,101,115,0,0,0,2,2,0,22,103,108,95,80,111,105,110,116,80,97,114,97,109,101,116,101,114,115,0,9, +110,101,115,0,0,0,2,2,0,24,103,108,95,80,111,105,110,116,80,97,114,97,109,101,116,101,114,115,0,9, 115,105,122,101,0,0,0,1,9,115,105,122,101,77,105,110,0,0,0,1,9,115,105,122,101,77,97,120,0,0,0,1,9, 102,97,100,101,84,104,114,101,115,104,111,108,100,83,105,122,101,0,0,0,1,9,100,105,115,116,97,110, 99,101,67,111,110,115,116,97,110,116,65,116,116,101,110,117,97,116,105,111,110,0,0,0,1,9,100,105, 115,116,97,110,99,101,76,105,110,101,97,114,65,116,116,101,110,117,97,116,105,111,110,0,0,0,1,9, 100,105,115,116,97,110,99,101,81,117,97,100,114,97,116,105,99,65,116,116,101,110,117,97,116,105, -111,110,0,0,0,0,0,0,2,2,4,23,103,108,95,80,111,105,110,116,80,97,114,97,109,101,116,101,114,115,0, -1,103,108,95,80,111,105,110,116,0,0,0,2,2,0,22,103,108,95,77,97,116,101,114,105,97,108,80,97,114, +111,110,0,0,0,0,0,0,2,2,4,25,103,108,95,80,111,105,110,116,80,97,114,97,109,101,116,101,114,115,0, +1,103,108,95,80,111,105,110,116,0,0,0,2,2,0,24,103,108,95,77,97,116,101,114,105,97,108,80,97,114, 97,109,101,116,101,114,115,0,12,101,109,105,115,115,105,111,110,0,0,0,1,12,97,109,98,105,101,110, 116,0,0,0,1,12,100,105,102,102,117,115,101,0,0,0,1,12,115,112,101,99,117,108,97,114,0,0,0,1,9,115, -104,105,110,105,110,101,115,115,0,0,0,0,0,0,2,2,4,23,103,108,95,77,97,116,101,114,105,97,108,80,97, +104,105,110,105,110,101,115,115,0,0,0,0,0,0,2,2,4,25,103,108,95,77,97,116,101,114,105,97,108,80,97, 114,97,109,101,116,101,114,115,0,1,103,108,95,70,114,111,110,116,77,97,116,101,114,105,97,108,0,0, -0,2,2,4,23,103,108,95,77,97,116,101,114,105,97,108,80,97,114,97,109,101,116,101,114,115,0,1,103, -108,95,66,97,99,107,77,97,116,101,114,105,97,108,0,0,0,2,2,0,22,103,108,95,76,105,103,104,116,83, +0,2,2,4,25,103,108,95,77,97,116,101,114,105,97,108,80,97,114,97,109,101,116,101,114,115,0,1,103, +108,95,66,97,99,107,77,97,116,101,114,105,97,108,0,0,0,2,2,0,24,103,108,95,76,105,103,104,116,83, 111,117,114,99,101,80,97,114,97,109,101,116,101,114,115,0,12,97,109,98,105,101,110,116,0,0,0,1,12, 100,105,102,102,117,115,101,0,0,0,1,12,115,112,101,99,117,108,97,114,0,0,0,1,12,112,111,115,105, 116,105,111,110,0,0,0,1,12,104,97,108,102,86,101,99,116,111,114,0,0,0,1,11,115,112,111,116,68,105, @@ -67,22 +67,22 @@ 112,111,116,67,117,116,111,102,102,0,0,0,1,9,115,112,111,116,67,111,115,67,117,116,111,102,102,0,0, 0,1,9,99,111,110,115,116,97,110,116,65,116,116,101,110,117,97,116,105,111,110,0,0,0,1,9,108,105, 110,101,97,114,65,116,116,101,110,117,97,116,105,111,110,0,0,0,1,9,113,117,97,100,114,97,116,105, -99,65,116,116,101,110,117,97,116,105,111,110,0,0,0,0,0,0,2,2,4,23,103,108,95,76,105,103,104,116,83, +99,65,116,116,101,110,117,97,116,105,111,110,0,0,0,0,0,0,2,2,4,25,103,108,95,76,105,103,104,116,83, 111,117,114,99,101,80,97,114,97,109,101,116,101,114,115,0,1,103,108,95,76,105,103,104,116,83,111, -117,114,99,101,0,3,18,103,108,95,77,97,120,76,105,103,104,116,115,0,0,0,2,2,0,22,103,108,95,76,105, +117,114,99,101,0,3,18,103,108,95,77,97,120,76,105,103,104,116,115,0,0,0,2,2,0,24,103,108,95,76,105, 103,104,116,77,111,100,101,108,80,97,114,97,109,101,116,101,114,115,0,12,97,109,98,105,101,110,116, -0,0,0,0,0,0,2,2,4,23,103,108,95,76,105,103,104,116,77,111,100,101,108,80,97,114,97,109,101,116,101, -114,115,0,1,103,108,95,76,105,103,104,116,77,111,100,101,108,0,0,0,2,2,0,22,103,108,95,76,105,103, +0,0,0,0,0,0,2,2,4,25,103,108,95,76,105,103,104,116,77,111,100,101,108,80,97,114,97,109,101,116,101, +114,115,0,1,103,108,95,76,105,103,104,116,77,111,100,101,108,0,0,0,2,2,0,24,103,108,95,76,105,103, 104,116,77,111,100,101,108,80,114,111,100,117,99,116,115,0,12,115,99,101,110,101,67,111,108,111, -114,0,0,0,0,0,0,2,2,4,23,103,108,95,76,105,103,104,116,77,111,100,101,108,80,114,111,100,117,99, +114,0,0,0,0,0,0,2,2,4,25,103,108,95,76,105,103,104,116,77,111,100,101,108,80,114,111,100,117,99, 116,115,0,1,103,108,95,70,114,111,110,116,76,105,103,104,116,77,111,100,101,108,80,114,111,100,117, -99,116,0,0,0,2,2,4,23,103,108,95,76,105,103,104,116,77,111,100,101,108,80,114,111,100,117,99,116, +99,116,0,0,0,2,2,4,25,103,108,95,76,105,103,104,116,77,111,100,101,108,80,114,111,100,117,99,116, 115,0,1,103,108,95,66,97,99,107,76,105,103,104,116,77,111,100,101,108,80,114,111,100,117,99,116,0, -0,0,2,2,0,22,103,108,95,76,105,103,104,116,80,114,111,100,117,99,116,115,0,12,97,109,98,105,101, +0,0,2,2,0,24,103,108,95,76,105,103,104,116,80,114,111,100,117,99,116,115,0,12,97,109,98,105,101, 110,116,0,0,0,1,12,100,105,102,102,117,115,101,0,0,0,1,12,115,112,101,99,117,108,97,114,0,0,0,0,0, -0,2,2,4,23,103,108,95,76,105,103,104,116,80,114,111,100,117,99,116,115,0,1,103,108,95,70,114,111, +0,2,2,4,25,103,108,95,76,105,103,104,116,80,114,111,100,117,99,116,115,0,1,103,108,95,70,114,111, 110,116,76,105,103,104,116,80,114,111,100,117,99,116,0,3,18,103,108,95,77,97,120,76,105,103,104, -116,115,0,0,0,2,2,4,23,103,108,95,76,105,103,104,116,80,114,111,100,117,99,116,115,0,1,103,108,95, +116,115,0,0,0,2,2,4,25,103,108,95,76,105,103,104,116,80,114,111,100,117,99,116,115,0,1,103,108,95, 66,97,99,107,76,105,103,104,116,80,114,111,100,117,99,116,0,3,18,103,108,95,77,97,120,76,105,103, 104,116,115,0,0,0,2,2,4,12,1,103,108,95,84,101,120,116,117,114,101,69,110,118,67,111,108,111,114,0, 3,18,103,108,95,77,97,120,84,101,120,116,117,114,101,73,109,97,103,101,85,110,105,116,115,0,0,0,2, @@ -97,9 +97,9 @@ 120,84,101,120,116,117,114,101,67,111,111,114,100,115,0,0,0,2,2,4,12,1,103,108,95,79,98,106,101,99, 116,80,108,97,110,101,82,0,3,18,103,108,95,77,97,120,84,101,120,116,117,114,101,67,111,111,114,100, 115,0,0,0,2,2,4,12,1,103,108,95,79,98,106,101,99,116,80,108,97,110,101,81,0,3,18,103,108,95,77,97, -120,84,101,120,116,117,114,101,67,111,111,114,100,115,0,0,0,2,2,0,22,103,108,95,70,111,103,80,97, +120,84,101,120,116,117,114,101,67,111,111,114,100,115,0,0,0,2,2,0,24,103,108,95,70,111,103,80,97, 114,97,109,101,116,101,114,115,0,12,99,111,108,111,114,0,0,0,1,9,100,101,110,115,105,116,121,0,0,0, -1,9,115,116,97,114,116,0,0,0,1,9,101,110,100,0,0,0,1,9,115,99,97,108,101,0,0,0,0,0,0,2,2,4,23,103, +1,9,115,116,97,114,116,0,0,0,1,9,101,110,100,0,0,0,1,9,115,99,97,108,101,0,0,0,0,0,0,2,2,4,25,103, 108,95,70,111,103,80,97,114,97,109,101,116,101,114,115,0,1,103,108,95,70,111,103,0,0,0,1,0,9,0,114, 97,100,105,97,110,115,0,1,1,0,9,100,101,103,0,0,0,1,3,2,1,9,1,99,0,2,17,51,0,49,52,49,53,57,50,54, 0,0,17,49,56,48,0,48,0,0,49,0,0,4,118,101,99,52,95,109,117,108,116,105,112,108,121,0,18,95,95,114, diff --git a/src/mesa/shader/slang/library/slang_fragment_builtin.gc b/src/mesa/shader/slang/library/slang_fragment_builtin.gc index 40b1207ca88..9a7e17bdaf2 100644 --- a/src/mesa/shader/slang/library/slang_fragment_builtin.gc +++ b/src/mesa/shader/slang/library/slang_fragment_builtin.gc @@ -68,6 +68,8 @@ vec4 texture1DProj(const sampler1D sampler, const vec4 coord, const float bias) } + + vec4 texture2D(const sampler2D sampler, const vec2 coord, const float bias) { vec4 coord4; @@ -95,6 +97,8 @@ vec4 texture2DProj(const sampler2D sampler, const vec4 coord, const float bias) } + + vec4 texture3D(const sampler3D sampler, const vec3 coord, const float bias) { vec4 coord4; @@ -113,6 +117,8 @@ vec4 texture3DProj(const sampler3D sampler, const vec4 coord, const float bias) } + + vec4 textureCube(const samplerCube sampler, const vec3 coord, const float bias) { vec4 coord4; @@ -122,6 +128,8 @@ vec4 textureCube(const samplerCube sampler, const vec3 coord, const float bias) } + + // For shadow textures, we use the regular tex instructions since they should // do the depth comparison step. @@ -142,6 +150,9 @@ vec4 shadow1DProj(const sampler1DShadow sampler, const vec4 coord, const float b __asm vec4_texb1d __retVal, sampler, pcoord; } + + + vec4 shadow2D(const sampler2DShadow sampler, const vec3 coord, const float bias) { vec4 coord4; @@ -161,6 +172,38 @@ vec4 shadow2DProj(const sampler2DShadow sampler, const vec4 coord, const float b +//// GL_ARB_texture_rectangle: +vec4 texture2DRect(const sampler2DRect sampler, const vec2 coord) +{ + __asm vec4_tex_rect __retVal, sampler, coord; +} + +vec4 texture2DRectProj(const sampler2DRect sampler, const vec3 coord) +{ + // do projection here + vec4 pcoord; + pcoord.xy = coord.xy / coord.z; + __asm vec4_texp_rect __retVal, sampler, pcoord; +} + +vec4 texture2DRectProj(const sampler2DRect sampler, const vec4 coord) +{ + // do projection here + vec4 pcoord; + pcoord.xy = coord.xy / coord.w; + __asm vec4_texp_rect __retVal, sampler, pcoord; +} + +vec4 shadow2DRect(const sampler2DRectShadow sampler, const vec3 coord) +{ +// XXX to do +} + +vec4 shadow2DRectProj(const sampler2DRectShadow sampler, const vec4 coord) +{ +// XXX to do +} + // 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 8b8202ea2f9..88317107b2b 100644 --- a/src/mesa/shader/slang/library/slang_fragment_builtin_gc.h +++ b/src/mesa/shader/slang/library/slang_fragment_builtin_gc.h @@ -77,23 +77,39 @@ 121,0,18,99,111,111,114,100,0,59,119,0,49,20,0,9,18,112,99,111,111,114,100,0,59,122,0,18,99,111, 111,114,100,0,59,122,0,20,0,9,18,112,99,111,111,114,100,0,59,119,0,18,98,105,97,115,0,20,0,4,118, 101,99,52,95,116,101,120,98,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,112,99,111,111,114,100,0,0,0,0,1,0,9,0,100,70,100,120,0,1,1,0,9,112,0,0,0,1,4,118,101, -99,52,95,100,100,120,0,18,95,95,114,101,116,86,97,108,0,59,120,0,0,18,112,0,59,120,120,120,120,0,0, -0,0,1,0,10,0,100,70,100,120,0,1,1,0,10,112,0,0,0,1,4,118,101,99,52,95,100,100,120,0,18,95,95,114, -101,116,86,97,108,0,59,120,121,0,0,18,112,0,59,120,121,121,121,0,0,0,0,1,0,11,0,100,70,100,120,0,1, -1,0,11,112,0,0,0,1,4,118,101,99,52,95,100,100,120,0,18,95,95,114,101,116,86,97,108,0,59,120,121, -122,0,0,18,112,0,59,120,121,122,122,0,0,0,0,1,0,12,0,100,70,100,120,0,1,1,0,12,112,0,0,0,1,4,118, -101,99,52,95,100,100,120,0,18,95,95,114,101,116,86,97,108,0,0,18,112,0,0,0,0,1,0,9,0,100,70,100, -121,0,1,1,0,9,112,0,0,0,1,4,118,101,99,52,95,100,100,121,0,18,95,95,114,101,116,86,97,108,0,59,120, -0,0,18,112,0,59,120,120,120,120,0,0,0,0,1,0,10,0,100,70,100,121,0,1,1,0,10,112,0,0,0,1,4,118,101, -99,52,95,100,100,121,0,18,95,95,114,101,116,86,97,108,0,59,120,121,0,0,18,112,0,59,120,121,121,121, -0,0,0,0,1,0,11,0,100,70,100,121,0,1,1,0,11,112,0,0,0,1,4,118,101,99,52,95,100,100,121,0,18,95,95, +114,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,82,101,99,116, +0,1,1,0,22,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,95,114,101,99,116,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,50,68,82,101,99,116,80,114, +111,106,0,1,1,0,22,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, +112,99,111,111,114,100,0,0,0,9,18,112,99,111,111,114,100,0,59,120,121,0,18,99,111,111,114,100,0,59, +120,121,0,18,99,111,111,114,100,0,59,122,0,49,20,0,4,118,101,99,52,95,116,101,120,112,95,114,101, +99,116,0,18,95,95,114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,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,82,101,99,116,80,114,111,106,0,1,1,0,22, +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,12,1,112,99,111,111,114, +100,0,0,0,9,18,112,99,111,111,114,100,0,59,120,121,0,18,99,111,111,114,100,0,59,120,121,0,18,99, +111,111,114,100,0,59,119,0,49,20,0,4,118,101,99,52,95,116,101,120,112,95,114,101,99,116,0,18,95,95, +114,101,116,86,97,108,0,0,18,115,97,109,112,108,101,114,0,0,18,112,99,111,111,114,100,0,0,0,0,1,0, +12,0,115,104,97,100,111,119,50,68,82,101,99,116,0,1,1,0,23,115,97,109,112,108,101,114,0,0,1,1,0,11, +99,111,111,114,100,0,0,0,1,0,1,0,12,0,115,104,97,100,111,119,50,68,82,101,99,116,80,114,111,106,0, +1,1,0,23,115,97,109,112,108,101,114,0,0,1,1,0,12,99,111,111,114,100,0,0,0,1,0,1,0,9,0,100,70,100, +120,0,1,1,0,9,112,0,0,0,1,4,118,101,99,52,95,100,100,120,0,18,95,95,114,101,116,86,97,108,0,59,120, +0,0,18,112,0,59,120,120,120,120,0,0,0,0,1,0,10,0,100,70,100,120,0,1,1,0,10,112,0,0,0,1,4,118,101, +99,52,95,100,100,120,0,18,95,95,114,101,116,86,97,108,0,59,120,121,0,0,18,112,0,59,120,121,121,121, +0,0,0,0,1,0,11,0,100,70,100,120,0,1,1,0,11,112,0,0,0,1,4,118,101,99,52,95,100,100,120,0,18,95,95, 114,101,116,86,97,108,0,59,120,121,122,0,0,18,112,0,59,120,121,122,122,0,0,0,0,1,0,12,0,100,70,100, -121,0,1,1,0,12,112,0,0,0,1,4,118,101,99,52,95,100,100,121,0,18,95,95,114,101,116,86,97,108,0,0,18, -112,0,0,0,0,1,0,9,0,102,119,105,100,116,104,0,1,1,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,1,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,1,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,1,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,0,1,1,0,12,112,0,0,0,1,4,118,101,99,52,95,100,100,120,0,18,95,95,114,101,116,86,97,108,0,0,18, +112,0,0,0,0,1,0,9,0,100,70,100,121,0,1,1,0,9,112,0,0,0,1,4,118,101,99,52,95,100,100,121,0,18,95,95, +114,101,116,86,97,108,0,59,120,0,0,18,112,0,59,120,120,120,120,0,0,0,0,1,0,10,0,100,70,100,121,0,1, +1,0,10,112,0,0,0,1,4,118,101,99,52,95,100,100,121,0,18,95,95,114,101,116,86,97,108,0,59,120,121,0, +0,18,112,0,59,120,121,121,121,0,0,0,0,1,0,11,0,100,70,100,121,0,1,1,0,11,112,0,0,0,1,4,118,101,99, +52,95,100,100,121,0,18,95,95,114,101,116,86,97,108,0,59,120,121,122,0,0,18,112,0,59,120,121,122, +122,0,0,0,0,1,0,12,0,100,70,100,121,0,1,1,0,12,112,0,0,0,1,4,118,101,99,52,95,100,100,121,0,18,95, +95,114,101,116,86,97,108,0,0,18,112,0,0,0,0,1,0,9,0,102,119,105,100,116,104,0,1,1,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,1,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,1,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,1, +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/library/slang_shader.syn b/src/mesa/shader/slang/library/slang_shader.syn index bfa6793f067..9389869da23 100644 --- a/src/mesa/shader/slang/library/slang_shader.syn +++ b/src/mesa/shader/slang/library/slang_shader.syn @@ -139,8 +139,10 @@ .emtcode TYPE_SPECIFIER_SAMPLERCUBE 19 .emtcode TYPE_SPECIFIER_SAMPLER1DSHADOW 20 .emtcode TYPE_SPECIFIER_SAMPLER2DSHADOW 21 -.emtcode TYPE_SPECIFIER_STRUCT 22 -.emtcode TYPE_SPECIFIER_TYPENAME 23 +.emtcode TYPE_SPECIFIER_SAMPLER2DRECT 22 +.emtcode TYPE_SPECIFIER_SAMPLER2DRECTSHADOW 23 +.emtcode TYPE_SPECIFIER_STRUCT 24 +.emtcode TYPE_SPECIFIER_TYPENAME 25 /* structure field */ .emtcode FIELD_NONE 0 @@ -884,6 +886,8 @@ type_qualifier | "samplerCube" | "sampler1DShadow" | "sampler2DShadow" + | "sampler2DRect" + | "sampler2DRectShadow" | | */ @@ -910,6 +914,8 @@ type_specifier_space "samplerCube" .emit TYPE_SPECIFIER_SAMPLERCUBE .or "sampler1DShadow" .emit TYPE_SPECIFIER_SAMPLER1DSHADOW .or "sampler2DShadow" .emit TYPE_SPECIFIER_SAMPLER2DSHADOW .or + "sampler2DRect" .emit TYPE_SPECIFIER_SAMPLER2DRECT .or + "sampler2DRectShadow" .emit TYPE_SPECIFIER_SAMPLER2DRECTSHADOW .or type_name .emit TYPE_SPECIFIER_TYPENAME; type_specifier_nospace struct_specifier .emit TYPE_SPECIFIER_STRUCT; diff --git a/src/mesa/shader/slang/library/slang_shader_syn.h b/src/mesa/shader/slang/library/slang_shader_syn.h index 58cf1b13904..4863feda5bd 100644 --- a/src/mesa/shader/slang/library/slang_shader_syn.h +++ b/src/mesa/shader/slang/library/slang_shader_syn.h @@ -63,8 +63,10 @@ ".emtcode TYPE_SPECIFIER_SAMPLERCUBE 19\n" ".emtcode TYPE_SPECIFIER_SAMPLER1DSHADOW 20\n" ".emtcode TYPE_SPECIFIER_SAMPLER2DSHADOW 21\n" -".emtcode TYPE_SPECIFIER_STRUCT 22\n" -".emtcode TYPE_SPECIFIER_TYPENAME 23\n" +".emtcode TYPE_SPECIFIER_SAMPLER2DRECT 22\n" +".emtcode TYPE_SPECIFIER_SAMPLER2DRECTSHADOW 23\n" +".emtcode TYPE_SPECIFIER_STRUCT 24\n" +".emtcode TYPE_SPECIFIER_TYPENAME 25\n" ".emtcode FIELD_NONE 0\n" ".emtcode FIELD_NEXT 1\n" ".emtcode FIELD_ARRAY 2\n" @@ -435,6 +437,8 @@ " \"samplerCube\" .emit TYPE_SPECIFIER_SAMPLERCUBE .or\n" " \"sampler1DShadow\" .emit TYPE_SPECIFIER_SAMPLER1DSHADOW .or\n" " \"sampler2DShadow\" .emit TYPE_SPECIFIER_SAMPLER2DSHADOW .or\n" +" \"sampler2DRect\" .emit TYPE_SPECIFIER_SAMPLER2DRECT .or\n" +" \"sampler2DRectShadow\" .emit TYPE_SPECIFIER_SAMPLER2DRECTSHADOW .or\n" " type_name .emit TYPE_SPECIFIER_TYPENAME;\n" "type_specifier_nospace\n" " struct_specifier .emit TYPE_SPECIFIER_STRUCT;\n" diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c index e972da459b6..e91e0446ad1 100644 --- a/src/mesa/shader/slang/slang_codegen.c +++ b/src/mesa/shader/slang/slang_codegen.c @@ -69,6 +69,8 @@ is_sampler_type(const slang_fully_specified_type *t) case SLANG_SPEC_SAMPLERCUBE: case SLANG_SPEC_SAMPLER1DSHADOW: case SLANG_SPEC_SAMPLER2DSHADOW: + case SLANG_SPEC_SAMPLER2DRECT: + case SLANG_SPEC_SAMPLER2DRECTSHADOW: return GL_TRUE; default: return GL_FALSE; @@ -118,6 +120,8 @@ _slang_sizeof_type_specifier(const slang_type_specifier *spec) case SLANG_SPEC_SAMPLERCUBE: case SLANG_SPEC_SAMPLER1DSHADOW: case SLANG_SPEC_SAMPLER2DSHADOW: + case SLANG_SPEC_SAMPLER2DRECT: + case SLANG_SPEC_SAMPLER2DRECTSHADOW: return 1; /* special case */ case SLANG_SPEC_STRUCT: { @@ -196,6 +200,10 @@ sampler_to_texture_index(const slang_type_specifier_type type) return TEXTURE_1D_INDEX; /* XXX fix */ case SLANG_SPEC_SAMPLER2DSHADOW: return TEXTURE_2D_INDEX; /* XXX fix */ + case SLANG_SPEC_SAMPLER2DRECT: + return TEXTURE_RECT_INDEX; + case SLANG_SPEC_SAMPLER2DRECTSHADOW: + return TEXTURE_RECT_INDEX; /* XXX fix */ default: return -1; } @@ -357,6 +365,8 @@ static slang_asm_info AsmInfo[] = { { "vec4_texb3d", IR_TEXB, 1, 2 }, /* 3d w/ bias */ { "vec4_texp3d", IR_TEXP, 1, 2 }, /* 3d w/ projection */ { "vec4_texcube", IR_TEX, 1, 2 }, /* cubemap */ + { "vec4_tex_rect", IR_TEX, 1, 2 }, /* rectangle */ + { "vec4_texp_rect", IR_TEX, 1, 2 },/* rectangle w/ projection */ /* unary op */ { "int_to_float", IR_I_TO_F, 1, 1 }, diff --git a/src/mesa/shader/slang/slang_compile.c b/src/mesa/shader/slang/slang_compile.c index e1837520253..619b0de0d0d 100644 --- a/src/mesa/shader/slang/slang_compile.c +++ b/src/mesa/shader/slang/slang_compile.c @@ -487,8 +487,10 @@ parse_type_qualifier(slang_parse_ctx * C, slang_type_qualifier * qual) #define TYPE_SPECIFIER_SAMPLERCUBE 19 #define TYPE_SPECIFIER_SAMPLER1DSHADOW 20 #define TYPE_SPECIFIER_SAMPLER2DSHADOW 21 -#define TYPE_SPECIFIER_STRUCT 22 -#define TYPE_SPECIFIER_TYPENAME 23 +#define TYPE_SPECIFIER_SAMPLER2DRECT 22 +#define TYPE_SPECIFIER_SAMPLER2DRECTSHADOW 23 +#define TYPE_SPECIFIER_STRUCT 24 +#define TYPE_SPECIFIER_TYPENAME 25 static int parse_type_specifier(slang_parse_ctx * C, slang_output_ctx * O, @@ -555,12 +557,18 @@ parse_type_specifier(slang_parse_ctx * C, slang_output_ctx * O, case TYPE_SPECIFIER_SAMPLERCUBE: spec->type = SLANG_SPEC_SAMPLERCUBE; break; + case TYPE_SPECIFIER_SAMPLER2DRECT: + spec->type = SLANG_SPEC_SAMPLER2DRECT; + break; case TYPE_SPECIFIER_SAMPLER1DSHADOW: spec->type = SLANG_SPEC_SAMPLER1DSHADOW; break; case TYPE_SPECIFIER_SAMPLER2DSHADOW: spec->type = SLANG_SPEC_SAMPLER2DSHADOW; break; + case TYPE_SPECIFIER_SAMPLER2DRECTSHADOW: + spec->type = SLANG_SPEC_SAMPLER2DRECTSHADOW; + break; case TYPE_SPECIFIER_STRUCT: spec->type = SLANG_SPEC_STRUCT; if (!parse_struct(C, O, &spec->_struct)) diff --git a/src/mesa/shader/slang/slang_compile_variable.c b/src/mesa/shader/slang/slang_compile_variable.c index 09ca736c20c..ae37aed5145 100644 --- a/src/mesa/shader/slang/slang_compile_variable.c +++ b/src/mesa/shader/slang/slang_compile_variable.c @@ -62,6 +62,8 @@ static const type_specifier_type_name type_specifier_type_names[] = { {"samplerCube", SLANG_SPEC_SAMPLERCUBE}, {"sampler1DShadow", SLANG_SPEC_SAMPLER1DSHADOW}, {"sampler2DShadow", SLANG_SPEC_SAMPLER2DSHADOW}, + {"sampler2DRect", SLANG_SPEC_SAMPLER2DRECT}, + {"sampler2DRectShadow", SLANG_SPEC_SAMPLER2DRECTSHADOW}, {NULL, SLANG_SPEC_VOID} }; diff --git a/src/mesa/shader/slang/slang_print.c b/src/mesa/shader/slang/slang_print.c index a2f3691ddb1..c377759bea5 100644 --- a/src/mesa/shader/slang/slang_print.c +++ b/src/mesa/shader/slang/slang_print.c @@ -709,6 +709,10 @@ slang_type_string(slang_type_specifier_type t) return "sampler1DShadow"; case SLANG_SPEC_SAMPLER2DSHADOW: return "sampler2DShadow"; + case SLANG_SPEC_SAMPLER2DRECT: + return "sampler2DRect"; + case SLANG_SPEC_SAMPLER2DRECTSHADOW: + return "sampler2DRectShadow"; case SLANG_SPEC_STRUCT: return "struct"; case SLANG_SPEC_ARRAY: diff --git a/src/mesa/shader/slang/slang_storage.c b/src/mesa/shader/slang/slang_storage.c index 74aff01aadb..04995aa8420 100644 --- a/src/mesa/shader/slang/slang_storage.c +++ b/src/mesa/shader/slang/slang_storage.c @@ -191,6 +191,8 @@ _slang_aggregate_variable(slang_storage_aggregate * agg, case SLANG_SPEC_SAMPLERCUBE: case SLANG_SPEC_SAMPLER1DSHADOW: case SLANG_SPEC_SAMPLER2DSHADOW: + case SLANG_SPEC_SAMPLER2DRECT: + case SLANG_SPEC_SAMPLER2DRECTSHADOW: return aggregate_vector(agg, SLANG_STORE_INT, 1); case SLANG_SPEC_STRUCT: return aggregate_variables(agg, spec->_struct->fields, funcs, structs, diff --git a/src/mesa/shader/slang/slang_typeinfo.h b/src/mesa/shader/slang/slang_typeinfo.h index bde2e67ae23..f1c9a635b81 100644 --- a/src/mesa/shader/slang/slang_typeinfo.h +++ b/src/mesa/shader/slang/slang_typeinfo.h @@ -111,8 +111,10 @@ typedef enum slang_type_specifier_type_ SLANG_SPEC_SAMPLER2D, SLANG_SPEC_SAMPLER3D, SLANG_SPEC_SAMPLERCUBE, + SLANG_SPEC_SAMPLER2DRECT, SLANG_SPEC_SAMPLER1DSHADOW, SLANG_SPEC_SAMPLER2DSHADOW, + SLANG_SPEC_SAMPLER2DRECTSHADOW, SLANG_SPEC_STRUCT, SLANG_SPEC_ARRAY } slang_type_specifier_type;