mirror of
https://github.com/rt64/rt64.git
synced 2024-12-28 09:29:53 +00:00
21cfeae50c
* Add graphics test [WIP] * Ignore IDEA files * Explicit cast from size_t to uint64_t * Build statically when buiding examples * Remove unused file * Runs on ARM64 Linux * Update .gitignore
26 lines
704 B
HLSL
26 lines
704 B
HLSL
//
|
|
// RT64
|
|
//
|
|
|
|
struct Constants {
|
|
float4 Multiply;
|
|
uint2 Resolution;
|
|
};
|
|
|
|
[[vk::push_constant]] ConstantBuffer<Constants> gConstants : register(b0);
|
|
|
|
Texture2D<float4> gBlueNoiseTexture : register(t1);
|
|
SamplerState gSampler : register(s2);
|
|
[[vk::image_format("rgba8")]]
|
|
RWTexture2D<float4> gTarget : register(u16, space1);
|
|
|
|
[numthreads(8, 8, 1)]
|
|
void CSMain(uint2 coord : SV_DispatchThreadID) {
|
|
if (any(coord >= gConstants.Resolution)) {
|
|
return;
|
|
}
|
|
|
|
float2 blueNoiseUV = float2(coord) / float2(gConstants.Resolution);
|
|
float4 blueNoise = float4(gBlueNoiseTexture.SampleLevel(gSampler, blueNoiseUV, 0).rgb, 1.0f);
|
|
gTarget[coord] *= (blueNoise * gConstants.Multiply);
|
|
} |