[XeSL] Metal Shading Language definitions

This commit is contained in:
Triang3l
2022-06-16 21:39:16 +03:00
parent 820b7ba217
commit 166be463be
176 changed files with 83740 additions and 83682 deletions

View File

@@ -10,28 +10,41 @@
#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_writeTypedStorageBuffer_declare(xesl_uint4, xe_host_depth_store_dest,
set=0, 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_HOST_DEPTH_STORE_PUSH_CONSTANTS_BINDING
xesl_entry_binding_next
xesl_writeTypedStorageBuffer_binding(xesl_uint4, xe_host_depth_store_dest,
buffer(1))
xesl_entry_binding_next
xesl_texture(xesl_texture2D, 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
space0, texture(0))
xesl_entry_bindings_end_inputs_begin_compute
xesl_entry_input_globalInvocationID
xesl_entry_inputs_end_code_begin_compute
// 1 thread = 8 samples (same as resolve granularity).
uint rect_constant = xesl_pushConstant(xe_host_depth_store_rectangle);
uint rt_constant = xesl_pushConstant(xe_host_depth_store_render_target);
xesl_uint2 resolution_scale = XeHostDepthStoreRTResolutionScale(rt_constant);
// Group height can't cross resolve granularity, Y overflow check not needed.
xesl_dont_flatten
if (xesl_GlobalInvocationID.x >= XeHostDepthStoreScaledWidthDiv8()) {
if (xesl_GlobalInvocationID.x >=
(XeHostDepthStoreRectUnscaledWidthDiv8Minus1(rect_constant) *
resolution_scale.x)) {
return;
}
xesl_int2 pixel_index =
xesl_int2(XeHostDepthStoreScaledOrigin() +
(xesl_GlobalInvocationID.xy << xesl_uint2(3u, 0u)));
xesl_int2 pixel_index = xesl_int2(
XeHostDepthStoreRectUnscaledOrigin(rect_constant) * resolution_scale +
(xesl_GlobalInvocationID.xy << xesl_uint2(3u, 0u)));
uint edram_address_int4s =
XeEdramOffsetInts(xesl_uint2(pixel_index), 0u,
XeHostDepthStorePitchTiles(), kXenosMsaaSamples_1X,
false, 0u, 0u, XeHostDepthStoreResolutionScale())
XeHostDepthStoreRTPitchTiles(rt_constant),
kXenosMsaaSamples_1X, false, 0u, 0u,
resolution_scale)
>> 2u;
xesl_writeTypedStorageBufferStore(
xe_host_depth_store_dest, edram_address_int4s,
@@ -54,4 +67,4 @@ xesl_entry_signature_end
pixel_index + xesl_int2(6, 0), 0).r,
xesl_texelFetch2D(xe_host_depth_store_source,
pixel_index + xesl_int2(7, 0), 0).r)));
xesl_entry_end
xesl_entry_code_end_compute