Mesa (main): d3d12: Stop trying to set D3D12_DIRTY_SHADER during bindings

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jan 11 01:48:38 UTC 2022


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

Author: Jesse Natalie <jenatali at microsoft.com>
Date:   Fri Dec 31 13:47:04 2021 -0800

d3d12: Stop trying to set D3D12_DIRTY_SHADER during bindings

We don't key off of it to try to figure out if we need to produce
a new shader variant, so there's no need to set it when changing
properties that feed into variants. If we do have a new shader or
variant at draw time, we'll produce a new PSO without this.

Reviewed-by: Sil Vilerino <sivileri at microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14367>

---

 src/gallium/drivers/d3d12/d3d12_context.cpp | 17 ++---------------
 1 file changed, 2 insertions(+), 15 deletions(-)

diff --git a/src/gallium/drivers/d3d12/d3d12_context.cpp b/src/gallium/drivers/d3d12/d3d12_context.cpp
index 9fe45130a46..0874b546d37 100644
--- a/src/gallium/drivers/d3d12/d3d12_context.cpp
+++ b/src/gallium/drivers/d3d12/d3d12_context.cpp
@@ -695,7 +695,6 @@ d3d12_bind_sampler_states(struct pipe_context *pctx,
                           void **samplers)
 {
    struct d3d12_context *ctx = d3d12_context(pctx);
-   bool shader_state_dirty = false;
 
 #define STATIC_ASSERT_PIPE_EQUAL_COMP_FUNC(X) \
    static_assert((enum compare_func)PIPE_FUNC_##X == COMPARE_FUNC_##X, #X " needs switch case");
@@ -715,11 +714,6 @@ d3d12_bind_sampler_states(struct pipe_context *pctx,
       ctx->samplers[shader][start_slot + i] = sampler;
       dxil_wrap_sampler_state &wrap = ctx->tex_wrap_states[shader][start_slot + i];
       if (sampler) {
-         shader_state_dirty |= wrap.wrap[0] != sampler->wrap_s ||
-                               wrap.wrap[1] != sampler->wrap_t ||
-                               wrap.wrap[2] != sampler->wrap_r;
-         shader_state_dirty |= !!memcmp(wrap.border_color, sampler->border_color, 4 * sizeof(float));
-
          wrap.wrap[0] = sampler->wrap_s;
          wrap.wrap[1] = sampler->wrap_t;
          wrap.wrap[2] = sampler->wrap_r;
@@ -735,8 +729,6 @@ d3d12_bind_sampler_states(struct pipe_context *pctx,
 
    ctx->num_samplers[shader] = start_slot + num_samplers;
    ctx->shader_dirty[shader] |= D3D12_SHADER_DIRTY_SAMPLERS;
-   if (shader_state_dirty)
-      ctx->state_dirty |= D3D12_DIRTY_SHADER;
 }
 
 static void
@@ -1592,7 +1584,7 @@ d3d12_set_shader_images(struct pipe_context *pctx,
          pipe_resource_reference(&slot->resource, NULL);
       }
 
-      enum pipe_format emulation_format = PIPE_FORMAT_NONE;
+      ctx->image_view_emulation_formats[shader][i] = PIPE_FORMAT_NONE;
       if (i < count && images && images[i].resource) {
          pipe_resource_reference(&slot->resource, images[i].resource);
          *slot = images[i];
@@ -1603,16 +1595,11 @@ d3d12_set_shader_images(struct pipe_context *pctx,
              d3d12_get_typeless_format(images[i].format) !=
              d3d12_get_typeless_format(images[i].resource->format)) {
             /* Can't use D3D casting, have to use shader lowering instead */
-            emulation_format =
+            ctx->image_view_emulation_formats[shader][i] =
                get_shader_image_emulation_format(images[i].resource->format);
          }
       } else
          memset(slot, 0, sizeof(*slot));
-
-      if (ctx->image_view_emulation_formats[shader][i] != emulation_format) {
-         ctx->image_view_emulation_formats[shader][i] = emulation_format;
-         ctx->state_dirty |= D3D12_DIRTY_SHADER;
-      }
    }
 
    if (images) {



More information about the mesa-commit mailing list