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.
3 changed files with 36 additions and 6 deletions
Showing only changes of commit 360970121d - Show all commits

View File

@ -54,7 +54,18 @@ namespace blender::gpu::shader {
# define GPU_SHADER_CREATE_INFO(_info) namespace _info { # define GPU_SHADER_CREATE_INFO(_info) namespace _info {
# define GPU_SHADER_CREATE_END() } # define GPU_SHADER_CREATE_END() }
# define USE_CREATE_INFO(_info) using namespace _info; # define VERTEX_SHADER_CREATE_INFO(_info) \
using namespace gl_VertexShader; \
using namespace _info::gl_VertexShader; \
using namespace _info;
# define FRAGMENT_SHADER_CREATE_INFO(_info) \
using namespace gl_FragmentShader; \
using namespace _info::gl_FragmentShader; \
using namespace _info;
# define COMPUTE_SHADER_CREATE_INFO(_info) \
using namespace gl_ComputeShader; \
using namespace _info::gl_ComputeShader; \
using namespace _info;
#elif !defined(GPU_SHADER_CREATE_INFO) #elif !defined(GPU_SHADER_CREATE_INFO)
/* Helps intellisense / auto-completion inside info files. */ /* Helps intellisense / auto-completion inside info files. */
@ -190,7 +201,10 @@ namespace blender::gpu::shader {
/* LOCAL_GROUP_SIZE(int size_x, int size_y = -1, int size_z = -1) */ /* LOCAL_GROUP_SIZE(int size_x, int size_y = -1, int size_z = -1) */
# define LOCAL_GROUP_SIZE(...) # define LOCAL_GROUP_SIZE(...)
# define VERTEX_IN(slot, type, name) const type name = {}; # define VERTEX_IN(slot, type, name) \
namespace gl_VertexShader { \
const type name = {}; \
}
# define VERTEX_OUT(stage_interface) using namespace stage_interface; # define VERTEX_OUT(stage_interface) using namespace stage_interface;
/* TO REMOVE. */ /* TO REMOVE. */
# define GEOMETRY_LAYOUT(...) # define GEOMETRY_LAYOUT(...)
@ -198,9 +212,18 @@ namespace blender::gpu::shader {
# define SUBPASS_IN(slot, type, name, rog) const type name = {}; # define SUBPASS_IN(slot, type, name, rog) const type name = {};
# define FRAGMENT_OUT(slot, type, name) type name; # define FRAGMENT_OUT(slot, type, name) \
# define FRAGMENT_OUT_DUAL(slot, type, name, blend) type name; namespace gl_FragmentShader { \
# define FRAGMENT_OUT_ROG(slot, type, name, rog) type name; type name; \
}
# define FRAGMENT_OUT_DUAL(slot, type, name, blend) \
namespace gl_FragmentShader { \
type name; \
}
# define FRAGMENT_OUT_ROG(slot, type, name, rog) \
namespace gl_FragmentShader { \
type name; \
}
# define EARLY_FRAGMENT_TEST(enable) # define EARLY_FRAGMENT_TEST(enable)
# define DEPTH_WRITE(value) # define DEPTH_WRITE(value)

View File

@ -10,6 +10,13 @@
* the rounded corner, and the rectangle sides. * the rounded corner, and the rectangle sides.
*/ */
/* TODO(fclem): Replace with gpu_glsl_cpp_stubs.hh include. */
#define GLSL_CPP_STUBS
#include "infos/gpu_shader_icon_info.hh"
FRAGMENT_SHADER_CREATE_INFO(gpu_shader_icon)
void main() void main()
{ {
/* Sample texture with LOD BIAS. Used instead of custom LOD bias in GPU_SAMPLER_CUSTOM_ICON. */ /* Sample texture with LOD BIAS. Used instead of custom LOD bias in GPU_SAMPLER_CUSTOM_ICON. */

View File

@ -12,7 +12,7 @@
#include "infos/gpu_shader_icon_info.hh" #include "infos/gpu_shader_icon_info.hh"
USE_CREATE_INFO(gpu_shader_icon) VERTEX_SHADER_CREATE_INFO(gpu_shader_icon)
void main() void main()
{ {