// Copyright (C) 2009-present, Panagiotis Christopoulos Charitos and contributors. // All rights reserved. // Code licensed under the BSD License. // http://www.anki3d.org/LICENSE #pragma anki technique vert pixel comp #include #if ANKI_COMPUTE_SHADER || ANKI_PIXEL_SHADER # include SamplerState g_linearAnyClampSampler : register(s0); Texture2D g_inputTex : register(t0); # if ANKI_COMPUTE_SHADER # define USE_COMPUTE 1 # else # define USE_COMPUTE 0 # endif # if USE_COMPUTE RWTexture2D g_storageTex : register(u0); struct Consts { Vec2 m_viewportSize; UVec2 m_viewportSizeU; }; ANKI_FAST_CONSTANTS(Consts, g_consts) # endif # if USE_COMPUTE [numthreads(8, 8, 1)] void main(UVec3 svDispatchThreadId : SV_DISPATCHTHREADID) # else Vec3 main(VertOut input) : SV_TARGET0 # endif { # if USE_COMPUTE if(skipOutOfBoundsInvocations(UVec2(8, 8), g_consts.m_viewportSizeU, svDispatchThreadId.xy)) { return; } const Vec2 uv = (Vec2(svDispatchThreadId.xy) + 0.5) / g_consts.m_viewportSize; # else const Vec2 uv = input.m_uv; # endif const Vec3 color = g_inputTex.SampleLevel(g_linearAnyClampSampler, uv, 0.0).rgb; # if USE_COMPUTE g_storageTex[svDispatchThreadId.xy] = Vec4(color, 0.0); # else return color; # endif } #endif // ANKI_COMPUTE_SHADER || ANKI_PIXEL_SHADER