2020-07-19 18:13:40 +08: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-14 00:09:05 +08: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``
|
2021-01-22 16:49:36 +08:00
|
|
|
* ``depthClamp``
|
|
|
|
* ``depthBiasClamp``
|
2020-10-14 00:09:05 +08:00
|
|
|
* ``fillModeNonSolid``
|
|
|
|
* ``wideLines``
|
|
|
|
* ``largePoints``
|
|
|
|
* ``alphaToOne``
|
|
|
|
* ``shaderClipDistance``
|
|
|
|
|
|
|
|
* Instance extensions:
|
|
|
|
|
|
|
|
* `VK_KHR_get_physical_device_properties2`_
|
|
|
|
* `VK_KHR_external_memory_capabilities`_
|
|
|
|
|
|
|
|
* Device extensions:
|
|
|
|
|
|
|
|
* `VK_KHR_maintenance1`_
|
|
|
|
* `VK_KHR_external_memory`_
|
|
|
|
|
|
|
|
OpenGL 3.0
|
|
|
|
^^^^^^^^^^
|
|
|
|
|
|
|
|
|
2021-01-22 17:45:20 +08: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-14 00:09:05 +08:00
|
|
|
|
2020-10-23 15:00:43 +08: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 17:57:32 +08: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 15:00:43 +08:00
|
|
|
|
2021-01-23 03:37:57 +08:00
|
|
|
* ``VkPhysicalDeviceFeatures``:
|
2020-10-23 15:00:43 +08:00
|
|
|
|
|
|
|
* ``occlusionQueryPrecise``
|
|
|
|
|
|
|
|
* Device extensions:
|
|
|
|
|
2020-10-26 19:27:41 +08:00
|
|
|
* `VK_EXT_vertex_attribute_divisor`_
|
2020-10-23 15:00:43 +08:00
|
|
|
|
2021-01-22 18:04:33 +08: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`_
|
|
|
|
* `VK_KHR_vulkan_memory_model`
|
|
|
|
|
|
|
|
* Formats features:
|
|
|
|
|
|
|
|
* ```VK_FORMAT_R32G32B32_SFLOAT```: ```VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT```
|
|
|
|
* ```VK_FORMAT_R32G32B32_SINT```: ```VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT```
|
|
|
|
* ```VK_FORMAT_R32G32B32_UINT```: ```VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT```
|
|
|
|
|
2020-07-19 18:13:40 +08: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-27 02:26:23 +08:00
|
|
|
``validation``
|
|
|
|
Dump Validation layer output.
|
2020-07-19 18:13:40 +08: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
|
|
|
|
questions, don't hesitate to visit `#zink on FreeNode
|
|
|
|
<irc://irc.freenode.net/zink>`_ and say hi!
|
2020-10-14 00:09:05 +08:00
|
|
|
|
|
|
|
|
|
|
|
.. _VK_KHR_get_physical_device_properties2: https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VK_KHR_get_physical_device_properties2.html
|
|
|
|
.. _VK_KHR_external_memory_capabilities: https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VK_KHR_external_memory_capabilities.html
|
|
|
|
.. _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
|
|
|
|
.. _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 19:27:41 +08: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 18:04:33 +08:00
|
|
|
.. _VK_KHR_maintenance2: https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VK_KHR_maintenance2.html
|
|
|
|
.. _VK_KHR_vulkan_memory_model: https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VK_KHR_vulkan_memory_model.html
|