Files
Xenia-Canary/src/xenia/gpu/shaders/resolve_full_32bpp.xesli
Triang3l b61953374e [GPU] Make resolve EDRAM binding DS 0 and rename it
Ordering the descriptor sets by the change frequency on Vulkan, in increasing order (the opposite of D3D12 root signatures). The EDRAM binding never changes there (always one storage buffer), while the destination buffer binding may become changeable in the future (to split dispatches if exceeding `maxStorageBufferRange`, for example).
2022-06-20 12:15:52 +03:00

59 lines
2.5 KiB
Plaintext

/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2022 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#include "endian.xesli"
#include "pixel_formats.xesli"
#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
XE_RESOLVE_COPY_EDRAM_BINDING
xesl_entry_bindings_end_inputs_begin_compute
xesl_entry_input_globalInvocationID
xesl_entry_inputs_end_code_begin_compute
// 1 thread = 4 host pixels.
// 1 pixel per thread is 160% as slow on Nvidia Pascal, 8 pixels per thread is
// 115% as slow.
XeResolveInfo resolve_info =
XeResolveGetInfo(xesl_function_call_pushConstants);
xesl_uint2 pixel_index = xesl_GlobalInvocationID.xy << xesl_uint2(2u, 0u);
// Group height can't cross resolve granularity, Y overflow check not needed.
xesl_dont_flatten
if (pixel_index.x >= resolve_info.width_div_8_scaled << 3u) {
return;
}
xesl_float4 pixel_0, pixel_1, pixel_2, pixel_3;
XeResolveLoad4RGBAColors(
xesl_function_call_uintVectorBuffer(xe_resolve_edram)
xesl_function_call_next_after_uintVectorBuffer
resolve_info,
XeResolveColorCopySourcePixelAddressIntsYDuplicating(resolve_info,
pixel_index),
pixel_0, pixel_1, pixel_2, pixel_3);
if (resolve_info.duplicate_second_host_pixel.x && pixel_index.x == 0u) {
pixel_0 = pixel_1;
}
xesl_writeTypedStorageBufferStore(
xe_resolve_dest,
XeResolveDestPixelAddress(resolve_info, pixel_index, 2u) >> 4u,
XeEndianSwap32(XePack32bpp4Pixels(pixel_0, pixel_1, pixel_2, pixel_3,
resolve_info.dest_format),
resolve_info.dest_endian_128));
xesl_entry_code_end_compute