summaryrefslogtreecommitdiff
path: root/src/mesa/shader/slang/slang_codegen.c
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2010-02-25 19:45:45 -0700
committerBrian Paul <brianp@vmware.com>2010-02-25 20:11:55 -0700
commit1f2b495b5567897acbd236f302a1e2b9b5faec65 (patch)
tree5ed40e51c53eabfd2163bd771d60f28063c15e5b /src/mesa/shader/slang/slang_codegen.c
parent1edd444c2e9afadb56df55682ae606b5cefd811c (diff)
glsl: implement support for GL_EXT_texture_array
GL_EXT_texture_array is different from the existing GL_MESA_texture_array support in that the former is only supported for GLSL, not fixed-function. The shadow compare versions of the sampler functions haven't been tested yet. The non-shadow versions have been tested with a new piglit test.
Diffstat (limited to 'src/mesa/shader/slang/slang_codegen.c')
-rw-r--r--src/mesa/shader/slang/slang_codegen.c76
1 files changed, 50 insertions, 26 deletions
diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c
index 6901b93d5d..adfea890b3 100644
--- a/src/mesa/shader/slang/slang_codegen.c
+++ b/src/mesa/shader/slang/slang_codegen.c
@@ -100,14 +100,18 @@ static GLboolean
is_sampler_type(const slang_fully_specified_type *t)
{
switch (t->specifier.type) {
- case SLANG_SPEC_SAMPLER1D:
- case SLANG_SPEC_SAMPLER2D:
- case SLANG_SPEC_SAMPLER3D:
- case SLANG_SPEC_SAMPLERCUBE:
- case SLANG_SPEC_SAMPLER1DSHADOW:
- case SLANG_SPEC_SAMPLER2DSHADOW:
- case SLANG_SPEC_SAMPLER2DRECT:
- case SLANG_SPEC_SAMPLER2DRECTSHADOW:
+ case SLANG_SPEC_SAMPLER_1D:
+ case SLANG_SPEC_SAMPLER_2D:
+ case SLANG_SPEC_SAMPLER_3D:
+ case SLANG_SPEC_SAMPLER_CUBE:
+ case SLANG_SPEC_SAMPLER_1D_SHADOW:
+ case SLANG_SPEC_SAMPLER_2D_SHADOW:
+ case SLANG_SPEC_SAMPLER_RECT:
+ case SLANG_SPEC_SAMPLER_RECT_SHADOW:
+ case SLANG_SPEC_SAMPLER_1D_ARRAY:
+ case SLANG_SPEC_SAMPLER_2D_ARRAY:
+ case SLANG_SPEC_SAMPLER_1D_ARRAY_SHADOW:
+ case SLANG_SPEC_SAMPLER_2D_ARRAY_SHADOW:
return GL_TRUE;
default:
return GL_FALSE;
@@ -222,14 +226,18 @@ _slang_sizeof_type_specifier(const slang_type_specifier *spec)
case SLANG_SPEC_MAT43:
sz = 4 * 4; /* 4 columns (regs) */
break;
- case SLANG_SPEC_SAMPLER1D:
- case SLANG_SPEC_SAMPLER2D:
- case SLANG_SPEC_SAMPLER3D:
- case SLANG_SPEC_SAMPLERCUBE:
- case SLANG_SPEC_SAMPLER1DSHADOW:
- case SLANG_SPEC_SAMPLER2DSHADOW:
- case SLANG_SPEC_SAMPLER2DRECT:
- case SLANG_SPEC_SAMPLER2DRECTSHADOW:
+ case SLANG_SPEC_SAMPLER_1D:
+ case SLANG_SPEC_SAMPLER_2D:
+ case SLANG_SPEC_SAMPLER_3D:
+ case SLANG_SPEC_SAMPLER_CUBE:
+ case SLANG_SPEC_SAMPLER_1D_SHADOW:
+ case SLANG_SPEC_SAMPLER_2D_SHADOW:
+ case SLANG_SPEC_SAMPLER_RECT:
+ case SLANG_SPEC_SAMPLER_RECT_SHADOW:
+ case SLANG_SPEC_SAMPLER_1D_ARRAY:
+ case SLANG_SPEC_SAMPLER_2D_ARRAY:
+ case SLANG_SPEC_SAMPLER_1D_ARRAY_SHADOW:
+ case SLANG_SPEC_SAMPLER_2D_ARRAY_SHADOW:
sz = 1; /* a sampler is basically just an integer index */
break;
case SLANG_SPEC_STRUCT:
@@ -310,22 +318,30 @@ static GLint
sampler_to_texture_index(const slang_type_specifier_type type)
{
switch (type) {
- case SLANG_SPEC_SAMPLER1D:
+ case SLANG_SPEC_SAMPLER_1D:
return TEXTURE_1D_INDEX;
- case SLANG_SPEC_SAMPLER2D:
+ case SLANG_SPEC_SAMPLER_2D:
return TEXTURE_2D_INDEX;
- case SLANG_SPEC_SAMPLER3D:
+ case SLANG_SPEC_SAMPLER_3D:
return TEXTURE_3D_INDEX;
- case SLANG_SPEC_SAMPLERCUBE:
+ case SLANG_SPEC_SAMPLER_CUBE:
return TEXTURE_CUBE_INDEX;
- case SLANG_SPEC_SAMPLER1DSHADOW:
+ case SLANG_SPEC_SAMPLER_1D_SHADOW:
return TEXTURE_1D_INDEX; /* XXX fix */
- case SLANG_SPEC_SAMPLER2DSHADOW:
+ case SLANG_SPEC_SAMPLER_2D_SHADOW:
return TEXTURE_2D_INDEX; /* XXX fix */
- case SLANG_SPEC_SAMPLER2DRECT:
+ case SLANG_SPEC_SAMPLER_RECT:
return TEXTURE_RECT_INDEX;
- case SLANG_SPEC_SAMPLER2DRECTSHADOW:
+ case SLANG_SPEC_SAMPLER_RECT_SHADOW:
return TEXTURE_RECT_INDEX; /* XXX fix */
+ case SLANG_SPEC_SAMPLER_1D_ARRAY:
+ return TEXTURE_1D_ARRAY_INDEX;
+ case SLANG_SPEC_SAMPLER_2D_ARRAY:
+ return TEXTURE_2D_ARRAY_INDEX;
+ case SLANG_SPEC_SAMPLER_1D_ARRAY_SHADOW:
+ return TEXTURE_1D_ARRAY_INDEX;
+ case SLANG_SPEC_SAMPLER_2D_ARRAY_SHADOW:
+ return TEXTURE_2D_ARRAY_INDEX;
default:
return -1;
}
@@ -453,6 +469,14 @@ static slang_asm_info AsmInfo[] = {
{ "vec4_tex_cube", IR_TEX, 1, 2 }, /* cubemap */
{ "vec4_tex_rect", IR_TEX, 1, 2 }, /* rectangle */
{ "vec4_tex_rect_bias", IR_TEX, 1, 2 }, /* rectangle w/ projection */
+ { "vec4_tex_1d_array", IR_TEX, 1, 2 },
+ { "vec4_tex_1d_array_bias", IR_TEXB, 1, 2 },
+ { "vec4_tex_1d_array_shadow", IR_TEX, 1, 2 },
+ { "vec4_tex_1d_array_bias_shadow", IR_TEXB, 1, 2 },
+ { "vec4_tex_2d_array", IR_TEX, 1, 2 },
+ { "vec4_tex_2d_array_bias", IR_TEXB, 1, 2 },
+ { "vec4_tex_2d_array_shadow", IR_TEX, 1, 2 },
+ { "vec4_tex_2d_array_bias_shadow", IR_TEXB, 1, 2 },
/* texture / sampler but with shadow comparison */
{ "vec4_tex_1d_shadow", IR_TEX_SH, 1, 2 },
@@ -4923,8 +4947,8 @@ is_rect_sampler_spec(const slang_type_specifier *spec)
while (spec->_array) {
spec = spec->_array;
}
- return spec->type == SLANG_SPEC_SAMPLER2DRECT ||
- spec->type == SLANG_SPEC_SAMPLER2DRECTSHADOW;
+ return spec->type == SLANG_SPEC_SAMPLER_RECT ||
+ spec->type == SLANG_SPEC_SAMPLER_RECT_SHADOW;
}