if (dinfo->mode >= PIPE_PRIM_QUADS ||
dinfo->mode == PIPE_PRIM_LINE_LOOP ||
- dinfo->index_size == 1) {
+ (dinfo->index_size == 1 && !screen->have_EXT_index_type_uint8)) {
if (!u_trim_pipe_prim(dinfo->mode, (unsigned *)&dinfo->count))
return;
}
if (dinfo->index_size > 0) {
- assert(dinfo->index_size != 1);
- VkIndexType index_type = dinfo->index_size == 2 ? VK_INDEX_TYPE_UINT16 : VK_INDEX_TYPE_UINT32;
+ VkIndexType index_type;
+ switch (dinfo->index_size) {
+ case 1:
+ assert(screen->have_EXT_index_type_uint8);
+ index_type = VK_INDEX_TYPE_UINT8_EXT;
+ break;
+ case 2:
+ index_type = VK_INDEX_TYPE_UINT16;
+ break;
+ case 4:
+ index_type = VK_INDEX_TYPE_UINT32;
+ break;
+ default:
+ unreachable("unknown index size!");
+ }
struct zink_resource *res = zink_resource(index_buffer);
vkCmdBindIndexBuffer(batch->cmdbuf, res->buffer, index_offset, index_type);
zink_batch_reference_resoure(batch, res);
zink_internal_create_screen(struct sw_winsys *winsys, int fd)
{
struct zink_screen *screen = CALLOC_STRUCT(zink_screen);
- bool have_tf_ext = false, have_cond_render_ext = false;
+ bool have_tf_ext = false, have_cond_render_ext = false, have_EXT_index_type_uint8 = false;
if (!screen)
return NULL;
if (!strcmp(extensions[i].extensionName,
VK_EXT_TRANSFORM_FEEDBACK_EXTENSION_NAME))
have_tf_ext = true;
+ if (!strcmp(extensions[i].extensionName,
+ VK_EXT_INDEX_TYPE_UINT8_EXTENSION_NAME))
+ have_EXT_index_type_uint8 = true;
}
FREE(extensions);
VkPhysicalDeviceFeatures2 feats = {};
VkPhysicalDeviceTransformFeedbackFeaturesEXT tf_feats = {};
VkPhysicalDeviceConditionalRenderingFeaturesEXT cond_render_feats = {};
+ VkPhysicalDeviceIndexTypeUint8FeaturesEXT index_uint8_feats = {};
feats.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2;
if (have_tf_ext) {
cond_render_feats.pNext = feats.pNext;
feats.pNext = &cond_render_feats;
}
+ if (have_EXT_index_type_uint8) {
+ index_uint8_feats.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INDEX_TYPE_UINT8_FEATURES_EXT;
+ index_uint8_feats.pNext = feats.pNext;
+ feats.pNext = &index_uint8_feats;
+ }
vkGetPhysicalDeviceFeatures2(screen->pdev, &feats);
memcpy(&screen->feats, &feats.features, sizeof(screen->feats));
if (have_tf_ext && tf_feats.transformFeedback)
screen->have_EXT_transform_feedback = true;
if (have_cond_render_ext && cond_render_feats.conditionalRendering)
screen->have_EXT_conditional_rendering = true;
+ if (have_EXT_index_type_uint8 && index_uint8_feats.indexTypeUint8)
+ screen->have_EXT_index_type_uint8 = true;
VkPhysicalDeviceProperties2 props = {};
props.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2;
* this requires us to pass the whole VkPhysicalDeviceFeatures2 struct
*/
dci.pNext = &feats;
- const char *extensions[5] = {
+ const char *extensions[6] = {
VK_KHR_MAINTENANCE1_EXTENSION_NAME,
};
num_extensions = 1;
if (screen->have_EXT_conditional_rendering)
extensions[num_extensions++] = VK_EXT_CONDITIONAL_RENDERING_EXTENSION_NAME;
+ if (screen->have_EXT_index_type_uint8)
+ extensions[num_extensions++] = VK_EXT_INDEX_TYPE_UINT8_EXTENSION_NAME;
+
if (screen->have_EXT_transform_feedback)
extensions[num_extensions++] = VK_EXT_TRANSFORM_FEEDBACK_EXTENSION_NAME;
assert(num_extensions <= ARRAY_SIZE(extensions));