mirror of
https://github.com/PCSX2/pcsx2.git
synced 2026-07-11 01:34:17 +02:00
GS/GL: Remove ROV support.
Buggy on multiple systems, even with various barrier hacks.
This commit is contained in:
@@ -40,12 +40,6 @@
|
||||
#define PS_AA1_TRIANGLE_SW_Z 3
|
||||
#endif
|
||||
|
||||
#ifndef PS_ROV_DEPTH_NONE
|
||||
#define PS_ROV_DEPTH_NONE 0
|
||||
#define PS_ROV_DEPTH_READ_WRITE 1
|
||||
#define PS_ROV_DEPTH_READ_ONLY 2
|
||||
#endif
|
||||
|
||||
// TEX_COORD_DEBUG output the uv coordinate as color. It is useful
|
||||
// to detect bad sampling due to upscaling
|
||||
//#define TEX_COORD_DEBUG
|
||||
@@ -70,12 +64,6 @@
|
||||
#define SW_DEPTH (NEEDS_DEPTH_FOR_AFAIL || NEEDS_DEPTH_FOR_ZTST || NEEDS_DEPTH_FOR_AA1)
|
||||
#define ZWRITE (SW_DEPTH || PS_ZCLAMP || PS_ZFLOOR)
|
||||
|
||||
#define PS_RETURN_COLOR_ROV (!PS_NO_COLOR && PS_ROV_COLOR)
|
||||
#define PS_RETURN_COLOR (!PS_NO_COLOR && !PS_ROV_COLOR)
|
||||
#define PS_RETURN_DEPTH_ROV (PS_ROV_DEPTH == PS_ROV_DEPTH_READ_WRITE)
|
||||
#define PS_RETURN_DEPTH (ZWRITE && !PS_ROV_DEPTH)
|
||||
#define PS_ROV_EARLYDEPTHSTENCIL (PS_ROV_COLOR && !PS_ROV_DEPTH && !ZWRITE)
|
||||
|
||||
layout(std140, binding = 0) uniform cb21
|
||||
{
|
||||
vec3 FogColor;
|
||||
@@ -139,16 +127,12 @@ in SHADER
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if PS_RETURN_COLOR
|
||||
#if !PS_NO_COLOR && !PS_NO_COLOR1
|
||||
// Same buffer but 2 colors for dual source blending
|
||||
layout(location = 0, index = 0) TARGET_0_QUALIFIER vec4 o_col0;
|
||||
layout(location = 0, index = 1) out vec4 o_col1;
|
||||
#elif !PS_NO_COLOR
|
||||
layout(location = 0) TARGET_0_QUALIFIER vec4 o_col0;
|
||||
#endif
|
||||
#elif PS_RETURN_COLOR_ROV
|
||||
vec4 o_col0;
|
||||
#if !PS_NO_COLOR && !PS_NO_COLOR1
|
||||
// Same buffer but 2 colors for dual source blending
|
||||
layout(location = 0, index = 0) TARGET_0_QUALIFIER vec4 o_col0;
|
||||
layout(location = 0, index = 1) out vec4 o_col1;
|
||||
#elif !PS_NO_COLOR
|
||||
layout(location = 0) TARGET_0_QUALIFIER vec4 o_col0;
|
||||
#endif
|
||||
|
||||
// Depth feedback mode 2 is for depth as color.
|
||||
@@ -161,16 +145,6 @@ in SHADER
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if PS_ROV_COLOR
|
||||
layout(binding = 0, rgba8) uniform restrict coherent image2D RtImageRov;
|
||||
vec4 rov_rt_value = vec4(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
#endif
|
||||
|
||||
#if PS_ROV_DEPTH
|
||||
layout(binding = 1, r32f) uniform restrict coherent image2D DepthImageRov;
|
||||
float rov_depth_value = 0.0f;
|
||||
#endif
|
||||
|
||||
#if NEEDS_TEX
|
||||
layout(binding = 0) uniform sampler2D TextureSampler;
|
||||
layout(binding = 1) uniform sampler2D PaletteSampler;
|
||||
@@ -187,19 +161,17 @@ layout(binding = 3) uniform sampler2D img_prim_min;
|
||||
// Depth feedback mode 1 binds depth buffer directly as a texture.
|
||||
// Depth feedback mode 2 (depth as color) can use FB fetch for the feedback,
|
||||
// in which case we don't need to explicitly bind depth as a texture.
|
||||
#if (DEPTH_FEEDBACK_SUPPORT == 1 || (DEPTH_FEEDBACK_SUPPORT == 2 && !HAS_FRAMEBUFFER_FETCH)) && SW_DEPTH && !PS_ROV_DEPTH
|
||||
#if (DEPTH_FEEDBACK_SUPPORT == 1 || (DEPTH_FEEDBACK_SUPPORT == 2 && !HAS_FRAMEBUFFER_FETCH)) && SW_DEPTH
|
||||
layout(binding = 4) uniform sampler2D DepthSampler;
|
||||
#endif
|
||||
|
||||
#if ZWRITE && PS_HAS_CONSERVATIVE_DEPTH && !SW_DEPTH && !PS_ROV_DEPTH
|
||||
#if ZWRITE && PS_HAS_CONSERVATIVE_DEPTH && !SW_DEPTH
|
||||
layout(depth_less) out float gl_FragDepth;
|
||||
#endif
|
||||
|
||||
vec4 sample_from_rt()
|
||||
{
|
||||
#if PS_ROV_COLOR
|
||||
return rov_rt_value;
|
||||
#elif !NEEDS_RT
|
||||
#if !NEEDS_RT
|
||||
return vec4(0.0);
|
||||
#elif HAS_FRAMEBUFFER_FETCH
|
||||
return LAST_FRAG_COLOR;
|
||||
@@ -210,9 +182,7 @@ vec4 sample_from_rt()
|
||||
|
||||
float sample_from_depth()
|
||||
{
|
||||
#if PS_ROV_DEPTH
|
||||
return rov_depth_value;
|
||||
#elif !SW_DEPTH
|
||||
#if !SW_DEPTH
|
||||
return 0.0f;
|
||||
#elif HAS_FRAMEBUFFER_FETCH && (DEPTH_FEEDBACK_SUPPORT == 2)
|
||||
return o_col1;
|
||||
@@ -1213,20 +1183,6 @@ float As = As_rgba.a;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if (PS_ROV_COLOR || PS_ROV_DEPTH) && (USE_ARB_FSI || USE_NV_FSI)
|
||||
layout(pixel_interlock_ordered) in;
|
||||
#endif
|
||||
|
||||
#if PS_ROV_EARLYDEPTHSTENCIL
|
||||
layout(early_fragment_tests) in;
|
||||
#endif
|
||||
|
||||
#if PS_ROV_COLOR || PS_ROV_DEPTH
|
||||
#define DISCARD rov_discard = true
|
||||
#else
|
||||
#define DISCARD discard
|
||||
#endif
|
||||
|
||||
void ps_main()
|
||||
{
|
||||
float input_z = gl_FragCoord.z;
|
||||
@@ -1236,40 +1192,18 @@ void ps_main()
|
||||
input_z = floor(input_z * exp2(32.0f)) * exp2(-32.0f);
|
||||
#endif
|
||||
|
||||
#if PS_ROV_COLOR || PS_ROV_DEPTH
|
||||
#if USE_ARB_FSI
|
||||
beginInvocationInterlockARB();
|
||||
#elif USE_NV_FSI
|
||||
beginInvocationInterlockNV();
|
||||
#elif USE_INTEL_FSI
|
||||
beginFragmentShaderOrderingINTEL();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if PS_ROV_COLOR
|
||||
rov_rt_value = imageLoad(RtImageRov, ivec2(gl_FragCoord.xy));
|
||||
#endif
|
||||
|
||||
#if PS_ROV_DEPTH
|
||||
rov_depth_value = imageLoad(DepthImageRov, ivec2(gl_FragCoord.xy)).r;
|
||||
#endif
|
||||
|
||||
#if PS_ROV_COLOR || PS_ROV_DEPTH
|
||||
bool rov_discard = false;
|
||||
#endif
|
||||
|
||||
#if PS_ZTST == ZTST_GEQUAL
|
||||
if (input_z < sample_from_depth())
|
||||
DISCARD;
|
||||
discard;
|
||||
#elif PS_ZTST == ZTST_GREATER
|
||||
if (input_z <= sample_from_depth())
|
||||
DISCARD;
|
||||
discard;
|
||||
#endif
|
||||
|
||||
#if PS_SCANMSK & 2
|
||||
// fail depth test on prohibited lines
|
||||
if ((int(gl_FragCoord.y) & 1) == (PS_SCANMSK & 1))
|
||||
DISCARD;
|
||||
discard;
|
||||
#endif
|
||||
|
||||
#if PS_DATE >= 5
|
||||
@@ -1298,7 +1232,7 @@ void ps_main()
|
||||
#endif
|
||||
|
||||
if (bad) {
|
||||
DISCARD;
|
||||
discard;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1309,7 +1243,7 @@ void ps_main()
|
||||
// the bad alpha value so we must keep it.
|
||||
|
||||
if (gl_PrimitiveID > stencil_ceil) {
|
||||
DISCARD;
|
||||
discard;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1332,7 +1266,7 @@ void ps_main()
|
||||
|
||||
#if PS_ATST != PS_ATST_NONE && PS_AFAIL == AFAIL_KEEP
|
||||
if (!atst_pass)
|
||||
DISCARD;
|
||||
discard;
|
||||
#endif
|
||||
|
||||
#if SW_AD_TO_HW
|
||||
@@ -1470,16 +1404,8 @@ void ps_main()
|
||||
input_z = sample_from_depth(); // No depth update for triangle edges.
|
||||
#endif
|
||||
|
||||
// Writing back color (result already written to o_col0 for non-ROV)
|
||||
#if PS_RETURN_COLOR_ROV
|
||||
bvec4 discard_channels = bvec4(uvec4(rov_discard) | uvec4(equal(FbMask, uvec4(0xFFu))));
|
||||
o_col0 = mix(o_col0, sample_from_rt(), discard_channels);
|
||||
|
||||
imageStore(RtImageRov, ivec2(gl_FragCoord.xy), o_col0);
|
||||
#endif
|
||||
|
||||
// Writing back depth
|
||||
#if PS_RETURN_DEPTH
|
||||
#if ZWRITE
|
||||
#if SW_DEPTH && PS_NO_COLOR1 && (DEPTH_FEEDBACK_SUPPORT == 2)
|
||||
// Depth as color write. For depth as color feedback we write to both
|
||||
// color copy and real depth to avoid having to copy back to real depth.
|
||||
@@ -1489,18 +1415,5 @@ void ps_main()
|
||||
#endif
|
||||
// Standard depth write.
|
||||
gl_FragDepth = input_z;
|
||||
#elif PS_RETURN_DEPTH_ROV
|
||||
input_z = rov_discard ? sample_from_depth() : input_z;
|
||||
|
||||
imageStore(DepthImageRov, ivec2(gl_FragCoord.xy), vec4(input_z, 0, 0, 1.0f));
|
||||
#endif
|
||||
|
||||
#if (PS_ROV_COLOR || PS_ROV_DEPTH)
|
||||
#if USE_ARB_FSI
|
||||
endInvocationInterlockARB();
|
||||
#elif USE_NV_FSI
|
||||
endInvocationInterlockNV();
|
||||
#endif
|
||||
// No end invocation for Intel fragment shader ordering.
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -38,22 +38,14 @@ namespace GLState
|
||||
GSTextureOGL* ds_as_rt = nullptr;
|
||||
GSTextureOGL* ds = nullptr;
|
||||
|
||||
GSTextureOGL* rt_uav = nullptr;
|
||||
GSTextureOGL* ds_uav = nullptr;
|
||||
|
||||
bool rt_written;
|
||||
bool ds_as_rt_written;
|
||||
bool ds_written;
|
||||
|
||||
bool rt_uav_written;
|
||||
bool ds_uav_written;
|
||||
|
||||
u32 draw_buffers;
|
||||
|
||||
GLuint tex_unit[8];
|
||||
|
||||
GLuint image_unit[8];
|
||||
|
||||
u32 UpdateDrawBuffers()
|
||||
{
|
||||
draw_buffers = ds_as_rt ? 2 : 1;
|
||||
@@ -90,20 +82,12 @@ namespace GLState
|
||||
ds_as_rt = nullptr;
|
||||
ds = nullptr;
|
||||
|
||||
rt_uav = nullptr;
|
||||
ds_uav = nullptr;
|
||||
|
||||
rt_written = false;
|
||||
ds_as_rt_written = false;
|
||||
ds_written = false;
|
||||
|
||||
rt_uav_written = false;
|
||||
ds_uav_written = false;
|
||||
|
||||
draw_buffers = 0;
|
||||
|
||||
std::fill(std::begin(tex_unit), std::end(tex_unit), 0);
|
||||
|
||||
std::fill(std::begin(image_unit), std::end(image_unit), 0);
|
||||
}
|
||||
} // namespace GLState
|
||||
|
||||
@@ -42,22 +42,14 @@ namespace GLState
|
||||
extern GSTextureOGL* ds_as_rt; // Depth-Stencil as color
|
||||
extern GSTextureOGL* ds; // Depth-Stencil
|
||||
|
||||
extern GSTextureOGL* rt_uav; // Color UAV (storage image)
|
||||
extern GSTextureOGL* ds_uav; // Depth UAV (storage image)
|
||||
|
||||
extern u32 draw_buffers; // Number of color attachments to framebuffer.
|
||||
|
||||
extern bool rt_written; // Render Target written
|
||||
extern bool ds_as_rt_written; // Depth Stencil as RT written
|
||||
extern bool ds_written; // Depth Stencil written
|
||||
|
||||
extern bool rt_uav_written; // RT UAV written
|
||||
extern bool ds_uav_written; // Depth UAV written
|
||||
|
||||
extern GLuint tex_unit[8]; // shader input texture
|
||||
|
||||
extern GLuint image_unit[8]; // shader UAV texture
|
||||
|
||||
extern u32 UpdateDrawBuffers();
|
||||
extern void Clear();
|
||||
} // namespace GLState
|
||||
|
||||
@@ -901,21 +901,9 @@ bool GSDeviceOGL::CheckFeatures()
|
||||
|
||||
m_features.aa1 = GSConfig.HWAA1 && m_features.vs_expand && m_features.feedback_loops();
|
||||
|
||||
m_features.rov = (GLAD_GL_ARB_fragment_shader_interlock || GLAD_GL_NV_fragment_shader_interlock ||
|
||||
GLAD_GL_INTEL_fragment_shader_ordering) && GLAD_GL_ARB_shader_image_load_store && GLAD_GL_VERSION_4_5;
|
||||
|
||||
m_features.rov &= !m_features.framebuffer_fetch; // Prefer FB fetch over ROV.
|
||||
|
||||
m_features.rov &= GSConfig.HWROV;
|
||||
|
||||
#if PCSX2_DEVBUILD
|
||||
// Force enable even without FSI extensions (works for debugging on Mesa).
|
||||
m_features.rov = GSConfig.HWROV && GLAD_GL_ARB_shader_image_load_store && GLAD_GL_VERSION_4_5;
|
||||
#endif
|
||||
|
||||
if (GSConfig.HWROV && !m_features.rov)
|
||||
if (GSConfig.HWROV)
|
||||
{
|
||||
Console.Warning("GL: ROV is disabled because but the needed extensions are not present or framebuffer fetch is being used.");
|
||||
Console.Warning("GL: ROV is not implemented for GL and will be disabled.");
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -1457,12 +1445,7 @@ std::string GSDeviceOGL::GenGlslHeader(const std::string_view entry, GLenum type
|
||||
{
|
||||
std::string header;
|
||||
|
||||
if (m_features.rov)
|
||||
{
|
||||
// FSI extensions need 4.5 GLSL
|
||||
header = "#version 450 core\n";
|
||||
}
|
||||
else if (m_features.vs_expand && GLAD_GL_VERSION_4_3)
|
||||
if (m_features.vs_expand && GLAD_GL_VERSION_4_3)
|
||||
{
|
||||
// Intel's GL driver doesn't like the readonly qualifier with 3.3 GLSL.
|
||||
header = "#version 430 core\n";
|
||||
@@ -1524,38 +1507,6 @@ std::string GSDeviceOGL::GenGlslHeader(const std::string_view entry, GLenum type
|
||||
pxAssert(0);
|
||||
}
|
||||
|
||||
if (m_features.rov && type == GL_FRAGMENT_SHADER)
|
||||
{
|
||||
header += "#extension GL_ARB_shader_image_load_store : require\n";
|
||||
if (GLAD_GL_ARB_fragment_shader_interlock)
|
||||
{
|
||||
header += "#extension GL_ARB_fragment_shader_interlock : require\n";
|
||||
header += "#define USE_ARB_FSI 1\n";
|
||||
header += "#define USE_NV_FSI 0\n";
|
||||
header += "#define USE_INTEL_FSI 0\n";
|
||||
}
|
||||
else if (GLAD_GL_NV_fragment_shader_interlock)
|
||||
{
|
||||
header += "#extension GL_NV_fragment_shader_interlock : require\n";
|
||||
header += "#define USE_ARB_FSI 0\n";
|
||||
header += "#define USE_NV_FSI 1\n";
|
||||
header += "#define USE_INTEL_FSI 0\n";
|
||||
}
|
||||
else if (GLAD_GL_INTEL_fragment_shader_ordering)
|
||||
{
|
||||
header += "#extension GL_INTEL_fragment_shader_ordering : require\n";
|
||||
header += "#define USE_ARB_FSI 0\n";
|
||||
header += "#define USE_NV_FSI 0\n";
|
||||
header += "#define USE_INTEL_FSI 1\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
header += "#define USE_ARB_FSI 0\n";
|
||||
header += "#define USE_NV_FSI 0\n";
|
||||
header += "#define USE_INTEL_FSI 0\n";
|
||||
}
|
||||
|
||||
// Don't remove this, the recursive macro breaks some Intel drivers.
|
||||
if (entry != "main")
|
||||
{
|
||||
@@ -1648,8 +1599,8 @@ std::string GSDeviceOGL::GetPSSource(const PSSelector& sel)
|
||||
+ fmt::format("#define PS_AA1 {}\n", static_cast<u32>(sel.aa1))
|
||||
+ fmt::format("#define PS_ABE {}\n", sel.abe)
|
||||
+ fmt::format("#define PS_ANISOTROPIC_FILTERING {}\n", sel.sw_aniso)
|
||||
+ fmt::format("#define PS_ROV_COLOR {}\n", sel.rov_color)
|
||||
+ fmt::format("#define PS_ROV_DEPTH {}\n", static_cast<u32>(sel.rov_depth))
|
||||
+ fmt::format("#define PS_ROV_COLOR {}\n", 0)
|
||||
+ fmt::format("#define PS_ROV_DEPTH {}\n", 0)
|
||||
;
|
||||
|
||||
std::string src = GenGlslHeader("ps_main", GL_FRAGMENT_SHADER, macro);
|
||||
@@ -2290,45 +2241,6 @@ void GSDeviceOGL::IASetPrimitiveTopology(GLenum topology)
|
||||
m_draw_topology = topology;
|
||||
}
|
||||
|
||||
void GSDeviceOGL::PSBindImage(GLuint image_unit, GSTexture* tex)
|
||||
{
|
||||
GLuint id = tex ? static_cast<GSTextureOGL*>(tex)->GetID() : 0;
|
||||
if (GLState::image_unit[image_unit] != id)
|
||||
{
|
||||
GLState::image_unit[image_unit] = id;
|
||||
glBindImageTexture(image_unit, id, 0, GL_FALSE, 0, GL_READ_WRITE,
|
||||
tex ? static_cast<GSTextureOGL*>(tex)->GetGLFormat() : GL_R32F);
|
||||
}
|
||||
}
|
||||
|
||||
void GSDeviceOGL::PSSetUnorderedAccess(GSTexture* rt, GSTexture* ds)
|
||||
{
|
||||
const bool rt_changed = (rt != GLState::rt_uav);
|
||||
const bool ds_changed = (ds != GLState::ds_uav);
|
||||
|
||||
GLState::rt_uav_written = false;
|
||||
GLState::ds_uav_written = false;
|
||||
|
||||
PSBindImage(IMAGE_RT_ROV, rt);
|
||||
if (rt)
|
||||
{
|
||||
CommitClear(rt, false);
|
||||
GLState::rt_uav_written = rt_changed;
|
||||
|
||||
PSSetShaderResource(TEXTURE_RT, nullptr); // Unbind to avoid conflicts.
|
||||
}
|
||||
|
||||
PSBindImage(IMAGE_DEPTH_ROV, ds);
|
||||
if (ds)
|
||||
{
|
||||
pxAssert(ds->IsDepthColor());
|
||||
CommitClear(ds, false);
|
||||
GLState::ds_uav_written = ds_changed;
|
||||
|
||||
PSSetShaderResource(TEXTURE_DEPTH, nullptr); // Unbind to avoid conflicts.
|
||||
}
|
||||
}
|
||||
|
||||
void GSDeviceOGL::PSSetShaderResource(int i, GSTexture* sr)
|
||||
{
|
||||
pxAssert(i < static_cast<int>(std::size(GLState::tex_unit)));
|
||||
@@ -2620,10 +2532,6 @@ void GSDeviceOGL::OMUnbindTexture(GSTextureOGL* tex)
|
||||
OMAttachDsAsRt();
|
||||
if (GLState::ds == tex)
|
||||
OMAttachDs();
|
||||
if (GLState::rt_uav == tex)
|
||||
PSBindImage(IMAGE_RT_ROV, nullptr);
|
||||
if (GLState::ds_uav == tex)
|
||||
PSBindImage(IMAGE_DEPTH_ROV, nullptr);
|
||||
}
|
||||
|
||||
void GSDeviceOGL::OMSetBlendState(bool enable, GLenum src_factor, GLenum dst_factor, GLenum op,
|
||||
@@ -2670,8 +2578,7 @@ void GSDeviceOGL::OMSetBlendState(bool enable, GLenum src_factor, GLenum dst_fac
|
||||
}
|
||||
}
|
||||
|
||||
void GSDeviceOGL::OMSetRenderTargets(GSTexture* rt, GSTexture* ds_as_rt, GSTexture* ds, const GSVector4i* scissor,
|
||||
const GSVector2i* viewport)
|
||||
void GSDeviceOGL::OMSetRenderTargets(GSTexture* rt, GSTexture* ds_as_rt, GSTexture* ds, const GSVector4i* scissor)
|
||||
{
|
||||
const bool rt_changed = (rt != GLState::rt);
|
||||
const bool ds_as_rt_changed = (ds_as_rt != GLState::ds_as_rt);
|
||||
@@ -2714,9 +2621,12 @@ void GSDeviceOGL::OMSetRenderTargets(GSTexture* rt, GSTexture* ds_as_rt, GSTextu
|
||||
else
|
||||
OMAttachDs();
|
||||
|
||||
const GSVector2i size = rt ? rt->GetSize() : (ds_as_rt ? ds_as_rt->GetSize() : (ds ? ds->GetSize() : *viewport));
|
||||
SetViewport(size);
|
||||
SetScissor(scissor ? *scissor : GSVector4i::loadh(size));
|
||||
if (rt || ds_as_rt || ds)
|
||||
{
|
||||
const GSVector2i size = rt ? rt->GetSize() : (ds_as_rt ? ds_as_rt->GetSize() : ds->GetSize());
|
||||
SetViewport(size);
|
||||
SetScissor(scissor ? *scissor : GSVector4i::loadh(size));
|
||||
}
|
||||
|
||||
if (draw_buffers != GLState::UpdateDrawBuffers())
|
||||
{
|
||||
@@ -2724,13 +2634,6 @@ void GSDeviceOGL::OMSetRenderTargets(GSTexture* rt, GSTexture* ds_as_rt, GSTextu
|
||||
static constexpr GLenum target[2] = { GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1 };
|
||||
glDrawBuffers(GLState::draw_buffers, target);
|
||||
}
|
||||
|
||||
if (!(rt || ds_as_rt || ds))
|
||||
{
|
||||
// Need to set dimensions to avoid an incomplete FBO if we're doing a pure ROV draw.
|
||||
glNamedFramebufferParameteri(m_fbo, GL_FRAMEBUFFER_DEFAULT_WIDTH, size.x);
|
||||
glNamedFramebufferParameteri(m_fbo, GL_FRAMEBUFFER_DEFAULT_HEIGHT, size.y);
|
||||
}
|
||||
}
|
||||
|
||||
void GSDeviceOGL::SetViewport(const GSVector2i& viewport)
|
||||
@@ -2811,11 +2714,9 @@ void GSDeviceOGL::RenderHW(GSHWDrawConfig& config)
|
||||
|
||||
const GSVector2i rtsize = (config.rt ? config.rt : config.ds)->GetSize();
|
||||
GSTexture* colclip_rt = g_gs_device->GetColorClipTexture();
|
||||
GSTexture* draw_rt = config.ps.HasColorROV() ? nullptr : config.rt;
|
||||
GSTexture* draw_ds = config.ps.HasDepthROV() ? nullptr : config.ds;
|
||||
GSTexture* draw_ds_as_rt = config.ps.HasDepthROV() ? nullptr : m_ds_as_rt;
|
||||
GSTexture* draw_rt_rov = config.ps.HasColorROV() ? config.rt : nullptr;
|
||||
GSTexture* draw_ds_rov = config.ps.HasDepthROV() ? config.ds : nullptr;
|
||||
GSTexture* draw_rt = config.rt;
|
||||
GSTexture* draw_ds = config.ds;
|
||||
GSTexture* draw_ds_as_rt = m_ds_as_rt;
|
||||
GSTexture* draw_rt_clone = nullptr;
|
||||
GSTexture* draw_ds_clone = nullptr;
|
||||
GSTexture* primid_texture = nullptr;
|
||||
@@ -3037,13 +2938,13 @@ void GSDeviceOGL::RenderHW(GSHWDrawConfig& config)
|
||||
|
||||
// Avoid changing framebuffer just to switch from rt+depth to rt and vice versa.
|
||||
bool fb_optimization_needs_barrier = false;
|
||||
if (!(draw_rt || draw_rt_rov) && GLState::rt && GLState::ds == draw_ds && config.tex != GLState::rt &&
|
||||
if (!draw_rt && GLState::rt && GLState::ds == draw_ds && config.tex != GLState::rt &&
|
||||
draw_ds && GLState::rt->GetSize() == draw_ds->GetSize() && !draw_ds_as_rt)
|
||||
{
|
||||
draw_rt = GLState::rt;
|
||||
fb_optimization_needs_barrier = !GLState::rt_written;
|
||||
}
|
||||
else if (!(draw_ds || draw_ds_rov) && GLState::ds && GLState::rt == draw_rt && config.tex != GLState::ds &&
|
||||
else if (!draw_ds && GLState::ds && GLState::rt == draw_rt && config.tex != GLState::ds &&
|
||||
draw_rt && GLState::ds->GetSize() == draw_rt->GetSize() && !draw_ds_as_rt)
|
||||
{
|
||||
draw_ds = GLState::ds;
|
||||
@@ -3061,7 +2962,7 @@ void GSDeviceOGL::RenderHW(GSHWDrawConfig& config)
|
||||
|
||||
const bool rt_feedbackloop_pass1 = config.IsFeedbackLoopRT(config.ps);
|
||||
const bool rt_feedbackloop_pass2 = config.IsFeedbackLoopRT(config.alpha_second_pass.ps);
|
||||
if (draw_rt && !draw_rt_rov && !m_features.texture_barrier && (((config.require_one_barrier || (config.require_full_barrier && m_features.multidraw_fb_copy)) &&
|
||||
if (draw_rt && !m_features.texture_barrier && (((config.require_one_barrier || (config.require_full_barrier && m_features.multidraw_fb_copy)) &&
|
||||
(rt_feedbackloop_pass1 || rt_feedbackloop_pass2))))
|
||||
{
|
||||
// Requires a copy of the RT.
|
||||
@@ -3073,7 +2974,7 @@ void GSDeviceOGL::RenderHW(GSHWDrawConfig& config)
|
||||
|
||||
const bool ds_feedbackloop_pass1 = config.ps.IsFeedbackLoopDepth();
|
||||
const bool ds_feedbackloop_pass2 = config.alpha_second_pass.ps.IsFeedbackLoopDepth();
|
||||
if (draw_ds && !draw_ds_rov && !m_features.texture_barrier && m_features.depth_feedback &&
|
||||
if (draw_ds && !m_features.texture_barrier && m_features.depth_feedback &&
|
||||
(config.require_one_barrier || (config.require_full_barrier && m_features.multidraw_fb_copy)) && (ds_feedbackloop_pass1 || ds_feedbackloop_pass2))
|
||||
{
|
||||
// Requires a copy of the DS.
|
||||
@@ -3083,9 +2984,7 @@ void GSDeviceOGL::RenderHW(GSHWDrawConfig& config)
|
||||
Console.Warning("GL: Failed to allocate temp texture for DS copy.");
|
||||
}
|
||||
|
||||
PSSetUnorderedAccess(draw_rt_rov, draw_ds_rov);
|
||||
|
||||
OMSetRenderTargets(draw_rt, draw_ds_as_rt, draw_ds, &config.scissor, &rtsize);
|
||||
OMSetRenderTargets(draw_rt, draw_ds_as_rt, draw_ds, &config.scissor);
|
||||
OMSetColorMaskState(config.colormask);
|
||||
SetupOM(config.depth);
|
||||
|
||||
@@ -3103,7 +3002,7 @@ void GSDeviceOGL::RenderHW(GSHWDrawConfig& config)
|
||||
}
|
||||
|
||||
SendHWDraw(config, rt_feedbackloop_pass1 ? draw_rt_clone : nullptr, draw_rt, ds_feedbackloop_pass1 ? draw_ds_clone : nullptr, draw_ds,
|
||||
config.require_one_barrier, config.require_full_barrier, rtsize);
|
||||
config.require_one_barrier, config.require_full_barrier);
|
||||
|
||||
if (config.blend_multi_pass.enable)
|
||||
{
|
||||
@@ -3151,7 +3050,7 @@ void GSDeviceOGL::RenderHW(GSHWDrawConfig& config)
|
||||
const bool one_barrier = config.alpha_second_pass.require_one_barrier && m_features.feedback_loops();
|
||||
SetupOM(config.alpha_second_pass.depth);
|
||||
SendHWDraw(config, rt_feedbackloop_pass2 ? draw_rt_clone : nullptr, draw_rt, ds_feedbackloop_pass2 ? draw_ds_clone : nullptr, draw_ds,
|
||||
one_barrier, config.alpha_second_pass.require_full_barrier, rtsize);
|
||||
one_barrier, config.alpha_second_pass.require_full_barrier);
|
||||
}
|
||||
|
||||
if (colclip_rt)
|
||||
@@ -3224,7 +3123,7 @@ void GSDeviceOGL::FeedbackCopyAndBind(const GSHWDrawConfig& config,
|
||||
|
||||
void GSDeviceOGL::SendHWDraw(const GSHWDrawConfig& config,
|
||||
GSTexture* draw_rt_clone, GSTexture* draw_rt, GSTexture* draw_ds_clone, GSTexture* draw_ds,
|
||||
const bool one_barrier, const bool full_barrier, const GSVector2i& rtsize)
|
||||
const bool one_barrier, const bool full_barrier)
|
||||
{
|
||||
#ifdef PCSX2_DEVBUILD
|
||||
if ((one_barrier || full_barrier) && !(config.IsFeedbackLoopRT(config.ps) || config.IsFeedbackLoopDepth(config.ps))) [[unlikely]]
|
||||
@@ -3281,9 +3180,6 @@ void GSDeviceOGL::SendHWDraw(const GSHWDrawConfig& config,
|
||||
}
|
||||
|
||||
Draw(config);
|
||||
|
||||
if (config.ps.HasColorROV() || config.ps.HasDepthROV())
|
||||
g_perfmon.Put(GSPerfMon::DrawCallsROV, 1);
|
||||
}
|
||||
|
||||
// Note: used as a callback of DebugMessageCallback. Don't change the signature
|
||||
|
||||
@@ -124,12 +124,6 @@ public:
|
||||
TEXTURE_DEPTH,
|
||||
};
|
||||
|
||||
enum ImageUnit : u32
|
||||
{
|
||||
IMAGE_RT_ROV,
|
||||
IMAGE_DEPTH_ROV,
|
||||
};
|
||||
|
||||
struct alignas(16) ProgramSelector
|
||||
{
|
||||
PSSelector ps;
|
||||
@@ -299,8 +293,6 @@ private:
|
||||
void OMAttachDs(GSTexture* ds = nullptr);
|
||||
void OMSetFBO(GLuint fbo);
|
||||
|
||||
void PSBindImage(GLuint image_unit, GSTexture* img);
|
||||
|
||||
void DrawStretchRect(const GSVector4& sRect, const GSVector4& dRect, const GSVector2i& ds);
|
||||
|
||||
void SetIndexBuffer(std::unique_ptr<GLStreamBuffer>& buffer, const void* index, size_t count);
|
||||
@@ -386,7 +378,7 @@ public:
|
||||
const GSVector4i& copyarea, const GSVector4i& samplearea);
|
||||
void SendHWDraw(const GSHWDrawConfig& config,
|
||||
GSTexture* draw_rt_clone, GSTexture* draw_rt, GSTexture* draw_ds_clone, GSTexture* draw_ds,
|
||||
const bool one_barrier, const bool full_barrier, const GSVector2i& rtsize);
|
||||
const bool one_barrier, const bool full_barrier);
|
||||
void SetupDATE(GSTexture* rt, GSTexture* ds, SetDATM datm, const GSVector4i& bbox);
|
||||
|
||||
void VSSetUniformBuffer(GSHWDrawConfig::VSConstantBuffer& cb);
|
||||
@@ -399,7 +391,6 @@ public:
|
||||
void IASetIndexBuffer(const void* index, size_t count);
|
||||
void VSSetIndexBuffer(const void* index, size_t count);
|
||||
|
||||
void PSSetUnorderedAccess(GSTexture* rt, GSTexture* ds);
|
||||
void PSSetShaderResource(int i, GSTexture* sr);
|
||||
void PSSetSamplerState(GLuint ss);
|
||||
void ClearSamplerCache() override;
|
||||
@@ -407,8 +398,7 @@ public:
|
||||
void OMSetDepthStencilState(GSDepthStencilOGL* dss);
|
||||
void OMSetBlendState(bool enable = false, GLenum src_factor = GL_ONE, GLenum dst_factor = GL_ZERO, GLenum op = GL_FUNC_ADD,
|
||||
GLenum src_factor_alpha = GL_ONE, GLenum dst_factor_alpha = GL_ZERO, bool is_constant = false, u8 constant = 0);
|
||||
void OMSetRenderTargets(GSTexture* rt, GSTexture* ds_as_rt, GSTexture* ds, const GSVector4i* scissor = nullptr,
|
||||
const GSVector2i* viewport = nullptr);
|
||||
void OMSetRenderTargets(GSTexture* rt, GSTexture* ds_as_rt, GSTexture* ds, const GSVector4i* scissor = nullptr);
|
||||
void OMSetColorMaskState(OMColorMaskSelector sel = OMColorMaskSelector());
|
||||
void OMUnbindTexture(GSTextureOGL* tex);
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ GSTextureOGL::GSTextureOGL(Type type, int width, int height, int levels, Format
|
||||
m_int_shift = 1;
|
||||
break;
|
||||
|
||||
// 1 Channel normalized
|
||||
// 1 Channel normalized
|
||||
case Format::UNorm8:
|
||||
m_gl_format = GL_R8;
|
||||
m_int_format = GL_RED;
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
/// Version number for GS and other shaders. Increment whenever any of the contents of the
|
||||
/// shaders change, to invalidate the cache.
|
||||
static constexpr u32 SHADER_CACHE_VERSION = 99; // Last changed in PR 14503
|
||||
static constexpr u32 SHADER_CACHE_VERSION = 100; // Last changed in PR 14503
|
||||
|
||||
Reference in New Issue
Block a user