How it works...

One of the most commonly used pipelines is a pipeline with only vertex and fragment shaders. To prepare parameters of vertex and fragment shader stages we can use the following code:

 std::vector<unsigned char> vertex_shader_spirv; if( !GetBinaryFileContents( vertex_shader_filename, vertex_shader_spirv ) ) { return false; } VkDestroyer<VkShaderModule> vertex_shader_module( logical_device ); if( !CreateShaderModule( logical_device, vertex_shader_spirv, *vertex_shader_module ) ) { return false; } std::vector<unsigned char> fragment_shader_spirv; if( !GetBinaryFileContents( fragment_shader_filename, fragment_shader_spirv ) ) { return false; } VkDestroyer<VkShaderModule> fragment_shader_module( logical_device ); if( !CreateShaderModule( ...

Get Vulkan Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.