mirror of https://github.com/PCSX2/pcsx2.git
GS/HW: Try to improve first barrier placement for Metal, Vulkan and OGL
This commit is contained in:
parent
869f43b836
commit
6a56da8788
|
@ -2114,7 +2114,7 @@ void GSDeviceMTL::MREInitHWDraw(GSHWDrawConfig& config, const Map& verts)
|
|||
|
||||
void GSDeviceMTL::RenderHW(GSHWDrawConfig& config)
|
||||
{ @autoreleasepool {
|
||||
if (config.tex && config.ds == config.tex)
|
||||
if (config.tex && (config.ds == config.tex || config.rt == config.tex))
|
||||
EndRenderPass(); // Barrier
|
||||
|
||||
size_t vertsize = config.nverts * sizeof(*config.verts);
|
||||
|
|
|
@ -2496,12 +2496,6 @@ void GSDeviceOGL::RenderHW(GSHWDrawConfig& config)
|
|||
config.drawarea.width(), config.drawarea.height());
|
||||
CopyRect(hdr_rt ? hdr_rt : config.rt, draw_rt_clone, config.drawarea, config.drawarea.left, config.drawarea.top);
|
||||
}
|
||||
else if (config.tex && config.tex == config.ds)
|
||||
{
|
||||
// Ensure all depth writes are finished before sampling
|
||||
GL_INS("Texture barrier to flush depth before reading");
|
||||
glTextureBarrier();
|
||||
}
|
||||
|
||||
IASetVertexBuffer(config.verts, config.nverts);
|
||||
if (config.vs.expand != GSHWDrawConfig::VSExpand::None && !GLAD_GL_ARB_shader_draw_parameters)
|
||||
|
@ -2563,6 +2557,15 @@ void GSDeviceOGL::RenderHW(GSHWDrawConfig& config)
|
|||
|
||||
SetupPipeline(psel);
|
||||
|
||||
const bool check_barrier = !(config.require_one_barrier && !m_features.texture_barrier);
|
||||
|
||||
// Be careful of the rt already being bound and the blend using the RT without a barrier.
|
||||
if (check_barrier && ((config.tex && (config.tex == config.ds || config.tex == config.rt)) || ((psel.ps.IsFeedbackLoop() || psel.ps.blend_c == 1) && GLState::rt == config.rt)))
|
||||
{
|
||||
// Ensure all depth writes are finished before sampling
|
||||
GL_INS("Texture barrier to flush depth or rt before reading");
|
||||
glTextureBarrier();
|
||||
}
|
||||
// additional non-pipeline config stuff
|
||||
const bool point_size_enabled = config.vs.point_size;
|
||||
if (GLState::point_size != point_size_enabled)
|
||||
|
|
|
@ -5641,6 +5641,10 @@ void GSDeviceVK::RenderHW(GSHWDrawConfig& config)
|
|||
PipelineSelector& pipe = m_pipeline_selector;
|
||||
UpdateHWPipelineSelector(config, pipe);
|
||||
|
||||
// If we don't have a barrier but the texture was drawn to last draw, end the pass to insert a barrier.
|
||||
if (InRenderPass() && !pipe.IsRTFeedbackLoop() && (config.tex == m_current_render_target || config.tex == m_current_depth_target))
|
||||
EndRenderPass();
|
||||
|
||||
// now blit the hdr texture back to the original target
|
||||
if (hdr_rt)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue