forked from blender/blender
GPU: Shader Create Info GLSL-C++ stubs #3
@ -38,8 +38,25 @@
|
|||||||
|
|
||||||
namespace blender::gpu::shader {
|
namespace blender::gpu::shader {
|
||||||
|
|
||||||
/* Helps intellisense / auto-completion. */
|
#if defined(GLSL_CPP_STUBS)
|
||||||
#ifndef GPU_SHADER_CREATE_INFO
|
# define GPU_SHADER_NAMED_INTERFACE_INFO(_interface, _inst_name) \
|
||||||
|
namespace _interface { \
|
||||||
|
struct {
|
||||||
|
# define GPU_SHADER_NAMED_INTERFACE_END(_inst_name) \
|
||||||
|
} \
|
||||||
|
_inst_name; \
|
||||||
|
}
|
||||||
|
|
||||||
|
# define GPU_SHADER_INTERFACE_INFO(_interface, _inst_name) namespace _interface {
|
||||||
|
# define GPU_SHADER_INTERFACE_END() }
|
||||||
|
|
||||||
|
# define GPU_SHADER_CREATE_INFO(_info) namespace _info {
|
||||||
|
# define GPU_SHADER_CREATE_END() }
|
||||||
|
|
||||||
|
# define USE_CREATE_INFO(_info) using namespace _info;
|
||||||
|
|
||||||
|
#elif !defined(GPU_SHADER_CREATE_INFO)
|
||||||
|
/* Helps intellisense / auto-completion inside info files. */
|
||||||
# define GPU_SHADER_NAMED_INTERFACE_INFO(_interface, _inst_name) \
|
# define GPU_SHADER_NAMED_INTERFACE_INFO(_interface, _inst_name) \
|
||||||
StageInterfaceInfo _interface(#_interface, _inst_name); \
|
StageInterfaceInfo _interface(#_interface, _inst_name); \
|
||||||
_interface
|
_interface
|
||||||
@ -51,27 +68,12 @@ namespace blender::gpu::shader {
|
|||||||
_info
|
_info
|
||||||
|
|
||||||
# define GPU_SHADER_NAMED_INTERFACE_END(_inst_name) ;
|
# define GPU_SHADER_NAMED_INTERFACE_END(_inst_name) ;
|
||||||
# define GPU_SHADER_INTERFACE_END ;
|
# define GPU_SHADER_INTERFACE_END() ;
|
||||||
# define GPU_SHADER_CREATE_END ;
|
# define GPU_SHADER_CREATE_END() ;
|
||||||
|
|
||||||
#elif defined(GLSL_CPP_STUBS)
|
|
||||||
|
|
||||||
# define GPU_SHADER_NAMED_INTERFACE_INFO(_interface, _inst_name) \
|
|
||||||
namespace _interface { \
|
|
||||||
struct {
|
|
||||||
# define GPU_SHADER_NAMED_INTERFACE_END(_inst_name) \
|
|
||||||
} \
|
|
||||||
_inst_name; \
|
|
||||||
}
|
|
||||||
|
|
||||||
# define GPU_SHADER_INTERFACE_INFO(_interface, _inst_name) namespace _interface {
|
|
||||||
# define GPU_SHADER_INTERFACE_END }
|
|
||||||
|
|
||||||
# define GPU_SHADER_CREATE_INFO(_info) namespace _info {
|
|
||||||
# define GPU_SHADER_CREATE_END }
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef GPU_CREATE_INFO_RUNTIME_IMPL
|
#ifndef GLSL_CPP_STUBS
|
||||||
# define SMOOTH(type, name) .smooth(type, name)
|
# define SMOOTH(type, name) .smooth(type, name)
|
||||||
# define FLAT(type, name) .flat(type, name)
|
# define FLAT(type, name) .flat(type, name)
|
||||||
# define NO_PERSPECTIVE(type, name) .no_perspective(type, name)
|
# define NO_PERSPECTIVE(type, name) .no_perspective(type, name)
|
||||||
@ -99,7 +101,9 @@ namespace blender::gpu::shader {
|
|||||||
# define SPECIALIZATION_CONSTANT(type, name, default_value) \
|
# define SPECIALIZATION_CONSTANT(type, name, default_value) \
|
||||||
.specialization_constant(Type::##type, #name, default_value)
|
.specialization_constant(Type::##type, #name, default_value)
|
||||||
|
|
||||||
# define PUSH_CONSTANT(type, name, array_size) .push_constant(Type::##type, #name, array_size)
|
# define PUSH_CONSTANT(type, name) .push_constant(Type::##type, #name)
|
||||||
|
# define PUSH_CONSTANT_ARRAY(type, name, array_size) \
|
||||||
|
.push_constant(Type::##type, #name, array_size)
|
||||||
|
|
||||||
# define UNIFORM_BUF(slot, type_name, name, freq) .uniform_buf(slot, #type_name, #name)
|
# define UNIFORM_BUF(slot, type_name, name, freq) .uniform_buf(slot, #type_name, #name)
|
||||||
# define UNIFORM_BUF_FREQ(slot, type_name, name, freq) \
|
# define UNIFORM_BUF_FREQ(slot, type_name, name, freq) \
|
||||||
@ -204,7 +208,8 @@ namespace blender::gpu::shader {
|
|||||||
|
|
||||||
# define SPECIALIZATION_CONSTANT(type, name, default_value) constexpr type name = {};
|
# define SPECIALIZATION_CONSTANT(type, name, default_value) constexpr type name = {};
|
||||||
|
|
||||||
# define PUSH_CONSTANT(type, name, array_size) const type name = {};
|
# define PUSH_CONSTANT(type, name) const type name = {};
|
||||||
|
# define PUSH_CONSTANT_ARRAY(type, name, array_size) const type name[array_size] = {};
|
||||||
|
|
||||||
# define UNIFORM_BUF(slot, type_name, name, freq) const type_name name;
|
# define UNIFORM_BUF(slot, type_name, name, freq) const type_name name;
|
||||||
# define UNIFORM_BUF_FREQ(slot, type_name, name, freq) const type_name name;
|
# define UNIFORM_BUF_FREQ(slot, type_name, name, freq) const type_name name;
|
||||||
|
Loading…
Reference in New Issue
Block a user