- Timestamp:
- Jan 25, 2013 1:42:45 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_framebuffer.c
r44196 r44378 1046 1046 crStateFramebufferObjectDisableHW(CRContext *ctx, GLuint idDrawFBO, GLuint idReadFBO) 1047 1047 { 1048 GL boolean fAdjustDrawReadBuffers = GL_FALSE;1048 GLenum idDrawBuffer = 0, idReadBuffer = 0; 1049 1049 1050 1050 if (ctx->framebufferobject.drawFB || idDrawFBO) 1051 1051 { 1052 1052 diff_api.BindFramebufferEXT(GL_DRAW_FRAMEBUFFER, 0); 1053 fAdjustDrawReadBuffers = GL_TRUE;1053 idDrawBuffer = ctx->buffer.drawBuffer; 1054 1054 } 1055 1055 … … 1057 1057 { 1058 1058 diff_api.BindFramebufferEXT(GL_READ_FRAMEBUFFER, 0); 1059 fAdjustDrawReadBuffers = GL_TRUE; 1060 } 1061 1062 if (fAdjustDrawReadBuffers) 1063 { 1064 diff_api.DrawBuffer(GL_BACK); 1065 diff_api.ReadBuffer(GL_BACK); 1066 } 1067 1068 if (ctx->framebufferobject.renderbuffer) 1069 diff_api.BindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0); 1070 } 1071 1072 DECLEXPORT(void) STATE_APIENTRY 1073 crStateFramebufferObjectReenableHW(CRContext *fromCtx, CRContext *toCtx, GLuint idDrawFBO, GLuint idReadFBO) 1074 { 1075 GLuint idReadBuffer = 0, idDrawBuffer = 0; 1076 if (!fromCtx) 1077 fromCtx = toCtx; /* <- in case fromCtx is zero, set it to toCtx to ensure framebuffer state gets re-enabled correctly */ 1078 1079 if ((fromCtx->framebufferobject.drawFB) /* <- the FBO state was reset in crStateFramebufferObjectDisableHW */ 1080 && fromCtx->framebufferobject.drawFB == toCtx->framebufferobject.drawFB) /* .. and it was NOT restored properly in crStateFramebufferObjectSwitch */ 1081 { 1082 diff_api.BindFramebufferEXT(GL_DRAW_FRAMEBUFFER, toCtx->framebufferobject.drawFB->hwid); 1083 idDrawBuffer = toCtx->framebufferobject.drawFB->drawbuffer[0]; 1084 } 1085 else if (idDrawFBO && !toCtx->framebufferobject.drawFB) 1086 { 1087 diff_api.BindFramebufferEXT(GL_DRAW_FRAMEBUFFER, idDrawFBO); 1088 idDrawBuffer = GL_COLOR_ATTACHMENT0; 1089 } 1090 1091 if ((fromCtx->framebufferobject.readFB) /* <- the FBO state was reset in crStateFramebufferObjectDisableHW */ 1092 && fromCtx->framebufferobject.readFB == toCtx->framebufferobject.readFB) /* .. and it was NOT restored properly in crStateFramebufferObjectSwitch */ 1093 { 1094 diff_api.BindFramebufferEXT(GL_READ_FRAMEBUFFER, toCtx->framebufferobject.readFB->hwid); 1095 idReadBuffer = toCtx->framebufferobject.readFB->readbuffer; 1096 } 1097 else if (idReadFBO && !toCtx->framebufferobject.readFB) 1098 { 1099 diff_api.BindFramebufferEXT(GL_READ_FRAMEBUFFER, idReadFBO); 1100 idReadBuffer = GL_COLOR_ATTACHMENT0; 1059 idReadBuffer = ctx->buffer.readBuffer; 1101 1060 } 1102 1061 … … 1106 1065 diff_api.ReadBuffer(idReadBuffer); 1107 1066 1067 if (ctx->framebufferobject.renderbuffer) 1068 diff_api.BindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0); 1069 } 1070 1071 DECLEXPORT(void) STATE_APIENTRY 1072 crStateFramebufferObjectReenableHW(CRContext *fromCtx, CRContext *toCtx, GLuint idDrawFBO, GLuint idReadFBO) 1073 { 1074 GLuint idReadBuffer = 0, idDrawBuffer = 0; 1075 if (!fromCtx) 1076 fromCtx = toCtx; /* <- in case fromCtx is zero, set it to toCtx to ensure framebuffer state gets re-enabled correctly */ 1077 1078 if ((fromCtx->framebufferobject.drawFB) /* <- the FBO state was reset in crStateFramebufferObjectDisableHW */ 1079 && fromCtx->framebufferobject.drawFB == toCtx->framebufferobject.drawFB) /* .. and it was NOT restored properly in crStateFramebufferObjectSwitch */ 1080 { 1081 diff_api.BindFramebufferEXT(GL_DRAW_FRAMEBUFFER, toCtx->framebufferobject.drawFB->hwid); 1082 idDrawBuffer = toCtx->framebufferobject.drawFB->drawbuffer[0]; 1083 } 1084 else if (idDrawFBO && !toCtx->framebufferobject.drawFB) 1085 { 1086 diff_api.BindFramebufferEXT(GL_DRAW_FRAMEBUFFER, idDrawFBO); 1087 idDrawBuffer = GL_COLOR_ATTACHMENT0; 1088 } 1089 1090 if ((fromCtx->framebufferobject.readFB) /* <- the FBO state was reset in crStateFramebufferObjectDisableHW */ 1091 && fromCtx->framebufferobject.readFB == toCtx->framebufferobject.readFB) /* .. and it was NOT restored properly in crStateFramebufferObjectSwitch */ 1092 { 1093 diff_api.BindFramebufferEXT(GL_READ_FRAMEBUFFER, toCtx->framebufferobject.readFB->hwid); 1094 idReadBuffer = toCtx->framebufferobject.readFB->readbuffer; 1095 } 1096 else if (idReadFBO && !toCtx->framebufferobject.readFB) 1097 { 1098 diff_api.BindFramebufferEXT(GL_READ_FRAMEBUFFER, idReadFBO); 1099 idReadBuffer = GL_COLOR_ATTACHMENT0; 1100 } 1101 1102 if (idDrawBuffer) 1103 diff_api.DrawBuffer(idDrawBuffer); 1104 if (idReadBuffer) 1105 diff_api.ReadBuffer(idReadBuffer); 1106 1108 1107 if (fromCtx->framebufferobject.renderbuffer /* <- the FBO state was reset in crStateFramebufferObjectDisableHW */ 1109 1108 && fromCtx->framebufferobject.renderbuffer==toCtx->framebufferobject.renderbuffer) /* .. and it was NOT restored properly in crStateFramebufferObjectSwitch */
Note:
See TracChangeset
for help on using the changeset viewer.