summaryrefslogtreecommitdiffstats
path: root/src/glsl/ir.cpp
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2011-02-25 14:29:36 -0800
committerKenneth Graunke <[email protected]>2011-03-14 13:03:50 -0700
commit233b88eab9d8095523ebae3c4be1dbf2e2bd856a (patch)
tree7e39ea474572d67c90e82b16ae6cd029224e28d4 /src/glsl/ir.cpp
parentcb3317b85a9b8916317cb733ef4e6f13eaf0d890 (diff)
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.
Diffstat (limited to 'src/glsl/ir.cpp')
-rw-r--r--src/glsl/ir.cpp20
1 files changed, 8 insertions, 12 deletions
diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp
index fc356ba5275..a55b7ef6536 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);
}