glsl: implement support for GL_EXT_texture_array
authorBrian Paul <brianp@vmware.com>
Fri, 26 Feb 2010 02:45:45 +0000 (19:45 -0700)
committerBrian Paul <brianp@vmware.com>
Fri, 26 Feb 2010 03:11:55 +0000 (20:11 -0700)
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.

src/glsl/cl/sl_cl_parse.c
src/mesa/shader/slang/library/slang_common_builtin.gc
src/mesa/shader/slang/library/slang_fragment_builtin.gc
src/mesa/shader/slang/library/slang_vertex_builtin.gc
src/mesa/shader/slang/slang_codegen.c
src/mesa/shader/slang/slang_compile.c
src/mesa/shader/slang/slang_print.c
src/mesa/shader/slang/slang_storage.c
src/mesa/shader/slang/slang_typeinfo.c
src/mesa/shader/slang/slang_typeinfo.h

index 9a20509fc66759fe61d4c801457eb27717d90a31..771bdfd08250c953db574e7f692495b0fedd97ad 100644 (file)
 #define TYPE_SPECIFIER_MAT34                       30
 #define TYPE_SPECIFIER_MAT43                       31
 
+/* GL_EXT_texture_array */
+#define TYPE_SPECIFIER_SAMPLER_1D_ARRAY            32
+#define TYPE_SPECIFIER_SAMPLER_2D_ARRAY            33
+#define TYPE_SPECIFIER_SAMPLER_1D_ARRAY_SHADOW     34
+#define TYPE_SPECIFIER_SAMPLER_2D_ARRAY_SHADOW     35
+
 /* type specifier array */
 #define TYPE_SPECIFIER_NONARRAY                    0
 #define TYPE_SPECIFIER_ARRAY                       1
