struct {
XGL_GPU_MEMORY mem;
- XGL_MEMORY_VIEW_ATTACH_INFO view;
XGL_PIPELINE_VERTEX_INPUT_CREATE_INFO vi;
XGL_VERTEX_INPUT_BINDING_DESCRIPTION vi_bindings[1];
xglCmdBindAttachments(demo->cmd, 1, &color_attachment, &depth_stencil);
+ xglCmdBindVertexData(demo->cmd, demo->vertices.mem, 0, 0);
+
clear_range.aspect = XGL_IMAGE_ASPECT_COLOR;
clear_range.baseMipLevel = 0;
clear_range.mipLevels = 1;
err = xglUnmapMemory(demo->vertices.mem);
assert(!err);
- demo->vertices.view.sType = XGL_STRUCTURE_TYPE_MEMORY_VIEW_ATTACH_INFO;
- demo->vertices.view.pNext = NULL;
- demo->vertices.view.mem = demo->vertices.mem;
- demo->vertices.view.offset = 0;
- demo->vertices.view.range = sizeof(vb);
- demo->vertices.view.stride = sizeof(vb[0]);
- demo->vertices.view.format.channelFormat = XGL_CH_FMT_UNDEFINED;
- demo->vertices.view.format.numericFormat = XGL_NUM_FMT_UNDEFINED;
- demo->vertices.view.state = XGL_MEMORY_STATE_GRAPHICS_SHADER_READ_ONLY;
-
demo->vertices.vi.sType = XGL_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_CREATE_INFO;
demo->vertices.vi.pNext = NULL;
demo->vertices.vi.bindingCount = 1;
const XGL_DESCRIPTOR_SET_CREATE_INFO descriptor_set = {
.sType = XGL_STRUCTURE_TYPE_DESCRIPTOR_SET_CREATE_INFO,
.pNext = NULL,
- .slots = DEMO_TEXTURE_COUNT * 2 + 1,
+ .slots = DEMO_TEXTURE_COUNT * 2,
};
XGL_RESULT err;
XGL_UINT i;
assert(!err);
xglBeginDescriptorSetUpdate(demo->dset);
- xglClearDescriptorSetSlots(demo->dset, 0, DEMO_TEXTURE_COUNT * 2 + 1);
+ xglClearDescriptorSetSlots(demo->dset, 0, DEMO_TEXTURE_COUNT * 2);
for (i = 0; i < DEMO_TEXTURE_COUNT; i++) {
const XGL_IMAGE_VIEW_ATTACH_INFO image_view = {
&image_view);
}
- xglAttachMemoryViewDescriptors(demo->dset, 2 * i, 1, &demo->vertices.view);
-
xglEndDescriptorSetUpdate(demo->dset);
}
XGL_PIPELINE_DB_STATE_CREATE_INFO db;
XGL_PIPELINE_SHADER_STAGE_CREATE_INFO vs;
XGL_PIPELINE_SHADER_STAGE_CREATE_INFO fs;
- XGL_DESCRIPTOR_SLOT_INFO vs_slots[DEMO_TEXTURE_COUNT * 2 + 1];
- XGL_DESCRIPTOR_SLOT_INFO fs_slots[DEMO_TEXTURE_COUNT * 2 + 1];
+ XGL_DESCRIPTOR_SLOT_INFO fs_slots[DEMO_TEXTURE_COUNT * 2];
XGL_RESULT err;
XGL_UINT i;
db.sType = XGL_STRUCTURE_TYPE_PIPELINE_DB_STATE_CREATE_INFO;
db.format = demo->depth.format;
- memset(&vs_slots, 0, sizeof(vs_slots));
- vs_slots[2 * DEMO_TEXTURE_COUNT].slotObjectType = XGL_SLOT_VERTEX_INPUT;
- vs_slots[2 * DEMO_TEXTURE_COUNT].shaderEntityIndex = 0;
-
memset(&fs_slots, 0, sizeof(fs_slots));
for (i = 0; i < DEMO_TEXTURE_COUNT; i++) {
fs_slots[2 * i].slotObjectType = XGL_SLOT_SHADER_SAMPLER;
vs.sType = XGL_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
vs.shader.stage = XGL_SHADER_STAGE_VERTEX;
vs.shader.shader = demo_prepare_vs(demo);
- vs.shader.descriptorSetMapping[0].descriptorCount =
- DEMO_TEXTURE_COUNT * 2 + 1;
- vs.shader.descriptorSetMapping[0].pDescriptorInfo = vs_slots;
memset(&fs, 0, sizeof(fs));
fs.sType = XGL_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
fs.shader.stage = XGL_SHADER_STAGE_FRAGMENT;
fs.shader.shader = demo_prepare_fs(demo);
fs.shader.descriptorSetMapping[0].descriptorCount =
- DEMO_TEXTURE_COUNT * 2 + 1;
+ DEMO_TEXTURE_COUNT * 2;
fs.shader.descriptorSetMapping[0].pDescriptorInfo = fs_slots;
pipeline.pNext = (const XGL_VOID *) &vi;
XGL_SLOT_SHADER_RESOURCE = 0x00000001,
XGL_SLOT_SHADER_UAV = 0x00000002,
XGL_SLOT_SHADER_SAMPLER = 0x00000003,
-// IMG CHANGE BEGIN - support for vertex input description
- XGL_SLOT_VERTEX_INPUT = 0x00000004,
- XGL_SLOT_NEXT_DESCRIPTOR_SET = 0x00000005,
-// IMG CHANGE END
+ XGL_SLOT_NEXT_DESCRIPTOR_SET = 0x00000004,
XGL_DESCRIPTOR_SET_SLOT_TYPE_BEGIN_RANGE = XGL_SLOT_UNUSED,
XGL_DESCRIPTOR_SET_SLOT_TYPE_END_RANGE = XGL_SLOT_NEXT_DESCRIPTOR_SET,
// IMG CHANGE BEGIN - support for vertex input description
XGL_CH_FMT_R8G8B8 = 31,
XGL_CH_FMT_R16G16B16 = 32,
- XGL_MAX_CH_FMT = XGL_CH_FMT_R16G16B16,
+
+ // optional? TBD'
+ XGL_CH_FMT_B10G10R10A2 = 33,
+ XGL_CH_FMT_R64 = 34,
+ XGL_CH_FMT_R64G64 = 35,
+ XGL_CH_FMT_R64G64B64 = 36,
+ XGL_CH_FMT_R64G64B64A64 = 37,
+
+ XGL_MAX_CH_FMT = XGL_CH_FMT_R64G64B64A64,
// IMG CHANGE END
XGL_MAX_ENUM(_XGL_CHANNEL_FORMAT)
} XGL_CHANNEL_FORMAT;
XGL_NUM_FMT_FLOAT = 5,
XGL_NUM_FMT_SRGB = 6,
XGL_NUM_FMT_DS = 7,
- XGL_MAX_NUM_FMT = XGL_NUM_FMT_DS,
+// IMG CHANGE BEGIN - support for vertex input description
+ XGL_NUM_FMT_USCALED = 8,
+ XGL_NUM_FMT_SSCALED = 9,
+ XGL_MAX_NUM_FMT = XGL_NUM_FMT_SSCALED,
+// IMG CHANGE END
XGL_MAX_ENUM(_XGL_NUM_FORMAT)
} XGL_NUM_FORMAT;
// IMG CHANGE BEGIN - support for vertex input description
-// Example descriptor set mapping:
-//
-// {
-// .descriptorCount = 4;
-// .pDescriptorInfo[0] =
-// {
-// .slotObjectType = XGL_SLOT_VERTEX_INPUT;
-// .shaderEntityIndex = 2; // describes XGL_PIPELINE_VERTEX_INPUT_CREATE_INFO.pVertexBindingDescriptions[2]
-// }
-// .pDescriptorInfo[1] =
-// {
-// .slotObjectType = XGL_SLOT_UNUSED;
-// .shaderEntityIndex = 0;
-// }
-// .pDescriptorInfo[2] =
-// {
-// .slotObjectType = XGL_SLOT_VERTEX_INPUT;
-// .shaderEntityIndex = 0; // describes XGL_PIPELINE_VERTEX_INPUT_CREATE_INFO.pVertexBindingDescriptions[0]
-// }
-// .pDescriptorInfo[3] =
-// {
-// .slotObjectType = XGL_SLOT_VERTEX_INPUT;
-// .shaderEntityIndex = 1; // describes XGL_PIPELINE_VERTEX_INPUT_CREATE_INFO.pVertexBindingDescriptions[1]
-// }
-// }
//
// The shader inputs are mapped to pVertexAttributeDescriptions using a decoration in the BIL.
//
+// The binding parameter in xglCmdBindVertexBuffer describes the index into pVertexBindingDescriptions[]
+//
//
// Formats allowed for attributes (XGL_VERTEX_INPUT_ATTRIBUTE_DESCRIPTION.format) will be detailed in
// a table in the specification.
XGL_PIPELINE_BIND_POINT pipelineBindPoint,
const XGL_MEMORY_VIEW_ATTACH_INFO* pMemView);
+// IMG CHANGE BEGIN - support for vertex input description
+XGL_VOID XGLAPI xglCmdBindVertexData(
+ XGL_CMD_BUFFER cmdBuffer,
+ XGL_GPU_MEMORY mem,
+ XGL_GPU_SIZE offset,
+ XGL_UINT binding);
+// IMG CHANGE END
+
XGL_VOID XGLAPI xglCmdBindIndexData(
XGL_CMD_BUFFER cmdBuffer,
XGL_GPU_MEMORY mem,
typedef XGL_VOID (XGLAPI *CmdBindStateObjectType)(XGL_CMD_BUFFER cmdBuffer, XGL_STATE_BIND_POINT stateBindPoint, XGL_STATE_OBJECT state);
typedef XGL_VOID (XGLAPI *CmdBindDescriptorSetType)(XGL_CMD_BUFFER cmdBuffer, XGL_PIPELINE_BIND_POINT pipelineBindPoint, XGL_UINT index, XGL_DESCRIPTOR_SET descriptorSet, XGL_UINT slotOffset);
typedef XGL_VOID (XGLAPI *CmdBindDynamicMemoryViewType)(XGL_CMD_BUFFER cmdBuffer, XGL_PIPELINE_BIND_POINT pipelineBindPoint, const XGL_MEMORY_VIEW_ATTACH_INFO* pMemView);
+typedef XGL_VOID (XGLAPI *CmdBindVertexDataType)(XGL_CMD_BUFFER cmdBuffer, XGL_GPU_MEMORY mem, XGL_GPU_SIZE offset, XGL_UINT binding);
typedef XGL_VOID (XGLAPI *CmdBindIndexDataType)(XGL_CMD_BUFFER cmdBuffer, XGL_GPU_MEMORY mem, XGL_GPU_SIZE offset, XGL_INDEX_TYPE indexType);
typedef XGL_VOID (XGLAPI *CmdBindAttachmentsType)(XGL_CMD_BUFFER cmdBuffer, XGL_UINT colorAttachmentCount, const XGL_COLOR_ATTACHMENT_BIND_INFO* pColorAttachments, const XGL_DEPTH_STENCIL_BIND_INFO* pDepthStencilAttachment);
typedef XGL_VOID (XGLAPI *CmdPrepareMemoryRegionsType)(XGL_CMD_BUFFER cmdBuffer, XGL_UINT transitionCount, const XGL_MEMORY_STATE_TRANSITION* pStateTransitions);
CmdBindStateObjectType CmdBindStateObject;
CmdBindDescriptorSetType CmdBindDescriptorSet;
CmdBindDynamicMemoryViewType CmdBindDynamicMemoryView;
+ CmdBindVertexDataType CmdBindVertexData;
CmdBindIndexDataType CmdBindIndexData;
CmdBindAttachmentsType CmdBindAttachments;
CmdPrepareMemoryRegionsType CmdPrepareMemoryRegions;
nextTable.CmdBindDescriptorSet = fpCmdBindDescriptorSet;
CmdBindDynamicMemoryViewType fpCmdBindDynamicMemoryView = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdBindDynamicMemoryView");
nextTable.CmdBindDynamicMemoryView = fpCmdBindDynamicMemoryView;
+ CmdBindVertexDataType fpCmdBindVertexData = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdBindVertexData");
+ nextTable.CmdBindVertexData = fpCmdBindVertexData;
CmdBindIndexDataType fpCmdBindIndexData = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdBindIndexData");
nextTable.CmdBindIndexData = fpCmdBindIndexData;
CmdBindAttachmentsType fpCmdBindAttachments = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdBindAttachments");
}
}
+XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdBindVertexData(XGL_CMD_BUFFER cmdBuffer, XGL_GPU_MEMORY mem, XGL_GPU_SIZE offset, XGL_UINT binding)
+{
+ nextTable.CmdBindVertexData(cmdBuffer, mem, offset, binding);
+ printf("xglCmdBindVertexData(cmdBuffer = %p, mem = %p, offset = %i, binding = %d)\n", (void*)cmdBuffer, (void*)mem, offset, binding);
+}
+
XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdBindIndexData(XGL_CMD_BUFFER cmdBuffer, XGL_GPU_MEMORY mem, XGL_GPU_SIZE offset, XGL_INDEX_TYPE indexType)
{
nextTable.CmdBindIndexData(cmdBuffer, mem, offset, indexType);
return xglCmdBindDescriptorSet;
else if (!strncmp("xglCmdBindDynamicMemoryView", (const char *) funcName, sizeof("xglCmdBindDynamicMemoryView")))
return xglCmdBindDynamicMemoryView;
+ else if (!strncmp("xglCmdBindVertexData", (const char *) funcName, sizeof("xglCmdBindVertexData")))
+ return xglCmdBindVertexData;
else if (!strncmp("xglCmdBindIndexData", (const char *) funcName, sizeof("xglCmdBindIndexData")))
return xglCmdBindIndexData;
else if (!strncmp("xglCmdBindAttachments", (const char *) funcName, sizeof("xglCmdBindAttachments")))
myTable.CmdBindStateObject = fpGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (const XGL_CHAR *) "xglCmdBindStateObject");
myTable.CmdBindDescriptorSet = fpGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (const XGL_CHAR *) "xglCmdBindDescriptorSet");
myTable.CmdBindDynamicMemoryView = fpGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (const XGL_CHAR *) "xglCmdBindDynamicMemoryView");
+ myTable.CmdBindVertexData = fpGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (const XGL_CHAR *) "xglCmdBindVertexData");
myTable.CmdBindIndexData = fpGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (const XGL_CHAR *) "xglCmdBindIndexData");
myTable.CmdBindAttachments = fpGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (const XGL_CHAR *) "xglCmdBindAttachments");
myTable.CmdPrepareMemoryRegions = fpGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (const XGL_CHAR *) "xglCmdPrepareMemoryRegions");
return myTable.CmdBindDescriptorSet;
else if (!strncmp("xglCmdBindDynamicMemoryView", (const char *) pName, sizeof ("xglCmdBindDynamicMemoryView")))
return myTable.CmdBindDynamicMemoryView;
+ else if (!strncmp("xglCmdBindVertexData", (const char *) pName, sizeof ("xglCmdBindVertexData")))
+ return myTable.CmdBindVertexData;
else if (!strncmp("xglCmdBindIndexData", (const char *) pName, sizeof ("xglCmdBindIndexData")))
return myTable.CmdBindIndexData;
else if (!strncmp("xglCmdBindAttachments", (const char *) pName, sizeof ("xglCmdBindAttachments")))
if (MAPPING_SAMPLER != slotBinding)
error = XGL_TRUE;
break;
- case XGL_SLOT_VERTEX_INPUT:
- if (MAPPING_MEMORY != slotBinding)
- error = XGL_TRUE;
- break;
case XGL_SLOT_SHADER_UAV:
if (MAPPING_MEMORY != slotBinding)
error = XGL_TRUE;
nextTable.CmdBindDescriptorSet = fpCmdBindDescriptorSet;
CmdBindDynamicMemoryViewType fpCmdBindDynamicMemoryView = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdBindDynamicMemoryView");
nextTable.CmdBindDynamicMemoryView = fpCmdBindDynamicMemoryView;
+ CmdBindVertexDataType fpCmdBindVertexData = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdBindVertexData");
+ nextTable.CmdBindVertexData = fpCmdBindVertexData;
CmdBindIndexDataType fpCmdBindIndexData = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdBindIndexData");
nextTable.CmdBindIndexData = fpCmdBindIndexData;
CmdBindAttachmentsType fpCmdBindAttachments = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdBindAttachments");
nextTable.CmdBindDynamicMemoryView(cmdBuffer, pipelineBindPoint, pMemView);
}
+XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdBindVertexData(XGL_CMD_BUFFER cmdBuffer, XGL_GPU_MEMORY mem, XGL_GPU_SIZE offset, XGL_UINT binding)
+{
+ nextTable.CmdBindVertexData(cmdBuffer, mem, offset, binding);
+}
+
XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdBindIndexData(XGL_CMD_BUFFER cmdBuffer, XGL_GPU_MEMORY mem, XGL_GPU_SIZE offset, XGL_INDEX_TYPE indexType)
{
nextTable.CmdBindIndexData(cmdBuffer, mem, offset, indexType);
nextTable.CmdBindDescriptorSet = fpCmdBindDescriptorSet;
CmdBindDynamicMemoryViewType fpCmdBindDynamicMemoryView = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdBindDynamicMemoryView");
nextTable.CmdBindDynamicMemoryView = fpCmdBindDynamicMemoryView;
+ CmdBindVertexDataType fpCmdBindVertexData = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdBindVertexData");
+ nextTable.CmdBindVertexData = fpCmdBindVertexData;
CmdBindIndexDataType fpCmdBindIndexData = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdBindIndexData");
nextTable.CmdBindIndexData = fpCmdBindIndexData;
CmdBindAttachmentsType fpCmdBindAttachments = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdBindAttachments");
nextTable.CmdBindDynamicMemoryView(cmdBuffer, pipelineBindPoint, pMemView);
}
+XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdBindVertexData(XGL_CMD_BUFFER cmdBuffer, XGL_GPU_MEMORY mem, XGL_GPU_SIZE offset, XGL_UINT binding)
+{
+ ll_increment_use_count((XGL_VOID*)cmdBuffer);
+ printf("OBJ[%llu] : USING cmdBuffer object %p (%lu total uses)\n", object_track_index++, (void*)cmdBuffer, ll_get_obj_uses((XGL_VOID*)cmdBuffer));
+ nextTable.CmdBindVertexData(cmdBuffer, mem, offset, binding);
+}
+
XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdBindIndexData(XGL_CMD_BUFFER cmdBuffer, XGL_GPU_MEMORY mem, XGL_GPU_SIZE offset, XGL_INDEX_TYPE indexType)
{
ll_increment_use_count((XGL_VOID*)cmdBuffer);
case XGL_SLOT_UNUSED:
return "XGL_SLOT_UNUSED";
- case XGL_SLOT_VERTEX_INPUT:
- return "XGL_SLOT_VERTEX_INPUT";
-
default:
return "Unhandled XGL_DESCRIPTOR_SET_SLOT_TYPE";
}
tab->CmdBindStateObject = fpGPA(gpu, (const XGL_CHAR *) "xglCmdBindStateObject");
tab->CmdBindDescriptorSet = fpGPA(gpu, (const XGL_CHAR *) "xglCmdBindDescriptorSet");
tab->CmdBindDynamicMemoryView = fpGPA(gpu, (const XGL_CHAR *) "xglCmdBindDynamicMemoryView");
+ tab->CmdBindVertexData = fpGPA(gpu, (const XGL_CHAR *) "xglCmdBindVertexData");
tab->CmdBindIndexData = fpGPA(gpu, (const XGL_CHAR *) "xglCmdBindIndexData");
tab->CmdBindAttachments = fpGPA(gpu, (const XGL_CHAR *) "xglCmdBindAttachments");
tab->CmdPrepareMemoryRegions = fpGPA(gpu, (const XGL_CHAR *) "xglCmdPrepareMemoryRegions");
return disp_table->CmdBindDescriptorSet;
else if (!strncmp("xglCmdBindDynamicMemoryView", (const char *) pName, sizeof ("xglCmdBindDynamicMemoryView")))
return disp_table->CmdBindDynamicMemoryView;
+ else if (!strncmp("xglCmdBindVertexData", (const char *) pName, sizeof ("xglCmdBindVertexData")))
+ return disp_table->CmdBindVertexData;
else if (!strncmp("xglCmdBindIndexData", (const char *) pName, sizeof ("xglCmdBindIndexData")))
return disp_table->CmdBindIndexData;
else if (!strncmp("xglCmdBindAttachments", (const char *) pName, sizeof ("xglCmdBindAttachments")))
Param("XGL_PIPELINE_BIND_POINT", "pipelineBindPoint"),
Param("const XGL_MEMORY_VIEW_ATTACH_INFO*", "pMemView"))),
+ Proto("XGL_VOID", "CmdBindVertexData",
+ (Param("XGL_CMD_BUFFER", "cmdBuffer"),
+ Param("XGL_GPU_MEMORY", "mem"),
+ Param("XGL_GPU_SIZE", "offset"),
+ Param("XGL_UINT", "binding"))),
+
Proto("XGL_VOID", "CmdBindIndexData",
(Param("XGL_CMD_BUFFER", "cmdBuffer"),
Param("XGL_GPU_MEMORY", "mem"),
"CmdBindStateObject",
"CmdBindDescriptorSet",
"CmdBindDynamicMemoryView",
+ "CmdBindVertexData",
"CmdBindIndexData",
"CmdBindAttachments",
"CmdPrepareMemoryRegions",