16#if !defined(GPU_SHADER)
30#if !defined(GPU_SHADER)
35#define GPU_FORCE_ENABLE_SHADER_PRINTF 0
37#if !defined(NDEBUG) || GPU_FORCE_ENABLE_SHADER_PRINTF
38# define GPU_SHADER_PRINTF_ENABLE 1
40# define GPU_SHADER_PRINTF_ENABLE 0
42#define GPU_SHADER_PRINTF_SLOT 13
43#define GPU_SHADER_PRINTF_MAX_CAPACITY (1024 * 4)
46#define GPU_SSBO_INDEX_BUF_SLOT 7
48#define GPU_SSBO_POLYLINE_POS_BUF_SLOT 0
49#define GPU_SSBO_POLYLINE_COL_BUF_SLOT 1
51#if defined(GLSL_CPP_STUBS)
52# define GPU_SHADER_NAMED_INTERFACE_INFO(_interface, _inst_name) \
53 namespace iface_ns::_interface { \
55# define GPU_SHADER_NAMED_INTERFACE_END(_inst_name) \
60# define GPU_SHADER_INTERFACE_INFO(_interface) namespace iface_ns::_interface {
61# define GPU_SHADER_INTERFACE_END() }
63# define GPU_SHADER_CREATE_INFO(_info) \
65 namespace gl_VertexShader { \
67 namespace gl_FragmentShader { \
69 namespace gl_ComputeShader { \
71# define GPU_SHADER_CREATE_END() }
73# define SHADER_LIBRARY_CREATE_INFO(_info) using namespace _info;
74# define VERTEX_SHADER_CREATE_INFO(_info) \
75 using namespace ::gl_VertexShader; \
76 using namespace _info::gl_VertexShader; \
77 using namespace _info;
78# define FRAGMENT_SHADER_CREATE_INFO(_info) \
79 using namespace ::gl_FragmentShader; \
80 using namespace _info::gl_FragmentShader; \
81 using namespace _info;
82# define COMPUTE_SHADER_CREATE_INFO(_info) \
83 using namespace ::gl_ComputeShader; \
84 using namespace _info::gl_ComputeShader; \
85 using namespace _info;
87#elif !defined(GPU_SHADER_CREATE_INFO)
89# define GPU_SHADER_NAMED_INTERFACE_INFO(_interface, _inst_name) \
90 static inline void autocomplete_helper_interface_##_interface() \
92 StageInterfaceInfo _interface(#_interface, _inst_name); \
94# define GPU_SHADER_INTERFACE_INFO(_interface) \
95 static inline void autocomplete_helper_interface_##_interface() \
97 StageInterfaceInfo _interface(#_interface); \
99# define GPU_SHADER_CREATE_INFO(_info) \
100 static inline void autocomplete_helper_info_##_info() \
102 ShaderCreateInfo _info(#_info); \
105# define GPU_SHADER_NAMED_INTERFACE_END(_inst_name) \
108# define GPU_SHADER_INTERFACE_END() \
111# define GPU_SHADER_CREATE_END() \
117#ifndef GLSL_CPP_STUBS
118# define SMOOTH(type, name) .smooth(Type::type##_t, #name)
119# define FLAT(type, name) .flat(Type::type##_t, #name)
120# define NO_PERSPECTIVE(type, name) .no_perspective(Type::type##_t, #name)
123# define LOCAL_GROUP_SIZE(...) .local_group_size(__VA_ARGS__)
125# define VERTEX_IN(slot, type, name) .vertex_in(slot, Type::type##_t, #name)
126# define VERTEX_OUT(stage_interface) .vertex_out(stage_interface)
128# define GEOMETRY_LAYOUT(...) .geometry_layout(__VA_ARGS__)
129# define GEOMETRY_OUT(stage_interface) .geometry_out(stage_interface)
131# define VERTEX_IN_SRT(srt) .additional_info(srt)
132# define VERTEX_OUT_SRT(srt) .vertex_out(srt##_t)
133# define FRAGMENT_OUT_SRT(srt) .additional_info(srt)
134# define RESOURCE_SRT(srd) .additional_info(srt)
136# define SUBPASS_IN(slot, type, img_type, name, rog) \
137 .subpass_in(slot, Type::type##_t, ImageType::img_type, #name, rog)
139# define FRAGMENT_OUT(slot, type, name) .fragment_out(slot, Type::type##_t, #name)
140# define FRAGMENT_OUT_DUAL(slot, type, name, blend) \
141 .fragment_out(slot, Type::type##_t, #name, DualBlend::blend)
142# define FRAGMENT_OUT_ROG(slot, type, name, rog) \
143 .fragment_out(slot, Type::type##_t, #name, DualBlend::NONE, rog)
145# define EARLY_FRAGMENT_TEST(enable) .early_fragment_test(enable)
146# define DEPTH_WRITE(value) .depth_write(value)
148# define SPECIALIZATION_CONSTANT(type, name, default_value) \
149 .specialization_constant(Type::type##_t, #name, default_value)
151# define COMPILATION_CONSTANT(type, name, value) \
152 .compilation_constant(Type::type##_t, #name, value)
153# define COMPILATION_CONSTANT_SRT(type, name, value) \
154 .compilation_constant(Type::type##_t, #name, value)
156# define PUSH_CONSTANT(type, name) .push_constant(Type::type##_t, #name)
157# define PUSH_CONSTANT_ARRAY(type, name, array_size) \
158 .push_constant(Type::type##_t, #name, array_size)
160# define UNIFORM_BUF(slot, type_name, name) .uniform_buf(slot, #type_name, #name)
161# define UNIFORM_BUF_FREQ(slot, type_name, name, freq) \
162 .uniform_buf(slot, #type_name, #name, Frequency::freq)
164# define STORAGE_BUF(slot, qualifiers, type_name, name) \
165 .storage_buf(slot, Qualifier::qualifiers, STRINGIFY(type_name), #name)
166# define STORAGE_BUF_FREQ(slot, qualifiers, type_name, name, freq) \
167 .storage_buf(slot, Qualifier::qualifiers, STRINGIFY(type_name), #name, Frequency::freq)
169# define ACCELERATION_STRUCTURE(slot, name) .acceleration_structure(slot, #name)
170# define ACCELERATION_STRUCTURE_FREQ(slot, name, freq) \
171 .acceleration_structure(slot, #name, Frequency::freq)
173# define SAMPLER(slot, type, name) .sampler(slot, ImageType::type, #name)
174# define SAMPLER_FREQ(slot, type, name, freq) \
175 .sampler(slot, ImageType::type, #name, Frequency::freq)
177# define IMAGE(slot, format, qualifiers, type, name) \
179 slot, gpu::TextureFormat::format, Qualifier::qualifiers, ImageReadWriteType::type, #name)
180# define IMAGE_FREQ(slot, format, qualifiers, type, name, freq) \
182 gpu::TextureFormat::format, \
183 Qualifier::qualifiers, \
184 ImageReadWriteType::type, \
188# define GROUP_SHARED(type, name) .shared_variable(Type::type##_t, #name)
190# define BUILTINS(builtin) .builtins(builtin)
192# define VERTEX_SOURCE(filename) .vertex_source(filename)
193# define FRAGMENT_SOURCE(filename) .fragment_source(filename)
194# define COMPUTE_SOURCE(filename) .compute_source(filename)
195# define GRAPHIC_SOURCE(filename) .vertex_source(filename).fragment_source(filename)
197# define VERTEX_FUNCTION(function) .vertex_function(function)
198# define FRAGMENT_FUNCTION(function) .fragment_function(function)
199# define COMPUTE_FUNCTION(function) .compute_function(function)
201# define DEFINE(name) .define(name)
202# define DEFINE_VALUE(name, value) .define(name, value)
204# define DO_STATIC_COMPILATION() .do_static_compilation(true)
207# define METAL_BACKEND_ONLY() .metal_backend_only(true)
209# define ADDITIONAL_INFO(info_name) .additional_info(#info_name)
210# define TYPEDEF_SOURCE(filename) .typedef_source(filename)
212# define SRT_DATA(srt_name) .additional_info(#srt_name)
214# define MTL_MAX_TOTAL_THREADS_PER_THREADGROUP(value) \
215 .mtl_max_total_threads_per_threadgroup(value)
223# define SMOOTH(type, name) type name = {};
224# define FLAT(type, name) type name = {};
225# define NO_PERSPECTIVE(type, name) type name = {};
228# define LOCAL_GROUP_SIZE(...)
230# define VERTEX_IN(slot, type, name) \
231 namespace gl_VertexShader { \
232 const type name = {}; \
234# define VERTEX_OUT(stage_interface) using namespace iface_ns::stage_interface;
237# define GEOMETRY_LAYOUT(...)
238# define GEOMETRY_OUT(stage_interface) using namespace iface_ns::stage_interface;
240# define SUBPASS_IN(slot, type, img_type, name, rog) const type name = {};
242# define FRAGMENT_OUT(slot, type, name) \
243 namespace gl_FragmentShader { \
246# define FRAGMENT_OUT_DUAL(slot, type, name, blend) \
247 namespace gl_FragmentShader { \
250# define FRAGMENT_OUT_ROG(slot, type, name, rog) \
251 namespace gl_FragmentShader { \
255# define VERTEX_IN_SRT(srt)
256# define VERTEX_OUT_SRT(srt)
257# define FRAGMENT_OUT_SRT(srt)
258# define RESOURCE_SRT(srd)
260# define EARLY_FRAGMENT_TEST(enable)
261# define DEPTH_WRITE(value)
263# define SPECIALIZATION_CONSTANT(type, name, default_value) \
264 constexpr type name = type(default_value);
266# define COMPILATION_CONSTANT(type, name, value) constexpr type name = type(value);
267# define COMPILATION_CONSTANT_SRT(type, name, value)
269# define PUSH_CONSTANT(type, name) extern const type name;
270# define PUSH_CONSTANT_ARRAY(type, name, array_size) extern const type name[array_size];
272# define UNIFORM_BUF(slot, type_name, name) extern const type_name name;
273# define UNIFORM_BUF_FREQ(slot, type_name, name, freq) extern const type_name name;
275# define STORAGE_BUF(slot, qualifiers, type_name, name) extern _##qualifiers type_name name;
276# define STORAGE_BUF_FREQ(slot, qualifiers, type_name, name, freq) \
277 extern _##qualifiers type_name name;
279# define ACCELERATION_STRUCTURE(slot, name) accelerationStructure name;
280# define ACCELERATION_STRUCTURE_FREQ(slot, name, freq) accelerationStructure name;
282# define SAMPLER(slot, type, name) type name;
283# define SAMPLER_FREQ(slot, type, name, freq) type name;
285# define IMAGE(slot, format, qualifiers, type, name) _##qualifiers type name;
286# define IMAGE_FREQ(slot, format, qualifiers, type, name, freq) _##qualifiers type name;
288# define GROUP_SHARED(type, name) type name;
290# define BUILTINS(builtin)
292# define VERTEX_SOURCE(filename)
293# define FRAGMENT_SOURCE(filename)
294# define COMPUTE_SOURCE(filename)
295# define GRAPHIC_SOURCE(filename)
297# define VERTEX_FUNCTION(filename)
298# define FRAGMENT_FUNCTION(filename)
299# define COMPUTE_FUNCTION(filename)
302# define DEFINE_VALUE(name, value)
304# define DO_STATIC_COMPILATION()
307# define METAL_BACKEND_ONLY()
309# define ADDITIONAL_INFO(info_name) \
310 using namespace info_name; \
311 using namespace info_name::gl_FragmentShader; \
312 using namespace info_name::gl_VertexShader;
314# define SRT_DATA(srt_name)
316# define TYPEDEF_SOURCE(filename)
318# define MTL_MAX_TOTAL_THREADS_PER_THREADGROUP(value)
321#define _INFO_EXPAND2(a, b) ADDITIONAL_INFO(a) ADDITIONAL_INFO(b)
322#define _INFO_EXPAND3(a, b, c) _INFO_EXPAND2(a, b) ADDITIONAL_INFO(c)
323#define _INFO_EXPAND4(a, b, c, d) _INFO_EXPAND3(a, b, c) ADDITIONAL_INFO(d)
324#define _INFO_EXPAND5(a, b, c, d, e) _INFO_EXPAND4(a, b, c, d) ADDITIONAL_INFO(e)
325#define _INFO_EXPAND6(a, b, c, d, e, f) _INFO_EXPAND5(a, b, c, d, e) ADDITIONAL_INFO(f)
327#define ADDITIONAL_INFO_EXPAND(...) VA_NARGS_CALL_OVERLOAD(_INFO_EXPAND, __VA_ARGS__)
329#define CREATE_INFO_VARIANT(name, ...) \
330 GPU_SHADER_CREATE_INFO(name) \
331 DO_STATIC_COMPILATION() \
332 ADDITIONAL_INFO_EXPAND(__VA_ARGS__) \
333 GPU_SHADER_CREATE_END()
335#if !defined(GLSL_CPP_STUBS)
381 BLI_assert_msg(0,
"Error: Cannot convert GPUType to shader::Type.");
389 return stream <<
"float";
391 return stream <<
"float2";
393 return stream <<
"float3";
395 return stream <<
"float4";
397 return stream <<
"float3x3";
399 return stream <<
"float4x4";
401 return stream <<
"vec3_1010102_Inorm";
403 return stream <<
"uchar";
405 return stream <<
"uchar2";
407 return stream <<
"uchar3";
409 return stream <<
"uchar4";
411 return stream <<
"char";
413 return stream <<
"char2";
415 return stream <<
"char3";
417 return stream <<
"char4";
419 return stream <<
"int";
421 return stream <<
"int2";
423 return stream <<
"int3";
425 return stream <<
"int4";
427 return stream <<
"uint";
429 return stream <<
"uint2";
431 return stream <<
"uint3";
433 return stream <<
"uint4";
435 return stream <<
"ushort";
437 return stream <<
"ushort2";
439 return stream <<
"ushort3";
441 return stream <<
"ushort4";
443 return stream <<
"short";
445 return stream <<
"short2";
447 return stream <<
"short3";
449 return stream <<
"short4";
451 return stream <<
"bool";
462 return stream <<
"Closure";
464 return stream <<
to_type(type);
475 STENCIL_REF = (1 << 1),
477 CLIP_DISTANCES = (1 << 3),
479 GLOBAL_INVOCATION_ID = (1 << 5),
481 INSTANCE_INDEX = INSTANCE_ID,
488 LOCAL_INVOCATION_INDEX = (1 << 9),
490 POINT_COORD = (1 << 11),
492 PRIMITIVE_ID = (1 << 13),
494 WORK_GROUP_ID = (1 << 15),
500 VIEWPORT_INDEX = (1 << 17),
507 CLIP_CONTROL = (1 << 19),
513 RAY_QUERY = (1 << 21),
523 NO_BUFFER_TYPE_LINTING = (1 << 24),
526 USE_DEBUG_DRAW = (1 << 26),
548# define TYPES_EXPAND(s) \
549 Float##s, Uint##s, Int##s, sampler##s = Float##s, usampler##s = Uint##s, isampler##s = Int##s
561# define TYPES_EXPAND(s) \
562 Shadow##s, Depth##s, sampler##s##Shadow = Shadow##s, sampler##s##Depth = Depth##s
570# define TYPES_EXPAND(s) \
571 AtomicUint##s, AtomicInt##s, usampler##s##Atomic = AtomicUint##s, \
572 isampler##s##Atomic = AtomicInt##s
592# define TYPES_EXPAND(s) \
593 Float##s = int(ImageType::Float##s), Uint##s = int(ImageType::Uint##s), \
594 Int##s = int(ImageType::Int##s), image##s = Float##s, uimage##s = Uint##s, iimage##s = Int##s
603# define TYPES_EXPAND(s) \
604 AtomicUint##s = int(ImageType::AtomicUint##s), AtomicInt##s = int(ImageType::AtomicInt##s), \
605 uimage##s##Atomic = AtomicUint##s, iimage##s##Atomic = AtomicInt##s
625 case ImageType::AtomicUint2D:
626 case ImageType::AtomicInt2D:
627 case ImageType::AtomicUint2DArray:
628 case ImageType::AtomicInt2DArray:
629 case ImageType::AtomicUint3D:
630 case ImageType::AtomicInt3D:
645 read_write = read | write,
646 read_no_restrict = read | no_restrict,
647 QUALIFIER_MAX = (write << 1) - 1,
754 return *
static_cast<Self *
>(
this);
760 return *
static_cast<Self *
>(
this);
766 return *
static_cast<Self *
>(
this);
780# define TEST_EQUAL(a, b, _member) \
781 if (!((a)._member == (b)._member)) { \
785# define TEST_VECTOR_EQUAL(a, b, _vector) \
786 TEST_EQUAL(a, b, _vector.size()); \
787 for (auto i : _vector.index_range()) { \
788 TEST_EQUAL(a, b, _vector[i]); \
814 for (
const auto &cond : *
this) {
815 if (cond(constants)) {
975 if (constant.name == name) {
977 return constant.value.i;
1107 return all_resources;
1184# ifdef WITH_METAL_BACKEND
1185 ushort mtl_max_threads_per_threadgroup_ = 0;
1209 return *
static_cast<Self *
>(
this);
1216 return *
static_cast<Self *
>(
this);
1222 int invocations = -1)
1228 return *
static_cast<Self *
>(
this);
1236 return *
static_cast<Self *
>(
this);
1246 return *
static_cast<Self *
>(
this);
1258 return *
static_cast<Self *
>(
this);
1270 return *
static_cast<Self *
>(
this);
1291 return *
static_cast<Self *
>(
this);
1297 return *
static_cast<Self *
>(
this);
1313 constant.
type = type;
1314 constant.
name = name;
1317 constant.
value.i = int(default_value);
1324 BLI_assert_msg(0,
"Only scalar integer and bool types can be used as constants");
1329 return *
static_cast<Self *
>(
this);
1363 constant.
type = type;
1364 constant.
name = name;
1367 constant.
value.i = int(default_value);
1382 return *
static_cast<Self *
>(
this);
1398 return *
static_cast<Self *
>(
this);
1414 res.uniformbuf.name = name;
1415 res.uniformbuf.type_name = type_name;
1418 return *
static_cast<Self *
>(
this);
1429 res.storagebuf.qualifiers = qualifiers;
1430 res.storagebuf.type_name = type_name;
1431 res.storagebuf.name = name;
1434 return *
static_cast<Self *
>(
this);
1443 res.acceleration_structure.name = name;
1447 return *(
Self *)
this;
1459 res.image.format = format;
1460 res.image.qualifiers = qualifiers;
1462 res.image.name = name;
1465 return *
static_cast<Self *
>(
this);
1475 res.sampler.type = type;
1476 res.sampler.name = name;
1479 return *
static_cast<Self *
>(
this);
1491 return *
static_cast<Self *
>(
this);
1497 return *
static_cast<Self *
>(
this);
1503 return *
static_cast<Self *
>(
this);
1509 return *
static_cast<Self *
>(
this);
1515 return *
static_cast<Self *
>(
this);
1521 return *
static_cast<Self *
>(
this);
1541 "Array syntax is forbidden for push constants."
1542 "Use the array_size parameter instead.");
1545 return *
static_cast<Self *
>(
this);
1557 return *
static_cast<Self *
>(
this);
1569 return *
static_cast<Self *
>(
this);
1575 return *
static_cast<Self *
>(
this);
1582 return *
static_cast<Self *
>(
this);
1588 return *
static_cast<Self *
>(
this);
1602 return *
static_cast<Self *
>(
this);
1609 return *
static_cast<Self *
>(
this);
1615 return *
static_cast<Self *
>(
this);
1631 return *
static_cast<Self *
>(
this);
1651# ifdef WITH_METAL_BACKEND
1652 mtl_max_threads_per_threadgroup_ = max_total_threads_per_threadgroup;
1656 return *
static_cast<Self *
>(
this);
1671 void finalize(
const bool recursive =
false);
1690 int &acceleration_structures)
const;
1740 auto print_resource = [&](
const Resource &res) {
1741 switch (res.bind_type) {
1743 stream <<
"UNIFORM_BUFFER(" << res.slot <<
", " << res.uniformbuf.name <<
")"
1747 stream <<
"STORAGE_BUFFER(" << res.slot <<
", " << res.storagebuf.name <<
")"
1751 stream <<
"SAMPLER(" << res.slot <<
", " << res.sampler.name <<
")" << std::endl;
1754 stream <<
"IMAGE(" << res.slot <<
", " << res.image.name <<
")" << std::endl;
1757 stream <<
"ACCELERATION_STRUCTURE(" << res.slot <<
", "
1758 << res.acceleration_structure.name <<
")" << std::endl;
1765 print_resource(res);
1768 print_resource(res);
1771 print_resource(res);
1779 if (res.bind_type == bind_type) {
1784 if (res.bind_type == bind_type) {
1789 if (res.bind_type == bind_type) {
1821 slot = std::max(slot, res.slot);
1826 slot = std::max(slot, res.slot);
1831 slot = std::max(slot, res.slot);
1861# undef TEST_VECTOR_EQUAL
1882#if !defined(GPU_SHADER)
#define BLI_assert_unreachable()
#define BLI_assert_msg(a, msg)
constexpr int64_t find_first_of(StringRef chars, int64_t pos=0) const
constexpr int64_t size() const
constexpr int64_t find(char c, int64_t pos=0) const
constexpr StringRef substr(int64_t start, int64_t size) const
constexpr StringRefNull()
constexpr const char * c_str() const
#define SMOOTH(type, name)
#define TEST_VECTOR_EQUAL(a, b, _vector)
#define NO_PERSPECTIVE(type, name)
#define TEST_EQUAL(a, b, _member)
#define raster_order_group(i)
std::string filename(const std::string_view &str, size_t pos)
Vector< shader::GeneratedSource, 0 > GeneratedSourceList
static bool is_atomic_type(ImageType type)
static Type to_type(const GPUType type)
static std::ostream & operator<<(std::ostream &stream, const Type type)
Vector< std::unique_ptr< std::string >, 0 > ShaderCreateInfoStringCache
ENUM_OPERATORS(BuiltinBits)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
unsigned __int64 uint64_t
BLI_INLINE float D(const float *data, const int res[3], int x, int y, int z)
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
uint64_t operator()(const Vector< gpu::shader::SpecializationConstant::Value > &key) const
SpecializationConstant::Value value
Vector< StringRefNull > dependencies
Description of a graphical pipeline to pre-compile during shader creation.
ResourceString(const std::string &str)
StringRef str_no_array() const
ResourceString(const StringRefNull &str)
constexpr ResourceString(const char *str, int64_t size)
constexpr ResourceString()
StringRef str_only_array() const
ResourceString(std::nullptr_t)=delete
constexpr ResourceString(const char *str)
int64_t array_offset() const
bool operator==(const AdditionalInfo &b) const
bool operator==(const BuiltinBit &b) const
bool operator==(const ComputeStageLayout &b) const
bool evaluate(Span< CompilationConstant > constants) const
Conditions(ConditionFn &fn)
bool operator==(const FragOut &b) const
bool operator==(const GeometryStageLayout &b) const
PrimitiveOut primitive_out
int array_size_safe() const
std::string array_str() const
bool operator==(const PushConst &b) const
bool operator==(const Resource &b) const
Resource(const ShaderCreateInfo &info, BindType type, int _slot, ConditionFn cond)
StageInterfaceInfo * iface
bool operator==(const StageInterfaceInfoHandle &b) const
bool operator==(const SubpassIn &b) const
bool operator==(const VertIn &b) const
Describe inputs & outputs, stage interfaces, resources and sources of a shader. If all data is correc...
Self & uniform_buf(int slot, StringRefNull type_name, StringRefNull name, Frequency freq=Frequency::PASS, ConditionFn cond=nullptr)
StringRefNull vertex_source_
void validate_vertex_attributes(const ShaderCreateInfo *other_info=nullptr)
StringRefNull compute_source_
Vector< Resource, 0 > geometry_resources_
StringRefNull compute_entry_fn_
Self & mtl_max_total_threads_per_threadgroup(ushort max_total_threads_per_threadgroup)
Self & image(int slot, TextureFormat format, Qualifier qualifiers, ImageReadWriteType type, StringRefNull name, Frequency freq=Frequency::PASS, ConditionFn cond=nullptr)
Self & compute_source(StringRefNull filename)
Self & compilation_constant(Type type, StringRefNull name, double default_value)
Vector< StringRefNull, 0 > typedef_sources_
bool has_resource_image() const
Vector< BuiltinBit, 0 > builtins_
Self & do_static_compilation(bool value)
Self & additional_info_with_condition(StringRefNull info_name, ConditionFn cond=nullptr)
Self & geometry_layout(PrimitiveIn prim_in, PrimitiveOut prim_out, int max_vertices, int invocations=-1)
Self & fragment_source(StringRefNull filename)
std::string fragment_source_generated
Vector< SpecializationConstant, 0 > specialization_constants_
Self & depth_write(DepthWrite value)
int max_sampler_slot() const
void extend_predicate(Vector< Resource, 0 > &resource_vector, ShaderCreateInfo::Resource res_copy, Span< ConditionFn > additional_conditions) const
Self & vertex_in(int slot, Type type, StringRefNull name, ConditionFn cond=nullptr)
void assert_no_overlap(const ShaderCreateInfo &info, const bool test, const StringRefNull error) const
Vector< CompilationConstant, 0 > compilation_constants_
GeneratedSourceList generated_sources
Vector< AdditionalInfo, 0 > additional_infos_
Self & metal_backend_only(bool flag)
bool early_fragment_test_
Vector< VertIn, 0 > vertex_inputs_
void finalize(const bool recursive=false)
std::string resource_guard_defines(Span< CompilationConstant > constants) const
int sampler_count() const
Self & fragment_out(int slot, Type type, StringRefNull name, DualBlend blend=DualBlend::NONE, int raster_order_group=-1, ConditionFn cond=nullptr)
Vector< StageInterfaceInfoHandle, 0 > geometry_out_interfaces_
Vector< Resource, 0 > & resources_get_(Frequency freq)
StringRefNull geometry_entry_fn_
void validate_merge(const ShaderCreateInfo &other_info)
size_t interface_names_size_
Vector< StageInterfaceInfoHandle, 0 > vertex_out_interfaces_
Self & shared_variable(Type type, StringRefNull name)
Vector< StringRefNull, 0 > dependencies_generated
bool operator==(const ShaderCreateInfo &b) const
Self & vertex_function(StringRefNull function_name)
Self & additional_info(StringRefNull info_name)
std::string check_error() const
Vector< Resource, 0 > pass_resources_
Self & typedef_source(StringRefNull filename)
Vector< PushConst, 0 > push_constants_
StringRefNull geometry_source_
Self & storage_buf(int slot, Qualifier qualifiers, StringRefNull type_name, StringRefNull name, Frequency freq=Frequency::PASS, ConditionFn cond=nullptr)
std::string vertex_source_generated
StringRefNull vertex_entry_fn_
std::string iface_guard_defines() const
std::string typedef_source_generated
bool has_resource_type(Resource::BindType bind_type) const
Self & shared_resource_descriptor(void(*fn)(ShaderCreateInfo &))
Vector< Resource > resources_get_all_() const
void set_resource_slot(Resource &res, int &images, int &samplers, int &ubos, int &ssbos, int &acceleration_structures) const
Self & builtins(BuiltinBits builtin, ConditionFn cond=nullptr)
Self & vertex_source(StringRefNull filename)
GeometryStageLayout geometry_layout_
StringRefNull fragment_source_
Vector< SubpassIn, 0 > subpass_inputs_
Vector< Resource, 0 > batch_resources_
Vector< SharedVariable, 0 > shared_variables_
Self & acceleration_structure(int slot, StringRefNull name, Frequency freq=Frequency::PASS, ConditionFn cond=nullptr)
bool do_static_compilation_
ComputeStageLayout compute_layout_
bool is_vulkan_compatible() const
Self & compute_function(StringRefNull function_name)
Vector< PipelineState, 0 > pipelines_
Self & additional_info(StringRefNull info_name, Args... args)
Self & subpass_in(int slot, Type type, ImageType img_type, StringRefNull name, int raster_order_group=-1)
std::string compute_source_generated
Self & specialization_constant(Type type, StringRefNull name, double default_value)
~ShaderCreateInfo()=default
Self & fragment_function(StringRefNull function_name)
friend std::ostream & operator<<(std::ostream &stream, const ShaderCreateInfo &info)
std::string geometry_source_generated
Vector< FragOut, 0 > fragment_outputs_
StringRefNull fragment_entry_fn_
Self & local_group_size(int local_size_x, int local_size_y=1, int local_size_z=1)
Self & vertex_out(StageInterfaceInfo &interface, ConditionFn cond=nullptr)
PipelineState & pipeline_state()
Create a new pipeline state.
static int find_constant(Span< CompilationConstant > constants, StringRefNull name)
Self & early_fragment_test(bool enable)
Self & sampler(int slot, ImageType type, StringRefNull name, Frequency freq=Frequency::PASS, ConditionFn cond=nullptr)
Self & define(StringRefNull name, StringRefNull value="")
BuiltinBits builtins_combined() const
Self & geometry_out(StageInterfaceInfo &interface, ConditionFn cond=nullptr)
Self & push_constant(Type type, StringRefNull name, int array_size=0, ConditionFn cond=nullptr)
std::function< bool(Span< CompilationConstant >)> ConditionFn
Vector< std::array< StringRefNull, 2 >, 0 > defines_
ShaderCreateInfo(const char *name)
Self & smooth(Type type, StringRefNull _name)
StageInterfaceInfo(const char *name_, const char *instance_name_="")
~StageInterfaceInfo()=default
Self & no_perspective(Type type, StringRefNull _name)
StringRefNull instance_name
Self & flat(Type type, StringRefNull _name)
AccelerationStructure acceleration_structure