i965: Add a brw->scalar_gs flag controlled by INTEL_SCALAR_GS=1.
authorKenneth Graunke <kenneth@whitecape.org>
Fri, 26 Jun 2015 23:20:21 +0000 (16:20 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Wed, 21 Oct 2015 21:27:53 +0000 (14:27 -0700)
This patch introduces a brw->scalar_gs flag, similar to brw->scalar_vs,
which controls whether or not to use SIMD8 geometry shaders.

For now, we control it via a new environment variable, INTEL_SCALAR_GS.
This provides a convenient way to try it out.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
src/mesa/drivers/dri/i965/brw_compiler.h
src/mesa/drivers/dri/i965/brw_gs.c
src/mesa/drivers/dri/i965/brw_shader.cpp

index 6a9799e578eb8442205f92514de370325b87c47d..742bac4e8efd1e628eef4e8f6330a7626cf8f8fe 100644 (file)
@@ -90,6 +90,7 @@ struct brw_compiler {
    void (*shader_perf_log)(void *, const char *str, ...) PRINTFLIKE(2, 3);
 
    bool scalar_vs;
+   bool scalar_gs;
    struct gl_shader_compiler_options glsl_compiler_options[MESA_SHADER_STAGES];
 };
 
index dc59b06bac10ebc16eb6afdfabe216903d83a910..ed0890f430fa374cc2e74b8e0776f97207d3b9ea 100644 (file)
@@ -57,6 +57,7 @@ brw_codegen_gs_prog(struct brw_context *brw,
                     struct brw_geometry_program *gp,
                     struct brw_gs_prog_key *key)
 {
+   struct brw_compiler *compiler = brw->intelScreen->compiler;
    struct gl_shader *shader = prog->_LinkedShaders[MESA_SHADER_GEOMETRY];
    struct brw_stage_state *stage_state = &brw->gs.base;
    struct brw_gs_prog_data prog_data;
@@ -86,7 +87,7 @@ brw_codegen_gs_prog(struct brw_context *brw,
    prog_data.base.base.nr_image_params = gs->NumImages;
 
    brw_nir_setup_glsl_uniforms(gp->program.Base.nir, prog, &gp->program.Base,
-                               &prog_data.base.base, false);
+                               &prog_data.base.base, compiler->scalar_gs);
 
    GLbitfield64 outputs_written = gp->program.Base.OutputsWritten;
 
index d910e479c9d77f36e6bbd6f4ebad9d14297fe349..0ac4f2f6e0dfd2bb42c5edb3f279519867bbea99 100644 (file)
@@ -79,6 +79,8 @@ is_scalar_shader_stage(const struct brw_compiler *compiler, int stage)
    case MESA_SHADER_FRAGMENT:
    case MESA_SHADER_COMPUTE:
       return true;
+   case MESA_SHADER_GEOMETRY:
+      return compiler->scalar_gs;
    case MESA_SHADER_VERTEX:
       return compiler->scalar_vs;
    default:
@@ -101,6 +103,9 @@ brw_compiler_create(void *mem_ctx, const struct brw_device_info *devinfo)
    if (devinfo->gen >= 8 && !(INTEL_DEBUG & DEBUG_VEC4VS))
       compiler->scalar_vs = true;
 
+   if (devinfo->gen >= 8 && brw_env_var_as_boolean("INTEL_SCALAR_GS", false))
+      compiler->scalar_gs = true;
+
    nir_shader_compiler_options *nir_options =
       rzalloc(compiler, nir_shader_compiler_options);
    nir_options->native_integers = true;