mame/3rdparty/bgfx/examples/37-gpudrivenrendering/cs_gdr_copy_z.sc
Miodrag Milanović 812e6094f4
Update BGFX, BX and BIMG (#10789)
* Update to bgfx a93a714632b79b5ddbf5c86ac323fa9b76ed3433
Co-authored-by: Бранимир Караџић <branimirkaradzic@gmail.com>
2023-01-05 09:32:40 -05:00

27 lines
635 B
Scala

/*
* Copyright 2018 Kostas Anagnostou. All rights reserved.
* License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE
*/
#include "bgfx_compute.sh"
SAMPLER2D(s_texOcclusionDepth, 0);
IMAGE2D_WR(s_texOcclusionDepthOut, r32f, 1);
uniform vec4 u_inputRTSize;
NUM_THREADS(16, 16, 1)
void main()
{
// this shader can be used to both copy a mip over to the output and downscale it.
ivec2 coord = ivec2(gl_GlobalInvocationID.xy);
if (all(lessThan(coord.xy, u_inputRTSize.xy) ) )
{
float maxDepth = texelFetch(s_texOcclusionDepth, coord.xy, 0).x;
imageStore(s_texOcclusionDepthOut, coord, vec4(maxDepth,0,0,1) );
}
}