webgpu triangle
This commit is contained in:
parent
64116cd980
commit
5553ded476
22 changed files with 2107 additions and 42 deletions
|
|
@ -49,6 +49,7 @@ export namespace Crafter {
|
|||
class WebGPUComputeShader {
|
||||
public:
|
||||
std::uint32_t pipelineHandle = 0;
|
||||
bool rayQueryCapable = false;
|
||||
std::vector<UICustomBinding> customBindings;
|
||||
|
||||
WebGPUComputeShader() = default;
|
||||
|
|
@ -56,22 +57,28 @@ export namespace Crafter {
|
|||
WebGPUComputeShader& operator=(const WebGPUComputeShader&) = delete;
|
||||
WebGPUComputeShader(WebGPUComputeShader&& o) noexcept
|
||||
: pipelineHandle(o.pipelineHandle),
|
||||
rayQueryCapable(o.rayQueryCapable),
|
||||
customBindings(std::move(o.customBindings)) {
|
||||
o.pipelineHandle = 0;
|
||||
}
|
||||
|
||||
// Compile + link a custom compute shader. `wgsl` is the source
|
||||
// string; the library does NOT add anything to it — the user's
|
||||
// shader must declare @group(0)/@group(1) bindings matching the
|
||||
// contract above. `bindings` lists every additional resource
|
||||
// (groups 2+) that the renderer should bind at dispatch time.
|
||||
// string; the library does NOT add anything to it (except when
|
||||
// `rayQuery` is true — then a RT prelude exposing the rayQuery*
|
||||
// API is prepended). The user's shader must declare
|
||||
// @group(0)/@group(1) bindings matching the contract above
|
||||
// (rayQuery shaders MUST NOT redeclare group(1)).
|
||||
// `bindings` lists every additional resource (groups 2+) that the
|
||||
// renderer should bind at dispatch time.
|
||||
void Load(std::string_view wgsl,
|
||||
std::span<const UICustomBinding> bindings = {});
|
||||
std::span<const UICustomBinding> bindings = {},
|
||||
bool rayQuery = false);
|
||||
|
||||
// Path-based overload for symmetry with the Vulkan ComputeShader.
|
||||
// Reads the file from disk (browser VFS) and forwards to Load(wgsl).
|
||||
void Load(const std::filesystem::path& wgslPath,
|
||||
std::span<const UICustomBinding> bindings = {});
|
||||
std::span<const UICustomBinding> bindings = {},
|
||||
bool rayQuery = false);
|
||||
};
|
||||
}
|
||||
#endif // CRAFTER_GRAPHICS_WINDOW_DOM
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue