diff options
author | marha <marha@users.sourceforge.net> | 2014-08-22 21:55:11 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2014-08-22 21:55:11 +0200 |
commit | 6c0c95d6045d2d2b4e6a3a2f11457850031c57bc (patch) | |
tree | 32dfc45d688fa198bf0d41597e82589890012cf1 /mesalib/src/glsl/link_uniform_initializers.cpp | |
parent | fdbedba4d50e1b28b0249c83ba11c029f096e400 (diff) | |
download | vcxsrv-6c0c95d6045d2d2b4e6a3a2f11457850031c57bc.tar.gz vcxsrv-6c0c95d6045d2d2b4e6a3a2f11457850031c57bc.tar.bz2 vcxsrv-6c0c95d6045d2d2b4e6a3a2f11457850031c57bc.zip |
fontconfig libxcb/xcb-proto mesa xkeyboard-config git update 22 Aug 2014
libxcb/xcb-proto commit 8e3db42d67a0035bb16d16da28bd5eea7a269178
xkeyboard-config commit 10fce2c2baae471795d069f3a5f1307eedb9ff0a
fontconfig commit 286cdc9c10b0453c25950103b6a1f7170d15bfdc
mesa commit 97d03b9366bfa55b27feb92aa5afacd9c5f6f421
Diffstat (limited to 'mesalib/src/glsl/link_uniform_initializers.cpp')
-rw-r--r-- | mesalib/src/glsl/link_uniform_initializers.cpp | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/mesalib/src/glsl/link_uniform_initializers.cpp b/mesalib/src/glsl/link_uniform_initializers.cpp index c6fe6a9ad..f6a60bce9 100644 --- a/mesalib/src/glsl/link_uniform_initializers.cpp +++ b/mesalib/src/glsl/link_uniform_initializers.cpp @@ -60,7 +60,8 @@ void copy_constant_to_storage(union gl_constant_value *storage, const ir_constant *val, const enum glsl_base_type base_type, - const unsigned int elements) + const unsigned int elements, + unsigned int boolean_true) { for (unsigned int i = 0; i < elements; i++) { switch (base_type) { @@ -75,7 +76,7 @@ copy_constant_to_storage(union gl_constant_value *storage, storage[i].f = val->value.f[i]; break; case GLSL_TYPE_BOOL: - storage[i].b = int(val->value.b[i]); + storage[i].b = val->value.b[i] ? boolean_true : 0; break; case GLSL_TYPE_ARRAY: case GLSL_TYPE_STRUCT: @@ -156,7 +157,7 @@ set_block_binding(gl_shader_program *prog, const char *block_name, int binding) void set_uniform_initializer(void *mem_ctx, gl_shader_program *prog, const char *name, const glsl_type *type, - ir_constant *val) + ir_constant *val, unsigned int boolean_true) { if (type->is_record()) { ir_constant *field_constant; @@ -168,7 +169,7 @@ set_uniform_initializer(void *mem_ctx, gl_shader_program *prog, const char *field_name = ralloc_asprintf(mem_ctx, "%s.%s", name, type->fields.structure[i].name); set_uniform_initializer(mem_ctx, prog, field_name, - field_type, field_constant); + field_type, field_constant, boolean_true); field_constant = (ir_constant *)field_constant->next; } return; @@ -179,7 +180,8 @@ set_uniform_initializer(void *mem_ctx, gl_shader_program *prog, const char *element_name = ralloc_asprintf(mem_ctx, "%s[%d]", name, i); set_uniform_initializer(mem_ctx, prog, element_name, - element_type, val->array_elements[i]); + element_type, val->array_elements[i], + boolean_true); } return; } @@ -204,7 +206,8 @@ set_uniform_initializer(void *mem_ctx, gl_shader_program *prog, copy_constant_to_storage(& storage->storage[idx], val->array_elements[i], base_type, - elements); + elements, + boolean_true); idx += elements; } @@ -212,7 +215,8 @@ set_uniform_initializer(void *mem_ctx, gl_shader_program *prog, copy_constant_to_storage(storage->storage, val, val->type->base_type, - val->type->components()); + val->type->components(), + boolean_true); if (storage->type->is_sampler()) { for (int sh = 0; sh < MESA_SHADER_STAGES; sh++) { @@ -232,7 +236,8 @@ set_uniform_initializer(void *mem_ctx, gl_shader_program *prog, } void -link_set_uniform_initializers(struct gl_shader_program *prog) +link_set_uniform_initializers(struct gl_shader_program *prog, + unsigned int boolean_true) { void *mem_ctx = NULL; @@ -254,8 +259,7 @@ link_set_uniform_initializers(struct gl_shader_program *prog) if (var->data.explicit_binding) { const glsl_type *const type = var->type; - if (type->is_sampler() - || (type->is_array() && type->fields.array->is_sampler())) { + if (type->without_array()->is_sampler()) { linker::set_sampler_binding(prog, var->name, var->data.binding); } else if (var->is_in_uniform_block()) { const glsl_type *const iface_type = var->get_interface_type(); @@ -301,7 +305,8 @@ link_set_uniform_initializers(struct gl_shader_program *prog) } } else if (var->constant_value) { linker::set_uniform_initializer(mem_ctx, prog, var->name, - var->type, var->constant_value); + var->type, var->constant_value, + boolean_true); } } } |