webgpu triangle

This commit is contained in:
Jorijn van der Graaf 2026-05-18 18:43:30 +02:00
commit 5553ded476
22 changed files with 2107 additions and 42 deletions

View file

@ -0,0 +1,32 @@
/*
Crafter®.Graphics
Copyright (C) 2026 Catcrafts®
catcrafts.net
*/
module;
module Crafter.Graphics:ShaderBindingTableWebGPU_impl;
import :ShaderBindingTableWebGPU;
import std;
using namespace Crafter;
WebGPUShader::WebGPUShader(const std::filesystem::path& wgslPath,
std::string fn,
WebGPURTStage s)
: entryFn(std::move(fn)), stage(s) {
std::ifstream f(wgslPath, std::ios::binary | std::ios::ate);
if (!f.is_open()) {
std::println("WebGPUShader: cannot open {}", wgslPath.string());
return;
}
auto size = f.tellg();
if (size <= 0) {
std::println("WebGPUShader: empty file {}", wgslPath.string());
return;
}
f.seekg(0, std::ios::beg);
source.resize(static_cast<std::size_t>(size));
f.read(source.data(), size);
}