svga: encode sample count in resource declarations
authorBrian Paul <brianp@vmware.com>
Mon, 31 Jul 2017 12:40:12 +0000 (06:40 -0600)
committerBrian Paul <brianp@vmware.com>
Wed, 5 Sep 2018 17:22:42 +0000 (11:22 -0600)
No regressions before the corresponding host-side change.

Reviewed-by: Neha Bhende <bhenden@vmware.com>
src/gallium/drivers/svga/include/VGPU10ShaderTokens.h
src/gallium/drivers/svga/svga_shader.c
src/gallium/drivers/svga/svga_shader.h
src/gallium/drivers/svga/svga_tgsi_vgpu10.c

index 4440235890c81bdd4b2e92c8192d3ce66186bf64..1f9746e1cc6946bac001a7307334d7dbccd3e20c 100644 (file)
@@ -267,6 +267,7 @@ typedef union {
    struct {
       unsigned int                     : 11;
       unsigned int resourceDimension   : 5;  /* VGPU10_RESOURCE_DIMENSION */
+      unsigned int sampleCount         : 7;
    };
    struct {
       unsigned int                     : 11;
index c9cc0f739a3b21679c17082ab74b115fbdc67fcb..e16842f2358a6f349ac2b391a49e091aa5486445 100644 (file)
@@ -223,6 +223,9 @@ svga_init_shader_key_common(const struct svga_context *svga,
             }
          }
 
+         assert(view->texture->nr_samples < (1 << 5)); /* 5-bit field */
+         key->tex[i].num_samples = view->texture->nr_samples;
+
          /* If we have a non-alpha view into an svga3d surface with an
           * alpha channel, then explicitly set the alpha channel to 1
           * when sampling. Note that we need to check the
index b703e048b24cc0a177586a2dfafdb05653134e54..b80cf181441be992e72f6f1bfac92abe1cfb2004 100644 (file)
@@ -105,6 +105,7 @@ struct svga_compile_key
       unsigned swizzle_g:3;
       unsigned swizzle_b:3;
       unsigned swizzle_a:3;
+      unsigned num_samples:5;   /**< Up to 16 samples */
    } tex[PIPE_MAX_SAMPLERS];
    /* Note: svga_compile_keys_equal() depends on the variable-size
     * tex[] array being at the end of this structure.
index 4292894056e139e7ef0b6f6bf8a0f0e894d9accf..e7a636f17403400f57b04bfce7a105f8f78a5212 100644 (file)
@@ -3067,6 +3067,7 @@ emit_resource_declarations(struct svga_shader_emitter_v10 *emit)
       opcode0.resourceDimension =
          tgsi_texture_to_resource_dimension(emit->sampler_target[i],
                                             emit->key.tex[i].is_array);
+      opcode0.sampleCount = emit->key.tex[i].num_samples;
       operand0.value = 0;
       operand0.numComponents = VGPU10_OPERAND_0_COMPONENT;
       operand0.operandType = VGPU10_OPERAND_TYPE_RESOURCE;