xgl: Proposal to remove XGL_FRAMEBUFFER
bug # 13323
alpha header: r29635
Don't actually remove XGL_FRAMEBUFFER but do change how
RenderPass and Framebuffer are connected. Some comments
from the bug:
- Created a new structure XGL_RENDER_PASS_BEGIN that contains
both the XGL_RENDER_PASS and XGL_FRAMEBUFFER.
- XGL_CMD_BUFFER_GRAPHICS_BEGIN_INFO and xglCmdBeginRenderPass
both use XGL_RENDER_PASS_BEGIN to ensure they stay consistent.
- Renamed the member in XGL_CMD_BUFFER_GRAPHICS_BEGIN_INFO to
renderPassContinue with a comment to clarify that this is
only needed when a render pass is split across two command buffer.
The last has the biggest impact on this patch. The tests now
directly call CmdBeginRenderPass and CmdEndRenderPass in the
command buffer rather than set the BEGIN_INFO to a render pass and
have the driver implicitly do BeginRenderPass and EndRenderPass.
It would probably still work, but didn't seem to match the intent
with this change in the header file.
diff --git a/layers/draw_state.cpp b/layers/draw_state.cpp
index 3687c06..c37930c 100644
--- a/layers/draw_state.cpp
+++ b/layers/draw_state.cpp
@@ -509,10 +509,10 @@
uint32_t psoNumSamples = getNumSamples(pipeline);
if (pCB->activeRenderPass) {
XGL_RENDER_PASS_CREATE_INFO* pRPCI = renderPassMap[pCB->activeRenderPass];
- XGL_FRAMEBUFFER_CREATE_INFO* pFBCI = frameBufferMap[pRPCI->framebuffer];
+ XGL_FRAMEBUFFER_CREATE_INFO* pFBCI = frameBufferMap[pCB->framebuffer];
if (psoNumSamples != pFBCI->sampleCount) {
char str[1024];
- sprintf(str, "Num samples mismatche! Binding PSO (%p) with %u samples while current RenderPass (%p) uses FB (%p) with %u samples!", (void*)pipeline, psoNumSamples, (void*)pCB->activeRenderPass, (void*)pRPCI->framebuffer, pFBCI->sampleCount);
+ sprintf(str, "Num samples mismatche! Binding PSO (%p) with %u samples while current RenderPass (%p) uses FB (%p) with %u samples!", (void*)pipeline, psoNumSamples, (void*)pCB->activeRenderPass, (void*)pCB->framebuffer, pFBCI->sampleCount);
layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, pipeline, 0, DRAWSTATE_NUM_SAMPLES_MISMATCH, "DS", str);
}
} else {
@@ -1894,7 +1894,7 @@
if (pBeginInfo->pNext) {
XGL_CMD_BUFFER_GRAPHICS_BEGIN_INFO* pCbGfxBI = (XGL_CMD_BUFFER_GRAPHICS_BEGIN_INFO*)pBeginInfo->pNext;
if (XGL_STRUCTURE_TYPE_CMD_BUFFER_GRAPHICS_BEGIN_INFO == pCbGfxBI->sType) {
- pCB->activeRenderPass = pCbGfxBI->renderPass;
+ pCB->activeRenderPass = pCbGfxBI->renderPassContinue.renderPass;
}
}
}
@@ -2526,21 +2526,21 @@
return result;
}
-XGL_LAYER_EXPORT void XGLAPI xglCmdBeginRenderPass(XGL_CMD_BUFFER cmdBuffer, XGL_RENDER_PASS renderPass)
+XGL_LAYER_EXPORT void XGLAPI xglCmdBeginRenderPass(XGL_CMD_BUFFER cmdBuffer, const XGL_RENDER_PASS_BEGIN *pRenderPassBegin)
{
GLOBAL_CB_NODE* pCB = getCBNode(cmdBuffer);
if (pCB) {
updateCBTracking(cmdBuffer);
addCmd(pCB, CMD_BEGINRENDERPASS);
- pCB->activeRenderPass = renderPass;
+ pCB->activeRenderPass = pRenderPassBegin->renderPass;
+ pCB->framebuffer = pRenderPassBegin->framebuffer;
validatePipelineState(pCB, XGL_PIPELINE_BIND_POINT_GRAPHICS, pCB->lastBoundPipeline);
- }
- else {
+ } else {
char str[1024];
sprintf(str, "Attempt to use CmdBuffer %p that doesn't exist!", (void*)cmdBuffer);
layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, cmdBuffer, 0, DRAWSTATE_INVALID_CMD_BUFFER, "DS", str);
}
- nextTable.CmdBeginRenderPass(cmdBuffer, renderPass);
+ nextTable.CmdBeginRenderPass(cmdBuffer, pRenderPassBegin);
}
XGL_LAYER_EXPORT void XGLAPI xglCmdEndRenderPass(XGL_CMD_BUFFER cmdBuffer, XGL_RENDER_PASS renderPass)