1#ifndef TOPAZ_GPU_SHADER_HPP
2#define TOPAZ_GPU_SHADER_HPP
3#include "tz/core/handle.hpp"
4#include "tz/core/error.hpp"
13 struct shader_tag_t{};
35 std::expected<shader_handle, tz::error_code>
create_graphics_shader(std::string_view vertex_source, std::string_view fragment_source);
59#define TZ_MACROHACKERY_JOIN4(X, Y, Z, W) X##Y##Z##W
60#define TZ_MACROHACKERY_STRINGIFY(X) TZ_MACROHACKERY_STRINGIFY2(X)
61#define TZ_MACROHACKERY_STRINGIFY2(X) #X
63#define TZ_MACROHACKERY_JOIN_SHADER(X, Y, Z) TZ_MACROHACKERY_JOIN4(X, Y, Z, _tzsl_spv)
74#define ImportedShaderHeader(shader_name, shader_type) TZ_MACROHACKERY_STRINGIFY2(shader_name.shader_type.tzsl.spv.hpp)
78#define ImportedShaderHeader
88#define ImportedShaderSource(shader_name, shader_type) []()->std::string_view{std::span<const std::byte> shader_bin = std::as_bytes(std::span<const std::int8_t>(TZ_MACROHACKERY_JOIN_SHADER(shader_name, _, shader_type))); return std::string_view{reinterpret_cast<const char*>(shader_bin.data()), shader_bin.size_bytes()};}()
std::expected< shader_handle, tz::error_code > 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.
std::expected< shader_handle, tz::error_code > create_compute_shader(std::string_view compute_source)
Create a new shader intended for compute GPU work, comprised of a single compute shader.
void destroy_shader(shader_handle)
Manually destroy a previously-created shader.