Do away with qrhivulkanext_p.h
This is not scalable. Instead of putting parts of post-1.0 vulkan_core.h into this header, apply the appropriate ifdefs instead. Change-Id: I21a9d6f7c51169efa7b66705545bae192ed30c14 Reviewed-by: Christian Strømme <christian.stromme@qt.io> (cherry picked from commit 497c0f1b0d920a934147f1bd3abcd40daa67828f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
0ca64287f8
commit
de01c5ecb8
@ -827,7 +827,7 @@ qt_internal_extend_target(Gui CONDITION QT_FEATURE_filesystemmodel
|
|||||||
|
|
||||||
qt_internal_extend_target(Gui CONDITION QT_FEATURE_vulkan
|
qt_internal_extend_target(Gui CONDITION QT_FEATURE_vulkan
|
||||||
SOURCES
|
SOURCES
|
||||||
rhi/qrhivulkan.cpp rhi/qrhivulkan_p.h rhi/qrhivulkanext_p.h
|
rhi/qrhivulkan.cpp rhi/qrhivulkan_p.h
|
||||||
vulkan/qbasicvulkanplatforminstance.cpp vulkan/qbasicvulkanplatforminstance_p.h
|
vulkan/qbasicvulkanplatforminstance.cpp vulkan/qbasicvulkanplatforminstance_p.h
|
||||||
vulkan/qplatformvulkaninstance.cpp vulkan/qplatformvulkaninstance.h
|
vulkan/qplatformvulkaninstance.cpp vulkan/qplatformvulkaninstance.h
|
||||||
vulkan/qvulkandefaultinstance.cpp vulkan/qvulkandefaultinstance_p.h
|
vulkan/qvulkandefaultinstance.cpp vulkan/qvulkandefaultinstance_p.h
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
|
||||||
|
|
||||||
#include "qrhivulkan_p.h"
|
#include "qrhivulkan_p.h"
|
||||||
#include "qrhivulkanext_p.h"
|
|
||||||
#include <qpa/qplatformvulkaninstance.h>
|
#include <qpa/qplatformvulkaninstance.h>
|
||||||
|
|
||||||
#define VMA_IMPLEMENTATION
|
#define VMA_IMPLEMENTATION
|
||||||
@ -603,12 +602,14 @@ bool QRhiVulkan::create(QRhi::Flags flags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
caps.vertexAttribDivisor = false;
|
caps.vertexAttribDivisor = false;
|
||||||
|
#ifdef VK_EXT_vertex_attribute_divisor
|
||||||
if (devExts.contains(VK_EXT_VERTEX_ATTRIBUTE_DIVISOR_EXTENSION_NAME)) {
|
if (devExts.contains(VK_EXT_VERTEX_ATTRIBUTE_DIVISOR_EXTENSION_NAME)) {
|
||||||
if (hasPhysDevProp2) {
|
if (hasPhysDevProp2) {
|
||||||
requestedDevExts.append(VK_EXT_VERTEX_ATTRIBUTE_DIVISOR_EXTENSION_NAME);
|
requestedDevExts.append(VK_EXT_VERTEX_ATTRIBUTE_DIVISOR_EXTENSION_NAME);
|
||||||
caps.vertexAttribDivisor = true;
|
caps.vertexAttribDivisor = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
for (const QByteArray &ext : requestedDeviceExtensions) {
|
for (const QByteArray &ext : requestedDeviceExtensions) {
|
||||||
if (!ext.isEmpty() && !requestedDevExts.contains(ext)) {
|
if (!ext.isEmpty() && !requestedDevExts.contains(ext)) {
|
||||||
@ -7048,7 +7049,9 @@ bool QVkGraphicsPipeline::create()
|
|||||||
pipelineInfo.pStages = shaderStageCreateInfos.constData();
|
pipelineInfo.pStages = shaderStageCreateInfos.constData();
|
||||||
|
|
||||||
QVarLengthArray<VkVertexInputBindingDescription, 4> vertexBindings;
|
QVarLengthArray<VkVertexInputBindingDescription, 4> vertexBindings;
|
||||||
|
#ifdef VK_EXT_vertex_attribute_divisor
|
||||||
QVarLengthArray<VkVertexInputBindingDivisorDescriptionEXT> nonOneStepRates;
|
QVarLengthArray<VkVertexInputBindingDivisorDescriptionEXT> nonOneStepRates;
|
||||||
|
#endif
|
||||||
int bindingIndex = 0;
|
int bindingIndex = 0;
|
||||||
for (auto it = m_vertexInputLayout.cbeginBindings(), itEnd = m_vertexInputLayout.cendBindings();
|
for (auto it = m_vertexInputLayout.cbeginBindings(), itEnd = m_vertexInputLayout.cendBindings();
|
||||||
it != itEnd; ++it, ++bindingIndex)
|
it != itEnd; ++it, ++bindingIndex)
|
||||||
@ -7060,9 +7063,12 @@ bool QVkGraphicsPipeline::create()
|
|||||||
? VK_VERTEX_INPUT_RATE_VERTEX : VK_VERTEX_INPUT_RATE_INSTANCE
|
? VK_VERTEX_INPUT_RATE_VERTEX : VK_VERTEX_INPUT_RATE_INSTANCE
|
||||||
};
|
};
|
||||||
if (it->classification() == QRhiVertexInputBinding::PerInstance && it->instanceStepRate() != 1) {
|
if (it->classification() == QRhiVertexInputBinding::PerInstance && it->instanceStepRate() != 1) {
|
||||||
|
#ifdef VK_EXT_vertex_attribute_divisor
|
||||||
if (rhiD->caps.vertexAttribDivisor) {
|
if (rhiD->caps.vertexAttribDivisor) {
|
||||||
nonOneStepRates.append({ uint32_t(bindingIndex), it->instanceStepRate() });
|
nonOneStepRates.append({ uint32_t(bindingIndex), it->instanceStepRate() });
|
||||||
} else {
|
} else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
qWarning("QRhiVulkan: Instance step rates other than 1 not supported without "
|
qWarning("QRhiVulkan: Instance step rates other than 1 not supported without "
|
||||||
"VK_EXT_vertex_attribute_divisor on the device and "
|
"VK_EXT_vertex_attribute_divisor on the device and "
|
||||||
"VK_KHR_get_physical_device_properties2 on the instance");
|
"VK_KHR_get_physical_device_properties2 on the instance");
|
||||||
@ -7088,13 +7094,15 @@ bool QVkGraphicsPipeline::create()
|
|||||||
vertexInputInfo.pVertexBindingDescriptions = vertexBindings.constData();
|
vertexInputInfo.pVertexBindingDescriptions = vertexBindings.constData();
|
||||||
vertexInputInfo.vertexAttributeDescriptionCount = uint32_t(vertexAttributes.size());
|
vertexInputInfo.vertexAttributeDescriptionCount = uint32_t(vertexAttributes.size());
|
||||||
vertexInputInfo.pVertexAttributeDescriptions = vertexAttributes.constData();
|
vertexInputInfo.pVertexAttributeDescriptions = vertexAttributes.constData();
|
||||||
|
#ifdef VK_EXT_vertex_attribute_divisor
|
||||||
VkPipelineVertexInputDivisorStateCreateInfoEXT divisorInfo = {};
|
VkPipelineVertexInputDivisorStateCreateInfoEXT divisorInfo = {};
|
||||||
if (!nonOneStepRates.isEmpty()) {
|
if (!nonOneStepRates.isEmpty()) {
|
||||||
divisorInfo.sType = VkStructureType(1000190001); // VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_DIVISOR_STATE_CREATE_INFO_EXT
|
divisorInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_DIVISOR_STATE_CREATE_INFO_EXT;
|
||||||
divisorInfo.vertexBindingDivisorCount = uint32_t(nonOneStepRates.size());
|
divisorInfo.vertexBindingDivisorCount = uint32_t(nonOneStepRates.size());
|
||||||
divisorInfo.pVertexBindingDivisors = nonOneStepRates.constData();
|
divisorInfo.pVertexBindingDivisors = nonOneStepRates.constData();
|
||||||
vertexInputInfo.pNext = &divisorInfo;
|
vertexInputInfo.pNext = &divisorInfo;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
pipelineInfo.pVertexInputState = &vertexInputInfo;
|
pipelineInfo.pVertexInputState = &vertexInputInfo;
|
||||||
|
|
||||||
QVarLengthArray<VkDynamicState, 8> dynEnable;
|
QVarLengthArray<VkDynamicState, 8> dynEnable;
|
||||||
|
@ -1,48 +0,0 @@
|
|||||||
// Copyright (C) 2018 The Qt Company Ltd.
|
|
||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
|
|
||||||
|
|
||||||
#ifndef QRHIVULKANEXT_P_H
|
|
||||||
#define QRHIVULKANEXT_P_H
|
|
||||||
|
|
||||||
//
|
|
||||||
// W A R N I N G
|
|
||||||
// -------------
|
|
||||||
//
|
|
||||||
// This file is not part of the Qt API. It exists purely as an
|
|
||||||
// implementation detail. This header file may change from version to
|
|
||||||
// version without notice, or even be removed.
|
|
||||||
//
|
|
||||||
// We mean it.
|
|
||||||
//
|
|
||||||
|
|
||||||
#include "qrhivulkan_p.h"
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
|
||||||
|
|
||||||
#ifndef VK_EXT_vertex_attribute_divisor
|
|
||||||
#define VK_EXT_vertex_attribute_divisor 1
|
|
||||||
#define VK_EXT_VERTEX_ATTRIBUTE_DIVISOR_SPEC_VERSION 2
|
|
||||||
#define VK_EXT_VERTEX_ATTRIBUTE_DIVISOR_EXTENSION_NAME "VK_EXT_vertex_attribute_divisor"
|
|
||||||
|
|
||||||
typedef struct VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT {
|
|
||||||
VkStructureType sType;
|
|
||||||
void* pNext;
|
|
||||||
uint32_t maxVertexAttribDivisor;
|
|
||||||
} VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT;
|
|
||||||
|
|
||||||
typedef struct VkVertexInputBindingDivisorDescriptionEXT {
|
|
||||||
uint32_t binding;
|
|
||||||
uint32_t divisor;
|
|
||||||
} VkVertexInputBindingDivisorDescriptionEXT;
|
|
||||||
|
|
||||||
typedef struct VkPipelineVertexInputDivisorStateCreateInfoEXT {
|
|
||||||
VkStructureType sType;
|
|
||||||
const void* pNext;
|
|
||||||
uint32_t vertexBindingDivisorCount;
|
|
||||||
const VkVertexInputBindingDivisorDescriptionEXT* pVertexBindingDivisors;
|
|
||||||
} VkPipelineVertexInputDivisorStateCreateInfoEXT;
|
|
||||||
#endif // VK_EXT_vertex_attribute_divisor
|
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
|
||||||
|
|
||||||
#endif
|
|
Loading…
x
Reference in New Issue
Block a user