XGL_CMD_BUFFER cmd; // Buffer for initialization commands
XGL_MEMORY_REF mem_refs[16];
int num_refs;
+ XGL_DESCRIPTOR_SET_LAYOUT_CHAIN desc_layout_chain;
XGL_DESCRIPTOR_SET_LAYOUT desc_layout;
XGL_PIPELINE pipeline;
.count = 2,
.pBinding = layout_bindings,
};
- const uint32_t bind_point = 0;
XGL_RESULT err;
err = xglCreateDescriptorSetLayout(demo->device,
- XGL_SHADER_STAGE_FLAGS_ALL, &bind_point,
- XGL_NULL_HANDLE, &descriptor_layout,
- &demo->desc_layout);
+ &descriptor_layout, &demo->desc_layout);
+ assert(!err);
+
+ err = xglCreateDescriptorSetLayoutChain(demo->device,
+ 1, &demo->desc_layout, &demo->desc_layout_chain);
assert(!err);
}
memset(&pipeline, 0, sizeof(pipeline));
pipeline.sType = XGL_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO;
- pipeline.lastSetLayout = demo->desc_layout;
+ pipeline.pSetLayoutChain = demo->desc_layout_chain;
memset(&ia, 0, sizeof(ia));
ia.sType = XGL_STRUCTURE_TYPE_PIPELINE_IA_STATE_CREATE_INFO;
static void demo_prepare_descriptor_set(struct demo *demo)
{
- const XGL_BUFFER_VIEW_ATTACH_INFO *view_info_vs =
- &demo->uniform_data.attach;
XGL_IMAGE_VIEW_ATTACH_INFO view_info[DEMO_TEXTURE_COUNT];
XGL_SAMPLER_IMAGE_VIEW_INFO combined_info[DEMO_TEXTURE_COUNT];
XGL_UPDATE_SAMPLER_TEXTURES update_fs;
XGL_UPDATE_BUFFERS update_vs;
+ const void *update_array[2] = { &update_vs, &update_fs };
XGL_RESULT err;
uint32_t count;
uint32_t i;
view_info[i].view = demo->textures[i].view,
view_info[i].layout = XGL_IMAGE_LAYOUT_GENERAL;
- combined_info[i].pSampler = demo->textures[i].sampler;
+ combined_info[i].sampler = demo->textures[i].sampler;
combined_info[i].pImageView = &view_info[i];
}
update_vs.pNext = &update_fs;
update_vs.descriptorType = XGL_DESCRIPTOR_TYPE_UNIFORM_BUFFER;
update_vs.count = 1;
- update_vs.pBufferViews = &view_info_vs;
+ update_vs.pBufferViews = &demo->uniform_data.attach;
memset(&update_fs, 0, sizeof(update_fs));
update_fs.sType = XGL_STRUCTURE_TYPE_UPDATE_SAMPLER_TEXTURES;
- update_fs.index = 1;
+ update_fs.binding = 1;
update_fs.count = DEMO_TEXTURE_COUNT;
update_fs.pSamplerImageViews = combined_info;
XGL_DESCRIPTOR_UPDATE_MODE_FASTEST);
xglClearDescriptorSets(demo->desc_pool, 1, &demo->desc_set);
- xglUpdateDescriptors(demo->desc_set, &update_vs);
+ xglUpdateDescriptors(demo->desc_set, 2, update_array);
xglEndDescriptorPoolUpdate(demo->device, demo->buffers[demo->current_buffer].cmd);
}
xglDestroyObject(demo->depth_stencil);
xglDestroyObject(demo->pipeline);
+ xglDestroyObject(demo->desc_layout_chain);
xglDestroyObject(demo->desc_layout);
for (i = 0; i < DEMO_TEXTURE_COUNT; i++) {
XGL_CMD_BUFFER cmd; // Buffer for initialization commands
XGL_MEMORY_REF mem_refs[16];
int num_refs;
+ XGL_DESCRIPTOR_SET_LAYOUT_CHAIN desc_layout_chain;
XGL_DESCRIPTOR_SET_LAYOUT desc_layout;
XGL_PIPELINE pipeline;
.count = 1,
.pBinding = &layout_binding,
};
- const uint32_t bind_point = 0;
XGL_RESULT err;
err = xglCreateDescriptorSetLayout(demo->device,
- XGL_SHADER_STAGE_FLAGS_ALL, &bind_point,
- XGL_NULL_HANDLE, &descriptor_layout,
- &demo->desc_layout);
+ &descriptor_layout, &demo->desc_layout);
+ assert(!err);
+
+ err = xglCreateDescriptorSetLayoutChain(demo->device,
+ 1, &demo->desc_layout, &demo->desc_layout_chain);
assert(!err);
}
memset(&pipeline, 0, sizeof(pipeline));
pipeline.sType = XGL_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO;
- pipeline.lastSetLayout = demo->desc_layout;
+ pipeline.pSetLayoutChain = demo->desc_layout_chain;
vi = demo->vertices.vi;
XGL_IMAGE_VIEW_ATTACH_INFO view_info[DEMO_TEXTURE_COUNT];
XGL_SAMPLER_IMAGE_VIEW_INFO combined_info[DEMO_TEXTURE_COUNT];
XGL_UPDATE_SAMPLER_TEXTURES update;
+ const void *update_array[1] = { &update };
XGL_RESULT err;
uint32_t count;
uint32_t i;
view_info[i].view = demo->textures[i].view,
view_info[i].layout = XGL_IMAGE_LAYOUT_GENERAL;
- combined_info[i].pSampler = demo->textures[i].sampler;
+ combined_info[i].sampler = demo->textures[i].sampler;
combined_info[i].pImageView = &view_info[i];
}
XGL_DESCRIPTOR_UPDATE_MODE_FASTEST);
xglClearDescriptorSets(demo->desc_pool, 1, &demo->desc_set);
- xglUpdateDescriptors(demo->desc_set, &update);
+ xglUpdateDescriptors(demo->desc_set, 1, update_array);
xglEndDescriptorPoolUpdate(demo->device, demo->cmd);
}
xglDestroyObject(demo->depth_stencil);
xglDestroyObject(demo->pipeline);
+ xglDestroyObject(demo->desc_layout_chain);
xglDestroyObject(demo->desc_layout);
xglBindObjectMemory(demo->vertices.buf, 0, XGL_NULL_HANDLE, 0);
}
static XGL_RESULT nulldrv_desc_layout_create(struct nulldrv_dev *dev,
- XGL_FLAGS stage_flags,
- const uint32_t *bind_points,
- const struct nulldrv_desc_layout *prior_layout,
const XGL_DESCRIPTOR_SET_LAYOUT_CREATE_INFO *info,
struct nulldrv_desc_layout **layout_ret)
{
return XGL_SUCCESS;
}
+static XGL_RESULT nulldrv_desc_layout_chain_create(struct nulldrv_dev *dev,
+ uint32_t setLayoutArrayCount,
+ const XGL_DESCRIPTOR_SET_LAYOUT *pSetLayoutArray,
+ struct nulldrv_desc_layout_chain **chain_ret)
+{
+ struct nulldrv_desc_layout_chain *chain;
+
+ chain = (struct nulldrv_desc_layout_chain *)
+ nulldrv_base_create(dev, sizeof(*chain),
+ XGL_DBG_OBJECT_DESCRIPTOR_SET_LAYOUT_CHAIN);
+ if (!chain)
+ return XGL_ERROR_OUT_OF_MEMORY;
+
+ *chain_ret = chain;
+
+ return XGL_SUCCESS;
+}
+
static struct nulldrv_desc_layout *nulldrv_desc_layout(XGL_DESCRIPTOR_SET_LAYOUT layout)
{
return (struct nulldrv_desc_layout *) layout;
ICD_EXPORT XGL_RESULT XGLAPI xglCreateDescriptorSetLayout(
XGL_DEVICE device,
- XGL_FLAGS stageFlags,
- const uint32_t* pSetBindPoints,
- XGL_DESCRIPTOR_SET_LAYOUT priorSetLayout,
const XGL_DESCRIPTOR_SET_LAYOUT_CREATE_INFO* pCreateInfo,
XGL_DESCRIPTOR_SET_LAYOUT* pSetLayout)
{
NULLDRV_LOG_FUNC;
struct nulldrv_dev *dev = nulldrv_dev(device);
- struct nulldrv_desc_layout *prior_layout = nulldrv_desc_layout(priorSetLayout);
- return nulldrv_desc_layout_create(dev, stageFlags, pSetBindPoints,
- prior_layout, pCreateInfo,
+ return nulldrv_desc_layout_create(dev, pCreateInfo,
(struct nulldrv_desc_layout **) pSetLayout);
}
+ICD_EXPORT XGL_RESULT XGLAPI xglCreateDescriptorSetLayoutChain(
+ XGL_DEVICE device,
+ uint32_t setLayoutArrayCount,
+ const XGL_DESCRIPTOR_SET_LAYOUT* pSetLayoutArray,
+ XGL_DESCRIPTOR_SET_LAYOUT_CHAIN* pLayoutChain)
+{
+ NULLDRV_LOG_FUNC;
+ struct nulldrv_dev *dev = nulldrv_dev(device);
+
+ return nulldrv_desc_layout_chain_create(dev,
+ setLayoutArrayCount, pSetLayoutArray,
+ (struct nulldrv_desc_layout_chain **) pLayoutChain);
+}
+
ICD_EXPORT XGL_RESULT XGLAPI xglBeginDescriptorPoolUpdate(
XGL_DEVICE device,
XGL_DESCRIPTOR_UPDATE_MODE updateMode)
ICD_EXPORT void XGLAPI xglUpdateDescriptors(
XGL_DESCRIPTOR_SET descriptorSet,
- const void* pUpdateChain)
+ uint32_t updateCount,
+ const void** ppUpdateArray)
{
NULLDRV_LOG_FUNC;
}
struct nulldrv_obj obj;
};
+struct nulldrv_desc_layout_chain {
+ struct nulldrv_obj obj;
+};
+
struct nulldrv_shader {
struct nulldrv_obj obj;
XGL_DEFINE_SUBCLASS_HANDLE(XGL_SAMPLER, XGL_OBJECT)
XGL_DEFINE_SUBCLASS_HANDLE(XGL_DESCRIPTOR_SET, XGL_OBJECT)
XGL_DEFINE_SUBCLASS_HANDLE(XGL_DESCRIPTOR_SET_LAYOUT, XGL_OBJECT)
+XGL_DEFINE_SUBCLASS_HANDLE(XGL_DESCRIPTOR_SET_LAYOUT_CHAIN, XGL_OBJECT)
XGL_DEFINE_SUBCLASS_HANDLE(XGL_DESCRIPTOR_POOL, XGL_OBJECT)
XGL_DEFINE_SUBCLASS_HANDLE(XGL_DYNAMIC_STATE_OBJECT, XGL_OBJECT)
XGL_DEFINE_SUBCLASS_HANDLE(XGL_DYNAMIC_VP_STATE_OBJECT, XGL_DYNAMIC_STATE_OBJECT)
{
XGL_STRUCTURE_TYPE sType; // Must be XGL_STRUCTURE_TYPE_UPDATE_SAMPLERS
const void* pNext; // Pointer to next structure
- uint32_t index;
- uint32_t count;
+ uint32_t binding; // Binding of the sampler (array)
+ uint32_t arrayIndex; // First element of the array to update or zero otherwise
+ uint32_t count; // Number of elements to update
const XGL_SAMPLER* pSamplers;
} XGL_UPDATE_SAMPLERS;
typedef struct _XGL_SAMPLER_IMAGE_VIEW_INFO
{
- XGL_SAMPLER pSampler;
+ XGL_SAMPLER sampler;
const XGL_IMAGE_VIEW_ATTACH_INFO* pImageView;
} XGL_SAMPLER_IMAGE_VIEW_INFO;
typedef struct _XGL_UPDATE_SAMPLER_TEXTURES
{
- XGL_STRUCTURE_TYPE sType; // Must be XGL_STRUCTURE_TYPE_UPDATE_SAMPLER_TEXTURES
- const void* pNext; // Pointer to next structure
- uint32_t index;
- uint32_t count;
- const XGL_SAMPLER_IMAGE_VIEW_INFO* pSamplerImageViews;
+ XGL_STRUCTURE_TYPE sType; // Must be XGL_STRUCTURE_TYPE_UPDATE_SAMPLER_TEXTURES
+ const void* pNext; // Pointer to next structure
+ uint32_t binding; // Binding of the combined texture sampler (array)
+ uint32_t arrayIndex; // First element of the array to update or zero otherwise
+ uint32_t count; // Number of elements to update
+ const XGL_SAMPLER_IMAGE_VIEW_INFO* pSamplerImageViews;
} XGL_UPDATE_SAMPLER_TEXTURES;
typedef struct _XGL_UPDATE_IMAGES
XGL_STRUCTURE_TYPE sType; // Must be XGL_STRUCTURE_TYPE_UPDATE_IMAGES
const void* pNext; // Pointer to next structure
XGL_DESCRIPTOR_TYPE descriptorType;
- uint32_t index;
- uint32_t count;
- const XGL_IMAGE_VIEW_ATTACH_INFO* const* pImageViews;
+ uint32_t binding; // Binding of the image (array)
+ uint32_t arrayIndex; // First element of the array to update or zero otherwise
+ uint32_t count; // Number of elements to update
+ const XGL_IMAGE_VIEW_ATTACH_INFO* pImageViews;
} XGL_UPDATE_IMAGES;
typedef struct _XGL_UPDATE_BUFFERS
XGL_STRUCTURE_TYPE sType; // Must be XGL_STRUCTURE_TYPE_UPDATE_BUFFERS
const void* pNext; // Pointer to next structure
XGL_DESCRIPTOR_TYPE descriptorType;
- uint32_t index;
- uint32_t count;
- const XGL_BUFFER_VIEW_ATTACH_INFO* const* pBufferViews;
+ uint32_t binding; // Binding of the buffer (array)
+ uint32_t arrayIndex; // First element of the array to update or zero otherwise
+ uint32_t count; // Number of elements to update
+ const XGL_BUFFER_VIEW_ATTACH_INFO* pBufferViews;
} XGL_UPDATE_BUFFERS;
typedef struct _XGL_UPDATE_AS_COPY
const void* pNext; // Pointer to next structure
XGL_DESCRIPTOR_TYPE descriptorType;
XGL_DESCRIPTOR_SET descriptorSet;
- uint32_t descriptorIndex;
+ uint32_t binding;
+ uint32_t arrayElement;
uint32_t count;
} XGL_UPDATE_AS_COPY;
const void* pNext; // Pointer to next structure
XGL_PIPELINE_SHADER cs;
XGL_FLAGS flags; // XGL_PIPELINE_CREATE_FLAGS
- XGL_DESCRIPTOR_SET_LAYOUT lastSetLayout;
+ XGL_DESCRIPTOR_SET_LAYOUT_CHAIN setLayoutChain;
+ // For local size fields zero is treated an invalid value
+ uint32_t localSizeX;
+ uint32_t localSizeY;
+ uint32_t localSizeZ;
+
} XGL_COMPUTE_PIPELINE_CREATE_INFO;
typedef struct _XGL_VERTEX_INPUT_BINDING_DESCRIPTION
XGL_STRUCTURE_TYPE sType; // Must be XGL_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO
const void* pNext; // Pointer to next structure
XGL_FLAGS flags; // XGL_PIPELINE_CREATE_FLAGS
- XGL_DESCRIPTOR_SET_LAYOUT lastSetLayout;
+ XGL_DESCRIPTOR_SET_LAYOUT_CHAIN pSetLayoutChain;
} XGL_GRAPHICS_PIPELINE_CREATE_INFO;
typedef struct _XGL_SAMPLER_CREATE_INFO
typedef XGL_RESULT (XGLAPI *xglLoadPipelineType)(XGL_DEVICE device, size_t dataSize, const void* pData, XGL_PIPELINE* pPipeline);
typedef XGL_RESULT (XGLAPI *xglLoadPipelineDerivativeType)(XGL_DEVICE device, size_t dataSize, const void* pData, XGL_PIPELINE basePipeline, XGL_PIPELINE* pPipeline);
typedef XGL_RESULT (XGLAPI *xglCreateSamplerType)(XGL_DEVICE device, const XGL_SAMPLER_CREATE_INFO* pCreateInfo, XGL_SAMPLER* pSampler);
-typedef XGL_RESULT (XGLAPI *xglCreateDescriptorSetLayoutType)(XGL_DEVICE device, XGL_FLAGS stageFlags, const uint32_t* pSetBindPoints, XGL_DESCRIPTOR_SET_LAYOUT priorSetLayout, const XGL_DESCRIPTOR_SET_LAYOUT_CREATE_INFO* pCreateInfo, XGL_DESCRIPTOR_SET_LAYOUT* pSetLayout);
+typedef XGL_RESULT (XGLAPI *xglCreateDescriptorSetLayoutType)(XGL_DEVICE device, const XGL_DESCRIPTOR_SET_LAYOUT_CREATE_INFO* pCreateInfo, XGL_DESCRIPTOR_SET_LAYOUT* pSetLayout);
+typedef XGL_RESULT (XGLAPI *xglCreateDescriptorSetLayoutChainType)(XGL_DEVICE device, uint32_t setLayoutArrayCount, const XGL_DESCRIPTOR_SET_LAYOUT* pSetLayoutArray, XGL_DESCRIPTOR_SET_LAYOUT_CHAIN* pLayoutChain);
typedef XGL_RESULT (XGLAPI *xglBeginDescriptorPoolUpdateType)(XGL_DEVICE device, XGL_DESCRIPTOR_UPDATE_MODE updateMode);
typedef XGL_RESULT (XGLAPI *xglEndDescriptorPoolUpdateType)(XGL_DEVICE device, XGL_CMD_BUFFER cmd);
typedef XGL_RESULT (XGLAPI *xglCreateDescriptorPoolType)(XGL_DEVICE device, XGL_DESCRIPTOR_POOL_USAGE poolUsage, uint32_t maxSets, const XGL_DESCRIPTOR_POOL_CREATE_INFO* pCreateInfo, XGL_DESCRIPTOR_POOL* pDescriptorPool);
typedef XGL_RESULT (XGLAPI *xglResetDescriptorPoolType)(XGL_DESCRIPTOR_POOL descriptorPool);
typedef XGL_RESULT (XGLAPI *xglAllocDescriptorSetsType)(XGL_DESCRIPTOR_POOL descriptorPool, XGL_DESCRIPTOR_SET_USAGE setUsage, uint32_t count, const XGL_DESCRIPTOR_SET_LAYOUT* pSetLayouts, XGL_DESCRIPTOR_SET* pDescriptorSets, uint32_t* pCount);
typedef void (XGLAPI *xglClearDescriptorSetsType)(XGL_DESCRIPTOR_POOL descriptorPool, uint32_t count, const XGL_DESCRIPTOR_SET* pDescriptorSets);
-typedef void (XGLAPI *xglUpdateDescriptorsType)(XGL_DESCRIPTOR_SET descriptorSet, const void* pUpdateChain);
+typedef void (XGLAPI *xglUpdateDescriptorsType)(XGL_DESCRIPTOR_SET descriptorSet, uint32_t updateCount, const void** ppUpdateArray);
typedef XGL_RESULT (XGLAPI *xglCreateDynamicViewportStateType)(XGL_DEVICE device, const XGL_DYNAMIC_VP_STATE_CREATE_INFO* pCreateInfo, XGL_DYNAMIC_VP_STATE_OBJECT* pState);
typedef XGL_RESULT (XGLAPI *xglCreateDynamicRasterStateType)(XGL_DEVICE device, const XGL_DYNAMIC_RS_STATE_CREATE_INFO* pCreateInfo, XGL_DYNAMIC_RS_STATE_OBJECT* pState);
typedef XGL_RESULT (XGLAPI *xglCreateDynamicColorBlendStateType)(XGL_DEVICE device, const XGL_DYNAMIC_CB_STATE_CREATE_INFO* pCreateInfo, XGL_DYNAMIC_CB_STATE_OBJECT* pState);
XGL_RESULT XGLAPI xglCreateDescriptorSetLayout(
XGL_DEVICE device,
- XGL_FLAGS stageFlags, // XGL_SHADER_STAGE_FLAGS
- const uint32_t* pSetBindPoints,
- XGL_DESCRIPTOR_SET_LAYOUT priorSetLayout,
const XGL_DESCRIPTOR_SET_LAYOUT_CREATE_INFO* pCreateInfo,
XGL_DESCRIPTOR_SET_LAYOUT* pSetLayout);
+XGL_RESULT XGLAPI xglCreateDescriptorSetLayoutChain(
+ XGL_DEVICE device,
+ uint32_t setLayoutArrayCount,
+ const XGL_DESCRIPTOR_SET_LAYOUT* pSetLayoutArray,
+ XGL_DESCRIPTOR_SET_LAYOUT_CHAIN* pLayoutChain);
+
XGL_RESULT XGLAPI xglBeginDescriptorPoolUpdate(
XGL_DEVICE device,
XGL_DESCRIPTOR_UPDATE_MODE updateMode);
void XGLAPI xglUpdateDescriptors(
XGL_DESCRIPTOR_SET descriptorSet,
- const void* pUpdateChain);
+ uint32_t updateCount,
+ const void** ppUpdateArray);
// State object functions
XGL_DBG_OBJECT_BUFFER,
XGL_DBG_OBJECT_BUFFER_VIEW,
XGL_DBG_OBJECT_DESCRIPTOR_SET_LAYOUT,
+ XGL_DBG_OBJECT_DESCRIPTOR_SET_LAYOUT_CHAIN,
XGL_DBG_OBJECT_DESCRIPTOR_POOL,
XGL_DBG_OBJECT_TYPE_BEGIN_RANGE = XGL_DBG_OBJECT_UNKNOWN,
xglLoadPipelineDerivativeType LoadPipelineDerivative;
xglCreateSamplerType CreateSampler;
xglCreateDescriptorSetLayoutType CreateDescriptorSetLayout;
+ xglCreateDescriptorSetLayoutChainType CreateDescriptorSetLayoutChain;
xglBeginDescriptorPoolUpdateType BeginDescriptorPoolUpdate;
xglEndDescriptorPoolUpdateType EndDescriptorPoolUpdate;
xglCreateDescriptorPoolType CreateDescriptorPool;
"XGL_SAMPLER",
"XGL_DESCRIPTOR_SET",
"XGL_DESCRIPTOR_SET_LAYOUT",
+ "XGL_DESCRIPTOR_SET_LAYOUT_CHAIN",
"XGL_DESCRIPTOR_POOL",
"XGL_DYNAMIC_STATE_OBJECT",
"XGL_DYNAMIC_VP_STATE_OBJECT",
Proto("XGL_RESULT", "CreateDescriptorSetLayout",
[Param("XGL_DEVICE", "device"),
- Param("XGL_FLAGS", "stageFlags"),
- Param("const uint32_t*", "pSetBindPoints"),
- Param("XGL_DESCRIPTOR_SET_LAYOUT", "priorSetLayout"),
Param("const XGL_DESCRIPTOR_SET_LAYOUT_CREATE_INFO*", "pCreateInfo"),
Param("XGL_DESCRIPTOR_SET_LAYOUT*", "pSetLayout")]),
+ Proto("XGL_RESULT", "CreateDescriptorSetLayoutChain",
+ [Param("XGL_DEVICE", "device"),
+ Param("uint32_t", "setLayoutArrayCount"),
+ Param("const XGL_DESCRIPTOR_SET_LAYOUT*", "pSetLayoutArray"),
+ Param("XGL_DESCRIPTOR_SET_LAYOUT_CHAIN*", "pLayoutChain")]),
+
Proto("XGL_RESULT", "BeginDescriptorPoolUpdate",
[Param("XGL_DEVICE", "device"),
Param("XGL_DESCRIPTOR_UPDATE_MODE", "updateMode")]),
Proto("void", "UpdateDescriptors",
[Param("XGL_DESCRIPTOR_SET", "descriptorSet"),
- Param("const void*", "pUpdateChain")]),
+ Param("uint32_t", "updateCount"),
+ Param("const void**", "ppUpdateArray")]),
Proto("XGL_RESULT", "CreateDynamicViewportState",
[Param("XGL_DEVICE", "device"),