glsl/st/mesa: use common system values read field
authorTimothy Arceri <timothy.arceri@collabora.com>
Thu, 20 Oct 2016 05:30:56 +0000 (16:30 +1100)
committerTimothy Arceri <timothy.arceri@collabora.com>
Wed, 26 Oct 2016 03:29:36 +0000 (14:29 +1100)
And set system values read directly in shader_info.

st/mesa changes where:
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/compiler/glsl/ir_set_program_inouts.cpp
src/compiler/shader_info.c
src/mesa/main/mtypes.h
src/mesa/program/prog_to_nir.c
src/mesa/program/program.c
src/mesa/program/programopt.c
src/mesa/state_tracker/st_glsl_to_tgsi.cpp
src/mesa/state_tracker/st_mesa_to_tgsi.c

index d8c4d709217cfb8de2b9bafcc880d0bf3e53e94d..ec589c776d0f8b206668e6b329355c14aa674f05 100644 (file)
@@ -124,7 +124,7 @@ mark(struct gl_program *prog, ir_variable *var, int offset, int len,
             prog->info.fs.uses_sample_qualifier |= var->data.sample;
          }
       } else if (var->data.mode == ir_var_system_value) {
-         prog->SystemValuesRead |= bitfield;
+         prog->info.system_values_read |= bitfield;
       } else {
          assert(var->data.mode == ir_var_shader_out);
          if (is_patch_generic) {
@@ -432,7 +432,7 @@ do_set_program_inouts(exec_list *instructions, struct gl_program *prog,
    prog->info.outputs_read = 0;
    prog->info.patch_inputs_read = 0;
    prog->info.patch_outputs_written = 0;
-   prog->SystemValuesRead = 0;
+   prog->info.system_values_read = 0;
    if (shader_stage == MESA_SHADER_FRAGMENT) {
       prog->info.fs.uses_sample_qualifier = false;
       prog->info.fs.uses_discard = false;
index fcda73a1d914864d23cff27388030d12f8c60dbd..83e40cbedc8d43b0a0bd53669696af8614572217 100644 (file)
@@ -30,6 +30,5 @@ copy_shader_info(const struct gl_shader_program *shader_prog,
 {
    shader_info *info = &sh->Program->info;
 
-   info->system_values_read = sh->Program->SystemValuesRead;
    info->uses_texture_gather = sh->Program->UsesGather;
 }
index 67910de61269c56a471c500c91dc64e4b7c709bf..fc216d011b9f04dad13628a7e3e4aa29ea3abea1 100644 (file)
@@ -1923,7 +1923,6 @@ struct gl_program
    struct shader_info info;
 
    GLbitfield64 SecondaryOutputsWritten; /**< Subset of OutputsWritten outputs written with non-zero index. */
-   GLbitfield SystemValuesRead;   /**< Bitmask of SYSTEM_VALUE_x inputs used */
    GLbitfield TexturesUsed[MAX_COMBINED_TEXTURE_IMAGE_UNITS];  /**< TEXTURE_x_BIT bitmask */
    GLbitfield SamplersUsed;   /**< Bitfield of which samplers are used */
    GLbitfield ShadowSamplers; /**< Texture units used for shadow sampling. */
index 3c62456106c8e94bf889a0b0d8f391cbed73e1f8..08df05dc776c0c4ef309320313c54e803c7a1824 100644 (file)
@@ -1051,7 +1051,6 @@ prog_to_nir(const struct gl_program *prog,
    s->info->num_abos = 0;
    s->info->num_ssbos = 0;
    s->info->num_images = 0;
-   s->info->system_values_read = prog->SystemValuesRead;
    s->info->uses_texture_gather = false;
    s->info->uses_clip_distance_out = false;
    s->info->separate_shader = false;
index 4915a09170f647b1b91673c180cf115037cf47b6..3b7745b905ac980ee9435f874520040fe727fd46 100644 (file)
@@ -521,8 +521,8 @@ _mesa_get_min_invocations_per_fragment(struct gl_context *ctx,
       if (prog->info.fs.uses_sample_qualifier && !ignore_sample_qualifier)
          return MAX2(_mesa_geometric_samples(ctx->DrawBuffer), 1);
 
-      if (prog->SystemValuesRead & (SYSTEM_BIT_SAMPLE_ID |
-                                    SYSTEM_BIT_SAMPLE_POS))
+      if (prog->info.system_values_read & (SYSTEM_BIT_SAMPLE_ID |
+                                           SYSTEM_BIT_SAMPLE_POS))
          return MAX2(_mesa_geometric_samples(ctx->DrawBuffer), 1);
       else if (ctx->Multisample.SampleShading)
          return MAX2(ceil(ctx->Multisample.MinSampleShadingValue *
index b4bbbdae76b39973fea3ae3ed976d23ca1fee7f2..1b50b5b7a0e8c906a8584335dc8ceac8704a56b1 100644 (file)
@@ -596,7 +596,7 @@ _mesa_program_fragment_position_to_sysval(struct gl_program *prog)
       return;
 
    prog->info.inputs_read &= ~BITFIELD64_BIT(VARYING_SLOT_POS);
-   prog->SystemValuesRead |= 1 << SYSTEM_VALUE_FRAG_COORD;
+   prog->info.system_values_read |= 1 << SYSTEM_VALUE_FRAG_COORD;
 
    for (i = 0; i < prog->NumInstructions; i++) {
       struct prog_instruction *inst = prog->Instructions + i;
index 61c3557b7d0fb69124b15f554b5b08c15776710f..5b53c40485d513bd6f845e3ab88ce5181776c0e7 100644 (file)
@@ -6170,7 +6170,7 @@ st_translate_program(
    /* Declare misc input registers
     */
    {
-      GLbitfield sysInputs = proginfo->SystemValuesRead;
+      GLbitfield sysInputs = proginfo->info.system_values_read;
 
       for (i = 0; sysInputs; i++) {
          if (sysInputs & (1 << i)) {
@@ -6520,7 +6520,7 @@ get_mesa_program_tgsi(struct gl_context *ctx,
    /* This must be done before the uniform storage is associated. */
    if (shader->Stage == MESA_SHADER_FRAGMENT &&
        (prog->info.inputs_read & VARYING_BIT_POS ||
-        prog->SystemValuesRead & (1 << SYSTEM_VALUE_FRAG_COORD))) {
+        prog->info.system_values_read & (1 << SYSTEM_VALUE_FRAG_COORD))) {
       static const gl_state_index wposTransformState[STATE_LENGTH] = {
          STATE_INTERNAL, STATE_FB_WPOS_Y_TRANSFORM
       };
index 18948d6a2c12932db066eeac65e439d7f3269f3a..9dc8f224ba399fa9d4c89c04a794b4f990daf705 100644 (file)
@@ -914,7 +914,7 @@ st_translate_mesa_program(
    /* Declare misc input registers
     */
    {
-      GLbitfield sysInputs = program->SystemValuesRead;
+      GLbitfield sysInputs = program->info.system_values_read;
 
       for (i = 0; sysInputs; i++) {
          if (sysInputs & (1 << i)) {