Module: Mesa
Branch: master
Commit: e334e104d0fe8a9704a51ad897cdae34006273da
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e334e104d0fe8a9704a51ad897cdae34006273da

Author: Brian Paul <[email protected]>
Date:   Mon Jul 31 06:40:12 2017 -0600

svga: encode sample count in resource declarations

No regressions before the corresponding host-side change.

Reviewed-by: Neha Bhende <[email protected]>

---

 src/gallium/drivers/svga/include/VGPU10ShaderTokens.h | 1 +
 src/gallium/drivers/svga/svga_shader.c                | 3 +++
 src/gallium/drivers/svga/svga_shader.h                | 1 +
 src/gallium/drivers/svga/svga_tgsi_vgpu10.c           | 1 +
 4 files changed, 6 insertions(+)

diff --git a/src/gallium/drivers/svga/include/VGPU10ShaderTokens.h 
b/src/gallium/drivers/svga/include/VGPU10ShaderTokens.h
index 4440235890..1f9746e1cc 100644
--- a/src/gallium/drivers/svga/include/VGPU10ShaderTokens.h
+++ b/src/gallium/drivers/svga/include/VGPU10ShaderTokens.h
@@ -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;
diff --git a/src/gallium/drivers/svga/svga_shader.c 
b/src/gallium/drivers/svga/svga_shader.c
index c9cc0f739a..e16842f235 100644
--- a/src/gallium/drivers/svga/svga_shader.c
+++ b/src/gallium/drivers/svga/svga_shader.c
@@ -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
diff --git a/src/gallium/drivers/svga/svga_shader.h 
b/src/gallium/drivers/svga/svga_shader.h
index b703e048b2..b80cf18144 100644
--- a/src/gallium/drivers/svga/svga_shader.h
+++ b/src/gallium/drivers/svga/svga_shader.h
@@ -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.
diff --git a/src/gallium/drivers/svga/svga_tgsi_vgpu10.c 
b/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
index 4292894056..e7a636f174 100644
--- a/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
+++ b/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
@@ -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;

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to