anv/lower_push_constants: Stop treating scalar specially
authorJason Ekstrand <jason.ekstrand@intel.com>
Tue, 19 Apr 2016 00:17:31 +0000 (17:17 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Wed, 20 Apr 2016 16:14:47 +0000 (09:14 -0700)
All of the code that did something special based on vec4 vs. scalar is
bogus.  In the backend, everything is now in units of bytes and the vec4
backend can handle full std140 packing so we don't need to do anything
special anymore.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94998

src/intel/vulkan/anv_nir.h
src/intel/vulkan/anv_nir_lower_push_constants.c
src/intel/vulkan/anv_pipeline.c

index 606fd1c0565e3d2e3bfced1743d8cd0c5a90aa66..567de6c2d08ff6d77eff81c0a78f03f0084a9bb8 100644 (file)
@@ -30,7 +30,7 @@
 extern "C" {
 #endif
 
-void anv_nir_lower_push_constants(nir_shader *shader, bool is_scalar);
+void anv_nir_lower_push_constants(nir_shader *shader);
 
 void anv_nir_apply_dynamic_offsets(struct anv_pipeline *pipeline,
                                    nir_shader *shader,
index 53cd3d737937d97380238fc3c925cc38e241fc3a..44a1a3fde2775d2436f02496fc76275f4e9384db 100644 (file)
 
 #include "anv_nir.h"
 
-struct lower_push_constants_state {
-   nir_shader *shader;
-   bool is_scalar;
-};
-
 static bool
 lower_push_constants_block(nir_block *block, void *void_state)
 {
-   struct lower_push_constants_state *state = void_state;
-
    nir_foreach_instr(block, instr) {
       if (instr->type != nir_instr_type_intrinsic)
          continue;
@@ -43,9 +36,6 @@ lower_push_constants_block(nir_block *block, void *void_state)
       if (intrin->intrinsic != nir_intrinsic_load_push_constant)
          continue;
 
-      /* This wont work for vec4 stages. */
-      assert(state->is_scalar);
-
       assert(intrin->const_index[0] % 4 == 0);
       assert(intrin->const_index[1] == 128);
 
@@ -57,21 +47,10 @@ lower_push_constants_block(nir_block *block, void *void_state)
 }
 
 void
-anv_nir_lower_push_constants(nir_shader *shader, bool is_scalar)
+anv_nir_lower_push_constants(nir_shader *shader)
 {
-   struct lower_push_constants_state state = {
-      .shader = shader,
-      .is_scalar = is_scalar,
-   };
-
    nir_foreach_function(shader, function) {
       if (function->impl)
-         nir_foreach_block(function->impl, lower_push_constants_block, &state);
+         nir_foreach_block(function->impl, lower_push_constants_block, NULL);
    }
-
-   assert(shader->num_uniforms % 4 == 0);
-   if (is_scalar)
-      shader->num_uniforms /= 4;
-   else
-      shader->num_uniforms = DIV_ROUND_UP(shader->num_uniforms, 16);
 }
index a215a377a967a0eded04f044a5c50102d86057bd..007c58be4366c41b48bb7f902fa2df46d84df539 100644 (file)
@@ -313,16 +313,13 @@ anv_pipeline_compile(struct anv_pipeline *pipeline,
                      struct brw_stage_prog_data *prog_data,
                      struct anv_pipeline_bind_map *map)
 {
-   const struct brw_compiler *compiler =
-      pipeline->device->instance->physicalDevice.compiler;
-
    nir_shader *nir = anv_shader_compile_to_nir(pipeline->device,
                                                module, entrypoint, stage,
                                                spec_info);
    if (nir == NULL)
       return NULL;
 
-   anv_nir_lower_push_constants(nir, compiler->scalar_stage[stage]);
+   anv_nir_lower_push_constants(nir);
 
    /* Figure out the number of parameters */
    prog_data->nr_params = 0;