Blender V5.3
gpu_shader_test_infos.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2022 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#ifdef GPU_SHADER
10# pragma once
11# include "gpu_shader_compat.hh"
12
13# include "GPU_shader_shared.hh"
14
16#endif
17
19
20GPU_SHADER_CREATE_INFO(gpu_compute_1d_test)
22IMAGE(1, SFLOAT_32_32_32_32, write, image1D, img_output)
23COMPUTE_SOURCE("gpu_compute_1d_test.glsl")
26
27GPU_SHADER_CREATE_INFO(gpu_compute_2d_test)
29IMAGE(1, SFLOAT_32_32_32_32, write, image2D, img_output)
30COMPUTE_SOURCE("gpu_compute_2d_test.glsl")
33
34GPU_SHADER_CREATE_INFO(gpu_compute_ibo_test)
36STORAGE_BUF(0, write, uint, out_indices[])
37COMPUTE_SOURCE("gpu_compute_ibo_test.glsl")
40
41GPU_SHADER_CREATE_INFO(gpu_compute_vbo_test)
43STORAGE_BUF(0, write, float4, out_positions[])
44COMPUTE_SOURCE("gpu_compute_vbo_test.glsl")
47
48GPU_SHADER_CREATE_INFO(gpu_compute_ssbo_test)
50STORAGE_BUF(0, write, int, data_out[])
51COMPUTE_SOURCE("gpu_compute_ssbo_test.glsl")
54
55GPU_SHADER_CREATE_INFO(gpu_compute_ssbo_binding_test)
57STORAGE_BUF(0, write, int, data0[])
58STORAGE_BUF(1, write, int, data1[])
59COMPUTE_SOURCE("gpu_compute_dummy_test.glsl")
62
63/* Push constants. */
64GPU_SHADER_CREATE_INFO(gpu_push_constants_base_test)
66STORAGE_BUF(0, write, float, data_out[])
67COMPUTE_SOURCE("gpu_push_constants_test.glsl")
69
70GPU_SHADER_CREATE_INFO(gpu_push_constants_test)
71ADDITIONAL_INFO(gpu_push_constants_base_test)
72PUSH_CONSTANT(float, float_in)
73PUSH_CONSTANT(float2, vec2_in)
74PUSH_CONSTANT(float3, vec3_in)
75PUSH_CONSTANT(float4, vec4_in)
78
79/* Push constants size test. */
80GPU_SHADER_CREATE_INFO(gpu_push_constants_128bytes_test)
81ADDITIONAL_INFO(gpu_push_constants_test)
82PUSH_CONSTANT_ARRAY(float, filler, 20)
85
86GPU_SHADER_CREATE_INFO(gpu_push_constants_256bytes_test)
87ADDITIONAL_INFO(gpu_push_constants_128bytes_test)
88PUSH_CONSTANT_ARRAY(float, filler2, 32)
91
92GPU_SHADER_CREATE_INFO(gpu_push_constants_512bytes_test)
93ADDITIONAL_INFO(gpu_push_constants_256bytes_test)
94PUSH_CONSTANT_ARRAY(float, filler3, 64)
97
98GPU_SHADER_CREATE_INFO(gpu_push_constants_8192bytes_test)
99ADDITIONAL_INFO(gpu_push_constants_512bytes_test)
100PUSH_CONSTANT_ARRAY(float, filler4, 1920)
103
104GPU_SHADER_CREATE_INFO(gpu_buffer_texture_test)
106SAMPLER(0, samplerBuffer, bufferTexture)
107STORAGE_BUF(0, write, float, data_out[])
108COMPUTE_SOURCE("gpu_buffer_texture_test.glsl")
111
112GPU_SHADER_CREATE_INFO(gpu_sampler_arg_buf_test)
113/* Leave sampler 0 empty to cover the case of empty slot. */
114SAMPLER(1, sampler2D, tex_1)
115SAMPLER(2, sampler2D, tex_2)
116SAMPLER(3, sampler2D, tex_3)
117SAMPLER(4, sampler2D, tex_4)
118SAMPLER(5, sampler2D, tex_5)
119SAMPLER(6, sampler2D, tex_6)
120SAMPLER(7, sampler2D, tex_7)
121SAMPLER(8, sampler2D, tex_8)
122SAMPLER(9, sampler2D, tex_9)
123SAMPLER(10, sampler2D, tex_10)
124SAMPLER(11, sampler2D, tex_11)
125SAMPLER(12, sampler2D, tex_12)
126SAMPLER(13, sampler2D, tex_13)
127SAMPLER(14, sampler2D, tex_14)
128SAMPLER(15, sampler2D, tex_15)
129SAMPLER(16, sampler2D, tex_16)
130SAMPLER(17, sampler2D, tex_17)
131SAMPLER(18, sampler2D, tex_18)
132STORAGE_BUF(0, write, float4, data_out[])
133VERTEX_SOURCE("gpu_texture_test.glsl")
134FRAGMENT_SOURCE("gpu_texture_test.glsl")
137
138GPU_SHADER_CREATE_INFO(gpu_texture_atomic_test)
140BUILTINS(BuiltinBits::TEXTURE_ATOMIC)
141IMAGE(1, UINT_32, read_write, uimage2DAtomic, img_atomic_2D)
142IMAGE(3, UINT_32, read_write, uimage2DArrayAtomic, img_atomic_2D_array)
143IMAGE(5, UINT_32, read_write, uimage3DAtomic, img_atomic_3D)
144STORAGE_BUF(0, write, int, data_out[])
145PUSH_CONSTANT(bool, write_phase)
146COMPUTE_SOURCE("gpu_texture_atomic_test.glsl")
149
150/* Specialization constants. */
151
152GPU_SHADER_CREATE_INFO(gpu_specialization_constants_base_test)
153STORAGE_BUF(0, write, int, data_out[])
154SPECIALIZATION_CONSTANT(float, float_in, 2)
155SPECIALIZATION_CONSTANT(uint, uint_in, 3)
156SPECIALIZATION_CONSTANT(int, int_in, 4)
157SPECIALIZATION_CONSTANT(bool, bool_in, true)
159
160GPU_SHADER_CREATE_INFO(gpu_compute_specialization_test)
162ADDITIONAL_INFO(gpu_specialization_constants_base_test)
163COMPUTE_SOURCE("gpu_specialization_test.glsl")
166
167GPU_SHADER_CREATE_INFO(gpu_graphic_specialization_test)
168ADDITIONAL_INFO(gpu_specialization_constants_base_test)
169BUILTINS(BuiltinBits::POINT_SIZE)
170VERTEX_SOURCE("gpu_specialization_test.glsl")
171FRAGMENT_SOURCE("gpu_specialization_test.glsl")
174
175/* Runtime create info. */
176GPU_SHADER_CREATE_INFO(gpu_framebuffer_subpass_input_test)
177FRAGMENT_OUT(0, int, out_value)
179
180/* Runtime create info. */
181GPU_SHADER_CREATE_INFO(gpu_framebuffer_layer_viewport_test)
182FRAGMENT_OUT(0, int2, out_value)
184
185/* Ray tracing */
186GPU_SHADER_CREATE_INFO(gpu_ray_query_test)
187COMPUTE_SOURCE("gpu_ray_query_test.glsl")
188LOCAL_GROUP_SIZE(1, 1, 1)
189SPECIALIZATION_CONSTANT(uint, intersection_mask_in, 0u)
190STORAGE_BUF(0, read, float4, ray_pos_in[])
191STORAGE_BUF(1, read, float4, ray_dir_in[])
192STORAGE_BUF(2, write, uint, hit_out[])
193ACCELERATION_STRUCTURE(0, scene_as)
194BUILTINS(BuiltinBits::RAY_QUERY)
197
198/* Ray query from a fragment shader (one ray per fragment). */
199GPU_SHADER_CREATE_INFO(gpu_ray_query_raster_test)
200VERTEX_SOURCE("gpu_ray_query_raster_test.glsl")
201FRAGMENT_SOURCE("gpu_ray_query_raster_test.glsl")
202FRAGMENT_OUT(0, int, hit_out)
203STORAGE_BUF(0, read, float4, ray_pos_in[])
204STORAGE_BUF(1, read, float4, ray_dir_in[])
205ACCELERATION_STRUCTURE(0, scene_as)
206BUILTINS(BuiltinBits::RAY_QUERY | BuiltinBits::VERTEX_ID)
209
210/* Read the per-instance custom index (Metal userID) at the committed hit. */
211GPU_SHADER_CREATE_INFO(gpu_ray_query_custom_index_test)
212COMPUTE_SOURCE("gpu_ray_query_custom_index_test.glsl")
213LOCAL_GROUP_SIZE(1, 1, 1)
214STORAGE_BUF(0, read, float4, ray_pos_in[])
215STORAGE_BUF(1, read, float4, ray_dir_in[])
216STORAGE_BUF(2, write, uint, custom_index_out[])
217ACCELERATION_STRUCTURE(0, scene_as)
218BUILTINS(BuiltinBits::RAY_QUERY)
@ SFLOAT_32_32_32_32
#define GPU_SHADER_CREATE_INFO(_info)
#define GPU_SHADER_CREATE_END()
#define PUSH_CONSTANT_ARRAY(type, name, array_size)
#define SAMPLER(slot, type, name)
#define ACCELERATION_STRUCTURE(slot, name)
#define FRAGMENT_SOURCE(filename)
#define SPECIALIZATION_CONSTANT(type, name, default_value)
#define ADDITIONAL_INFO(info_name)
#define PUSH_CONSTANT(type, name)
#define FRAGMENT_OUT(slot, type, name)
#define BUILTINS(builtin)
#define STORAGE_BUF(slot, qualifiers, type_name, name)
#define VERTEX_SOURCE(filename)
#define LOCAL_GROUP_SIZE(...)
#define IMAGE(slot, format, qualifiers, type, name)
#define COMPUTE_SOURCE(filename)
#define DO_STATIC_COMPILATION()
ImageBase< uint, 2, true, true > uimage2DArrayAtomic
ImageBase< uint, 2, false, true > uimage2DAtomic
ImageBase< uint, 3, false, true > uimage3DAtomic
ImageBase< float, 2 > image2D
ImageBase< float, 1 > image1D
SamplerBase< float, 1 > samplerBuffer
SamplerBase< float, 2 > sampler2D