diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2019-06-24 10:22:50 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2019-07-01 17:34:29 +0200 |
commit | 854ddb0301ae677a31286da4476318f4e6b74e3f (patch) | |
tree | 9e9cdaa09a3d6f12f7636abdec0de15ed694e8a2 /src/gui/rhi/qrhivulkan.cpp | |
parent | 56fb2266f2d224ba58d262640f318a0439a9fa32 (diff) |
rhi: Enhance line width and point size support
...but this will vary between backends, or in some cases
even between implementations of the same API.
Point size is settable only via the vertex shader (gl_PointSize).
It is silently ignored with D3D and HLSL.
Line widths other than 1 are supported only on OpenGL and Vulkan.
(but this is in fact deprecated with GL and optional with Vulkan)
Add QRhi::Feature values for both.
The line width is now settable on QRhiGraphicsPipeline. It is not a
dynamic state since the static, per-pipeline width is good enough for
most cases. (and the feature is not supported on half of the backends
anyways so it will get limited use in practice).
Change-Id: I6d3a32269527c452b794b2cb8b0f03101eab40b2
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/gui/rhi/qrhivulkan.cpp')
-rw-r--r-- | src/gui/rhi/qrhivulkan.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/gui/rhi/qrhivulkan.cpp b/src/gui/rhi/qrhivulkan.cpp index f6ecd7c00e..8598e5869a 100644 --- a/src/gui/rhi/qrhivulkan.cpp +++ b/src/gui/rhi/qrhivulkan.cpp @@ -489,6 +489,9 @@ bool QRhiVulkan::create(QRhi::Flags flags) // elsewhere states that the minimum bufferOffset is 4... texbufAlign = qMax<VkDeviceSize>(4, physDevProperties.limits.optimalBufferCopyOffsetAlignment); + f->vkGetPhysicalDeviceFeatures(physDev, &physDevFeatures); + hasWideLines = physDevFeatures.wideLines; + if (!importedAllocator) { VmaVulkanFunctions afuncs; afuncs.vkGetPhysicalDeviceProperties = wrap_vkGetPhysicalDeviceProperties; @@ -3489,24 +3492,21 @@ QMatrix4x4 QRhiVulkan::clipSpaceCorrMatrix() const bool QRhiVulkan::isTextureFormatSupported(QRhiTexture::Format format, QRhiTexture::Flags flags) const { - VkPhysicalDeviceFeatures features; - f->vkGetPhysicalDeviceFeatures(physDev, &features); - // Note that with some SDKs the validation layer gives an odd warning about // BC not being supported, even when our check here succeeds. Not much we // can do about that. if (format >= QRhiTexture::BC1 && format <= QRhiTexture::BC7) { - if (!features.textureCompressionBC) + if (!physDevFeatures.textureCompressionBC) return false; } if (format >= QRhiTexture::ETC2_RGB8 && format <= QRhiTexture::ETC2_RGBA8) { - if (!features.textureCompressionETC2) + if (!physDevFeatures.textureCompressionETC2) return false; } if (format >= QRhiTexture::ASTC_4x4 && format <= QRhiTexture::ASTC_12x12) { - if (!features.textureCompressionASTC_LDR) + if (!physDevFeatures.textureCompressionASTC_LDR) return false; } @@ -3545,6 +3545,10 @@ bool QRhiVulkan::isFeatureSupported(QRhi::Feature feature) const return true; case QRhi::Compute: return hasCompute; + case QRhi::WideLines: + return hasWideLines; + case QRhi::VertexShaderPointSize: + return true; default: Q_UNREACHABLE(); return false; @@ -5612,7 +5616,7 @@ bool QVkGraphicsPipeline::build() rastInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO; rastInfo.cullMode = toVkCullMode(m_cullMode); rastInfo.frontFace = toVkFrontFace(m_frontFace); - rastInfo.lineWidth = 1.0f; + rastInfo.lineWidth = rhiD->hasWideLines ? m_lineWidth : 1.0f; pipelineInfo.pRasterizationState = &rastInfo; VkPipelineMultisampleStateCreateInfo msInfo; |