[GPU/WGF] Use ByteAddressBuffer in precompiled shaders

Drivers and hardware may provide more optimal paths for untyped buffers
compared to typed.

Also, ByteAddressBuffer may be bound via a root descriptor in Direct3D 12,
greatly simplifying the binding logic.

ByteAddressBuffer also doesn't have the 128 * 2^20 element count limit that
typed and structured buffers have, and doesn't require the structure stride
to be specified at resource creation time in Direct3D 11.
This commit is contained in:
Triang3l
2026-02-09 21:29:18 +03:00
parent c7f61342d7
commit 80dad41454
211 changed files with 121690 additions and 123176 deletions

View File

@@ -8,18 +8,17 @@
*/
#include "endian.xesli"
#define XE_RESOLVE_COPY_EDRAM_IS_UINT_VECTOR_BUFFER
#define XE_RESOLVE_COPY_EDRAM_BYTE_BUFFER_ALIGNMENT 4
#include "resolve.xesli"
array_buffer_wo_declare_xe(uint4_xe, xe_resolve_dest, set=1, binding=0, u0,
space0)
byte_buffer_align16_wo_declare_xe(xe_resolve_dest, set=1, binding=0, u0, space0)
#define LOCAL_SIZE_X_XE 8
#define LOCAL_SIZE_Y_XE 8
#define LOCAL_SIZE_Z_XE 1
entry_bindings_begin_compute_xe
XE_RESOLVE_PUSH_CONST_BINDING
entry_binding_next_xe
array_buffer_wo_binding_xe(uint4_xe, xe_resolve_dest, buffer(1))
byte_buffer_wo_binding_xe(xe_resolve_dest, buffer(1))
entry_binding_next_xe
XE_RESOLVE_COPY_EDRAM_BINDING
entry_bindings_end_inputs_begin_compute_xe
@@ -36,10 +35,9 @@ entry_inputs_end_code_begin_compute_xe
}
float4_xe pixel_0, pixel_1;
XeResolveLoad2RGBAColors(
pass_uint_vector_buffer_xe(xe_resolve_edram)
pass_next_after_uint_vector_buffer_xe
pass_byte_buffer_xe(xe_resolve_edram) pass_next_after_byte_buffer_xe
resolve_info,
XeResolveColorCopySourcePixelAddressIntsYHalfPixelOffsetFilling(
XeResolveColorCopySourcePixelAddressBytesYHalfPixelOffsetFilling(
resolve_info,
uint2_xe(max(pixel_index.x,
resolve_info.half_pixel_offset_fill_source.x),
@@ -56,14 +54,13 @@ entry_inputs_end_code_begin_compute_xe
pixel_1 = pixel_0;
}
// Only 32_32_32_32_FLOAT color format is 128bpp.
uint dest_address =
XeResolveDestPixelAddress(resolve_info, pixel_index, 4u) >> 4u;
array_buffer_store_xe(
uint dest_address = XeResolveDestPixelAddress(resolve_info, pixel_index, 4u);
byte_buffer_align16_store16_xe(
xe_resolve_dest, dest_address,
XeEndianSwap128(float_bits_to_uint_xe(pixel_0),
resolve_info.dest_endian_128));
dest_address += XeResolveLocalXAddressXor(1u, 4u) >> 4u;
array_buffer_store_xe(
dest_address += XeResolveLocalXAddressXor(1u, 4u);
byte_buffer_align16_store16_xe(
xe_resolve_dest, dest_address,
XeEndianSwap128(float_bits_to_uint_xe(pixel_1),
resolve_info.dest_endian_128));