Mesa (master): ast_function: Remove bogus cases from generate_constructor_matrix.
Kenneth Graunke
kwg at kemper.freedesktop.org
Thu Sep 2 01:58:36 UTC 2010
Module: Mesa
Branch: master
Commit: ee88c4664016b11359c391cc62296bcbfcc5decd
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ee88c4664016b11359c391cc62296bcbfcc5decd
Author: Kenneth Graunke <kenneth at whitecape.org>
Date: Wed Sep 1 14:49:53 2010 -0700
ast_function: Remove bogus cases from generate_constructor_matrix.
There are no integer matrix types, so switching on them is silly.
---
src/glsl/ast_function.cpp | 37 ++++++++-----------------------------
1 files changed, 8 insertions(+), 29 deletions(-)
diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp
index d39c4b1..d7d1b3e 100644
--- a/src/glsl/ast_function.cpp
+++ b/src/glsl/ast_function.cpp
@@ -485,38 +485,17 @@ void
generate_constructor_matrix(const glsl_type *type, ir_constant *initializer,
ir_constant_data *data)
{
- switch (type->base_type) {
- case GLSL_TYPE_UINT:
- case GLSL_TYPE_INT:
- for (unsigned i = 0; i < type->components(); i++)
- data->u[i] = 0;
-
- for (unsigned i = 0; i < type->matrix_columns; i++) {
- /* The array offset of the ith row and column of the matrix.
- */
- const unsigned idx = (i * type->vector_elements) + i;
+ assert(type->base_type == GLSL_TYPE_FLOAT);
+ assert(initializer->type->is_scalar());
- data->u[idx] = initializer->value.u[0];
- }
- break;
+ for (unsigned i = 0; i < type->components(); i++)
+ data->f[i] = 0;
- case GLSL_TYPE_FLOAT:
- for (unsigned i = 0; i < type->components(); i++)
- data->f[i] = 0;
+ for (unsigned i = 0; i < type->matrix_columns; i++) {
+ /* The array offset of the ith row and column of the matrix. */
+ const unsigned idx = (i * type->vector_elements) + i;
- for (unsigned i = 0; i < type->matrix_columns; i++) {
- /* The array offset of the ith row and column of the matrix.
- */
- const unsigned idx = (i * type->vector_elements) + i;
-
- data->f[idx] = initializer->value.f[0];
- }
-
- break;
-
- default:
- assert(!"Should not get here.");
- break;
+ data->f[idx] = initializer->value.f[0];
}
}
More information about the mesa-commit
mailing list