diff options
author | Dave Airlie <[email protected]> | 2014-06-11 13:28:32 +1000 |
---|---|---|
committer | Ilia Mirkin <[email protected]> | 2015-02-19 00:28:33 -0500 |
commit | 5cc486b4e3a169fd2d82c463ca793e48343daef3 (patch) | |
tree | 143275fd7beee53c38a5be2ebee8dd618e9efe86 /src/mesa/program | |
parent | bf257d2c909681139f6880555d896745289152e7 (diff) |
mesa: add double uniform support. (v5)
This adds support for the new uniform interfaces
from ARB_gpu_shader_fp64.
v2:
support ARB_separate_shader_objects ProgramUniform*d* (Ian)
don't allow boolean uniforms to be updated (issue 15) (Ian)
v3: fix size_mul
v4: Teach uniform update to take into account double precision (Topi)
v5: add transpose for double case (Ilia)
Signed-off-by: Dave Airlie <[email protected]>
Reviewed-by: Ilia Mirkin <[email protected]>
Diffstat (limited to 'src/mesa/program')
-rw-r--r-- | src/mesa/program/ir_to_mesa.cpp | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 725e51d63c3..f2365206ac5 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -606,6 +606,20 @@ type_size(const struct glsl_type *type) */ return 1; } + break; + case GLSL_TYPE_DOUBLE: + if (type->is_matrix()) { + if (type->vector_elements > 2) + return type->matrix_columns * 2; + else + return type->matrix_columns; + } else { + if (type->vector_elements > 2) + return 2; + else + return 1; + } + break; case GLSL_TYPE_ARRAY: assert(type->length > 0); return type_size(type->fields.array) * type->length; @@ -2385,6 +2399,8 @@ add_uniform_to_shader::visit_field(const glsl_type *type, const char *name, if (type->is_vector() || type->is_scalar()) { size = type->vector_elements; + if (type->is_double()) + size *= 2; } else { size = type_size(type) * 4; } @@ -2489,6 +2505,7 @@ _mesa_associate_uniform_storage(struct gl_context *ctx, enum gl_uniform_driver_format format = uniform_native; unsigned columns = 0; + int dmul = 4 * sizeof(float); switch (storage->type->base_type) { case GLSL_TYPE_UINT: assert(ctx->Const.NativeIntegers); @@ -2500,6 +2517,11 @@ _mesa_associate_uniform_storage(struct gl_context *ctx, (ctx->Const.NativeIntegers) ? uniform_native : uniform_int_float; columns = 1; break; + + case GLSL_TYPE_DOUBLE: + if (storage->type->vector_elements > 2) + dmul *= 2; + /* fallthrough */ case GLSL_TYPE_FLOAT: format = uniform_native; columns = storage->type->matrix_columns; @@ -2524,8 +2546,8 @@ _mesa_associate_uniform_storage(struct gl_context *ctx, } _mesa_uniform_attach_driver_storage(storage, - 4 * sizeof(float) * columns, - 4 * sizeof(float), + dmul * columns, + dmul, format, ¶ms->ParameterValues[i]); |