From b5f32e1d5a1780292b10ba51fa2c7d05e77a7346 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 14 Jan 2009 12:33:06 -0700 Subject: glsl: minor clean-up for rect sampler test --- src/mesa/shader/slang/slang_codegen.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'src/mesa/shader') diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c index 51eb4c9c11..11340d26e2 100644 --- a/src/mesa/shader/slang/slang_codegen.c +++ b/src/mesa/shader/slang/slang_codegen.c @@ -4238,6 +4238,21 @@ _slang_gen_operation(slang_assemble_ctx * A, slang_operation *oper) } +/** + * Check if the given type specifier is a rectangular texture sampler. + */ +static GLboolean +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; +} + + + /** * Called by compiler when a global variable has been parsed/compiled. * Here we examine the variable's type to determine what kind of register @@ -4282,14 +4297,12 @@ _slang_codegen_global_variable(slang_assemble_ctx *A, slang_variable *var, } #if FEATURE_es2_glsl /* XXX should use FEATURE_texture_rect */ /* disallow rect samplers */ - if ((var->type.specifier._array && - (var->type.specifier._array->type == SLANG_SPEC_SAMPLER2DRECT || - var->type.specifier._array->type == SLANG_SPEC_SAMPLER2DRECTSHADOW)) || - (var->type.specifier.type == SLANG_SPEC_SAMPLER2DRECT || - var->type.specifier.type == SLANG_SPEC_SAMPLER2DRECTSHADOW)) { + if (is_rect_sampler_spec(&var->type.specifier)) { slang_info_log_error(A->log, "invalid sampler type for '%s'", varName); return GL_FALSE; } +#else + (void) is_rect_sampler_spec; /* silence warning */ #endif { GLint sampNum = _mesa_add_sampler(prog->Parameters, varName, datatype); -- cgit v1.2.3 From 7d08091767c9713e153922385b02047c73ab70e2 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 14 Jan 2009 12:35:43 -0700 Subject: glsl: fix comment --- src/mesa/shader/slang/slang_typeinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mesa/shader') diff --git a/src/mesa/shader/slang/slang_typeinfo.c b/src/mesa/shader/slang/slang_typeinfo.c index a5bcde404f..1ef43f58c0 100644 --- a/src/mesa/shader/slang/slang_typeinfo.c +++ b/src/mesa/shader/slang/slang_typeinfo.c @@ -23,7 +23,7 @@ */ /** - * \file slang_assemble_typeinfo.c + * \file slang_typeinfo.c * slang type info * \author Michal Krol */ -- cgit v1.2.3 From e1ba29ea19fd99d16b63cc34bc2aa1e4a26c5a25 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 15 Jan 2009 07:04:36 -0700 Subject: glsl: move declaration before code --- src/mesa/shader/slang/slang_compile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mesa/shader') diff --git a/src/mesa/shader/slang/slang_compile.c b/src/mesa/shader/slang/slang_compile.c index 04fa2e0f93..818b90b7a8 100644 --- a/src/mesa/shader/slang/slang_compile.c +++ b/src/mesa/shader/slang/slang_compile.c @@ -1471,9 +1471,9 @@ parse_expression(slang_parse_ctx * C, slang_output_ctx * O, RETURN0; } else { - array_constructor = GL_TRUE; /* parse the array constructor size */ slang_operation array_size; + array_constructor = GL_TRUE; slang_operation_construct(&array_size); if (!parse_expression(C, O, &array_size)) { slang_operation_destruct(&array_size); -- cgit v1.2.3 From 4a8356209d143f21138eaa3ea64626e04c969669 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 15 Jan 2009 07:04:52 -0700 Subject: glsl: use _mesa_sprintf() --- src/mesa/shader/slang/slang_link.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/mesa/shader') diff --git a/src/mesa/shader/slang/slang_link.c b/src/mesa/shader/slang/slang_link.c index 05a3e2dee0..c6d5cc0566 100644 --- a/src/mesa/shader/slang/slang_link.c +++ b/src/mesa/shader/slang/slang_link.c @@ -260,8 +260,8 @@ link_uniform_vars(GLcontext *ctx, GLuint newSampNum = *numSamplers; if (newSampNum >= ctx->Const.MaxTextureImageUnits) { char s[100]; - sprintf(s, "Too many texture samplers (%u, max is %u)", - newSampNum, ctx->Const.MaxTextureImageUnits); + _mesa_sprintf(s, "Too many texture samplers (%u, max is %u)", + newSampNum, ctx->Const.MaxTextureImageUnits); link_error(shProg, s); return GL_FALSE; } -- cgit v1.2.3 From e442fe5ba53acf16c78339f19921d70dba3928f6 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 16 Jan 2009 09:30:37 -0700 Subject: glsl: fix broken sampler assignments --- src/mesa/shader/slang/slang_emit.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/mesa/shader') diff --git a/src/mesa/shader/slang/slang_emit.c b/src/mesa/shader/slang/slang_emit.c index 6b744d72c8..ea446fa5d4 100644 --- a/src/mesa/shader/slang/slang_emit.c +++ b/src/mesa/shader/slang/slang_emit.c @@ -1349,9 +1349,10 @@ emit_copy(slang_emit_info *emitInfo, slang_ir_node *n) if (n->Store->File == PROGRAM_SAMPLER) { /* no code generated for sampler assignments, - * just copy the sampler index at compile time. + * just copy the sampler index/target at compile time. */ n->Store->Index = n->Children[1]->Store->Index; + n->Store->TexTarget = n->Children[1]->Store->TexTarget; return NULL; } -- cgit v1.2.3