From be1cedc922cd9c551e1a557524c782500b9a6ba5 Mon Sep 17 00:00:00 2001 From: bjorn Date: Fri, 22 Apr 2022 01:07:07 -0700 Subject: [PATCH] Always enable fullIndexBufferRange feature; --- src/api/l_graphics.c | 1 - src/core/gpu.h | 3 +-- src/core/gpu_vk.c | 14 ++++++++------ src/modules/graphics/graphics.c | 1 - 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/api/l_graphics.c b/src/api/l_graphics.c index 8e44937d..2fbfd6f5 100644 --- a/src/api/l_graphics.c +++ b/src/api/l_graphics.c @@ -46,7 +46,6 @@ static int l_lovrGraphicsGetFeatures(lua_State* L) { lua_pushboolean(L, features.depthClamp), lua_setfield(L, -2, "depthClamp"); lua_pushboolean(L, features.clipDistance), lua_setfield(L, -2, "clipDistance"); lua_pushboolean(L, features.cullDistance), lua_setfield(L, -2, "cullDistance"); - lua_pushboolean(L, features.fullIndexBufferRange), lua_setfield(L, -2, "fullIndexBufferRange"); lua_pushboolean(L, features.indirectDrawFirstInstance), lua_setfield(L, -2, "indirectDrawFirstInstance"); lua_pushboolean(L, features.dynamicIndexing), lua_setfield(L, -2, "dynamicIndexing"); lua_pushboolean(L, features.float64), lua_setfield(L, -2, "float64"); diff --git a/src/core/gpu.h b/src/core/gpu.h index 68d6e9a4..fada5029 100644 --- a/src/core/gpu.h +++ b/src/core/gpu.h @@ -6,7 +6,7 @@ typedef struct { uint32_t serial; uint32_t vendor; uint32_t version; - const char name[256]; + char name[256]; const char* renderer; uint32_t subgroupSize; } gpu_device; @@ -18,7 +18,6 @@ typedef struct { bool depthClamp; bool clipDistance; bool cullDistance; - bool fullIndexBufferRange; bool indirectDrawFirstInstance; bool dynamicIndexing; bool float64; diff --git a/src/core/gpu_vk.c b/src/core/gpu_vk.c index 2a9e8a04..7fb4db3a 100644 --- a/src/core/gpu_vk.c +++ b/src/core/gpu_vk.c @@ -272,14 +272,12 @@ bool gpu_init(gpu_config* config) { } VkPhysicalDeviceShaderDrawParameterFeatures shaderDrawParameterFeatures = { - .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETER_FEATURES, - .shaderDrawParameters = true + .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETER_FEATURES }; VkPhysicalDeviceMultiviewFeatures multiviewFeatures = { .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES, - .pNext = &shaderDrawParameterFeatures, - .multiview = true + .pNext = &shaderDrawParameterFeatures }; VkPhysicalDeviceFeatures2 enabledFeatures = { @@ -293,7 +291,12 @@ bool gpu_init(gpu_config* config) { VkPhysicalDeviceFeatures* supports = &features2.features; vkGetPhysicalDeviceFeatures2(state.adapter, &features2); - // Internal features (they are exposed as limits) + // Required features + enable->fullDrawIndexUint32 = true; + multiviewFeatures.multiview = true; + shaderDrawParameterFeatures.shaderDrawParameters = true; + + // Internal features (exposed as limits) enable->samplerAnisotropy = supports->samplerAnisotropy; enable->multiDrawIndirect = supports->multiDrawIndirect; enable->largePoints = supports->largePoints; @@ -305,7 +308,6 @@ bool gpu_init(gpu_config* config) { config->features->depthClamp = enable->depthClamp = supports->depthClamp; config->features->clipDistance = enable->shaderClipDistance = supports->shaderClipDistance; config->features->cullDistance = enable->shaderCullDistance = supports->shaderCullDistance; - config->features->fullIndexBufferRange = enable->fullDrawIndexUint32 = supports->fullDrawIndexUint32; config->features->indirectDrawFirstInstance = enable->drawIndirectFirstInstance = supports->drawIndirectFirstInstance; config->features->float64 = enable->shaderFloat64 = supports->shaderFloat64; config->features->int64 = enable->shaderInt64 = supports->shaderInt64; diff --git a/src/modules/graphics/graphics.c b/src/modules/graphics/graphics.c index 38dcb901..b1945710 100644 --- a/src/modules/graphics/graphics.c +++ b/src/modules/graphics/graphics.c @@ -58,7 +58,6 @@ void lovrGraphicsGetFeatures(GraphicsFeatures* features) { features->depthClamp = state.features.depthClamp; features->clipDistance = state.features.clipDistance; features->cullDistance = state.features.cullDistance; - features->fullIndexBufferRange = state.features.fullIndexBufferRange; features->indirectDrawFirstInstance = state.features.indirectDrawFirstInstance; features->dynamicIndexing = state.features.dynamicIndexing; features->float64 = state.features.float64;