16 stage_ = SDL_GPU_SHADERSTAGE_VERTEX;
21 stage_ = SDL_GPU_SHADERSTAGE_FRAGMENT;
26 numUniformBuffers_ = n;
31 std::ifstream f(path_);
33 throw std::runtime_error(std::format(
"Could not find shader {}", path_));
35 std::stringstream buffer;
37 std::string code = buffer.str();
38 SDL_GPUShaderCreateInfo info {
39 .code_size = code.size(),
40 .code =
reinterpret_cast<unsigned char*
>(code.data()),
42 .format = SDL_GPU_SHADERFORMAT_SPIRV,
44 .num_uniform_buffers = numUniformBuffers_
46 if (
auto shader = SDL_CreateGPUShader(device, &info)) {
49 throw std::runtime_error(SDL_GetError());