File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed
cocos/renderer/backend/opengl Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -198,6 +198,23 @@ void CommandBufferGL::applyRenderPassDescriptor(const RenderPassDescriptor& desc
198
198
199
199
if (useGeneratedFBO)
200
200
_generatedFBOBindColor = true ;
201
+
202
+ #if CC_TARGET_PLATFORM == CC_PLATFORM_WIN32 || CC_TARGET_PLATFORM == CC_PLATFORM_LINUX
203
+ if (_framebufferReadWriteDisabled)
204
+ {
205
+ if (useGeneratedFBO) // user-defined framebuffer
206
+ {
207
+ glDrawBuffer (GL_COLOR_ATTACHMENT0);
208
+ glReadBuffer (GL_COLOR_ATTACHMENT0);
209
+ }
210
+ else // default framebuffer
211
+ {
212
+ glDrawBuffer (GL_BACK);
213
+ glReadBuffer (GL_BACK);
214
+ }
215
+ _framebufferReadWriteDisabled = false ;
216
+ }
217
+ #endif
201
218
}
202
219
else
203
220
{
@@ -219,6 +236,7 @@ void CommandBufferGL::applyRenderPassDescriptor(const RenderPassDescriptor& desc
219
236
#if CC_TARGET_PLATFORM == CC_PLATFORM_WIN32 || CC_TARGET_PLATFORM == CC_PLATFORM_LINUX
220
237
glDrawBuffer (GL_NONE);
221
238
glReadBuffer (GL_NONE);
239
+ _framebufferReadWriteDisabled = true ;
222
240
#endif
223
241
}
224
242
CHECK_GL_ERROR_DEBUG ();
Original file line number Diff line number Diff line change @@ -190,6 +190,9 @@ class CommandBufferGL final : public CommandBuffer
190
190
bool _generatedFBOBindColor = false ;
191
191
bool _generatedFBOBindDepth = false ;
192
192
bool _generatedFBOBindStencil = false ;
193
+ #if CC_TARGET_PLATFORM == CC_PLATFORM_WIN32 || CC_TARGET_PLATFORM == CC_PLATFORM_LINUX
194
+ bool _framebufferReadWriteDisabled = false ;
195
+ #endif
193
196
194
197
GLint _defaultFBO = 0 ; // The value gets from glGetIntegerv, so need to use GLint
195
198
GLuint _currentFBO = 0 ;
You can’t perform that action at this time.
0 commit comments