compute shaders

This commit is contained in:
2026-06-13 01:51:28 +03:00
parent 3b128315e7
commit b8aa36ccc0
28 changed files with 498 additions and 170 deletions

View File

@@ -0,0 +1,33 @@
#include "macros.hlsl"
// https://iolite-engine.com/blog_posts/minimal_agx_implementation
float3 agxDefaultContrastApprox(float3 x) {
float3 x2 = x * x;
float3 x4 = x2 * x2;
float3 x6 = x4 * x2;
return - 17.86 * x6 * x
+ 78.01 * x6
- 126.7 * x4 * x
+ 92.06 * x4
- 28.72 * x2 * x
+ 4.361 * x2
- 0.1718 * x
+ 0.002857;
}
CS
{
Texture2D<float4> g_in;
RWTexture2D<float4> g_out;
[numthreads(1,1,1)]
void csMain( int3 threadId : SV_DispatchThreadID )
{
float4 vColor = g_in.Load(threadId);
vColor.xyz = agxDefaultContrastApprox(vColor.xyz);
g_out.Store(threadId.xy, vColor);
}
}

View File

@@ -15,6 +15,12 @@
#define PS namespace PixelShader_DO_NOT_USE
#endif
#ifdef CS_SHADER
#define CS using namespace ComputeShader; namespace ComputeShader
#else
#define CS namespace ComputeShader_DO_NOT_USE
#endif
#ifdef RAY_SHADER
#define RAY using namespace RayShader; namespace RayShader
#else