diff options
author | Zack Rusin <[email protected]> | 2010-03-15 15:24:38 -0400 |
---|---|---|
committer | Zack Rusin <[email protected]> | 2010-03-15 15:24:38 -0400 |
commit | 275c4bd3643d773210780cb8d578ca84f2604684 (patch) | |
tree | 8266edc39d4253ac0f2a0ecd41f560f3d815bb5c /src/mesa/shader/slang/slang_codegen.c | |
parent | c5c5cd7132e18f4aad8e73d8ee879f8823c4c1e7 (diff) | |
parent | d0b35352ed27b1e66785c45ee95a352ed06b47ce (diff) |
Merge remote branch 'origin/master' into gallium_draw_llvm
Diffstat (limited to 'src/mesa/shader/slang/slang_codegen.c')
-rw-r--r-- | src/mesa/shader/slang/slang_codegen.c | 84 |
1 files changed, 55 insertions, 29 deletions
diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c index 6901b93d5de..ecb2f6d5c1e 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 }, @@ -1730,7 +1754,7 @@ swizzle_to_writemask(slang_assemble_ctx *A, GLuint swizzle, /* end */ break; } - assert(swz >= 0 && swz <= 3); + assert(swz <= 3); if (swizzle != SWIZZLE_XXXX && swizzle != SWIZZLE_YYYY && @@ -1870,6 +1894,7 @@ _slang_gen_asm(slang_assemble_ctx *A, slang_operation *oper, _mesa_problem(NULL, "undefined __asm function %s\n", (char *) oper->a_id); assert(info); + return NULL; } assert(info->NumParams <= 3); @@ -3160,6 +3185,7 @@ _slang_unroll_for_loop(slang_assemble_ctx * A, const slang_operation *oper) varId = oper->children[0].children[0].a_id; var = _slang_variable_locate(oper->children[0].children[0].locals, varId, GL_TRUE); + assert(var); start = (GLint) var->initializer->literal[0]; } else { @@ -4182,7 +4208,7 @@ swizzle_size(GLuint swizzle) GLuint size = 0, i; for (i = 0; i < 4; i++) { GLuint swz = GET_SWZ(swizzle, i); - size += (swz >= 0 && swz <= 3); + size += (swz <= 3); } return size; } @@ -4198,6 +4224,7 @@ _slang_gen_swizzle(slang_ir_node *child, GLuint swizzle) n->Store = _slang_new_ir_storage_relative(0, swizzle_size(swizzle), child->Store); + assert(n->Store); n->Store->Swizzle = swizzle; } return n; @@ -4499,7 +4526,6 @@ _slang_gen_array_element(slang_assemble_ctx * A, slang_operation *oper) SWIZZLE_NIL); n = _slang_gen_swizzle(n, swizzle); } - assert(n->Store); return n; } else { @@ -4923,8 +4949,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; } |