From 1f2b495b5567897acbd236f302a1e2b9b5faec65 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 25 Feb 2010 19:45:45 -0700 Subject: [PATCH] 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. --- src/glsl/cl/sl_cl_parse.c | 31 ++++++++ .../slang/library/slang_common_builtin.gc | 12 +++ .../slang/library/slang_fragment_builtin.gc | 64 ++++++++++++++++ .../slang/library/slang_vertex_builtin.gc | 20 +++++ src/mesa/shader/slang/slang_codegen.c | 76 ++++++++++++------- src/mesa/shader/slang/slang_compile.c | 44 ++++++++--- src/mesa/shader/slang/slang_print.c | 28 +++---- src/mesa/shader/slang/slang_storage.c | 21 +++-- src/mesa/shader/slang/slang_typeinfo.c | 44 +++++++---- src/mesa/shader/slang/slang_typeinfo.h | 20 +++-- 10 files changed, 277 insertions(+), 83 deletions(-) diff --git a/src/glsl/cl/sl_cl_parse.c b/src/glsl/cl/sl_cl_parse.c index 9a20509fc66..771bdfd0825 100644 --- a/src/glsl/cl/sl_cl_parse.c +++ b/src/glsl/cl/sl_cl_parse.c @@ -161,6 +161,12 @@ #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); diff --git a/src/mesa/shader/slang/library/slang_common_builtin.gc b/src/mesa/shader/slang/library/slang_common_builtin.gc index 56de47ee8d7..8b7771c2846 100644 --- a/src/mesa/shader/slang/library/slang_common_builtin.gc +++ b/src/mesa/shader/slang/library/slang_common_builtin.gc @@ -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 // diff --git a/src/mesa/shader/slang/library/slang_fragment_builtin.gc b/src/mesa/shader/slang/library/slang_fragment_builtin.gc index 2e063e64161..54a80ea0e06 100644 --- a/src/mesa/shader/slang/library/slang_fragment_builtin.gc +++ b/src/mesa/shader/slang/library/slang_fragment_builtin.gc @@ -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 // diff --git a/src/mesa/shader/slang/library/slang_vertex_builtin.gc b/src/mesa/shader/slang/library/slang_vertex_builtin.gc index 9ad5f35425b..0c67c2ef20d 100644 --- a/src/mesa/shader/slang/library/slang_vertex_builtin.gc +++ b/src/mesa/shader/slang/library/slang_vertex_builtin.gc @@ -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; +} + diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c index 6901b93d5de..adfea890b3c 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; } diff --git a/src/mesa/shader/slang/slang_compile.c b/src/mesa/shader/slang/slang_compile.c index 4280698cc94..b95c15fea61 100644 --- a/src/mesa/shader/slang/slang_compile.c +++ b/src/mesa/shader/slang/slang_compile.c @@ -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: diff --git a/src/mesa/shader/slang/slang_print.c b/src/mesa/shader/slang/slang_print.c index 6efc5b7826f..3c75523c42f 100644 --- a/src/mesa/shader/slang/slang_print.c +++ b/src/mesa/shader/slang/slang_print.c @@ -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"; diff --git a/src/mesa/shader/slang/slang_storage.c b/src/mesa/shader/slang/slang_storage.c index e8b0fb7747d..656e15670d3 100644 --- a/src/mesa/shader/slang/slang_storage.c +++ b/src/mesa/shader/slang/slang_storage.c @@ -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, diff --git a/src/mesa/shader/slang/slang_typeinfo.c b/src/mesa/shader/slang/slang_typeinfo.c index 01e2bc4a22b..0f96768b02e 100644 --- a/src/mesa/shader/slang/slang_typeinfo.c +++ b/src/mesa/shader/slang/slang_typeinfo.c @@ -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: diff --git a/src/mesa/shader/slang/slang_typeinfo.h b/src/mesa/shader/slang/slang_typeinfo.h index aa5f14ebc71..9a6407a31bf 100644 --- a/src/mesa/shader/slang/slang_typeinfo.h +++ b/src/mesa/shader/slang/slang_typeinfo.h @@ -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; -- 2.30.2