Mesa (main): microsoft/compiler: Pick a type that matches interpolation mode for structs

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jun 14 14:31:35 UTC 2022


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

Author: Boris Brezillon <boris.brezillon at collabora.com>
Date:   Tue Feb 15 10:04:33 2022 -0800

microsoft/compiler: Pick a type that matches interpolation mode for structs

We can't use linear interpolation on integer types, and varyings using
a struct type might actually contain only fp32 members, in which case
interpolation should happen as requested.

Reviewed-by: Jesse Natalie <jenatali at microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16961>

---

 src/gallium/drivers/d3d12/ci/d3d12-quick_shader.txt | 10 ++--------
 src/microsoft/compiler/dxil_enums.c                 |  2 +-
 src/microsoft/compiler/dxil_signature.c             | 13 +++++++++++--
 3 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/src/gallium/drivers/d3d12/ci/d3d12-quick_shader.txt b/src/gallium/drivers/d3d12/ci/d3d12-quick_shader.txt
index 79dec33ca02..02b65ed1fc8 100644
--- a/src/gallium/drivers/d3d12/ci/d3d12-quick_shader.txt
+++ b/src/gallium/drivers/d3d12/ci/d3d12-quick_shader.txt
@@ -263,10 +263,6 @@ spec/arb_gl_spirv/execution/xfb/vs_two_sets_struct: skip
 spec/arb_gl_spirv/linker/uniform/multisampler: skip
 spec/arb_gl_spirv/linker/uniform/multisampler-array: skip
 spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateatcentroid-array-of-structs: crash
-spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateatcentroid-struct: crash
-spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateatcentroid-struct2: crash
-spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateatoffset-struct: crash
-spec/arb_gpu_shader5/execution/built-in-functions/fs-interpolateatsample-struct: crash
 spec/arb_gpu_shader5/execution/ubo_array_indexing/fs-masked: fail
 spec/arb_gpu_shader5/execution/ubo_array_indexing/fs-nonuniform-control-flow: fail
 spec/arb_gpu_shader5/execution/ubo_array_indexing/vs-nonuniform-control-flow: fail
@@ -517,7 +513,6 @@ spec/arb_gpu_shader_int64/execution/indirect-array-two-accesses: fail
 spec/arb_gpu_shader_int64/execution/inout/vs-out-fs-in-s1/2-s2/2-s3/2-int64_t-location-0: crash
 spec/arb_gpu_shader_int64/execution/inout/vs-out-fs-in-s1/2-s2/2-s3/2-uint64_t-location-0: crash
 spec/arb_separate_shader_objects/execution/layout-location-block-with-struct-member: crash
-spec/arb_separate_shader_objects/execution/layout-location-struct: crash
 spec/arb_separate_shader_objects/execution/layout-location-struct-mixed-with-implicitly-assigned-varying: crash
 spec/arb_separate_shader_objects/linker/pervertex-culldistance-tcs-out-tes: skip
 spec/arb_separate_shader_objects/linker/pervertex-culldistance-tes-out-gs: skip
@@ -589,7 +584,6 @@ spec/arb_tessellation_shader/execution/variable-indexing/tcs-patch-output-array-
 spec/arb_tessellation_shader/execution/variable-indexing/tcs-patch-output-array-vec3-index-wr: crash
 spec/arb_tessellation_shader/execution/variable-indexing/tcs-patch-output-array-vec4-index-wr: crash
 spec/arb_tessellation_shader/execution/variable-indexing/tcs-patch-vec4-index-wr: crash
-spec/arb_tessellation_shader/execution/variable-indexing/tcs-tes-array-in-struct: crash
 spec/arb_tessellation_shader/execution/variable-indexing/tes-both-input-array-float-index-rd: crash
 spec/arb_tessellation_shader/execution/variable-indexing/tes-both-input-array-vec2-index-rd: crash
 spec/arb_tessellation_shader/execution/variable-indexing/tes-both-input-array-vec3-index-rd: crash
@@ -3089,9 +3083,9 @@ spec/oes_viewport_array/viewport-gs-writes-out-of-range: skip
 summary:
        name:  results
        ----  --------
-       pass:    17153
+       pass:    17159
        fail:       44
-      crash:       94
+      crash:       88
        skip:     2925
     timeout:        0
        warn:       25
diff --git a/src/microsoft/compiler/dxil_enums.c b/src/microsoft/compiler/dxil_enums.c
index 8b2e80be703..ce4c0d7199c 100644
--- a/src/microsoft/compiler/dxil_enums.c
+++ b/src/microsoft/compiler/dxil_enums.c
@@ -43,7 +43,7 @@ enum dxil_prog_sig_comp_type dxil_get_prog_sig_comp_type(const struct glsl_type
    case GLSL_TYPE_UINT64: return DXIL_PROG_SIG_COMP_TYPE_UINT64;
    case GLSL_TYPE_INT64: return DXIL_PROG_SIG_COMP_TYPE_SINT64;
    case GLSL_TYPE_BOOL: return DXIL_PROG_SIG_COMP_TYPE_UINT32;
-   case GLSL_TYPE_STRUCT: return DXIL_PROG_SIG_COMP_TYPE_UINT32;
+   case GLSL_TYPE_STRUCT: return DXIL_PROG_SIG_COMP_TYPE_UNKNOWN;
    default:
       debug_printf("unexpected type: %s\n", glsl_get_type_name(type));
       return DXIL_PROG_SIG_COMP_TYPE_UNKNOWN;
diff --git a/src/microsoft/compiler/dxil_signature.c b/src/microsoft/compiler/dxil_signature.c
index 1dfcbd6fd14..2636ff428a2 100644
--- a/src/microsoft/compiler/dxil_signature.c
+++ b/src/microsoft/compiler/dxil_signature.c
@@ -127,8 +127,17 @@ get_additional_semantic_info(nir_shader *s, nir_variable *var, struct semantic_i
       dxil_get_prog_sig_comp_type(type);
 
    bool is_depth = is_depth_output(info->kind);
-   info->sig_comp_type = glsl_type_is_struct(type) ?
-      DXIL_COMP_TYPE_U32 : dxil_get_comp_type(type);
+
+   if (!glsl_type_is_struct(type)) {
+      info->sig_comp_type = dxil_get_comp_type(type);
+   } else if (var->data.interpolation == INTERP_MODE_FLAT) {
+      info->sig_comp_type = DXIL_COMP_TYPE_U32;
+      info->comp_type = DXIL_PROG_SIG_COMP_TYPE_UINT32;
+   } else {
+      info->sig_comp_type = DXIL_COMP_TYPE_F32;
+      info->comp_type = DXIL_PROG_SIG_COMP_TYPE_FLOAT32;
+   }
+
    bool is_gs_input = s->info.stage == MESA_SHADER_GEOMETRY &&
       (var->data.mode & (nir_var_shader_in | nir_var_system_value));
 



More information about the mesa-commit mailing list