2020-07-19 11:13:40 +01:00
|
|
|
Zink
|
|
|
|
====
|
|
|
|
|
|
|
|
Overview
|
|
|
|
--------
|
|
|
|
|
|
|
|
The Zink driver is a Gallium driver that emits Vulkan API calls instead
|
|
|
|
of targeting a specific GPU architecture. This can be used to get full
|
|
|
|
desktop OpenGL support on devices that only support Vulkan.
|
|
|
|
|
2020-10-13 17:09:05 +01:00
|
|
|
Features
|
|
|
|
--------
|
|
|
|
|
|
|
|
The feature-level of Zink depends on two things; what's implemented in Zink,
|
|
|
|
as well as the features of the Vulkan driver.
|
|
|
|
|
|
|
|
OpenGL 2.1
|
|
|
|
^^^^^^^^^^
|
|
|
|
|
|
|
|
OpenGL 2.1 is the minimum version Zink can support, and will always be
|
|
|
|
exposed, given Vulkan support. There's a few features that are required
|
|
|
|
for correct behavior, but not all of these are validated; instead you'll
|
|
|
|
see rendering-issues and likely validation error, or even crashes.
|
|
|
|
|
|
|
|
Here's a list of those requirements:
|
|
|
|
|
|
|
|
* Vulkan 1.0
|
|
|
|
* ``VkPhysicalDeviceFeatures``:
|
|
|
|
|
|
|
|
* ``logicOp``
|
|
|
|
* ``fillModeNonSolid``
|
|
|
|
* ``wideLines``
|
|
|
|
* ``largePoints``
|
|
|
|
* ``alphaToOne``
|
|
|
|
* ``shaderClipDistance``
|
|
|
|
|
|
|
|
* Device extensions:
|
|
|
|
|
|
|
|
* `VK_KHR_maintenance1`_
|
2021-04-27 09:07:12 +01:00
|
|
|
* `VK_EXT_custom_border_color`_
|
2021-04-26 20:29:15 +01:00
|
|
|
* `VK_EXT_provoking_vertex`_
|
2021-03-30 16:57:56 +01:00
|
|
|
|
|
|
|
In addition to this, `VK_KHR_external_memory`_ is required to support the
|
|
|
|
DRI code-path.
|
2020-10-13 17:09:05 +01:00
|
|
|
|
2021-04-09 08:53:31 +01:00
|
|
|
We also require either the `VK_EXT_scalar_block_layout`_ extension or
|
|
|
|
Vulkan 1.2, with the ``scalarBlockLayout`` feature.
|
|
|
|
|
2020-10-13 17:09:05 +01:00
|
|
|
OpenGL 3.0
|
|
|
|
^^^^^^^^^^
|
|
|
|
|
|
|
|
|
2021-01-22 09:45:20 +00:00
|
|
|
For OpenGL 3.0 support, the following additional requirements needs to be
|
|
|
|
supported:
|
|
|
|
|
|
|
|
* ``VkPhysicalDeviceFeatures``:
|
|
|
|
|
|
|
|
* ``independentBlend``
|
|
|
|
|
|
|
|
* Device extensions:
|
|
|
|
|
|
|
|
* `VK_EXT_transform_feedback`_
|
|
|
|
* `VK_EXT_conditional_rendering`_
|
2020-10-13 17:09:05 +01:00
|
|
|
|
2020-10-23 08:00:43 +01:00
|
|
|
|
|
|
|
OpenGL 3.1
|
|
|
|
^^^^^^^^^^
|
|
|
|
|
|
|
|
For OpenGL 3.1 support, the following additional ``VkPhysicalDeviceLimits``
|
|
|
|
are required:
|
|
|
|
|
|
|
|
* ``maxPerStageDescriptorSamplers`` ≥ 16
|
|
|
|
|
|
|
|
OpenGL 3.2
|
|
|
|
^^^^^^^^^^
|
|
|
|
|
|
|
|
For OpenGL 3.2 support, the following additional ``VkPhysicalDeviceFeatures``
|
|
|
|
are required to be supported, although some of these might not actually get
|
|
|
|
verified:
|
|
|
|
|
|
|
|
* ``depthClamp``
|
|
|
|
* ``geometryShader``
|
|
|
|
* ``shaderTessellationAndGeometryPointSize``
|
|
|
|
|
|
|
|
OpenGL 3.3
|
|
|
|
^^^^^^^^^^
|
|
|
|
|
2021-01-22 09:57:32 +00:00
|
|
|
For OpenGL 3.3 support, the following additional requirements needs to be
|
|
|
|
supported, although some of these might not actually get verified:
|
2020-10-23 08:00:43 +01:00
|
|
|
|
2021-01-22 19:37:57 +00:00
|
|
|
* ``VkPhysicalDeviceFeatures``:
|
2020-10-23 08:00:43 +01:00
|
|
|
|
|
|
|
* ``occlusionQueryPrecise``
|
|
|
|
|
|
|
|
* Device extensions:
|
|
|
|
|
2020-10-26 11:27:41 +00:00
|
|
|
* `VK_EXT_vertex_attribute_divisor`_
|
2020-10-23 08:00:43 +01:00
|
|
|
|
2021-01-22 10:04:33 +00:00
|
|
|
OpenGL 4.0
|
|
|
|
^^^^^^^^^^
|
|
|
|
|
|
|
|
For OpenGL 4.0 support, the following additional requirements needs to be
|
|
|
|
supported:
|
|
|
|
|
|
|
|
* ``VkPhysicalDeviceFeatures``:
|
|
|
|
|
|
|
|
* ``sampleRateShading``
|
|
|
|
* ``tessellationShader``
|
|
|
|
* ``imageCubeArray``
|
|
|
|
|
|
|
|
* Device extensions:
|
|
|
|
|
|
|
|
* `VK_KHR_maintenance2`_
|
|
|
|
|
2021-03-16 09:44:27 +00:00
|
|
|
* Formats requiring ``VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT``:
|
2021-01-22 10:04:33 +00:00
|
|
|
|
2021-03-16 09:44:27 +00:00
|
|
|
* ``VK_FORMAT_R32G32B32_SFLOAT``
|
|
|
|
* ``VK_FORMAT_R32G32B32_SINT``
|
|
|
|
* ``VK_FORMAT_R32G32B32_UINT``
|
2021-01-22 10:04:33 +00:00
|
|
|
|
2021-01-22 10:24:53 +00:00
|
|
|
OpenGL 4.1
|
|
|
|
^^^^^^^^^^
|
|
|
|
|
|
|
|
For OpenGL 4.1 support, the following additional ``VkPhysicalDeviceLimits``
|
|
|
|
are required:
|
|
|
|
|
2021-04-26 13:11:01 +01:00
|
|
|
* ``maxImageDimension2D`` ≥ 16384
|
|
|
|
* ``maxViewports`` ≥ 16
|
2021-01-22 10:24:53 +00:00
|
|
|
|
2021-01-22 11:15:33 +00:00
|
|
|
OpenGL 4.2
|
|
|
|
^^^^^^^^^^
|
|
|
|
|
2021-03-15 16:34:02 +00:00
|
|
|
For OpenGL 4.2 support, the following additional requirements needs to be
|
|
|
|
supported:
|
2021-01-22 11:15:33 +00:00
|
|
|
|
2021-04-26 13:11:56 +01:00
|
|
|
* ``VkPhysicalDeviceLimits``:
|
|
|
|
|
2021-04-26 16:35:21 +01:00
|
|
|
* ``shaderStorageImageExtendedFormats``
|
|
|
|
* ``shaderStorageImageWriteWithoutFormat``
|
2021-04-26 13:11:56 +01:00
|
|
|
|
2021-02-12 20:56:23 +00:00
|
|
|
* For Vulkan 1.2 and above:
|
|
|
|
|
|
|
|
* ``VkPhysicalDeviceVulkan11Features``:
|
|
|
|
|
|
|
|
* ``shaderDrawParameters``
|
2021-03-24 15:54:25 +00:00
|
|
|
* ``vertexPipelineStoresAndAtomics``
|
|
|
|
* ``fragmentStoresAndAtomics``
|
2021-03-24 15:56:31 +00:00
|
|
|
* ``textureCompressionBC``
|
2021-02-12 20:56:23 +00:00
|
|
|
|
|
|
|
* For Vulkan 1.1 and below:
|
|
|
|
|
|
|
|
* Device extensions:
|
|
|
|
|
|
|
|
* `VK_KHR_shader_draw_parameters`_
|
2021-01-22 11:15:33 +00:00
|
|
|
|
2021-03-16 09:44:27 +00:00
|
|
|
* Formats requiring ``VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT``:
|
2021-01-22 11:15:33 +00:00
|
|
|
|
2021-03-16 09:44:27 +00:00
|
|
|
* ``VK_FORMAT_BC7_UNORM_BLOCK``
|
|
|
|
* ``VK_FORMAT_BC7_SRGB_BLOCK``
|
|
|
|
* ``VK_FORMAT_BC6H_SFLOAT_BLOCK``
|
|
|
|
* ``VK_FORMAT_BC6H_UFLOAT_BLOCK``
|
2021-01-22 11:15:33 +00:00
|
|
|
|
2021-03-15 16:21:38 +00:00
|
|
|
OpenGL 4.3
|
|
|
|
^^^^^^^^^^
|
|
|
|
|
|
|
|
For OpenGL 4.3 support, the following additional requirements needs to be
|
|
|
|
supported:
|
|
|
|
|
|
|
|
* ``VkPhysicalDeviceFeatures``:
|
|
|
|
|
|
|
|
* ``robustBufferAccess``
|
|
|
|
* ``multiViewport``
|
|
|
|
|
2021-03-16 09:44:27 +00:00
|
|
|
* Formats requiring ``VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT``:
|
2021-03-15 16:21:38 +00:00
|
|
|
|
2021-03-16 09:44:27 +00:00
|
|
|
* ``VK_FORMAT_R8G8B8A8_UNORM``
|
|
|
|
* ``VK_FORMAT_R8G8B8A8_SRGB``
|
|
|
|
* ``VK_FORMAT_R16_UNORM``
|
|
|
|
* ``VK_FORMAT_R16G16_UNORM``
|
|
|
|
* ``VK_FORMAT_R16_SNORM``
|
|
|
|
* ``VK_FORMAT_R16G16_SNORM``
|
|
|
|
* ``VK_FORMAT_D32_SFLOAT_S8_UINT``
|
2021-03-15 16:21:38 +00:00
|
|
|
|
2021-03-15 16:27:04 +00:00
|
|
|
OpenGL 4.4
|
|
|
|
^^^^^^^^^^
|
|
|
|
|
2021-03-24 16:11:19 +00:00
|
|
|
For OpenGL 4.4 support, the following additional requirements needs to be
|
|
|
|
supported:
|
|
|
|
|
|
|
|
* Formats requiring ``VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT``:
|
2021-03-15 16:27:04 +00:00
|
|
|
|
2021-03-16 09:44:27 +00:00
|
|
|
* ``VK_FORMAT_B10G11R11_UFLOAT_PACK32``
|
2021-03-15 16:27:04 +00:00
|
|
|
|
2021-03-24 16:11:19 +00:00
|
|
|
* Device extensions:
|
|
|
|
|
|
|
|
* `VK_KHR_sampler_mirror_clamp_to_edge`_
|
|
|
|
|
2021-03-15 16:38:28 +00:00
|
|
|
OpenGL 4.5
|
|
|
|
^^^^^^^^^^
|
|
|
|
|
|
|
|
For OpenGL 4.5 support, the following additional ``VkPhysicalDeviceFeatures``
|
|
|
|
are required to be supported
|
|
|
|
|
|
|
|
* ``shaderCullDistance``
|
|
|
|
|
2021-03-15 16:44:13 +00:00
|
|
|
OpenGL 4.6
|
|
|
|
^^^^^^^^^^
|
|
|
|
|
|
|
|
For OpenGL 4.6 support, the following additional ``VkPhysicalDeviceFeatures``
|
|
|
|
are required to be supported
|
|
|
|
|
|
|
|
* ``VkPhysicalDeviceFeatures``:
|
|
|
|
|
|
|
|
* ``samplerAnisotropy``
|
2021-03-24 15:37:00 +00:00
|
|
|
* ``pipelineStatisticsQuery``
|
2021-03-24 15:43:06 +00:00
|
|
|
* ``depthBiasClamp``
|
2021-03-15 16:44:13 +00:00
|
|
|
|
|
|
|
* Device extensions:
|
|
|
|
|
|
|
|
* `VK_KHR_draw_indirect_count`_
|
|
|
|
|
2020-07-19 11:13:40 +01:00
|
|
|
Debugging
|
|
|
|
---------
|
|
|
|
|
|
|
|
There's a few tools that are useful for debugging Zink, like this environment
|
|
|
|
variable:
|
|
|
|
|
|
|
|
.. envvar:: ZINK_DEBUG <flags> ("")
|
|
|
|
|
|
|
|
``nir``
|
|
|
|
Print the NIR form of all shaders to stderr.
|
|
|
|
``spirv``
|
|
|
|
Write the binary SPIR-V form of all compiled shaders to a file in the
|
|
|
|
current directory, and print a message with the filename to stderr.
|
|
|
|
``tgsi``
|
|
|
|
Print the TGSI form of TGSI shaders to stderr.
|
2020-11-26 18:26:23 +00:00
|
|
|
``validation``
|
|
|
|
Dump Validation layer output.
|
2020-07-19 11:13:40 +01:00
|
|
|
|
|
|
|
Vulkan Validation Layers
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Another useful tool for debugging is the `Vulkan Validation Layers
|
|
|
|
<https://github.com/KhronosGroup/Vulkan-ValidationLayers/blob/master/README.md>`_.
|
|
|
|
|
|
|
|
The validation layers effectively insert extra checking between Zink and the
|
|
|
|
Vulkan driver, pointing out incorrect usage of the Vulkan API. The layers can
|
|
|
|
be enabled by setting the environment variable :envvar:`VK_INSTANCE_LAYERS` to
|
|
|
|
"VK_LAYER_KHRONOS_validation". You can read more about the Validation Layers
|
|
|
|
in the link above.
|
|
|
|
|
|
|
|
IRC
|
|
|
|
---
|
|
|
|
|
|
|
|
In order to make things a bit easier to follow, we have decided to create our
|
|
|
|
own IRC channel. If you're interested in contributing, or have any technical
|
2021-05-21 11:49:20 +01:00
|
|
|
questions, don't hesitate to visit `#zink on OFTC
|
|
|
|
<irc://irc.oftc.net/zink>`__ and say hi!
|
2020-10-13 17:09:05 +01:00
|
|
|
|
|
|
|
|
|
|
|
.. _VK_KHR_maintenance1: https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VK_KHR_maintenance1.html
|
|
|
|
.. _VK_KHR_external_memory: https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VK_KHR_external_memory.html
|
2021-04-09 08:53:31 +01:00
|
|
|
.. _VK_EXT_scalar_block_layout: https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VK_EXT_scalar_block_layout.html
|
2020-10-13 17:09:05 +01:00
|
|
|
.. _VK_EXT_transform_feedback: https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VK_EXT_transform_feedback.html
|
|
|
|
.. _VK_EXT_conditional_rendering: https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VK_EXT_conditional_rendering.html
|
2020-10-26 11:27:41 +00:00
|
|
|
.. _VK_EXT_vertex_attribute_divisor: https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VK_EXT_vertex_attribute_divisor.html
|
2021-01-22 10:04:33 +00:00
|
|
|
.. _VK_KHR_maintenance2: https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VK_KHR_maintenance2.html
|
2021-02-12 20:56:23 +00:00
|
|
|
.. _VK_KHR_shader_draw_parameters: https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VK_KHR_shader_draw_parameters.html
|
2021-03-15 16:44:13 +00:00
|
|
|
.. _VK_KHR_draw_indirect_count: https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VK_KHR_draw_indirect_count.html
|
2021-03-24 16:11:19 +00:00
|
|
|
.. _VK_KHR_sampler_mirror_clamp_to_edge: https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VK_KHR_sampler_mirror_clamp_to_edge.html
|
2021-04-26 13:09:49 +01:00
|
|
|
.. _VK_EXT_custom_border_color: https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VK_EXT_custom_border_color.html
|
2021-04-26 20:29:15 +01:00
|
|
|
.. _VK_EXT_provoking_vertex: https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VK_EXT_provoking_vertex.html
|