vulkan_test2

diff src/vkpipe.h @ 13:d34f84bede17

pipeline madness
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 25 Jun 2018 08:00:57 +0300
parents e17abe477616
children
line diff
     1.1 --- a/src/vkpipe.h	Sat Jun 23 07:47:49 2018 +0300
     1.2 +++ b/src/vkpipe.h	Mon Jun 25 08:00:57 2018 +0300
     1.3 @@ -5,7 +5,7 @@
     1.4  
     1.5  #define VKU_MAX_SDR_STAGES	8
     1.6  
     1.7 -struct vku_pstate {
     1.8 +struct vku_pipeline {
     1.9  	VkPipelineShaderStageCreateInfo sdrstage[VKU_MAX_SDR_STAGES];
    1.10  	int num_sdr_stages;
    1.11  	VkPipelineVertexInputStateCreateInfo vertinp;
    1.12 @@ -16,7 +16,11 @@
    1.13  	VkPipelineDepthStencilStateCreateInfo zstencil;
    1.14  	VkPipelineColorBlendStateCreateInfo blend;
    1.15  	/*VkPipelineDynamicStateCreateInfo dyn;*/
    1.16 -	VkPipelineLayoutCreateInfo layout;
    1.17 +	VkPipelineLayoutCreateInfo lay;
    1.18 +
    1.19 +	VkRenderPass rpass;
    1.20 +	VkPipeline pipeline;
    1.21 +	VkPipelineLayout layout;
    1.22  
    1.23  	/* data needed by the structs above */
    1.24  	VkViewport vport_data;
    1.25 @@ -24,28 +28,30 @@
    1.26  	VkPipelineColorBlendAttachmentState atblend;
    1.27  };
    1.28  
    1.29 -int vku_init_pstate(struct vku_pstate *st);
    1.30 -void vku_pstate_shader(struct vku_pstate *st, VkShaderModule sdr, VkShaderStageFlagBits type);
    1.31 -void vku_pstate_primitive(struct vku_pstate *st, VkPrimitiveTopology prim);
    1.32 -void vku_pstate_viewport(struct vku_pstate *st, int x, int y, int w, int h);
    1.33 -void vku_pstate_scissor(struct vku_pstate *st, int x, int y, int w, int h);
    1.34 -void vku_pstate_polygon_mode(struct vku_pstate *st, VkPolygonMode pmode);
    1.35 -void vku_pstate_line_width(struct vku_pstate *st, float w);
    1.36 -void vku_pstate_cull_mode(struct vku_pstate *st, VkCullModeFlagBits cull);
    1.37 -void vku_pstate_front_face(struct vku_pstate *st, VkFrontFace front);
    1.38 -void vku_pstate_depth_bias(struct vku_pstate *st, float fslope, float fconst, float clamp);
    1.39 -void vku_pstate_depth_test(struct vku_pstate *st, int enable);
    1.40 -void vku_pstate_depth_func(struct vku_pstate *st, VkCompareOp op);
    1.41 -void vku_pstate_depth_mask(struct vku_pstate *st, int zmask);
    1.42 -void vku_pstate_stencil_test(struct vku_pstate *st, int enable);
    1.43 -void vku_pstate_stencil_func(struct vku_pstate *st, VkCompareOp op, int ref, unsigned int mask);
    1.44 -void vku_pstate_stencil_op(struct vku_pstate *st, VkStencilOp sfail, VkStencilOp dfail, VkStencilOp pass);
    1.45 -void vku_pstate_stencil_mask(struct vku_pstate *st, unsigned int smask);
    1.46 -void vku_pstate_color_mask(struct vku_pstate *st, int rmask, int gmask, int bmask, int amask);
    1.47 -void vku_pstate_blend_enable(struct vku_pstate *st, int enable);
    1.48 -void vku_pstate_blend_func(struct vku_pstate *st, VkBlendFactor src, VkBlendFactor dst);
    1.49 +int vku_init_pipeline(struct vku_pipeline *st);
    1.50 +void vku_pipeline_shader(struct vku_pipeline *st, VkShaderModule sdr, VkShaderStageFlagBits type);
    1.51 +void vku_pipeline_primitive(struct vku_pipeline *st, VkPrimitiveTopology prim);
    1.52 +void vku_pipeline_viewport(struct vku_pipeline *st, int x, int y, int w, int h);
    1.53 +void vku_pipeline_scissor(struct vku_pipeline *st, int x, int y, int w, int h);
    1.54 +void vku_pipeline_polygon_mode(struct vku_pipeline *st, VkPolygonMode pmode);
    1.55 +void vku_pipeline_line_width(struct vku_pipeline *st, float w);
    1.56 +void vku_pipeline_cull_mode(struct vku_pipeline *st, VkCullModeFlagBits cull);
    1.57 +void vku_pipeline_front_face(struct vku_pipeline *st, VkFrontFace front);
    1.58 +void vku_pipeline_depth_bias(struct vku_pipeline *st, float fslope, float fconst, float clamp);
    1.59 +void vku_pipeline_depth_test(struct vku_pipeline *st, int enable);
    1.60 +void vku_pipeline_depth_func(struct vku_pipeline *st, VkCompareOp op);
    1.61 +void vku_pipeline_depth_mask(struct vku_pipeline *st, int zmask);
    1.62 +void vku_pipeline_stencil_test(struct vku_pipeline *st, int enable);
    1.63 +void vku_pipeline_stencil_func(struct vku_pipeline *st, VkCompareOp op, int ref, unsigned int mask);
    1.64 +void vku_pipeline_stencil_op(struct vku_pipeline *st, VkStencilOp sfail, VkStencilOp dfail, VkStencilOp pass);
    1.65 +void vku_pipeline_stencil_mask(struct vku_pipeline *st, unsigned int smask);
    1.66 +void vku_pipeline_color_mask(struct vku_pipeline *st, int rmask, int gmask, int bmask, int amask);
    1.67 +void vku_pipeline_blend_enable(struct vku_pipeline *st, int enable);
    1.68 +void vku_pipeline_blend_func(struct vku_pipeline *st, VkBlendFactor src, VkBlendFactor dst);
    1.69 +void vku_pipeline_renderpass(struct vku_pipeline *st, VkRenderPass rpass);
    1.70  
    1.71 -VkPipeline vku_create_pipeline(struct vku_pstate *st);
    1.72 +VkPipeline vku_create_pipeline(struct vku_pipeline *st);
    1.73 +void vku_destroy_pipeline(struct vku_pipeline *p);
    1.74  
    1.75  VkShaderModule vku_load_shader(const char *fname);
    1.76  void vku_destroy_shader(VkShaderModule sdr);