uint32_t graphics_queue_node_index;
XGL_PHYSICAL_GPU_QUEUE_PROPERTIES *queue_props;
+ XGL_FRAMEBUFFER framebuffer;
int width, height;
XGL_FORMAT format;
};
const float clear_depth = 1.0f;
XGL_IMAGE_SUBRESOURCE_RANGE clear_range;
- XGL_CMD_BUFFER_GRAPHICS_BEGIN_INFO graphics_cmd_buf_info = {
- .sType = XGL_STRUCTURE_TYPE_CMD_BUFFER_GRAPHICS_BEGIN_INFO,
- .pNext = NULL,
- };
XGL_CMD_BUFFER_BEGIN_INFO cmd_buf_info = {
.sType = XGL_STRUCTURE_TYPE_CMD_BUFFER_BEGIN_INFO,
- .pNext = &graphics_cmd_buf_info,
+ .pNext = NULL,
.flags = XGL_CMD_BUFFER_OPTIMIZE_GPU_SMALL_BATCH_BIT |
XGL_CMD_BUFFER_OPTIMIZE_ONE_TIME_SUBMIT_BIT,
};
.layers = 1,
};
XGL_RENDER_PASS_CREATE_INFO rp_info;
+ XGL_RENDER_PASS_BEGIN rp_begin;
memset(&rp_info, 0 , sizeof(rp_info));
- err = xglCreateFramebuffer(demo->device, &fb_info, &(rp_info.framebuffer));
+ err = xglCreateFramebuffer(demo->device, &fb_info, &rp_begin.framebuffer);
assert(!err);
rp_info.sType = XGL_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO;
rp_info.renderArea.extent.width = demo->width;
rp_info.renderArea.extent.height = demo->height;
- rp_info.colorAttachmentCount = 1;
- rp_info.pColorLoadClearValues = &clear_color;
+ rp_info.colorAttachmentCount = fb_info.colorAttachmentCount;
+ rp_info.pColorFormats = &demo->format;
+ rp_info.pColorLayouts = &color_attachment.layout;
rp_info.pColorLoadOps = &load_op;
rp_info.pColorStoreOps = &store_op;
+ rp_info.pColorLoadClearValues = &clear_color;
+ rp_info.depthStencilFormat = XGL_FMT_D16_UNORM;
+ rp_info.depthStencilLayout = depth_stencil.layout;
rp_info.depthLoadOp = XGL_ATTACHMENT_LOAD_OP_DONT_CARE;
+ rp_info.depthLoadClearValue = clear_depth;
rp_info.depthStoreOp = XGL_ATTACHMENT_STORE_OP_DONT_CARE;
rp_info.stencilLoadOp = XGL_ATTACHMENT_LOAD_OP_DONT_CARE;
+ rp_info.stencilLoadClearValue = 0;
rp_info.stencilStoreOp = XGL_ATTACHMENT_STORE_OP_DONT_CARE;
- err = xglCreateRenderPass(demo->device, &rp_info, &(graphics_cmd_buf_info.renderPass));
+ err = xglCreateRenderPass(demo->device, &rp_info, &rp_begin.renderPass);
assert(!err);
err = xglBeginCommandBuffer(cmd_buf, &cmd_buf_info);
xglCmdBindDynamicStateObject(cmd_buf, XGL_STATE_BIND_DEPTH_STENCIL,
demo->depth_stencil);
- xglCmdBeginRenderPass(cmd_buf, graphics_cmd_buf_info.renderPass);
+ xglCmdBeginRenderPass(cmd_buf, &rp_begin);
clear_range.aspect = XGL_IMAGE_ASPECT_COLOR;
clear_range.baseMipLevel = 0;
clear_range.mipLevels = 1;
clear_depth, 0, 1, &clear_range);
xglCmdDraw(cmd_buf, 0, 12 * 3, 0, 1);
- xglCmdEndRenderPass(cmd_buf, graphics_cmd_buf_info.renderPass);
+ xglCmdEndRenderPass(cmd_buf, rp_begin.renderPass);
err = xglEndCommandBuffer(cmd_buf);
assert(!err);
- xglDestroyObject(graphics_cmd_buf_info.renderPass);
- xglDestroyObject(rp_info.framebuffer);
+ xglDestroyObject(rp_begin.renderPass);
+ xglDestroyObject(rp_begin.framebuffer);
}
};
const float clear_depth = 0.9f;
XGL_IMAGE_SUBRESOURCE_RANGE clear_range;
- XGL_CMD_BUFFER_GRAPHICS_BEGIN_INFO graphics_cmd_buf_info = {
- .sType = XGL_STRUCTURE_TYPE_CMD_BUFFER_GRAPHICS_BEGIN_INFO,
- .pNext = NULL,
- };
XGL_CMD_BUFFER_BEGIN_INFO cmd_buf_info = {
.sType = XGL_STRUCTURE_TYPE_CMD_BUFFER_BEGIN_INFO,
- .pNext = &graphics_cmd_buf_info,
+ .pNext = NULL,
.flags = XGL_CMD_BUFFER_OPTIMIZE_GPU_SMALL_BATCH_BIT |
XGL_CMD_BUFFER_OPTIMIZE_ONE_TIME_SUBMIT_BIT,
};
.layers = 1,
};
XGL_RENDER_PASS_CREATE_INFO rp_info;
+ XGL_RENDER_PASS_BEGIN rp_begin;
memset(&rp_info, 0 , sizeof(rp_info));
- err = xglCreateFramebuffer(demo->device, &fb_info, &(rp_info.framebuffer));
+ err = xglCreateFramebuffer(demo->device, &fb_info, &rp_begin.framebuffer);
assert(!err);
rp_info.sType = XGL_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO;
rp_info.renderArea.extent.width = demo->width;
rp_info.renderArea.extent.height = demo->height;
rp_info.colorAttachmentCount = fb_info.colorAttachmentCount;
+ rp_info.pColorFormats = &demo->format;
+ rp_info.pColorLayouts = &color_attachment.layout;
rp_info.pColorLoadOps = &load_op;
rp_info.pColorStoreOps = &store_op;
+ rp_info.pColorLoadClearValues = &clear_color;
+ rp_info.depthStencilFormat = XGL_FMT_D16_UNORM;
+ rp_info.depthStencilLayout = depth_stencil.layout;
rp_info.depthLoadOp = XGL_ATTACHMENT_LOAD_OP_DONT_CARE;
+ rp_info.depthLoadClearValue = clear_depth;
rp_info.depthStoreOp = XGL_ATTACHMENT_STORE_OP_DONT_CARE;
rp_info.stencilLoadOp = XGL_ATTACHMENT_LOAD_OP_DONT_CARE;
+ rp_info.stencilLoadClearValue = 0;
rp_info.stencilStoreOp = XGL_ATTACHMENT_STORE_OP_DONT_CARE;
- err = xglCreateRenderPass(demo->device, &rp_info, &(graphics_cmd_buf_info.renderPass));
+ err = xglCreateRenderPass(demo->device, &rp_info, &(rp_begin.renderPass));
assert(!err);
err = xglBeginCommandBuffer(demo->cmd, &cmd_buf_info);
xglCmdBindVertexBuffer(demo->cmd, demo->vertices.buf, 0, 0);
- xglCmdBeginRenderPass(demo->cmd, graphics_cmd_buf_info.renderPass);
+ xglCmdBeginRenderPass(demo->cmd, &rp_begin);
clear_range.aspect = XGL_IMAGE_ASPECT_COLOR;
clear_range.baseMipLevel = 0;
clear_range.mipLevels = 1;
clear_depth, 0, 1, &clear_range);
xglCmdDraw(demo->cmd, 0, 3, 0, 1);
- xglCmdEndRenderPass(demo->cmd, graphics_cmd_buf_info.renderPass);
+ xglCmdEndRenderPass(demo->cmd, rp_begin.renderPass);
err = xglEndCommandBuffer(demo->cmd);
assert(!err);
- xglDestroyObject(graphics_cmd_buf_info.renderPass);
- xglDestroyObject(rp_info.framebuffer);
+ xglDestroyObject(rp_begin.renderPass);
+ xglDestroyObject(rp_begin.framebuffer);
}
static void demo_draw(struct demo *demo)
ICD_EXPORT void XGLAPI xglCmdBeginRenderPass(
XGL_CMD_BUFFER cmdBuffer,
- XGL_RENDER_PASS renderPass)
+ const XGL_RENDER_PASS_BEGIN* pRenderPassBegin)
{
NULLDRV_LOG_FUNC;
}
#include "xglPlatform.h"
// XGL API version supported by this file
-#define XGL_API_VERSION XGL_MAKE_VERSION(0, 56, 1)
+#define XGL_API_VERSION XGL_MAKE_VERSION(0, 57, 1)
#ifdef __cplusplus
extern "C"
{
XGL_IMAGE originalImage;
} XGL_PEER_IMAGE_OPEN_INFO;
-
typedef struct _XGL_SUBRESOURCE_LAYOUT
{
XGL_GPU_SIZE offset; // Specified in bytes
XGL_FLAGS flags; // XGL_CMD_BUFFER_BUILD_FLAGS
} XGL_CMD_BUFFER_BEGIN_INFO;
+typedef struct _XGL_RENDER_PASS_BEGIN
+{
+ XGL_RENDER_PASS renderPass;
+ XGL_FRAMEBUFFER framebuffer;
+} XGL_RENDER_PASS_BEGIN;
+
typedef struct _XGL_CMD_BUFFER_GRAPHICS_BEGIN_INFO
{
XGL_STRUCTURE_TYPE sType; // Must be XGL_STRUCTURE_TYPE_CMD_BUFFER_GRAPHICS_BEGIN_INFO
const void* pNext; // Pointer to next structure
- XGL_RENDER_PASS renderPass;
+ XGL_RENDER_PASS_BEGIN renderPassContinue; // Only needed when a render pass is split across two command buffers
} XGL_CMD_BUFFER_GRAPHICS_BEGIN_INFO;
// Union allowing specification of floating point or raw color data. Actual value selected is based on image being cleared.
const void* pNext; // Pointer to next structure
XGL_RECT renderArea;
- XGL_FRAMEBUFFER framebuffer;
uint32_t colorAttachmentCount;
- const XGL_ATTACHMENT_LOAD_OP* pColorLoadOps; // Array of size equivalent to the number of attachments in the framebuffer
- const XGL_ATTACHMENT_STORE_OP* pColorStoreOps; // Array of size equivalent to the number of attachments in the framebuffer
- const XGL_CLEAR_COLOR* pColorLoadClearValues; // Array of size equivalent to the number of attachments in the framebuffer
+ XGL_EXTENT2D extent;
+ uint32_t sampleCount;
+ uint32_t layers;
+ const XGL_FORMAT* pColorFormats;
+ const XGL_IMAGE_LAYOUT* pColorLayouts;
+ const XGL_ATTACHMENT_LOAD_OP* pColorLoadOps;
+ const XGL_ATTACHMENT_STORE_OP* pColorStoreOps;
+ const XGL_CLEAR_COLOR* pColorLoadClearValues;
+ XGL_FORMAT depthStencilFormat;
+ XGL_IMAGE_LAYOUT depthStencilLayout;
XGL_ATTACHMENT_LOAD_OP depthLoadOp;
float depthLoadClearValue;
XGL_ATTACHMENT_STORE_OP depthStoreOp;
typedef void (XGLAPI *xglCmdSaveAtomicCountersType)(XGL_CMD_BUFFER cmdBuffer, XGL_PIPELINE_BIND_POINT pipelineBindPoint, uint32_t startCounter, uint32_t counterCount, XGL_BUFFER destBuffer, XGL_GPU_SIZE destOffset);
typedef XGL_RESULT (XGLAPI *xglCreateFramebufferType)(XGL_DEVICE device, const XGL_FRAMEBUFFER_CREATE_INFO* pCreateInfo, XGL_FRAMEBUFFER* pFramebuffer);
typedef XGL_RESULT (XGLAPI *xglCreateRenderPassType)(XGL_DEVICE device, const XGL_RENDER_PASS_CREATE_INFO* pCreateInfo, XGL_RENDER_PASS* pRenderPass);
-typedef void (XGLAPI *xglCmdBeginRenderPassType)(XGL_CMD_BUFFER cmdBuffer, XGL_RENDER_PASS renderPass);
+typedef void (XGLAPI *xglCmdBeginRenderPassType)(XGL_CMD_BUFFER cmdBuffer, const XGL_RENDER_PASS_BEGIN* pRenderPassBegin);
typedef void (XGLAPI *xglCmdEndRenderPassType)(XGL_CMD_BUFFER cmdBuffer, XGL_RENDER_PASS renderPass);
#ifdef XGL_PROTOTYPES
void XGLAPI xglCmdBeginRenderPass(
XGL_CMD_BUFFER cmdBuffer,
- XGL_RENDER_PASS renderPass);
+ const XGL_RENDER_PASS_BEGIN* pRenderPassBegin);
void XGLAPI xglCmdEndRenderPass(
XGL_CMD_BUFFER cmdBuffer,
nextTable.CmdSaveAtomicCounters(cmdBuffer, pipelineBindPoint, startCounter, counterCount, destBuffer, destOffset);
}
-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) {
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)
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 {
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;
}
}
}
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)
DYNAMIC_STATE_NODE* lastBoundDynamicState[XGL_NUM_STATE_BIND_POINT];
XGL_DESCRIPTOR_SET lastBoundDescriptorSet;
XGL_RENDER_PASS activeRenderPass;
+ XGL_FRAMEBUFFER framebuffer;
} GLOBAL_CB_NODE;
//prototypes for extension functions
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)
{
loader_platform_thread_lock_mutex(&objLock);
ll_increment_use_count((void*)cmdBuffer, XGL_OBJECT_TYPE_CMD_BUFFER);
loader_platform_thread_unlock_mutex(&objLock);
- nextTable.CmdBeginRenderPass(cmdBuffer, renderPass);
+ nextTable.CmdBeginRenderPass(cmdBuffer, pRenderPassBegin);
}
XGL_LAYER_EXPORT void XGLAPI xglCmdEndRenderPass(XGL_CMD_BUFFER cmdBuffer, XGL_RENDER_PASS renderPass)
Proto("void", "CmdBeginRenderPass",
[Param("XGL_CMD_BUFFER", "cmdBuffer"),
- Param("XGL_RENDER_PASS", "renderPass")]),
+ Param("const XGL_RENDER_PASS_BEGIN*", "pRenderPassBegin")]),
Proto("void", "CmdEndRenderPass",
[Param("XGL_CMD_BUFFER", "cmdBuffer"),