i965: Use native integer uniforms when the new VS backend is in use.
authorEric Anholt <eric@anholt.net>
Fri, 19 Aug 2011 18:51:43 +0000 (11:51 -0700)
committerEric Anholt <eric@anholt.net>
Tue, 30 Aug 2011 19:09:40 +0000 (12:09 -0700)
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i965/brw_context.c
src/mesa/drivers/dri/i965/brw_context.h
src/mesa/drivers/dri/i965/brw_curbe.c
src/mesa/drivers/dri/i965/brw_vec4_emit.cpp
src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
src/mesa/drivers/dri/i965/gen6_vs_state.c

index 6c2e3e4c770b01efee9c8f58971bd108cef44ffb..6ef0fcb313c4b43371b215b6aef8a3ac5a88f0b4 100644 (file)
@@ -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;
 }
 
index e936a88996035de608fee2e83ae89bac9667def4..21068d9cf735d1c7b9695af17e0fbb7413c66ec8 100644 (file)
@@ -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;
 };
index 960be10006e2be843a3baf8610ca49ce041918cb..b9a4beb12366e843bb9c2cc15386a919d355de41 100644 (file)
@@ -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
index 47031bc998137052beb29126538a4e858065986d..11d0278ccd020735329475c7e239dce7fb83cde6 100644 (file)
@@ -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++;
index b3a07bd053906a7c416459e6cfc59103d221a766..46f826cbfc10f4a9607c08a8d053bb5076e6a62f 100644 (file)
@@ -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]++;
       }
index b94121e8437088ba35e81a2acd0b576eee56aee9..f1123af6c0b07058e6814b0eb2b01f9270f32957 100644 (file)
@@ -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;