/** ****************************************************************************** * 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 "texture_load.xesli" xesl_entry xesl_writeTypedStorageBuffer(xesl_uint4, xe_texture_load_dest, set=0, binding=0, u0, space0) xesl_entry_binding_next xesl_typedStorageBuffer(xesl_uint4, xe_texture_load_source, set=1, binding=0, t0, space0) xesl_entry_bindings_end_local_size(XeTextureLoadGroupSizeX, XeTextureLoadGroupSizeY, 1) xesl_input_global_invocation_id xesl_entry_signature_end // 1 thread = 8 packed 32-bit texels with the externally provided uint4 -> 2x // uint4 function (XE_TEXTURE_LOAD_32BPB_TO_64BPB) for converting to 64bpb - // useful for expansion of hendeca (10:11:11 or 11:11:10) to unorm16/snorm16. xesl_uint3 block_index = xesl_GlobalInvocationID << xesl_uint3(3u, 0u, 0u); xesl_uint3 size_blocks = XeTextureLoadSizeBlocks(); xesl_dont_flatten if (any(xesl_greaterThanEqual(block_index.xy, size_blocks.xy))) { return; } uint block_offset_host = uint( (XeTextureHostLinearOffset(xesl_int3(block_index), XeTextureLoadHostPitch(), size_blocks.y, 8u) + XeTextureLoadHostOffset()) >> 4u); uint block_offset_guest = XeTextureLoadGuestBlockOffset(block_index, 4u, 2u) >> 4u; uint endian = XeTextureLoadEndian32(); xesl_uint4 block_0, block_1; XE_TEXTURE_LOAD_32BPB_TO_64BPB( XeEndianSwap32(xesl_typedStorageBufferLoad(xe_texture_load_source, block_offset_guest), endian), block_0, block_1); xesl_writeTypedStorageBufferStore(xe_texture_load_dest, block_offset_host, block_0); xesl_writeTypedStorageBufferStore(xe_texture_load_dest, block_offset_host + 1u, block_1); block_offset_guest += XeTextureLoadRightConsecutiveBlocksOffset(block_index.x, 2u) >> 4u; XE_TEXTURE_LOAD_32BPB_TO_64BPB( XeEndianSwap32(xesl_typedStorageBufferLoad(xe_texture_load_source, block_offset_guest), endian), block_0, block_1); xesl_writeTypedStorageBufferStore(xe_texture_load_dest, block_offset_host + 2u, block_0); xesl_writeTypedStorageBufferStore(xe_texture_load_dest, block_offset_host + 3u, block_1); xesl_entry_end