From 233b88eab9d8095523ebae3c4be1dbf2e2bd856a Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Fri, 25 Feb 2011 14:29:36 -0800 Subject: glsl: Explicitly specify a type when reading/printing ir_texture. This is necessary for GLSL 1.30+ shadow sampling functions, which return a single float rather than splatting the value to a vec4 based on GL_DEPTH_TEXTURE_MODE. --- src/glsl/ir.cpp | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'src/glsl/ir.cpp') diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp index fc356ba527..a55b7ef653 100644 --- a/src/glsl/ir.cpp +++ b/src/glsl/ir.cpp @@ -1150,22 +1150,18 @@ ir_texture::get_opcode(const char *str) void -ir_texture::set_sampler(ir_dereference *sampler) +ir_texture::set_sampler(ir_dereference *sampler, const glsl_type *type) { assert(sampler != NULL); + assert(type != NULL); this->sampler = sampler; + this->type = type; - switch (sampler->type->sampler_type) { - case GLSL_TYPE_FLOAT: - this->type = glsl_type::vec4_type; - break; - case GLSL_TYPE_INT: - this->type = glsl_type::ivec4_type; - break; - case GLSL_TYPE_UINT: - this->type = glsl_type::uvec4_type; - break; - } + assert(sampler->type->sampler_type == type->base_type); + if (sampler->type->sampler_shadow) + assert(type->vector_elements == 4 || type->vector_elements == 1); + else + assert(type->vector_elements == 4); } -- cgit v1.2.3