diff options
author | Tomasz Kramkowski <tk@the-tk.com> | 2018-03-01 13:48:17 +0000 |
---|---|---|
committer | Tomasz Kramkowski <tk@the-tk.com> | 2018-03-01 14:43:15 +0000 |
commit | 78783f5a641e4429a61cf13251777502427db510 (patch) | |
tree | 3bacf769c0b5e45b5682e371bad3d965221fcf6d | |
parent | 364eea8654a69dd0e79cdfa86c10992e6e275ccd (diff) | |
download | vulkan-78783f5a641e4429a61cf13251777502427db510.tar.gz vulkan-78783f5a641e4429a61cf13251777502427db510.tar.xz vulkan-78783f5a641e4429a61cf13251777502427db510.zip |
shaders: fix shader embedding
The embedded shader data should be using char * instead of void *.
Additionally some macros are provided for better readability.
-rw-r--r-- | shaders.h | 14 | ||||
-rw-r--r-- | vulkan.c | 4 |
2 files changed, 10 insertions, 8 deletions
@@ -3,12 +3,14 @@ #include <stddef.h> -extern size_t _binary_vertex_spv_size; -extern void *_binary_vertex_spv_start; -extern void *_binary_vertex_spv_end; +extern char _binary_vertex_spv_start[]; +extern char _binary_vertex_spv_end[]; +#define vertex_spv_data _binary_vertex_spv_start +#define vertex_spv_size (_binary_vertex_spv_end - _binary_vertex_spv_start) -extern size_t _binary_fragment_spv_size; -extern void *_binary_fragment_spv_start; -extern void *_binary_fragment_spv_end; +extern char _binary_fragment_spv_start[]; +extern char _binary_fragment_spv_end[]; +#define fragment_spv_data _binary_fragment_spv_start +#define fragment_spv_size (_binary_fragment_spv_end - _binary_fragment_spv_start) #endif // VULKAN_SHADERS_H @@ -520,8 +520,8 @@ static void createpipeline(struct ppln *ppln, VkDevice dev, const VkExtent2D *ex if (res != VK_SUCCESS) eprintf("Could not create pipeline layout"); - vsmod = createsmod(dev, _binary_vertex_spv_start, _binary_vertex_spv_size); - fsmod = createsmod(dev, _binary_fragment_spv_start, _binary_fragment_spv_size); + vsmod = createsmod(dev, vertex_spv_data, vertex_spv_size); + fsmod = createsmod(dev, fragment_spv_data, fragment_spv_size); gpcinf = (VkGraphicsPipelineCreateInfo){ .sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO, |