From a28bdde711fae9c44b80f99d1701fc55dd0e0b56 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Sat, 28 Mar 2015 15:23:55 +0800 Subject: binding: update for xglCmdBindDescriptorSets() This update makes it possible to bind multiple descriptor sets to the command buffer. We introduced intel_cmd_dset_data to hold the descriptor set offsets in the global descriptor region as well as their dynamic offsets. We also changed the descriptor reading routines from intel_desc_set_read_surface() intel_desc_set_read_sampler() to intel_desc_region_read_surface() intel_desc_region_read_sampler() v2: fix a potential crash when allocation of dynamic_desc_indices fails --- demos/cube.c | 4 ++-- demos/tri.c | 4 ++-- icd/nulldrv/nulldrv.c | 7 +++++-- include/xgl.h | 9 ++++++--- include/xglLayer.h | 2 +- xgl.py | 7 +++++-- 6 files changed, 21 insertions(+), 12 deletions(-) diff --git a/demos/cube.c b/demos/cube.c index 4a5c4a45..319ef05e 100644 --- a/demos/cube.c +++ b/demos/cube.c @@ -441,8 +441,8 @@ static void demo_draw_build_cmd(struct demo *demo, XGL_CMD_BUFFER cmd_buf) xglCmdBindPipeline(cmd_buf, XGL_PIPELINE_BIND_POINT_GRAPHICS, demo->pipeline); - xglCmdBindDescriptorSet(cmd_buf, XGL_PIPELINE_BIND_POINT_GRAPHICS, - demo->desc_set, NULL); + xglCmdBindDescriptorSets(cmd_buf, XGL_PIPELINE_BIND_POINT_GRAPHICS, + demo->desc_layout_chain, 0, 1, &demo->desc_set, NULL); xglCmdBindDynamicStateObject(cmd_buf, XGL_STATE_BIND_VIEWPORT, demo->viewport); xglCmdBindDynamicStateObject(cmd_buf, XGL_STATE_BIND_RASTER, demo->raster); diff --git a/demos/tri.c b/demos/tri.c index 2fbe6b9f..2818e10c 100644 --- a/demos/tri.c +++ b/demos/tri.c @@ -269,8 +269,8 @@ static void demo_draw_build_cmd(struct demo *demo) xglCmdBindPipeline(demo->cmd, XGL_PIPELINE_BIND_POINT_GRAPHICS, demo->pipeline); - xglCmdBindDescriptorSet(demo->cmd, XGL_PIPELINE_BIND_POINT_GRAPHICS, - demo->desc_set, NULL); + xglCmdBindDescriptorSets(demo->cmd, XGL_PIPELINE_BIND_POINT_GRAPHICS, + demo->desc_layout_chain, 0, 1, & demo->desc_set, NULL); xglCmdBindDynamicStateObject(demo->cmd, XGL_STATE_BIND_VIEWPORT, demo->viewport); xglCmdBindDynamicStateObject(demo->cmd, XGL_STATE_BIND_RASTER, demo->raster); diff --git a/icd/nulldrv/nulldrv.c b/icd/nulldrv/nulldrv.c index c2ff7330..49439222 100644 --- a/icd/nulldrv/nulldrv.c +++ b/icd/nulldrv/nulldrv.c @@ -1098,10 +1098,13 @@ ICD_EXPORT void XGLAPI xglCmdBindDynamicStateObject( NULLDRV_LOG_FUNC; } -ICD_EXPORT void XGLAPI xglCmdBindDescriptorSet( +ICD_EXPORT void XGLAPI xglCmdBindDescriptorSets( XGL_CMD_BUFFER cmdBuffer, XGL_PIPELINE_BIND_POINT pipelineBindPoint, - XGL_DESCRIPTOR_SET descriptorSet, + XGL_DESCRIPTOR_SET_LAYOUT_CHAIN layoutChain, + uint32_t layoutChainSlot, + uint32_t count, + const XGL_DESCRIPTOR_SET* pDescriptorSets, const uint32_t* pUserData) { NULLDRV_LOG_FUNC; diff --git a/include/xgl.h b/include/xgl.h index f90b8a7e..bae9c3fb 100644 --- a/include/xgl.h +++ b/include/xgl.h @@ -2336,7 +2336,7 @@ typedef XGL_RESULT (XGLAPI *xglEndCommandBufferType)(XGL_CMD_BUFFER cmdBuffer); typedef XGL_RESULT (XGLAPI *xglResetCommandBufferType)(XGL_CMD_BUFFER cmdBuffer); typedef void (XGLAPI *xglCmdBindPipelineType)(XGL_CMD_BUFFER cmdBuffer, XGL_PIPELINE_BIND_POINT pipelineBindPoint, XGL_PIPELINE pipeline); typedef void (XGLAPI *xglCmdBindDynamicStateObjectType)(XGL_CMD_BUFFER cmdBuffer, XGL_STATE_BIND_POINT stateBindPoint, XGL_DYNAMIC_STATE_OBJECT state); -typedef void (XGLAPI *xglCmdBindDescriptorSetType)(XGL_CMD_BUFFER cmdBuffer, XGL_PIPELINE_BIND_POINT pipelineBindPoint, XGL_DESCRIPTOR_SET descriptorSet, const uint32_t* pUserData); +typedef void (XGLAPI *xglCmdBindDescriptorSetsType)(XGL_CMD_BUFFER cmdBuffer, XGL_PIPELINE_BIND_POINT pipelineBindPoint, XGL_DESCRIPTOR_SET_LAYOUT_CHAIN layoutChain, uint32_t layoutChainSlot, uint32_t count, const XGL_DESCRIPTOR_SET* pDescriptorSets, const uint32_t* pUserData); typedef void (XGLAPI *xglCmdBindIndexBufferType)(XGL_CMD_BUFFER cmdBuffer, XGL_BUFFER buffer, XGL_GPU_SIZE offset, XGL_INDEX_TYPE indexType); typedef void (XGLAPI *xglCmdBindVertexBufferType)(XGL_CMD_BUFFER cmdBuffer, XGL_BUFFER buffer, XGL_GPU_SIZE offset, uint32_t binding); typedef void (XGLAPI *xglCmdDrawType)(XGL_CMD_BUFFER cmdBuffer, uint32_t firstVertex, uint32_t vertexCount, uint32_t firstInstance, uint32_t instanceCount); @@ -2807,10 +2807,13 @@ void XGLAPI xglCmdBindDynamicStateObject( XGL_STATE_BIND_POINT stateBindPoint, XGL_DYNAMIC_STATE_OBJECT dynamicState); -void XGLAPI xglCmdBindDescriptorSet( +void XGLAPI xglCmdBindDescriptorSets( XGL_CMD_BUFFER cmdBuffer, XGL_PIPELINE_BIND_POINT pipelineBindPoint, - XGL_DESCRIPTOR_SET descriptorSet, + XGL_DESCRIPTOR_SET_LAYOUT_CHAIN layoutChain, + uint32_t layoutChainSlot, + uint32_t count, + const XGL_DESCRIPTOR_SET* pDescriptorSets, const uint32_t* pUserData); void XGLAPI xglCmdBindIndexBuffer( diff --git a/include/xglLayer.h b/include/xglLayer.h index 98e52537..6111bcb9 100644 --- a/include/xglLayer.h +++ b/include/xglLayer.h @@ -104,7 +104,7 @@ typedef struct _XGL_LAYER_DISPATCH_TABLE xglResetCommandBufferType ResetCommandBuffer; xglCmdBindPipelineType CmdBindPipeline; xglCmdBindDynamicStateObjectType CmdBindDynamicStateObject; - xglCmdBindDescriptorSetType CmdBindDescriptorSet; + xglCmdBindDescriptorSetsType CmdBindDescriptorSets; xglCmdBindVertexBufferType CmdBindVertexBuffer; xglCmdBindIndexBufferType CmdBindIndexBuffer; xglCmdDrawType CmdDraw; diff --git a/xgl.py b/xgl.py index f9c6d44f..0f89e5cb 100644 --- a/xgl.py +++ b/xgl.py @@ -602,10 +602,13 @@ core = Extension( Param("XGL_STATE_BIND_POINT", "stateBindPoint"), Param("XGL_DYNAMIC_STATE_OBJECT", "state")]), - Proto("void", "CmdBindDescriptorSet", + Proto("void", "CmdBindDescriptorSets", [Param("XGL_CMD_BUFFER", "cmdBuffer"), Param("XGL_PIPELINE_BIND_POINT", "pipelineBindPoint"), - Param("XGL_DESCRIPTOR_SET", "descriptorSet"), + Param("XGL_DESCRIPTOR_SET_LAYOUT_CHAIN", "layoutChain"), + Param("uint32_t", "layoutChainSlot"), + Param("uint32_t", "count"), + Param("const XGL_DESCRIPTOR_SET*", "pDescriptorSets"), Param("const uint32_t*", "pUserData")]), Proto("void", "CmdBindVertexBuffer", -- cgit v1.2.3