WebGPU wrapper wip: add command buffer object
This commit is contained in:
parent
2af6a1000a
commit
66d6fa5c36
2 changed files with 57 additions and 0 deletions
35
libs/wgpu/include/psemek/wgpu/command_buffer.hpp
Normal file
35
libs/wgpu/include/psemek/wgpu/command_buffer.hpp
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
#pragma once
|
||||
|
||||
#include <psemek/wgpu/chained_struct.hpp>
|
||||
#include <psemek/wgpu/detail/object.hpp>
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace psemek::wgpu
|
||||
{
|
||||
|
||||
struct command_buffer
|
||||
: detail::object<command_buffer>
|
||||
{
|
||||
using detail::object<command_buffer>::object;
|
||||
|
||||
struct descriptor
|
||||
{
|
||||
std::vector<chained_struct> chain = {};
|
||||
std::string label = {};
|
||||
};
|
||||
|
||||
void set_label(std::string const & label);
|
||||
|
||||
static void reference(void * ptr);
|
||||
static void release(void * ptr);
|
||||
|
||||
private:
|
||||
explicit command_buffer(void * ptr)
|
||||
: detail::object<command_buffer>(ptr)
|
||||
{}
|
||||
|
||||
friend struct command_encoder;
|
||||
};
|
||||
|
||||
}
|
||||
22
libs/wgpu/source/command_buffer.cpp
Normal file
22
libs/wgpu/source/command_buffer.cpp
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#include <psemek/wgpu/command_buffer.hpp>
|
||||
#include <psemek/wgpu/external/webgpu.h>
|
||||
|
||||
namespace psemek::wgpu
|
||||
{
|
||||
|
||||
void command_buffer::set_label(std::string const & label)
|
||||
{
|
||||
wgpuCommandBufferSetLabel((WGPUCommandBuffer)get(), label.data());
|
||||
}
|
||||
|
||||
void command_buffer::reference(void * ptr)
|
||||
{
|
||||
wgpuCommandBufferReference((WGPUCommandBuffer)ptr);
|
||||
}
|
||||
|
||||
void command_buffer::release(void * ptr)
|
||||
{
|
||||
wgpuCommandBufferRelease((WGPUCommandBuffer)ptr);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue