You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The nature of some Vulkan applications requires the ability run shader code that cannot be guaranteed to avoid bad memory accesses. Robustness is needed for these applications.
18
+
Some common cases for using robustness are
19
+
20
+
1. Need to prevent malicious memory accesses (ex. WebGPU).
21
+
2. Can't guarantee your shader will not be out-of-bounds
@@ -27,12 +31,33 @@ Turning on robustness may incur a runtime performance cost. Application writers
27
31
28
32
All Vulkan implementations are required to support the `robustBufferAccess` feature. The link:https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#features-robustBufferAccess[spec describes what is considered out-of-bounds] and also how it should be handled. Implementations are given some amount of flexibility for `robustBufferAccess`. An example would be accessing a `vec4(x,y,z,w)` where the `w` value is out-of-bounds as the spec allows the implementation to decide if the `x`, `y`, and `z` are also considered out-of-bounds or not.
29
33
30
-
If dealing with the update after bind functionality found in `VK_EXT_descriptor_indexing` (which is core as of Vulkan 1.2) it is important to be aware of the link:https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#limits-robustBufferAccessUpdateAfterBind[robustBufferAccessUpdateAfterBind] which indicates if an implementation can support both `robustBufferAccess` and the ability to update the descriptor after binding it.
31
-
32
34
The `robustBufferAccess` feature has some limitations as it only covers buffers and not images. It also allows out-of-bounds writes and atomics to modify the data of the buffer being accessed. For applications looking for a stronger form of robustness, there is link:https://registry.khronos.org/vulkan/specs/latest/man/html/VK_EXT_robustness2.html[VK_EXT_robustness2].
33
35
34
36
When images are out-of-bounds core Vulkan link:https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#textures-output-coordinate-validation[provides the guarantee] that stores and atomics have no effect on the memory being accessed.
35
37
38
+
== robustBufferAccess
39
+
40
+
The following is an example of using `robustBufferAccess`. (link:https://godbolt.org/z/d5rqK1aqK[Try Online])
41
+
42
+
[source,glsl]
43
+
----
44
+
#version 450
45
+
layout(set = 0, binding = 0) buffer SSBO {
46
+
// The VkBuffer is only 64 bytes large
47
+
// indexing from [0:63] is valid, rest is OOB
48
+
uint data[128];
49
+
};
50
+
51
+
void main() {
52
+
// will be OOB at runtime
53
+
// will be discarded with robustBufferAccess
54
+
data[96] = 0;
55
+
56
+
// will return zero with robustBufferAccess
57
+
uint x = data[127];
58
+
}
59
+
----
60
+
36
61
== VK_EXT_image_robustness
37
62
38
63
=== robustImageAccess
@@ -74,3 +99,7 @@ Because robustness can come at a performance cost for some implementations, the
74
99
At `VkPipeline` creation time one or more `VkPipelineRobustnessCreateInfoEXT` structures can be passed to specify the desired robustness behavior of accesses to buffer, image, and vertex input resources, either for the pipeline as a whole or on a per-pipeline-stage basis.
75
100
76
101
This extension also provides `VkPhysicalDevicePipelineRobustnessPropertiesEXT` which queries the implementation for what behavior it provides as default when no robustness features are enabled.
102
+
103
+
== VK_EXT_descriptor_indexing
104
+
105
+
If dealing with the update after bind functionality found in `VK_EXT_descriptor_indexing` (which is core as of Vulkan 1.2) it is important to be aware of the link:https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#limits-robustBufferAccessUpdateAfterBind[robustBufferAccessUpdateAfterBind] which indicates if an implementation can support both `robustBufferAccess` and the ability to update the descriptor after binding it.
모든 Vulkan 구현은 `robustBufferAccess` 기능을 지원해야 합니다. link:https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#features-robustBufferAccess[사양서는 어떤 것이 범위를 벗어난 것으로 간주되는지] 그리고 어떻게 처리해야 하는지를 설명합니다.구현에는 `robustBufferAccess` 에 대해 어느 정도의 유연성이 부여됩니다. 예를 들어 `w` 값이 범위를 벗어난 `vec4(x,y,z,w)` 에 접근하는 경우, `x`, `y`, `z` 도 범위를 벗어난 것으로 간주할지 여부를 구현에서 결정할 수 있도록 사양에서 허용하고 있기 때문입니다.
29
29
30
-
(Vulkan 1.2의 핵심인) `VK_EXT_descriptor_indexing` 에 있는 바인딩 후 업데이트 기능을 다루는 경우, 구현이 `robustBufferAccess` 와 바인딩 후 디스크립터를 업데이트하는 기능을 모두 지원할 수 있는지를 나타내는 link:https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#limits-robustBufferAccessUpdateAfterBind[robustBufferAccessUpdateAfterBind]를 알아두는 것이 중요합니다.
31
-
32
30
`robustBufferAccess` 기능은 이미지가 아닌 버퍼만 다루기 때문에 몇 가지 제한이 있습니다. 또한 접근 중인 버퍼의 데이터를 수정하기 위해 범위를 벗어난 쓰기나 아토믹을 허용해버립니다. 더 강력한 형태의 견고성을 원하는 애플리케이션의 경우, link:https://registry.khronos.org/vulkan/specs/latest/man/html/VK_EXT_robustness2.html[VK_EXT_robustness2]가 있습니다.
33
31
34
32
이미지가 범위를 벗어난 경우, 코어 Vulkan에서는 스토어나 아토믹이 접근하려는 메모리에 영향을 주지 않는 것이 link:https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#textures-output-coordinate-validation[보장되어 있습니다].
35
33
34
+
== robustBufferAccess
35
+
36
+
다음은 `robustBufferAccess`를 사용하는 예제입니다. (link:https://godbolt.org/z/d5rqK1aqK[온라인 체험])
`VkPipeline` 생성 시 파이프라인 전체 또는 파이프라인 스테이지별로 버퍼, 이미지 및 정점 입력 리소스에 접근하려는 견고성 동작을 지정하기 위해 하나 이상의 `VkPipelineRobustnessCreateInfoEXT` 구조체를 전달할 수 있습니다.
75
96
76
97
이 확장 기능은 견고성 기능이 활성화되지 않았을 때 어떤 동작을 기본으로 제공하는지 구현에 쿼리하는 `VkPhysicalDevicePipelineRobustnessPropertiesEXT` 도 제공합니다.
98
+
99
+
== VK_EXT_descriptor_indexing
100
+
101
+
(Vulkan 1.2의 핵심인) `VK_EXT_descriptor_indexing` 에 있는 바인딩 후 업데이트 기능을 다루는 경우, 구현이 `robustBufferAccess` 와 바인딩 후 디스크립터를 업데이트하는 기능을 모두 지원할 수 있는지를 나타내는 link:https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#limits-robustBufferAccessUpdateAfterBind[robustBufferAccessUpdateAfterBind]를 알아두는 것이 중요합니다.
0 commit comments