d3d12: Enable texture gather

The CI changes are because WARP fails really hard at gather,
with crashes when doing it on a 1x1 or Nx1 texture, and incorrectly
applying swizzling to the result vector instead of the actual texture
accesses.

Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14161>
This commit is contained in:
Jesse Natalie
2021-12-08 11:01:29 -08:00
parent bd7fc35d6a
commit 8926cfc9f7
6 changed files with 732 additions and 1065 deletions
File diff suppressed because it is too large Load Diff
@@ -71,7 +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/amd_texture_texture4/execution/texture4: 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
@@ -5755,7 +5754,6 @@ spec/arb_tessellation_shader/linker/no-vs: skip
spec/arb_tessellation_shader/linker/tcs-no-vs: skip
spec/arb_tessellation_shader/linker/tcs-output-size-declared-in-other-shader: skip
spec/arb_tessellation_shader/linker/tes-no-vs: skip
spec/arb_texture_gather/execution/miplevels: skip
spec/arb_texture_query_lod/execution/fs-texturequerylod-linear: crash
spec/arb_texture_query_lod/execution/fs-texturequerylod-nearest: crash
spec/arb_texture_query_lod/execution/fs-texturequerylod-nearest-biased: crash
@@ -13046,7 +13044,7 @@ summary:
pass: 7204
fail: 58
crash: 27
skip: 12932
skip: 12930
timeout: 0
warn: 25
incomplete: 0
@@ -13055,4 +13053,4 @@ summary:
changes: 0
fixes: 0
regressions: 0
total: 20246
total: 20244
@@ -38,3 +38,5 @@ test-d3d12-quick_shader:
variables:
PIGLIT_PROFILE: quick_shader
PIGLIT_RESULTS: "d3d12-quick_shader"
# These tests crash WARP causing the test suite to timeout
PIGLIT_TESTS: -x amd_texture_texture4 -x arb_texture_gather
@@ -209,10 +209,8 @@ d3d12_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
case PIPE_CAP_MIXED_FRAMEBUFFER_SIZES:
return 1;
#if 0 /* TODO: Enable me. Enables ARB_texture_gather */
case PIPE_CAP_MAX_TEXTURE_GATHER_COMPONENTS:
return 4;
#endif
case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER:
case PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT:
+1
View File
@@ -59,6 +59,7 @@ static struct predefined_func_descr predefined_funcs[] = {
{"dx.op.sampleCmp", "R", "i@@ffffiiiff", DXIL_ATTR_KIND_READ_ONLY},
{"dx.op.sampleCmpLevelZero", "R", "i@@ffffiiif", DXIL_ATTR_KIND_READ_ONLY},
{"dx.op.textureLoad", "R", "i@iiiiiii", DXIL_ATTR_KIND_READ_ONLY},
{"dx.op.textureGather", "R", "i@@ffffiii", DXIL_ATTR_KIND_READ_ONLY},
{"dx.op.discard", "v", "ib", DXIL_ATTR_KIND_READ_NONE},
{"dx.op.sampleIndex", "i", "i", DXIL_ATTR_KIND_READ_NONE},
{"dx.op.emitStream", "v", "ic", DXIL_ATTR_KIND_NONE},
+28
View File
@@ -235,6 +235,7 @@ enum dxil_intr {
DXIL_INTR_BUFFER_STORE = 69,
DXIL_INTR_TEXTURE_SIZE = 72,
DXIL_INTR_TEXTURE_GATHER = 73,
DXIL_INTR_ATOMIC_BINOP = 78,
DXIL_INTR_ATOMIC_CMPXCHG = 79,
@@ -3872,6 +3873,29 @@ emit_texture_lod(struct ntd_context *ctx, struct texop_parameters *params)
return dxil_emit_call(&ctx->mod, func, args, ARRAY_SIZE(args));
}
static const struct dxil_value *
emit_texture_gather(struct ntd_context *ctx, struct texop_parameters *params, unsigned component)
{
const struct dxil_func *func = dxil_get_function(&ctx->mod, "dx.op.textureGather", params->overload);
if (!func)
return false;
const struct dxil_value *args[] = {
dxil_module_get_int32_const(&ctx->mod, DXIL_INTR_TEXTURE_GATHER),
params->tex,
params->sampler,
params->coord[0],
params->coord[1],
params->coord[2],
params->coord[3],
params->offset[0],
params->offset[1],
dxil_module_get_int32_const(&ctx->mod, component)
};
return dxil_emit_call(&ctx->mod, func, args, ARRAY_SIZE(args));
}
static bool
emit_tex(struct ntd_context *ctx, nir_tex_instr *instr)
{
@@ -4031,6 +4055,10 @@ emit_tex(struct ntd_context *ctx, nir_tex_instr *instr)
sample = emit_texture_size(ctx, &params);
break;
case nir_texop_tg4:
sample = emit_texture_gather(ctx, &params, instr->component);
break;
case nir_texop_lod:
sample = emit_texture_lod(ctx, &params);
store_dest(ctx, &instr->dest, 0, sample, nir_alu_type_get_base_type(instr->dest_type));