i965/gs: Allow primitive id to be a system value
authorJason Ekstrand <jason.ekstrand@intel.com>
Fri, 11 Nov 2016 06:36:39 +0000 (22:36 -0800)
committerJason Ekstrand <jason.ekstrand@intel.com>
Fri, 11 Nov 2016 06:43:59 +0000 (22:43 -0800)
This allows for gl_PrimitiveId to come in as a system value rather than as
an input.  This is the way it will come in from SPIR-V. We keeps the input
path working for now so we don't break GL.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: "13.0" <mesa-stable@lists.freedesktop.org>
src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp

index 10be41b1803f918f8c8249e7d17739b8a0e89935..2f4306ab581d5d7cc1bcbbca2a5b80dbec4ce585 100644 (file)
@@ -626,7 +626,8 @@ brw_compile_gs(const struct brw_compiler *compiler, void *log_data,
    shader = brw_postprocess_nir(shader, compiler->devinfo, is_scalar);
 
    prog_data->include_primitive_id =
-      (shader->info->inputs_read & VARYING_BIT_PRIMITIVE_ID) != 0;
+      (shader->info->inputs_read & VARYING_BIT_PRIMITIVE_ID) ||
+      (shader->info->system_values_read & (1 << SYSTEM_VALUE_PRIMITIVE_ID));
 
    prog_data->invocations = shader->info->gs.invocations;