From 2bb2219aa71ea3f6c01a14a6aa60d6d42093afb1 Mon Sep 17 00:00:00 2001 From: Jesse Natalie Date: Tue, 28 Dec 2021 16:31:48 -0800 Subject: [PATCH] d3d12: Set appropriate caps for shader images Note that currently there's no emulation if the D3D12 driver doesn't support the "UAV typed load" feature for all of the GL required formats. This is not a required D3D12 feature, so this support won't light up on all D3D12 hardware. Reviewed-by: Sil Vilerino Part-of: --- .../drivers/d3d12/ci/d3d12-quick_gl.txt | 66 ++++++++++++------- .../drivers/d3d12/ci/d3d12-quick_shader.txt | 14 +--- src/gallium/drivers/d3d12/d3d12_screen.cpp | 17 ++++- 3 files changed, 59 insertions(+), 38 deletions(-) diff --git a/src/gallium/drivers/d3d12/ci/d3d12-quick_gl.txt b/src/gallium/drivers/d3d12/ci/d3d12-quick_gl.txt index 576e5a72eed..864c8905449 100644 --- a/src/gallium/drivers/d3d12/ci/d3d12-quick_gl.txt +++ b/src/gallium/drivers/d3d12/ci/d3d12-quick_gl.txt @@ -1954,7 +1954,6 @@ spec/arb_sample_shading/samplemask 6 all: skip spec/arb_sample_shading/samplemask 8: skip spec/arb_sample_shading/samplemask 8 all: skip spec/arb_seamless_cube_map/arb_seamless_cubemap: fail -spec/arb_separate_shader_objects/atomic counter: skip spec/arb_separate_shader_objects/mix-and-match-tcs-tes: skip spec/arb_separate_shader_objects/programuniform coverage/double matrices: skip spec/arb_separate_shader_objects/programuniform coverage/double scalar and vectors: skip @@ -1993,26 +1992,43 @@ spec/arb_shader_draw_parameters/drawid-single-draw-primitive-restart: skip spec/arb_shader_draw_parameters/drawid-vertexid: skip spec/arb_shader_draw_parameters/vertexid-zerobased: skip spec/arb_shader_draw_parameters/vertexid-zerobased-indirect: skip -spec/arb_shader_image_load_store/atomicity: skip -spec/arb_shader_image_load_store/bitcast: skip -spec/arb_shader_image_load_store/coherency: skip -spec/arb_shader_image_load_store/dead-fragments: skip -spec/arb_shader_image_load_store/early-z: skip -spec/arb_shader_image_load_store/host-mem-barrier: skip -spec/arb_shader_image_load_store/indexing: skip -spec/arb_shader_image_load_store/invalid: skip -spec/arb_shader_image_load_store/layer: skip -spec/arb_shader_image_load_store/level: skip -spec/arb_shader_image_load_store/max-images: skip -spec/arb_shader_image_load_store/max-size: skip -spec/arb_shader_image_load_store/minmax: skip -spec/arb_shader_image_load_store/qualifiers: skip -spec/arb_shader_image_load_store/restrict: skip -spec/arb_shader_image_load_store/semantics: skip -spec/arb_shader_image_load_store/shader-mem-barrier: skip -spec/arb_shader_image_load_store/state: skip -spec/arb_shader_image_load_store/unused: skip -spec/arb_shader_image_size/builtin: skip +spec/arb_shader_image_load_store/host-mem-barrier/indirect/raw/full barrier test/16x16: skip +spec/arb_shader_image_load_store/host-mem-barrier/indirect/raw/full barrier test/4x4: skip +spec/arb_shader_image_load_store/host-mem-barrier/indirect/raw/full barrier test/64x64: skip +spec/arb_shader_image_load_store/host-mem-barrier/indirect/raw/one bit barrier test/16x16: skip +spec/arb_shader_image_load_store/host-mem-barrier/indirect/raw/one bit barrier test/4x4: skip +spec/arb_shader_image_load_store/host-mem-barrier/indirect/raw/one bit barrier test/64x64: skip +spec/arb_shader_image_load_store/host-mem-barrier/transform feedback/waw/full barrier test/16x16: skip +spec/arb_shader_image_load_store/host-mem-barrier/transform feedback/waw/full barrier test/4x4: skip +spec/arb_shader_image_load_store/host-mem-barrier/transform feedback/waw/full barrier test/64x64: skip +spec/arb_shader_image_load_store/host-mem-barrier/transform feedback/waw/one bit barrier test/16x16: skip +spec/arb_shader_image_load_store/host-mem-barrier/transform feedback/waw/one bit barrier test/4x4: skip +spec/arb_shader_image_load_store/host-mem-barrier/transform feedback/waw/one bit barrier test/64x64: skip +spec/arb_shader_image_load_store/invalid/imageload/address bounds test/image1d/rgba32f: fail +spec/arb_shader_image_load_store/invalid/imageload/address bounds test/image1darray/rgba32f: fail +spec/arb_shader_image_load_store/invalid/imageload/address bounds test/image2d/rgb10_a2: fail +spec/arb_shader_image_load_store/invalid/imageload/address bounds test/image2d/rgb10_a2ui: fail +spec/arb_shader_image_load_store/invalid/imageload/address bounds test/image2d/rgba16: fail +spec/arb_shader_image_load_store/invalid/imageload/address bounds test/image2d/rgba16_snorm: fail +spec/arb_shader_image_load_store/invalid/imageload/address bounds test/image2d/rgba16f: fail +spec/arb_shader_image_load_store/invalid/imageload/address bounds test/image2d/rgba16i: fail +spec/arb_shader_image_load_store/invalid/imageload/address bounds test/image2d/rgba16ui: fail +spec/arb_shader_image_load_store/invalid/imageload/address bounds test/image2d/rgba32f: fail +spec/arb_shader_image_load_store/invalid/imageload/address bounds test/image2d/rgba32i: fail +spec/arb_shader_image_load_store/invalid/imageload/address bounds test/image2d/rgba32ui: fail +spec/arb_shader_image_load_store/invalid/imageload/address bounds test/image2d/rgba8: fail +spec/arb_shader_image_load_store/invalid/imageload/address bounds test/image2d/rgba8_snorm: fail +spec/arb_shader_image_load_store/invalid/imageload/address bounds test/image2d/rgba8i: fail +spec/arb_shader_image_load_store/invalid/imageload/address bounds test/image2d/rgba8ui: fail +spec/arb_shader_image_load_store/invalid/imageload/address bounds test/image2darray/rgba32f: fail +spec/arb_shader_image_load_store/invalid/imageload/address bounds test/image2drect/rgba32f: fail +spec/arb_shader_image_load_store/invalid/imageload/address bounds test/image3d/rgba32f: fail +spec/arb_shader_image_load_store/invalid/imageload/address bounds test/imagebuffer/rgba32f: fail +spec/arb_shader_image_load_store/invalid/imageload/address bounds test/imagecube/rgba32f: fail +spec/arb_shader_image_load_store/invalid/imageload/address bounds test/imagecubearray/rgba32f: fail +spec/arb_shader_image_load_store/max-size/imagecube max size test/16384x16384x6x1: skip +spec/arb_shader_image_load_store/max-size/imagecubearray max size test/16384x16384x6x1: skip +spec/arb_shader_image_load_store/semantics/imageatomicmax/vertex shader/r32ui/image1d test: fail spec/arb_shader_storage_buffer_object/minmax: skip spec/arb_shader_texture_image_samples/builtin-image: skip spec/arb_shader_texture_image_samples/texturesamples/fs-isampler2dms-16: skip @@ -4314,10 +4330,10 @@ wgl/wgl-sanity: skip summary: name: results ---- -------- - pass: 14720 - fail: 1177 + pass: 15927 + fail: 1200 crash: 68 - skip: 3048 + skip: 3041 timeout: 0 warn: 10 incomplete: 0 @@ -4326,4 +4342,4 @@ summary: changes: 0 fixes: 0 regressions: 0 - total: 19033 + total: 20256 diff --git a/src/gallium/drivers/d3d12/ci/d3d12-quick_shader.txt b/src/gallium/drivers/d3d12/ci/d3d12-quick_shader.txt index 6b360e7bc2f..a464f898510 100644 --- a/src/gallium/drivers/d3d12/ci/d3d12-quick_shader.txt +++ b/src/gallium/drivers/d3d12/ci/d3d12-quick_shader.txt @@ -71,10 +71,6 @@ spec/amd_shader_trinary_minmax/execution/built-in-functions/tcs-min3-uvec4-uvec4 spec/amd_shader_trinary_minmax/execution/built-in-functions/tcs-min3-vec2-vec2-vec2: skip spec/amd_shader_trinary_minmax/execution/built-in-functions/tcs-min3-vec3-vec3-vec3: skip spec/amd_shader_trinary_minmax/execution/built-in-functions/tcs-min3-vec4-vec4-vec4: skip -spec/arb_arrays_of_arrays/execution/image_store/basic-imagestore-const-uniform-index: skip -spec/arb_arrays_of_arrays/execution/image_store/basic-imagestore-mixed-const-non-const-uniform-index: skip -spec/arb_arrays_of_arrays/execution/image_store/basic-imagestore-mixed-const-non-const-uniform-index2: skip -spec/arb_arrays_of_arrays/execution/image_store/basic-imagestore-non-const-uniform-index: skip spec/arb_arrays_of_arrays/execution/sampler/fs-const-index: fail spec/arb_arrays_of_arrays/execution/sampler/fs-const-index-three-dimensions: fail spec/arb_arrays_of_arrays/execution/sampler/fs-initializer-const-index: fail @@ -3673,13 +3669,8 @@ spec/arb_shader_group_vote/vs-any-const: skip spec/arb_shader_group_vote/vs-any-uniform: skip spec/arb_shader_group_vote/vs-eq-const: skip spec/arb_shader_group_vote/vs-eq-uniform: skip -spec/arb_shader_image_load_store/execution/basic-imagestore-from-uniform: skip -spec/arb_shader_image_load_store/execution/disable_early_z: skip spec/arb_shader_image_load_store/execution/gl45-imageatomicexchange-float: skip -spec/arb_shader_image_load_store/execution/image_checkerboard: skip spec/arb_shader_image_load_store/execution/imagestore-array: skip -spec/arb_shader_image_load_store/execution/load-from-cleared-image: skip -spec/arb_shader_image_load_store/execution/write-to-rendered-image: skip spec/arb_shader_precision/fs-degrees-float: skip spec/arb_shader_precision/fs-degrees-vec2: skip spec/arb_shader_precision/fs-degrees-vec3: skip @@ -4002,7 +3993,6 @@ spec/arb_shader_storage_buffer_object/execution/indirect: skip spec/arb_shader_storage_buffer_object/execution/ssbo-atomiccompswap-int: skip spec/arb_shader_texture_lod/execution/glsl-fs-shadow2dgradarb-07: fail spec/arb_shader_texture_lod/execution/glsl-fs-shadow2dgradarb-cumulative: fail -spec/arb_shading_language_420pack/linker/different-bindings-image2d: skip spec/arb_shading_language_420pack/linker/different-bindings-shader-storage-blocks: skip spec/arb_shading_language_420pack/linker/different-bindings-shader-storage-blocks-instanced: skip spec/arb_shading_language_packing/execution/built-in-functions/fs-packhalf2x16: warn @@ -13037,10 +13027,10 @@ spec/oes_viewport_array/viewport-gs-writes-out-of-range: skip summary: name: results ---- -------- - pass: 7208 + pass: 7218 fail: 58 crash: 23 - skip: 12930 + skip: 12920 timeout: 0 warn: 25 incomplete: 0 diff --git a/src/gallium/drivers/d3d12/d3d12_screen.cpp b/src/gallium/drivers/d3d12/d3d12_screen.cpp index a727dca984f..14c63a0d522 100644 --- a/src/gallium/drivers/d3d12/d3d12_screen.cpp +++ b/src/gallium/drivers/d3d12/d3d12_screen.cpp @@ -163,6 +163,9 @@ d3d12_get_param(struct pipe_screen *pscreen, enum pipe_cap param) case PIPE_CAP_NIR_SAMPLERS_AS_DEREF: return 1; + case PIPE_CAP_NIR_IMAGES_AS_DEREF: + return 1; + case PIPE_CAP_MAX_TEXTURE_ARRAY_LAYERS: /* Divide by 6 because this also applies to cubemaps */ return D3D12_REQ_TEXTURE2D_ARRAY_AXIS_DIMENSION / 6; @@ -294,6 +297,13 @@ d3d12_get_param(struct pipe_screen *pscreen, enum pipe_cap param) case PIPE_CAP_NIR_COMPACT_ARRAYS: return 1; + case PIPE_CAP_MAX_COMBINED_SHADER_OUTPUT_RESOURCES: + if (screen->max_feature_level <= D3D_FEATURE_LEVEL_11_0) + return D3D12_PS_CS_UAV_REGISTER_COUNT; + if (screen->opts.ResourceBindingTier <= D3D12_RESOURCE_BINDING_TIER_2) + return D3D12_UAV_SLOT_COUNT; + return 0; + default: return u_pipe_screen_get_param_defaults(pscreen, param); } @@ -434,7 +444,12 @@ d3d12_get_shader_param(struct pipe_screen *pscreen, return 1 << PIPE_SHADER_IR_NIR; case PIPE_SHADER_CAP_MAX_SHADER_IMAGES: - return 0; /* TODO: enable me */ + if (!screen->support_shader_images) + return 0; + return + (screen->max_feature_level >= D3D_FEATURE_LEVEL_11_1 || + screen->opts.ResourceBindingTier >= D3D12_RESOURCE_BINDING_TIER_3) ? + PIPE_MAX_SHADER_IMAGES : D3D12_PS_CS_UAV_REGISTER_COUNT; case PIPE_SHADER_CAP_LOWER_IF_THRESHOLD: case PIPE_SHADER_CAP_TGSI_SKIP_MERGE_REGISTERS: