[GPU/UI] XeSL readability improvements + float suffix

Use the _xe suffix instead of the xesl_ prefix for quicker visual
recognition of identifiers, also switch to snake_case for consistency.

Also add the f suffix to float32 literals because the Metal Shading
Language is based on C++.
This commit is contained in:
Triang3l
2025-08-19 21:36:06 +03:00
parent 3b4b04c371
commit 04d5c40d0d
201 changed files with 90552 additions and 92369 deletions

View File

@@ -11,40 +11,39 @@
#define XE_RESOLVE_COPY_EDRAM_IS_UINT_VECTOR_BUFFER
#include "resolve.xesli"
xesl_writeTypedStorageBuffer_declare(xesl_uint4, xe_resolve_dest, set=1,
binding=0, u0, space0)
#define xesl_localSize_x 8
#define xesl_localSize_y 8
#define xesl_localSize_z 1
xesl_entry_bindings_begin_compute
XE_RESOLVE_PUSH_CONSTANTS_BINDING
xesl_entry_binding_next
xesl_writeTypedStorageBuffer_binding(xesl_uint4, xe_resolve_dest,
buffer(1))
xesl_entry_binding_next
array_buffer_wo_declare_xe(uint4_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))
entry_binding_next_xe
XE_RESOLVE_COPY_EDRAM_BINDING
xesl_entry_bindings_end_inputs_begin_compute
xesl_entry_input_globalInvocationID
xesl_entry_inputs_end_code_begin_compute
entry_bindings_end_inputs_begin_compute_xe
entry_in_global_thread_id_xe
entry_inputs_end_code_begin_compute_xe
{
// 1 thread = 2 host pixels.
XeResolveInfo resolve_info =
XeResolveGetInfo(xesl_function_call_pushConstants);
xesl_uint2 pixel_index = xesl_GlobalInvocationID.xy << xesl_uint2(1u, 0u);
XeResolveInfo resolve_info = XeResolveGetInfo(pass_push_consts_xe);
uint2_xe pixel_index = in_global_thread_id_xe.xy << uint2_xe(1u, 0u);
// Group height can't cross resolve granularity, Y overflow check not needed.
xesl_dont_flatten
dont_flatten_xe
if (pixel_index.x >= resolve_info.width_div_8_scaled << 3u) {
return;
}
xesl_float4 pixel_0, pixel_1;
float4_xe pixel_0, pixel_1;
XeResolveLoad2RGBAColors(
xesl_function_call_uintVectorBuffer(xe_resolve_edram)
xesl_function_call_next_after_uintVectorBuffer
pass_uint_vector_buffer_xe(xe_resolve_edram)
pass_next_after_uint_vector_buffer_xe
resolve_info,
XeResolveColorCopySourcePixelAddressIntsYHalfPixelOffsetFilling(
resolve_info,
xesl_uint2(max(pixel_index.x,
resolve_info.half_pixel_offset_fill_source.x),
pixel_index.y)),
uint2_xe(max(pixel_index.x,
resolve_info.half_pixel_offset_fill_source.x),
pixel_index.y)),
pixel_0, pixel_1);
// Inside the half-pixel offset filling columns, pixel_0 now contains the
// pixel to stretch, pixel_1 contains the pixel after it. However, this means
@@ -52,21 +51,22 @@ xesl_entry_inputs_end_code_begin_compute
// stretch, the two pixels will be 1 and 2 for pixel_index.x == 0. If 3 is,
// they will be 3 and 4 for pixel_index.x == 0 and 2. However, in the former
// case, they should be 1 and 1, and in the latter, 3 and 3.
xesl_dont_flatten
dont_flatten_xe
if (pixel_index.x < resolve_info.half_pixel_offset_fill_source.x) {
pixel_1 = pixel_0;
}
// Only 32_32_32_32_FLOAT color format is 128bpp.
uint dest_address =
XeResolveDestPixelAddress(resolve_info, pixel_index, 4u) >> 4u;
xesl_typedStorageBufferStore(
array_buffer_store_xe(
xe_resolve_dest, dest_address,
XeEndianSwap128(xesl_floatBitsToUint(pixel_0),
XeEndianSwap128(float_bits_to_uint_xe(pixel_0),
resolve_info.dest_endian_128));
dest_address += XeResolveDestRightConsecutiveBlocksOffset(
pixel_index.x, 4u, resolve_info.resolution_scale) >> 4u;
xesl_typedStorageBufferStore(
array_buffer_store_xe(
xe_resolve_dest, dest_address,
XeEndianSwap128(xesl_floatBitsToUint(pixel_1),
XeEndianSwap128(float_bits_to_uint_xe(pixel_1),
resolve_info.dest_endian_128));
xesl_entry_code_end_compute
}
entry_code_end_compute_xe