Skip to content

Commit 2b96739

Browse files
author
drops
committed
OpenGL Clean up
1 parent b463cc3 commit 2b96739

File tree

3 files changed

+25
-21
lines changed

3 files changed

+25
-21
lines changed

src/Layers/xrRenderPC_GL/gl_rendertarget_u_set_rt.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,7 @@ void CRenderTarget::u_setrtzb(CBackend& cmd_list, const ref_rt& _1, const ref_rt
114114
else
115115
cmd_list.unset_ZB();
116116

117-
118-
[[maybe_unused]] GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
119-
VERIFY(status == GL_FRAMEBUFFER_COMPLETE);
117+
VERIFY(glCheckFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE);
120118
CHK_GL(glDrawBuffers(3, buffers));
121119
}
122120
} // namespace xray::render::RENDER_NAMESPACE

src/Layers/xrRender_R2/r2.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -421,14 +421,15 @@ void CRender::create()
421421
o.msaa_hybrid = ps_r2_ls_flags.test((u32)R3FLAG_USE_DX10_1);
422422
o.msaa_hybrid &= !o.msaa_opt && o.msaa && (HW.FeatureLevel >= D3D_FEATURE_LEVEL_10_1);
423423
#elif defined(USE_OGL)
424-
// TODO: OGL: temporary disabled, need to fix it
425-
o.msaa = true;
426-
o.msaa_samples = 4;
424+
o.msaa_samples = (1 << ps_r3_msaa);
425+
o.msaa = o.msaa_samples > 1;
427426

428427
if (!o.msaa) o.msaa_samples = 0;
429428
// Important! DX10 related, for OpenGL same as o.msaa
430429
// It's messing with shader predefines
431430
o.msaa_opt = o.msaa;
431+
// DX related ?
432+
o.gbuffer_opt = true;
432433
// Important! DX10 related, for OpenGL always false
433434
o.msaa_hybrid = false;
434435
#else

src/Layers/xrRender_R2/r3_rendertarget_phase_scene.cpp

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,13 @@ void CRenderTarget::phase_scene_prepare()
2121
if (RImplementation.o.advancedpp && (ps_r2_ls_flags.test(R2FLAG_SOFT_PARTICLES | R2FLAG_DOF) ||
2222
((ps_r_sun_shafts > 0) && (fValue >= 0.0001)) || (ps_r_ssao > 0)))
2323
{
24+
#ifdef USE_DX11
2425
// TODO: DX11: Check if we need to set RT here.
25-
#ifdef USE_OGL
26-
u_setrtzb(RCache, rt_Position,rt_MSAADepth);
27-
#else
2826
u_setrt(RCache, Device.dwWidth, Device.dwHeight, rt_Position->pRT, 0, 0, rt_MSAADepth);
27+
#else
28+
/* TODO investigate: it should be rt_Normal and (maybe) rt_Color
29+
* rt_Position should be always single-sampled */
30+
u_setrtzb(RCache, rt_Position,rt_MSAADepth);
2931
#endif
3032

3133
const Fcolor color{}; // black
@@ -64,24 +66,27 @@ void CRenderTarget::phase_scene_prepare()
6466
void CRenderTarget::phase_scene_begin()
6567
{
6668
// Targets, use accumulator for temporary storage
67-
if (!RImplementation.o.gbuffer_opt)
68-
{
69-
auto& _3 = RImplementation.o.albedo_wo ? rt_Accumulator : rt_Color;
7069
#ifdef USE_OGL
71-
u_setrtzb(RCache, rt_Position, rt_Normal, _3, rt_MSAADepth);
70+
// TODO Investigate should be color always
71+
auto& _2 = RImplementation.o.albedo_wo ? rt_Accumulator : rt_Color;
72+
u_setrtzb(RCache, rt_Position, _2, rt_MSAADepth);
7273
#else
73-
u_setrt(RCache, rt_Position, rt_Normal, _3, rt_MSAADepth);
74-
#endif
74+
if (!RImplementation.o.gbuffer_opt)
75+
{
76+
if (RImplementation.o.albedo_wo)
77+
u_setrt(RCache, rt_Position, rt_Normal, rt_Accumulator, rt_MSAADepth);
78+
else
79+
u_setrt(RCache, rt_Position, rt_Normal, rt_Color, rt_MSAADepth);
7580
}
7681
else
7782
{
78-
auto& _2 = RImplementation.o.albedo_wo ? rt_Accumulator : rt_Color;
79-
#ifdef USE_OGL
80-
u_setrtzb(RCache, rt_Position, _2, rt_MSAADepth);
81-
#else
82-
u_setrt(RCache, rt_Position, _2, nullptr, rt_MSAADepth);
83-
#endif
83+
if (RImplementation.o.albedo_wo)
84+
u_setrt(RCache, rt_Position, rt_Accumulator, rt_MSAADepth);
85+
else
86+
u_setrt(RCache, rt_Position, rt_Color, rt_MSAADepth);
87+
// else u_setrt (rt_Position, rt_Color, rt_Normal, rt_MSAADepth);
8488
}
89+
#endif
8590

8691
// Stencil - write 0x1 at pixel pos
8792
RCache.set_Stencil(

0 commit comments

Comments
 (0)