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

Author: Erik Faye-Lund <erik.faye-l...@collabora.com>
Date:   Wed Nov 15 10:13:19 2023 +0100

d3d12: do not handle PIPE_SWIZZLE_NONE from sampler-view

This shouldn't be possible, so not need to handle it.

Reviewed-by: Jesse Natalie <jenat...@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26192>

---

 src/gallium/drivers/d3d12/d3d12_context.cpp | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/src/gallium/drivers/d3d12/d3d12_context.cpp 
b/src/gallium/drivers/d3d12/d3d12_context.cpp
index 97a3f14bb40..db9e8a54cbb 100644
--- a/src/gallium/drivers/d3d12/d3d12_context.cpp
+++ b/src/gallium/drivers/d3d12/d3d12_context.cpp
@@ -839,7 +839,7 @@ view_dimension(enum pipe_texture_target target, unsigned 
samples)
 }
 
 static D3D12_SHADER_COMPONENT_MAPPING
-component_mapping(enum pipe_swizzle swizzle, D3D12_SHADER_COMPONENT_MAPPING id)
+component_mapping(enum pipe_swizzle swizzle)
 {
    switch (swizzle) {
    case PIPE_SWIZZLE_X: return 
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_0;
@@ -848,7 +848,6 @@ component_mapping(enum pipe_swizzle swizzle, 
D3D12_SHADER_COMPONENT_MAPPING id)
    case PIPE_SWIZZLE_W: return 
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_3;
    case PIPE_SWIZZLE_0: return D3D12_SHADER_COMPONENT_MAPPING_FORCE_VALUE_0;
    case PIPE_SWIZZLE_1: return D3D12_SHADER_COMPONENT_MAPPING_FORCE_VALUE_1;
-   case PIPE_SWIZZLE_NONE: return id;
    default:
       unreachable("unexpected swizzle");
    }
@@ -877,10 +876,10 @@ d3d12_init_sampler_view_descriptor(struct 
d3d12_sampler_view *sampler_view)
    }
 
    desc.Shader4ComponentMapping = D3D12_ENCODE_SHADER_4_COMPONENT_MAPPING(
-      component_mapping((pipe_swizzle)sampler_view->swizzle_override_r, 
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_0),
-      component_mapping((pipe_swizzle)sampler_view->swizzle_override_g, 
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_1),
-      component_mapping((pipe_swizzle)sampler_view->swizzle_override_b, 
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_2),
-      component_mapping((pipe_swizzle)sampler_view->swizzle_override_a, 
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_3)
+      component_mapping((pipe_swizzle)sampler_view->swizzle_override_r),
+      component_mapping((pipe_swizzle)sampler_view->swizzle_override_g),
+      component_mapping((pipe_swizzle)sampler_view->swizzle_override_b),
+      component_mapping((pipe_swizzle)sampler_view->swizzle_override_a)
    );
 
    uint64_t offset = 0;

Reply via email to