summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/PostProcessing.cpp
diff options
context:
space:
mode:
authorStenzek <stenzek@gmail.com>2019-10-02 11:52:52 +1000
committerStenzek <stenzek@gmail.com>2019-10-02 11:52:54 +1000
commitb44a0980eb310b221feb84a195db63b89276a053 (patch)
tree60a3f8d8b670e27832573cea08ce681729e9134a /Source/Core/VideoCommon/PostProcessing.cpp
parente754c8ab265a85018cb1251578467d1a1f2dbd8a (diff)
PostProcessing: Use correct layer in quad-buffered modes
Previously, only the left eye was being used.
Diffstat (limited to 'Source/Core/VideoCommon/PostProcessing.cpp')
-rw-r--r--Source/Core/VideoCommon/PostProcessing.cpp23
1 files changed, 14 insertions, 9 deletions
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<int>& src,
{static_cast<float>(src.left) * rcp_src_width, static_cast<float>(src.top) * rcp_src_height,
static_cast<float>(src.GetWidth()) * rcp_src_width,
static_cast<float>(src.GetHeight()) * rcp_src_height},
- static_cast<s32>(m_timer.GetTimeElapsed()),
- static_cast<u32>(src_layer),
+ static_cast<s32>(src_layer),
+ static_cast<u32>(m_timer.GetTimeElapsed()),
};
u8* buf = m_uniform_staging_buffer.data();