webgpu triangle
This commit is contained in:
parent
64116cd980
commit
5553ded476
22 changed files with 2107 additions and 42 deletions
|
|
@ -12,18 +12,22 @@ import std;
|
|||
using namespace Crafter;
|
||||
|
||||
void WebGPUComputeShader::Load(std::string_view wgsl,
|
||||
std::span<const UICustomBinding> bindings) {
|
||||
std::span<const UICustomBinding> bindings,
|
||||
bool rayQuery) {
|
||||
customBindings.assign(bindings.begin(), bindings.end());
|
||||
rayQueryCapable = rayQuery;
|
||||
pipelineHandle = WebGPU::wgpuLoadCustomShader(
|
||||
wgsl.data(),
|
||||
static_cast<std::int32_t>(wgsl.size()),
|
||||
customBindings.data(),
|
||||
static_cast<std::int32_t>(customBindings.size())
|
||||
static_cast<std::int32_t>(customBindings.size()),
|
||||
rayQuery ? 1 : 0
|
||||
);
|
||||
}
|
||||
|
||||
void WebGPUComputeShader::Load(const std::filesystem::path& wgslPath,
|
||||
std::span<const UICustomBinding> bindings) {
|
||||
std::span<const UICustomBinding> bindings,
|
||||
bool rayQuery) {
|
||||
std::ifstream f(wgslPath, std::ios::binary | std::ios::ate);
|
||||
if (!f.is_open()) {
|
||||
std::println("WebGPUComputeShader::Load: cannot open {}", wgslPath.string());
|
||||
|
|
@ -37,5 +41,5 @@ void WebGPUComputeShader::Load(const std::filesystem::path& wgslPath,
|
|||
f.seekg(0, std::ios::beg);
|
||||
std::string src(static_cast<std::size_t>(size), '\0');
|
||||
f.read(src.data(), size);
|
||||
Load(std::string_view{src}, bindings);
|
||||
Load(std::string_view{src}, bindings, rayQuery);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue