GPU: Shader Create Info GLSL-C++ stubs #3

Closed
Clément Foucault wants to merge 90 commits from create-info-cpp-macros into glsl-include

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
Showing only changes of commit 601da1c78f - Show all commits

View File

@ -38,8 +38,25 @@
namespace blender::gpu::shader {
/* Helps intellisense / auto-completion. */
#ifndef GPU_SHADER_CREATE_INFO
#if 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() }
# 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) \
StageInterfaceInfo _interface(#_interface, _inst_name); \
_interface
@ -51,27 +68,12 @@ namespace blender::gpu::shader {
_info
# define GPU_SHADER_NAMED_INTERFACE_END(_inst_name) ;
# define GPU_SHADER_INTERFACE_END ;
# define GPU_SHADER_CREATE_END ;
# define GPU_SHADER_INTERFACE_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
#ifdef GPU_CREATE_INFO_RUNTIME_IMPL
#ifndef GLSL_CPP_STUBS
# define SMOOTH(type, name) .smooth(type, name)
# define FLAT(type, name) .flat(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) \
.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_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 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_FREQ(slot, type_name, name, freq) const type_name name;