diff --git a/Source/Core/VideoCommon/PostProcessing.cpp b/Source/Core/VideoCommon/PostProcessing.cpp index d8666c1cee..0212793f98 100644 --- a/Source/Core/VideoCommon/PostProcessing.cpp +++ b/Source/Core/VideoCommon/PostProcessing.cpp @@ -441,8 +441,8 @@ std::string PostProcessing::GetUniformBufferHeader() const ss << " float4 resolution;\n"; ss << " float4 window_resolution;\n"; ss << " float4 src_rect;\n"; + ss << " int src_layer;\n"; ss << " uint time;\n"; - ss << " int layer;\n"; for (u32 i = 0; i < 2; i++) ss << " uint ubo_align_" << unused_counter++ << "_;\n"; ss << "\n"; @@ -518,10 +518,10 @@ static float4 ocol0; } ss << R"( -float4 Sample() { return texture(samp0, float3(v_tex0.xy, float(layer))); } -float4 SampleLocation(float2 location) { return texture(samp0, float3(location, float(layer))); } +float4 Sample() { return texture(samp0, v_tex0); } +float4 SampleLocation(float2 location) { return texture(samp0, float3(location, float(v_tex0.z))); } float4 SampleLayer(int layer) { return texture(samp0, float3(v_tex0.xy, float(layer))); } -#define SampleOffset(offset) textureOffset(samp0, float3(v_tex0.xy, float(layer)), offset) +#define SampleOffset(offset) textureOffset(samp0, v_tex0, offset) float2 GetWindowResolution() { @@ -543,6 +543,11 @@ float2 GetCoordinates() return v_tex0.xy; } +float GetLayer() +{ + return v_tex0.z; +} + uint GetTime() { return time; @@ -599,7 +604,7 @@ bool PostProcessing::CompileVertexShader() } ss << " v_tex0 = float3(float((id << 1) & 2), float(id & 2), 0.0f);\n"; ss << " opos = float4(v_tex0.xy * float2(2.0f, -2.0f) + float2(-1.0f, 1.0f), 0.0f, 1.0f);\n"; - ss << " v_tex0 = float3(src_rect.xy + (src_rect.zw * v_tex0.xy), 0.0f);\n"; + ss << " v_tex0 = float3(src_rect.xy + (src_rect.zw * v_tex0.xy), float(src_layer));\n"; if (g_ActiveConfig.backend_info.api_type == APIType::Vulkan) ss << " opos.y = -opos.y;\n"; @@ -621,8 +626,8 @@ struct BuiltinUniforms float resolution[4]; float window_resolution[4]; float src_rect[4]; - s32 time; - u32 layer; + s32 src_layer; + u32 time; u32 padding[2]; }; @@ -646,8 +651,8 @@ void PostProcessing::FillUniformBuffer(const MathUtil::Rectangle& src, {static_cast(src.left) * rcp_src_width, static_cast(src.top) * rcp_src_height, static_cast(src.GetWidth()) * rcp_src_width, static_cast(src.GetHeight()) * rcp_src_height}, - static_cast(m_timer.GetTimeElapsed()), - static_cast(src_layer), + static_cast(src_layer), + static_cast(m_timer.GetTimeElapsed()), }; u8* buf = m_uniform_staging_buffer.data();