Topaz 5.0
Topaz Game Engine
|
Create shaders to carry out programmable GPU work.
Typedefs | |
using | tz::gpu::shader_handle = tz::handle<shader_tag_t> |
Corresponds to a previously-created shader program (for graphics or compute). | |
std::expected< shader_handle, tz::error_code > tz::gpu::create_graphics_shader | ( | std::string_view | vertex_source, |
std::string_view | fragment_source ) |
Create a new shader intended for graphics GPU work, comprised of a vertex and fragment shader.
vertex_source | Code for the vertex shader, in SPIRV. |
fragment_source | Code for the fragment shader, in SPIRV. |
std::expected< shader_handle, tz::error_code > tz::gpu::create_compute_shader | ( | std::string_view | compute_source | ) |
Create a new shader intended for compute GPU work, comprised of a single compute shader.
compute_source | Code for the compute shader, in SPIRV. |
void tz::gpu::destroy_shader | ( | shader_handle | ) |
Manually destroy a previously-created shader.
If you are certain that you are done with a shader program, you can destroy it here, causing all of its memory to be available for reuse.
#define ImportedShaderHeader | ( | shader_name, | |
shader_type ) |
Retrieves a file path which is intended to be #included in a application's main source file. Once included, the imported shader's source code can be retrieved as a constexpr string_view via ImportedShaderSource
#define ImportedShaderSource | ( | shader_name, | |
shader_type ) |
Retrieves a token representing a std::string_view
which contains the shader's compiled results. On Vulkan, this will be SPIRV, and GLSL source code for OpenGL. You can only retrieve an imported shader's source if the imported header has been included via ImportedShaderHeader
using tz::gpu::shader_handle = tz::handle<shader_tag_t> |
Corresponds to a previously-created shader program (for graphics or compute).