Skip to content

Commit 2407c94

Browse files
committed
gl_rendertarget: Always set all draw buffers.
1 parent a854ef6 commit 2407c94

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

src/Layers/xrRenderPC_GL/gl_rendertarget.cpp

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,80 +19,77 @@ void CRenderTarget::u_setrt(const ref_rt& _1, const ref_rt& _2, const ref_rt& _3
1919
VERIFY(_1);
2020
dwWidth = _1->dwWidth;
2121
dwHeight = _1->dwHeight;
22-
GLuint cnt = 0;
2322
GLenum buffers[3] = { GL_NONE };
2423
if (_1)
2524
{
26-
buffers[cnt++] = GL_COLOR_ATTACHMENT0;
25+
buffers[0] = GL_COLOR_ATTACHMENT0;
2726
RCache.set_RT(_1->pRT, 0);
2827
}
2928
if (_2)
3029
{
31-
buffers[cnt++] = GL_COLOR_ATTACHMENT1;
30+
buffers[1] = GL_COLOR_ATTACHMENT1;
3231
RCache.set_RT(_2->pRT, 1);
3332
}
3433
if (_3)
3534
{
36-
buffers[cnt++] = GL_COLOR_ATTACHMENT2;
35+
buffers[2] = GL_COLOR_ATTACHMENT2;
3736
RCache.set_RT(_3->pRT, 2);
3837
}
3938
RCache.set_ZB(zb);
4039
// RImplementation.rmNormal ();
4140
GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
4241
VERIFY(status == GL_FRAMEBUFFER_COMPLETE);
43-
CHK_GL(glDrawBuffers(cnt, buffers));
42+
CHK_GL(glDrawBuffers(3, buffers));
4443
}
4544

4645
void CRenderTarget::u_setrt(const ref_rt& _1, const ref_rt& _2, GLuint zb)
4746
{
4847
VERIFY(_1);
4948
dwWidth = _1->dwWidth;
5049
dwHeight = _1->dwHeight;
51-
GLuint cnt = 0;
5250
GLenum buffers[2] = { GL_NONE };
5351
if (_1)
5452
{
55-
buffers[cnt++] = GL_COLOR_ATTACHMENT0;
53+
buffers[0] = GL_COLOR_ATTACHMENT0;
5654
RCache.set_RT(_1->pRT, 0);
5755
}
5856
if (_2)
5957
{
60-
buffers[cnt++] = GL_COLOR_ATTACHMENT1;
58+
buffers[1] = GL_COLOR_ATTACHMENT1;
6159
RCache.set_RT(_2->pRT, 1);
6260
}
6361
RCache.set_ZB(zb);
6462
// RImplementation.rmNormal ();
6563
GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
6664
VERIFY(status == GL_FRAMEBUFFER_COMPLETE);
67-
CHK_GL(glDrawBuffers(cnt, buffers));
65+
CHK_GL(glDrawBuffers(2, buffers));
6866
}
6967

7068
void CRenderTarget::u_setrt(u32 W, u32 H, GLuint _1, GLuint _2, GLuint _3, GLuint zb)
7169
{
7270
dwWidth = W;
7371
dwHeight = H;
74-
GLuint cnt = 0;
7572
GLenum buffers[3] = { GL_NONE };
7673
if (_1)
7774
{
78-
buffers[cnt++] = GL_COLOR_ATTACHMENT0;
75+
buffers[0] = GL_COLOR_ATTACHMENT0;
7976
RCache.set_RT(_1, 0);
8077
}
8178
if (_2)
8279
{
83-
buffers[cnt++] = GL_COLOR_ATTACHMENT1;
80+
buffers[1] = GL_COLOR_ATTACHMENT1;
8481
RCache.set_RT(_2, 1);
8582
}
8683
if (_3)
8784
{
88-
buffers[cnt++] = GL_COLOR_ATTACHMENT2;
85+
buffers[2] = GL_COLOR_ATTACHMENT2;
8986
RCache.set_RT(_3, 2);
9087
}
9188
RCache.set_ZB(zb);
9289
// RImplementation.rmNormal ();
9390
GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
9491
VERIFY(status == GL_FRAMEBUFFER_COMPLETE);
95-
CHK_GL(glDrawBuffers(cnt, buffers));
92+
CHK_GL(glDrawBuffers(3, buffers));
9693
}
9794

9895
void CRenderTarget::u_stencil_optimize (eStencilOptimizeMode eSOM)

0 commit comments

Comments
 (0)