[GPU] XeSL host depth store and VS passthrough shaders
This commit is contained in:
75
src/xenia/gpu/shaders/host_depth_store_2xmsaa.cs.xesl
Normal file
75
src/xenia/gpu/shaders/host_depth_store_2xmsaa.cs.xesl
Normal file
@@ -0,0 +1,75 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* 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 "../../ui/shaders/xesl.xesli"
|
||||
|
||||
#include "edram.xesli"
|
||||
#include "host_depth_store.xesli"
|
||||
|
||||
xesl_entry
|
||||
xesl_writeTypedStorageBuffer(xesl_uint4, xe_host_depth_store_dest, set=0,
|
||||
binding=0, u0, space0)
|
||||
xesl_entry_binding_next
|
||||
xesl_texture(xesl_texture2DMS, xe_host_depth_store_source, set=1, binding=0,
|
||||
t0, space0)
|
||||
xesl_entry_bindings_end_local_size(8, 8, 1)
|
||||
xesl_input_global_invocation_id
|
||||
xesl_entry_signature_end
|
||||
// 1 thread = 8 samples (8x0.5 pixels, resolve granularity is 8 pixels).
|
||||
// Group height can't cross resolve granularity, Y overflow check not needed.
|
||||
xesl_dont_flatten
|
||||
if (xesl_GlobalInvocationID.x >= XeHostDepthStoreScaledWidthDiv8()) {
|
||||
return;
|
||||
}
|
||||
xesl_int2 pixel_index =
|
||||
xesl_int2(XeHostDepthStoreScaledOrigin() +
|
||||
xesl_uint2(xesl_GlobalInvocationID.x << 3u,
|
||||
xesl_GlobalInvocationID.y >> 1u));
|
||||
uint dest_sample_index = xesl_GlobalInvocationID.y & 1u;
|
||||
uint edram_address_int4s =
|
||||
XeEdramOffsetInts(xesl_uint2(pixel_index), 0u,
|
||||
XeHostDepthStorePitchTiles(), kXenosMsaaSamples_2X,
|
||||
false, 0u, dest_sample_index,
|
||||
XeHostDepthStoreResolutionScale())
|
||||
>> 2u;
|
||||
// Top and bottom to Direct3D 10.1+ and Vulkan top 1 and bottom 0 (for 2x) or
|
||||
// top-left 0 and bottom-right 3 (for 4x).
|
||||
int source_sample_index =
|
||||
XeHostDepthStoreMsaa2xSupported() ? (bool(dest_sample_index) ? 0 : 1)
|
||||
: (bool(dest_sample_index) ? 3 : 0);
|
||||
xesl_writeTypedStorageBufferStore(
|
||||
xe_host_depth_store_dest, edram_address_int4s,
|
||||
xesl_floatBitsToUint(xesl_float4(
|
||||
xesl_texelFetch2DMS(xe_host_depth_store_source, pixel_index,
|
||||
source_sample_index).r,
|
||||
xesl_texelFetch2DMS(xe_host_depth_store_source,
|
||||
pixel_index + xesl_int2(1, 0),
|
||||
source_sample_index).r,
|
||||
xesl_texelFetch2DMS(xe_host_depth_store_source,
|
||||
pixel_index + xesl_int2(2, 0),
|
||||
source_sample_index).r,
|
||||
xesl_texelFetch2DMS(xe_host_depth_store_source,
|
||||
pixel_index + xesl_int2(3, 0),
|
||||
source_sample_index).r)));
|
||||
xesl_writeTypedStorageBufferStore(
|
||||
xe_host_depth_store_dest, edram_address_int4s + 1u,
|
||||
xesl_floatBitsToUint(xesl_float4(
|
||||
xesl_texelFetch2DMS(xe_host_depth_store_source,
|
||||
pixel_index + xesl_int2(4, 0),
|
||||
source_sample_index).r,
|
||||
xesl_texelFetch2DMS(xe_host_depth_store_source,
|
||||
pixel_index + xesl_int2(5, 0),
|
||||
source_sample_index).r,
|
||||
xesl_texelFetch2DMS(xe_host_depth_store_source,
|
||||
pixel_index + xesl_int2(6, 0),
|
||||
source_sample_index).r,
|
||||
xesl_texelFetch2DMS(xe_host_depth_store_source,
|
||||
pixel_index + xesl_int2(7, 0),
|
||||
source_sample_index).r)));
|
||||
xesl_entry_end
|
||||
Reference in New Issue
Block a user