formats.c \
compiler.cpp
-BUILT_SOURCES = entrypoints.h entrypoints.c
+BUILT_SOURCES = \
+ entrypoints.h \
+ entrypoints.c \
+ meta-spirv.h
entrypoints.h : vk_gen.py $(vulkan_include_HEADERS)
$(AM_V_GEN)cat $(vulkan_include_HEADERS) | $(PYTHON2) $< header > $@
entrypoints.c : vk_gen.py $(vulkan_include_HEADERS)
$(AM_V_GEN)cat $(vulkan_include_HEADERS) | $(PYTHON2) $< code > $@
+%-spirv.h: %.c glsl_scraper.py
+ $(AM_V_GEN) $(PYTHON2) $(srcdir)/glsl_scraper.py --glsl-only -o $@ $<
+
CLEANFILES = entrypoints.h entrypoints.c
bin_PROGRAMS = vk
#pragma once
+#define _GLSL_SRC_VAR2(_line) _glsl_helpers_shader ## _line ## _glsl_src
+#define _GLSL_SRC_VAR(_line) _GLSL_SRC_VAR2(_line)
+
#define GLSL_VK_SHADER(device, stage, ...) ({ \
VkShader __shader; \
- const char __src[] = "#version 330\n" #__VA_ARGS__; \
VkShaderCreateInfo __shader_create_info = { \
.sType = VK_STRUCTURE_TYPE_SHADER_CREATE_INFO, \
- .codeSize = sizeof(__src), \
- .pCode = __src, \
+ .codeSize = sizeof(_GLSL_SRC_VAR(__LINE__)), \
+ .pCode = _GLSL_SRC_VAR(__LINE__), \
.flags = (1 << 31) /* GLSL back-door hack */ \
}; \
anv_CreateShader((VkDevice) device, &__shader_create_info, &__shader); \