@@ -281,6 +287,10 @@ struct parse_dict {
    int sampler2DShadow;
    int sampler2DRect;
    int sampler2DRectShadow;
+   int sampler1DArray;
+   int sampler2DArray;
+   int sampler1DArrayShadow;
+   int sampler2DArrayShadow;
 
    int invariant;
 
@@ -1028,6 +1038,15 @@ _parse_type_specifier_nonarray(struct parse_context *ctx,
       _update(ctx, e, TYPE_SPECIFIER_SAMPLER2DRECT);
    } else if (id == ctx->dict.sampler2DRectShadow) {
       _update(ctx, e, TYPE_SPECIFIER_SAMPLER2DRECTSHADOW);
+   } else if (id == ctx->dict.sampler1DArray) {
+      _update(ctx, e, TYPE_SPECIFIER_SAMPLER_1D_ARRAY);
+   } else if (id == ctx->dict.sampler2DArray) {
+      /* XXX check for GL_EXT_texture_array */
+      _update(ctx, e, TYPE_SPECIFIER_SAMPLER_2D_ARRAY);
+   } else if (id == ctx->dict.sampler1DArrayShadow) {
+      _update(ctx, e, TYPE_SPECIFIER_SAMPLER_1D_ARRAY_SHADOW);
+   } else if (id == ctx->dict.sampler2DArrayShadow) {
+      _update(ctx, e, TYPE_SPECIFIER_SAMPLER_2D_ARRAY_SHADOW);
    } else if (_parse_identifier(ctx, &p) == 0) {
       _update(ctx, e, TYPE_SPECIFIER_TYPENAME);
       *ps = p;
@@ -1944,6 +1963,14 @@ _parse_prectype(struct parse_context *ctx,
       type = TYPE_SPECIFIER_SAMPLER2DRECT;
    } else if (id == ctx->dict.sampler2DRectShadow) {
       type = TYPE_SPECIFIER_SAMPLER2DRECTSHADOW;
+   } else if (id == ctx->dict.sampler1DArray) {
+      type = TYPE_SPECIFIER_SAMPLER_1D_ARRAY;
+   } else if (id == ctx->dict.sampler2DArray) {
+      type = TYPE_SPECIFIER_SAMPLER_2D_ARRAY;
+   } else if (id == ctx->dict.sampler1DArrayShadow) {
+      type = TYPE_SPECIFIER_SAMPLER_1D_ARRAY_SHADOW;
+   } else if (id == ctx->dict.sampler2DArrayShadow) {
+      type = TYPE_SPECIFIER_SAMPLER_2D_ARRAY_SHADOW;
    } else {
       return -1;
    }
@@ -2886,6 +2913,10 @@ sl_cl_compile(struct sl_pp_context *context,
    ADD_NAME(ctx, sampler2DShadow);
    ADD_NAME(ctx, sampler2DRect);
    ADD_NAME(ctx, sampler2DRectShadow);
+   ADD_NAME(ctx, sampler1DArray);
+   ADD_NAME(ctx, sampler2DArray);
+   ADD_NAME(ctx, sampler1DArrayShadow);
+   ADD_NAME(ctx, sampler2DArrayShadow);
 
    ADD_NAME(ctx, invariant);
 
index 56de47ee8d75b60c8f19719a97668a8c87e658fc..8b7771c284648f67147ea8056260a35d315ebf27 100644 (file)
@@ -1769,6 +1769,18 @@ vec4 shadow2DRectProj(const sampler2DRectShadow sampler, const vec4 coord)
 
 
 
+//// GL_EXT_texture_array
+vec4 texture1DArray(const sampler1DArray sampler, const vec2 coord)
+{
+   __asm vec4_tex_1d_array __retVal, sampler, coord;
+}
+
+vec4 texture2DArray(const sampler2DArray sampler, const vec3 coord)
+{
+   __asm vec4_tex_2d_array __retVal, sampler, coord;
+}
+
+
 //
 // 8.9 Noise Functions
 //
index 2e063e64161ac5b52ed79d25db13d8d6d0b79618..54a80ea0e0637972616347e1e242aa979611dfd8 100644 (file)
@@ -165,6 +165,70 @@ vec4 shadow2DProj(const sampler2DShadow sampler, const vec4 coord, const float b
 
 
 
+//// GL_EXT_texture_array
+
+vec4 texture1DArray(const sampler1DArray sampler, const vec2 coord)
+{
+   vec4 coord4;
+   coord4.xy = coord;
+   __asm vec4_tex_1d_array __retVal, sampler, coord4;
+}
+
+vec4 texture1DArray(const sampler1DArray sampler, const vec2 coord, const float bias)
+{
+   vec4 coord4;
+   coord4.xy = coord;
+   coord4.w = bias;
+   __asm vec4_tex_1d_array_bias __retVal, sampler, coord4;
+}
+
+vec4 texure2DArray(const sampler2DArray sampler, const vec3 coord)
+{
+   vec4 coord4;
+   coord4.xyz = coord;
+   __asm vec4_tex_2d_array __retVal, sampler, coord4;
+}
+
+vec4 texture2DArray(const sampler2DArray sampler, const vec3 coord, const float bias)
+{
+   vec4 coord4;
+   coord4.xyz = coord;
+   coord4.w = bias;
+   __asm vec4_tex_2d_array_bias __retVal, sampler, coord4;
+}
+
+vec4 shadow1DArray(const sampler1DArrayShadow sampler, const vec2 coord)
+{
+   vec4 coord4;
+   coord4.xy = coord;
+   __asm vec4_tex_1d_array_shadow __retVal, sampler, coord4;
+}
+
+vec4 shadow1DArray(const sampler1DArrayShadow sampler, const vec2 coord, const float bias)
+{
+   vec4 coord4;
+   coord4.xy = coord;
+   coord4.w = bias;
+   __asm vec4_tex_1d_array_bias_shadow __retVal, sampler, coord4;
+}
+
+vec4 shadow2DArray(const sampler2DArrayShadow sampler, const vec3 coord)
+{
+   vec4 coord4;
+   coord4.xyz = coord;
+   __asm vec4_tex_2d_array_shadow __retVal, sampler, coord4;
+}
+
+vec4 shadow2DArray(const sampler2DArrayShadow sampler, const vec3 coord, const float bias)
+{
+   vec4 coord4;
+   coord4.xyz = coord;
+   coord4.w = bias;
+   __asm vec4_tex_2d_array_bias_shadow __retVal, sampler, coord4;
+}
+
+
+
 //
 // 8.8 Fragment Processing Functions
 //
index 9ad5f35425b0fde999e46f4f4a7cd701ee9a7ab6..0c67c2ef20dacd69e605a8011e911833dad4d89d 100644 (file)
@@ -188,3 +188,23 @@ vec4 shadow2DProjLod(const sampler2DShadow sampler, const vec4 coord,
    __asm vec4_tex_2d_bias_shadow __retVal, sampler, pcoord;
 }
 
+
+//// GL_EXT_texture_array
+
+vec4 texture1DArrayLod(const sampler1DArray sampler, const vec2 coord, const float lod)
+{
+   vec4 coord4;
+   coord4.xy = coord;
+   coord4.w = lod;
+   __asm vec4_tex_1d_array_bias __retVal, sampler, coord4;
+}
+
+
+vec4 texture2DArrayLod(const sampler2DArray sampler, const vec3 coord, const float lod)
+{
+   vec4 coord4;
+   coord4.xyz = coord;
+   coord4.w = lod;
+   __asm vec4_tex_2d_array_bias __retVal, sampler, coord4;
+}
+
index 6901b93d5dece60a0ce929b58bba95d1dd3a5b1e..adfea890b3c329dac9b5175875fb5edc8dfbdb16 100644 (file)
@@ -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;
 }
 
 
index 4280698cc9426705c1ec5687949efc9d15f80d15..b95c15fea6114e7c3bb80c193bf9a185aaf1a305 100644 (file)
@@ -55,7 +55,7 @@
 
 
 /** re-defined below, should be the same though */
-#define TYPE_SPECIFIER_COUNT 32
+#define TYPE_SPECIFIER_COUNT 36
 
 
 /**
@@ -742,13 +742,18 @@ parse_type_qualifier(slang_parse_ctx * C, slang_type_qualifier * qual)
 #define TYPE_SPECIFIER_MAT42 29
 #define TYPE_SPECIFIER_MAT34 30
 #define TYPE_SPECIFIER_MAT43 31
-#define TYPE_SPECIFIER_COUNT 32
+#define TYPE_SPECIFIER_SAMPLER_1D_ARRAY 32
+#define TYPE_SPECIFIER_SAMPLER_2D_ARRAY 33
+#define TYPE_SPECIFIER_SAMPLER_1D_ARRAY_SHADOW 34
+#define TYPE_SPECIFIER_SAMPLER_2D_ARRAY_SHADOW 35
+#define TYPE_SPECIFIER_COUNT 36
 
 static int
 parse_type_specifier(slang_parse_ctx * C, slang_output_ctx * O,
                      slang_type_specifier * spec)
 {
-   switch (*C->I++) {
+   int type = *C->I++;
+   switch (type) {
    case TYPE_SPECIFIER_VOID:
       spec->type = SLANG_SPEC_VOID;
       break;
@@ -816,28 +821,40 @@ parse_type_specifier(slang_parse_ctx * C, slang_output_ctx * O,
       spec->type = SLANG_SPEC_MAT43;
       break;
    case TYPE_SPECIFIER_SAMPLER1D:
-      spec->type = SLANG_SPEC_SAMPLER1D;
+      spec->type = SLANG_SPEC_SAMPLER_1D;
       break;
    case TYPE_SPECIFIER_SAMPLER2D:
-      spec->type = SLANG_SPEC_SAMPLER2D;
+      spec->type = SLANG_SPEC_SAMPLER_2D;
       break;
    case TYPE_SPECIFIER_SAMPLER3D:
-      spec->type = SLANG_SPEC_SAMPLER3D;
+      spec->type = SLANG_SPEC_SAMPLER_3D;
       break;
    case TYPE_SPECIFIER_SAMPLERCUBE:
-      spec->type = SLANG_SPEC_SAMPLERCUBE;
+      spec->type = SLANG_SPEC_SAMPLER_CUBE;
       break;
    case TYPE_SPECIFIER_SAMPLER2DRECT:
-      spec->type = SLANG_SPEC_SAMPLER2DRECT;
+      spec->type = SLANG_SPEC_SAMPLER_RECT;
       break;
    case TYPE_SPECIFIER_SAMPLER1DSHADOW:
-      spec->type = SLANG_SPEC_SAMPLER1DSHADOW;
+      spec->type = SLANG_SPEC_SAMPLER_1D_SHADOW;
       break;
    case TYPE_SPECIFIER_SAMPLER2DSHADOW:
-      spec->type = SLANG_SPEC_SAMPLER2DSHADOW;
+      spec->type = SLANG_SPEC_SAMPLER_2D_SHADOW;
       break;
    case TYPE_SPECIFIER_SAMPLER2DRECTSHADOW:
-      spec->type = SLANG_SPEC_SAMPLER2DRECTSHADOW;
+      spec->type = SLANG_SPEC_SAMPLER_RECT_SHADOW;
+      break;
+   case TYPE_SPECIFIER_SAMPLER_1D_ARRAY:
+      spec->type = SLANG_SPEC_SAMPLER_1D_ARRAY;
+      break;
+   case TYPE_SPECIFIER_SAMPLER_2D_ARRAY:
+      spec->type = SLANG_SPEC_SAMPLER_2D_ARRAY;
+      break;
+   case TYPE_SPECIFIER_SAMPLER_1D_ARRAY_SHADOW:
+      spec->type = SLANG_SPEC_SAMPLER_1D_ARRAY_SHADOW;
+      break;
+   case TYPE_SPECIFIER_SAMPLER_2D_ARRAY_SHADOW:
+      spec->type = SLANG_SPEC_SAMPLER_2D_ARRAY_SHADOW;
       break;
    case TYPE_SPECIFIER_STRUCT:
       spec->type = SLANG_SPEC_STRUCT;
@@ -2133,6 +2150,7 @@ parse_init_declarator(slang_parse_ctx * C, slang_output_ctx * O,
       var->type.qualifier = type->qualifier;
       var->type.centroid = type->centroid;
       var->type.precision = type->precision;
+      var->type.specifier = type->specifier;/*new*/
       var->type.variant = type->variant;
       var->type.layout = type->layout;
       var->type.array_len = type->array_len;
@@ -2441,6 +2459,10 @@ parse_default_precision(slang_parse_ctx * C, slang_output_ctx * O)
    case TYPE_SPECIFIER_SAMPLER2DSHADOW:
    case TYPE_SPECIFIER_SAMPLER2DRECT:
    case TYPE_SPECIFIER_SAMPLER2DRECTSHADOW:
+   case TYPE_SPECIFIER_SAMPLER_1D_ARRAY:
+   case TYPE_SPECIFIER_SAMPLER_2D_ARRAY:
+   case TYPE_SPECIFIER_SAMPLER_1D_ARRAY_SHADOW:
+   case TYPE_SPECIFIER_SAMPLER_2D_ARRAY_SHADOW:
       /* OK */
       break;
    default:
index 6efc5b7826f401482bc1a5722ced150bb6507de3..3c75523c42fbdfd3e04eb5942f721bc9df237022 100644 (file)
@@ -119,22 +119,22 @@ print_type(const slang_fully_specified_type *t)
    case SLANG_SPEC_MAT43:
       printf("mat4x3");
       break;
-   case SLANG_SPEC_SAMPLER1D:
+   case SLANG_SPEC_SAMPLER_1D:
       printf("sampler1D");
       break;
-   case SLANG_SPEC_SAMPLER2D:
+   case SLANG_SPEC_SAMPLER_2D:
       printf("sampler2D");
       break;
-   case SLANG_SPEC_SAMPLER3D:
+   case SLANG_SPEC_SAMPLER_3D:
       printf("sampler3D");
       break;
-   case SLANG_SPEC_SAMPLERCUBE:
+   case SLANG_SPEC_SAMPLER_CUBE:
       printf("samplerCube");
       break;
-   case SLANG_SPEC_SAMPLER1DSHADOW:
+   case SLANG_SPEC_SAMPLER_1D_SHADOW:
       printf("sampler1DShadow");
       break;
-   case SLANG_SPEC_SAMPLER2DSHADOW:
+   case SLANG_SPEC_SAMPLER_2D_SHADOW:
       printf("sampler2DShadow");
       break;
    case SLANG_SPEC_STRUCT:
@@ -783,21 +783,21 @@ slang_type_string(slang_type_specifier_type t)
       return "mat3";
    case SLANG_SPEC_MAT4:
       return "mat4";
-   case SLANG_SPEC_SAMPLER1D:
+   case SLANG_SPEC_SAMPLER_1D:
       return "sampler1D";
-   case SLANG_SPEC_SAMPLER2D:
+   case SLANG_SPEC_SAMPLER_2D:
       return "sampler2D";
-   case SLANG_SPEC_SAMPLER3D:
+   case SLANG_SPEC_SAMPLER_3D:
       return "sampler3D";
-   case SLANG_SPEC_SAMPLERCUBE:
+   case SLANG_SPEC_SAMPLER_CUBE:
       return "samplerCube";
-   case SLANG_SPEC_SAMPLER1DSHADOW:
+   case SLANG_SPEC_SAMPLER_1D_SHADOW:
       return "sampler1DShadow";
-   case SLANG_SPEC_SAMPLER2DSHADOW:
+   case SLANG_SPEC_SAMPLER_2D_SHADOW:
       return "sampler2DShadow";
-   case SLANG_SPEC_SAMPLER2DRECT:
+   case SLANG_SPEC_SAMPLER_RECT:
       return "sampler2DRect";
-   case SLANG_SPEC_SAMPLER2DRECTSHADOW:
+   case SLANG_SPEC_SAMPLER_RECT_SHADOW:
       return "sampler2DRectShadow";
    case SLANG_SPEC_STRUCT:
       return "struct";
index e8b0fb7747d5d9975e6128fe4fcd173ebb3bf1d2..656e15670d395fbc9bcfd7d07e05072c5eab98f1 100644 (file)
@@ -199,14 +199,19 @@ _slang_aggregate_variable(slang_storage_aggregate * agg,
    case SLANG_SPEC_MAT43:
       return aggregate_matrix(agg, SLANG_STORE_FLOAT, 4, 3);
 
-   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 aggregate_vector(agg, SLANG_STORE_INT, 1);
    case SLANG_SPEC_STRUCT:
       return aggregate_variables(agg, spec->_struct->fields, funcs, structs,
index 01e2bc4a22b829bfa75b143d036e8da3bbeaa9f1..0f96768b02ea96d3ace6cc3f0ce05e973311763b 100644 (file)
@@ -195,14 +195,18 @@ static const type_specifier_type_name type_specifier_type_names[] = {
    {"mat4x2", SLANG_SPEC_MAT42},
    {"mat3x4", SLANG_SPEC_MAT34},
    {"mat4x3", SLANG_SPEC_MAT43},
-   {"sampler1D", SLANG_SPEC_SAMPLER1D},
-   {"sampler2D", SLANG_SPEC_SAMPLER2D},
-   {"sampler3D", SLANG_SPEC_SAMPLER3D},
-   {"samplerCube", SLANG_SPEC_SAMPLERCUBE},
-   {"sampler1DShadow", SLANG_SPEC_SAMPLER1DSHADOW},
-   {"sampler2DShadow", SLANG_SPEC_SAMPLER2DSHADOW},
-   {"sampler2DRect", SLANG_SPEC_SAMPLER2DRECT},
-   {"sampler2DRectShadow", SLANG_SPEC_SAMPLER2DRECTSHADOW},
+   {"sampler1D", SLANG_SPEC_SAMPLER_1D},
+   {"sampler2D", SLANG_SPEC_SAMPLER_2D},
+   {"sampler3D", SLANG_SPEC_SAMPLER_3D},
+   {"samplerCube", SLANG_SPEC_SAMPLER_CUBE},
+   {"sampler1DShadow", SLANG_SPEC_SAMPLER_1D_SHADOW},
+   {"sampler2DShadow", SLANG_SPEC_SAMPLER_2D_SHADOW},
+   {"sampler2DRect", SLANG_SPEC_SAMPLER_RECT},
+   {"sampler2DRectShadow", SLANG_SPEC_SAMPLER_RECT_SHADOW},
+   {"sampler1DArray", SLANG_SPEC_SAMPLER_1D_ARRAY},
+   {"sampler2DArray", SLANG_SPEC_SAMPLER_2D_ARRAY},
+   {"sampler1DArrayShadow", SLANG_SPEC_SAMPLER_1D_ARRAY_SHADOW},
+   {"sampler2DArrayShadow", SLANG_SPEC_SAMPLER_2D_ARRAY_SHADOW},
    {NULL, SLANG_SPEC_VOID}
 };
 
@@ -1138,22 +1142,30 @@ _slang_gltype_from_specifier(const slang_type_specifier *type)
       return GL_FLOAT_MAT3x4;
    case SLANG_SPEC_MAT43:
       return GL_FLOAT_MAT4x3;
-   case SLANG_SPEC_SAMPLER1D:
+   case SLANG_SPEC_SAMPLER_1D:
       return GL_SAMPLER_1D;
-   case SLANG_SPEC_SAMPLER2D:
+   case SLANG_SPEC_SAMPLER_2D:
       return GL_SAMPLER_2D;
-   case SLANG_SPEC_SAMPLER3D:
+   case SLANG_SPEC_SAMPLER_3D:
       return GL_SAMPLER_3D;
-   case SLANG_SPEC_SAMPLERCUBE:
+   case SLANG_SPEC_SAMPLER_CUBE:
       return GL_SAMPLER_CUBE;
-   case SLANG_SPEC_SAMPLER1DSHADOW:
+   case SLANG_SPEC_SAMPLER_1D_SHADOW:
       return GL_SAMPLER_1D_SHADOW;
-   case SLANG_SPEC_SAMPLER2DSHADOW:
+   case SLANG_SPEC_SAMPLER_2D_SHADOW:
       return GL_SAMPLER_2D_SHADOW;
-   case SLANG_SPEC_SAMPLER2DRECT:
+   case SLANG_SPEC_SAMPLER_RECT:
       return GL_SAMPLER_2D_RECT_ARB;
-   case SLANG_SPEC_SAMPLER2DRECTSHADOW:
+   case SLANG_SPEC_SAMPLER_RECT_SHADOW:
       return GL_SAMPLER_2D_RECT_SHADOW_ARB;
+   case SLANG_SPEC_SAMPLER_1D_ARRAY:
+      return GL_SAMPLER_1D_ARRAY_EXT;
+   case SLANG_SPEC_SAMPLER_2D_ARRAY:
+      return GL_SAMPLER_2D_ARRAY_EXT;
+   case SLANG_SPEC_SAMPLER_1D_ARRAY_SHADOW:
+      return GL_SAMPLER_1D_ARRAY_SHADOW_EXT;
+   case SLANG_SPEC_SAMPLER_2D_ARRAY_SHADOW:
+      return GL_SAMPLER_2D_ARRAY_SHADOW_EXT;
    case SLANG_SPEC_ARRAY:
       return _slang_gltype_from_specifier(type->_array);
    case SLANG_SPEC_STRUCT:
index aa5f14ebc71c8657b967f0fd648cbc9c694a529c..9a6407a31bf23e4e1eafeabe34aa5238c4b706c7 100644 (file)
@@ -130,14 +130,18 @@ typedef enum slang_type_specifier_type_
    SLANG_SPEC_MAT42,
    SLANG_SPEC_MAT34,
    SLANG_SPEC_MAT43,
-   SLANG_SPEC_SAMPLER1D,
-   SLANG_SPEC_SAMPLER2D,
-   SLANG_SPEC_SAMPLER3D,
-   SLANG_SPEC_SAMPLERCUBE,
-   SLANG_SPEC_SAMPLER2DRECT,
-   SLANG_SPEC_SAMPLER1DSHADOW,
-   SLANG_SPEC_SAMPLER2DSHADOW,
-   SLANG_SPEC_SAMPLER2DRECTSHADOW,
+   SLANG_SPEC_SAMPLER_1D,
+   SLANG_SPEC_SAMPLER_2D,
+   SLANG_SPEC_SAMPLER_3D,
+   SLANG_SPEC_SAMPLER_CUBE,
+   SLANG_SPEC_SAMPLER_RECT,
+   SLANG_SPEC_SAMPLER_1D_SHADOW,
+   SLANG_SPEC_SAMPLER_2D_SHADOW,
+   SLANG_SPEC_SAMPLER_RECT_SHADOW,
+   SLANG_SPEC_SAMPLER_1D_ARRAY,
+   SLANG_SPEC_SAMPLER_2D_ARRAY,
+   SLANG_SPEC_SAMPLER_1D_ARRAY_SHADOW,
+   SLANG_SPEC_SAMPLER_2D_ARRAY_SHADOW,
    SLANG_SPEC_STRUCT,
    SLANG_SPEC_ARRAY
 } slang_type_specifier_type;