From 55b7fbb70ffc1f4def5c3ded63c3ef569e693731 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 19 Aug 2011 11:51:43 -0700 Subject: i965: Use native integer uniforms when the new VS backend is in use. Reviewed-by: Kenneth Graunke --- src/mesa/drivers/dri/i965/brw_context.c | 6 ++++++ src/mesa/drivers/dri/i965/brw_context.h | 2 -- src/mesa/drivers/dri/i965/brw_curbe.c | 3 +-- src/mesa/drivers/dri/i965/brw_vec4_emit.cpp | 1 - src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 29 +++++--------------------- src/mesa/drivers/dri/i965/gen6_vs_state.c | 3 +-- 6 files changed, 13 insertions(+), 31 deletions(-) (limited to 'src/mesa/drivers/dri') diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index 6c2e3e4c770..6ef0fcb313c 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -250,6 +250,12 @@ GLboolean brwCreateContext( int api, brw->new_vs_backend = (getenv("INTEL_NEW_VS") != NULL); + /* If we're using the new shader backend, we require integer uniforms + * stored as actual integers. + */ + if (brw->new_vs_backend) + ctx->Const.NativeIntegers = true; + return GL_TRUE; } diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index e936a889960..21068d9cf73 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -321,9 +321,7 @@ struct brw_vs_prog_data { GLuint urb_entry_size; const float *param[MAX_UNIFORMS * 4]; /* should be: BRW_MAX_CURBE */ - enum param_conversion param_convert[MAX_UNIFORMS * 4]; const float *pull_param[MAX_UNIFORMS * 4]; - enum param_conversion pull_param_convert[MAX_UNIFORMS * 4]; bool uses_new_param_layout; }; diff --git a/src/mesa/drivers/dri/i965/brw_curbe.c b/src/mesa/drivers/dri/i965/brw_curbe.c index 960be10006e..b9a4beb1236 100644 --- a/src/mesa/drivers/dri/i965/brw_curbe.c +++ b/src/mesa/drivers/dri/i965/brw_curbe.c @@ -246,8 +246,7 @@ static void prepare_constant_buffer(struct brw_context *brw) if (brw->vs.prog_data->uses_new_param_layout) { for (i = 0; i < brw->vs.prog_data->nr_params; i++) { - buf[offset + i] = convert_param(brw->vs.prog_data->param_convert[i], - brw->vs.prog_data->param[i]); + buf[offset + i] = *brw->vs.prog_data->param[i]; } } else { /* Load the subset of push constants that will get used when diff --git a/src/mesa/drivers/dri/i965/brw_vec4_emit.cpp b/src/mesa/drivers/dri/i965/brw_vec4_emit.cpp index 47031bc9981..11d0278ccd0 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4_emit.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4_emit.cpp @@ -120,7 +120,6 @@ vec4_visitor::setup_uniforms(int reg) unsigned int slot = this->uniforms * 4 + i; c->prog_data.param[slot] = NULL; - c->prog_data.param_convert[slot] = PARAM_CONVERT_ZERO; } this->uniforms++; diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp index b3a07bd0539..46f826cbfc1 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp @@ -362,32 +362,14 @@ vec4_visitor::setup_uniform_values(int loc, const glsl_type *type) case GLSL_TYPE_INT: case GLSL_TYPE_BOOL: for (unsigned int i = 0; i < type->vector_elements; i++) { - int slot = this->uniforms * 4 + i; - switch (type->base_type) { - case GLSL_TYPE_FLOAT: - c->prog_data.param_convert[slot] = PARAM_NO_CONVERT; - break; - case GLSL_TYPE_UINT: - c->prog_data.param_convert[slot] = PARAM_CONVERT_F2U; - break; - case GLSL_TYPE_INT: - c->prog_data.param_convert[slot] = PARAM_CONVERT_F2I; - break; - case GLSL_TYPE_BOOL: - c->prog_data.param_convert[slot] = PARAM_CONVERT_F2B; - break; - default: - assert(!"not reached"); - c->prog_data.param_convert[slot] = PARAM_NO_CONVERT; - break; - } - c->prog_data.param[slot] = &values[i]; + c->prog_data.param[this->uniforms * 4 + i] = &values[i]; } + /* Set up pad elements to get things aligned to a vec4 boundary. */ for (unsigned int i = type->vector_elements; i < 4; i++) { - c->prog_data.param_convert[this->uniforms * 4 + i] = - PARAM_CONVERT_ZERO; - c->prog_data.param[this->uniforms * 4 + i] = NULL; + static float zero = 0; + + c->prog_data.param[this->uniforms * 4 + i] = &zero; } this->uniform_size[this->uniforms] = type->vector_elements; @@ -448,7 +430,6 @@ vec4_visitor::setup_builtin_uniform_values(ir_variable *ir) last_swiz = swiz; c->prog_data.param[this->uniforms * 4 + j] = &values[swiz]; - c->prog_data.param_convert[this->uniforms * 4 + j] = PARAM_NO_CONVERT; if (swiz <= last_swiz) this->uniform_size[this->uniforms]++; } diff --git a/src/mesa/drivers/dri/i965/gen6_vs_state.c b/src/mesa/drivers/dri/i965/gen6_vs_state.c index b94121e8437..f1123af6c0b 100644 --- a/src/mesa/drivers/dri/i965/gen6_vs_state.c +++ b/src/mesa/drivers/dri/i965/gen6_vs_state.c @@ -83,8 +83,7 @@ gen6_prepare_vs_push_constants(struct brw_context *brw) if (brw->vs.prog_data->uses_new_param_layout) { for (i = 0; i < brw->vs.prog_data->nr_params; i++) { - *param = convert_param(brw->vs.prog_data->param_convert[i], - brw->vs.prog_data->param[i]); + *param = *brw->vs.prog_data->param[i]; param++; } params_uploaded += brw->vs.prog_data->nr_params / 4; -- cgit v1.2.3