diff options
author | Dave Airlie <[email protected]> | 2015-02-05 12:11:58 +0200 |
---|---|---|
committer | Ilia Mirkin <[email protected]> | 2015-02-19 00:28:35 -0500 |
commit | 37730721696a0644242af1a96112381052501b18 (patch) | |
tree | 0ea8c1a20151904bbf8f1e9a2dfd9617e1133432 /src/glsl | |
parent | 7aa3ffe2c5411d3cb2eee9f03ad1a92cb3629527 (diff) |
glsl: Linking support for doubles
Signed-off-by: Dave Airlie <[email protected]>
Reviewed-by: Ian Romanick <[email protected]>
Reviewed-by: Ilia Mirkin <[email protected]>
Diffstat (limited to 'src/glsl')
-rw-r--r-- | src/glsl/link_uniform_initializers.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/glsl/link_uniform_initializers.cpp b/src/glsl/link_uniform_initializers.cpp index f6a60bce993..69073841ea4 100644 --- a/src/glsl/link_uniform_initializers.cpp +++ b/src/glsl/link_uniform_initializers.cpp @@ -75,6 +75,11 @@ copy_constant_to_storage(union gl_constant_value *storage, case GLSL_TYPE_FLOAT: storage[i].f = val->value.f[i]; break; + case GLSL_TYPE_DOUBLE: + /* XXX need to check on big-endian */ + storage[i * 2].u = *(uint32_t *)&val->value.d[i]; + storage[i * 2 + 1].u = *(((uint32_t *)&val->value.d[i]) + 1); + break; case GLSL_TYPE_BOOL: storage[i].b = val->value.b[i] ? boolean_true : 0; break; @@ -200,6 +205,7 @@ set_uniform_initializer(void *mem_ctx, gl_shader_program *prog, val->array_elements[0]->type->base_type; const unsigned int elements = val->array_elements[0]->type->components(); unsigned int idx = 0; + unsigned dmul = (base_type == GLSL_TYPE_DOUBLE) ? 2 : 1; assert(val->type->length >= storage->array_elements); for (unsigned int i = 0; i < storage->array_elements; i++) { @@ -209,7 +215,7 @@ set_uniform_initializer(void *mem_ctx, gl_shader_program *prog, elements, boolean_true); - idx += elements; + idx += elements * dmul; } } else { copy_constant_to_storage(storage->storage, |