Update to wgpu-native v0.19.4.1

This commit is contained in:
Nikita Lisitsa 2024-05-18 21:40:54 +03:00
parent b436e7b2d8
commit fffd2c70e6
5 changed files with 30 additions and 8 deletions

View file

@ -14,6 +14,7 @@ typedef enum WGPUNativeSType {
WGPUSType_BindGroupEntryExtras = 0x00030007, WGPUSType_BindGroupEntryExtras = 0x00030007,
WGPUSType_BindGroupLayoutEntryExtras = 0x00030008, WGPUSType_BindGroupLayoutEntryExtras = 0x00030008,
WGPUSType_QuerySetDescriptorExtras = 0x00030009, WGPUSType_QuerySetDescriptorExtras = 0x00030009,
WGPUSType_SurfaceConfigurationExtras = 0x0003000A,
WGPUNativeSType_Force32 = 0x7FFFFFFF WGPUNativeSType_Force32 = 0x7FFFFFFF
} WGPUNativeSType; } WGPUNativeSType;
@ -26,6 +27,8 @@ typedef enum WGPUNativeFeature {
WGPUNativeFeature_TextureBindingArray = 0x00030006, WGPUNativeFeature_TextureBindingArray = 0x00030006,
WGPUNativeFeature_SampledTextureAndStorageBufferArrayNonUniformIndexing = 0x00030007, WGPUNativeFeature_SampledTextureAndStorageBufferArrayNonUniformIndexing = 0x00030007,
WGPUNativeFeature_PipelineStatisticsQuery = 0x00030008, WGPUNativeFeature_PipelineStatisticsQuery = 0x00030008,
WGPUNativeFeature_StorageResourceBindingArray = 0x00030009,
WGPUNativeFeature_PartiallyBoundBindingArray = 0x0003000A,
WGPUNativeFeature_Force32 = 0x7FFFFFFF WGPUNativeFeature_Force32 = 0x7FFFFFFF
} WGPUNativeFeature; } WGPUNativeFeature;
@ -131,8 +134,8 @@ typedef struct WGPUPushConstantRange {
typedef struct WGPUPipelineLayoutExtras { typedef struct WGPUPipelineLayoutExtras {
WGPUChainedStruct chain; WGPUChainedStruct chain;
uint32_t pushConstantRangeCount; size_t pushConstantRangeCount;
WGPUPushConstantRange* pushConstantRanges; WGPUPushConstantRange const * pushConstantRanges;
} WGPUPipelineLayoutExtras; } WGPUPipelineLayoutExtras;
typedef uint64_t WGPUSubmissionIndex; typedef uint64_t WGPUSubmissionIndex;
@ -159,7 +162,6 @@ typedef struct WGPURegistryReport {
size_t numAllocated; size_t numAllocated;
size_t numKeptFromUser; size_t numKeptFromUser;
size_t numReleasedFromUser; size_t numReleasedFromUser;
size_t numDestroyedFromUser;
size_t numError; size_t numError;
size_t elementSize; size_t elementSize;
} WGPURegistryReport; } WGPURegistryReport;
@ -218,6 +220,11 @@ typedef struct WGPUQuerySetDescriptorExtras {
size_t pipelineStatisticCount; size_t pipelineStatisticCount;
} WGPUQuerySetDescriptorExtras WGPU_STRUCTURE_ATTRIBUTE; } WGPUQuerySetDescriptorExtras WGPU_STRUCTURE_ATTRIBUTE;
typedef struct WGPUSurfaceConfigurationExtras {
WGPUChainedStruct chain;
WGPUBool desiredMaximumFrameLatency;
} WGPUSurfaceConfigurationExtras WGPU_STRUCTURE_ATTRIBUTE;
typedef void (*WGPULogCallback)(WGPULogLevel level, char const * message, void * userdata); typedef void (*WGPULogCallback)(WGPULogLevel level, char const * message, void * userdata);
#ifdef __cplusplus #ifdef __cplusplus
@ -225,12 +232,12 @@ extern "C" {
#endif #endif
void wgpuGenerateReport(WGPUInstance instance, WGPUGlobalReport * report); void wgpuGenerateReport(WGPUInstance instance, WGPUGlobalReport * report);
size_t wgpuInstanceEnumerateAdapters(WGPUInstance instance, WGPUInstanceEnumerateAdapterOptions const * options, WGPUAdapter * adapters); size_t wgpuInstanceEnumerateAdapters(WGPUInstance instance, WGPU_NULLABLE WGPUInstanceEnumerateAdapterOptions const * options, WGPUAdapter * adapters);
WGPUSubmissionIndex wgpuQueueSubmitForIndex(WGPUQueue queue, size_t commandCount, WGPUCommandBuffer const * commands); WGPUSubmissionIndex wgpuQueueSubmitForIndex(WGPUQueue queue, size_t commandCount, WGPUCommandBuffer const * commands);
// Returns true if the queue is empty, or false if there are more queue submissions still in flight. // Returns true if the queue is empty, or false if there are more queue submissions still in flight.
WGPUBool wgpuDevicePoll(WGPUDevice device, WGPUBool wait, WGPUWrappedSubmissionIndex const * wrappedSubmissionIndex); WGPUBool wgpuDevicePoll(WGPUDevice device, WGPUBool wait, WGPU_NULLABLE WGPUWrappedSubmissionIndex const * wrappedSubmissionIndex);
void wgpuSetLogCallback(WGPULogCallback callback, void * userdata); void wgpuSetLogCallback(WGPULogCallback callback, void * userdata);
@ -238,7 +245,7 @@ void wgpuSetLogLevel(WGPULogLevel level);
uint32_t wgpuGetVersion(void); uint32_t wgpuGetVersion(void);
void wgpuRenderPassEncoderSetPushConstants(WGPURenderPassEncoder encoder, WGPUShaderStageFlags stages, uint32_t offset, uint32_t sizeBytes, void* const data); void wgpuRenderPassEncoderSetPushConstants(WGPURenderPassEncoder encoder, WGPUShaderStageFlags stages, uint32_t offset, uint32_t sizeBytes, void const * data);
void wgpuRenderPassEncoderMultiDrawIndirect(WGPURenderPassEncoder encoder, WGPUBuffer buffer, uint64_t offset, uint32_t count); void wgpuRenderPassEncoderMultiDrawIndirect(WGPURenderPassEncoder encoder, WGPUBuffer buffer, uint64_t offset, uint32_t count);
void wgpuRenderPassEncoderMultiDrawIndexedIndirect(WGPURenderPassEncoder encoder, WGPUBuffer buffer, uint64_t offset, uint32_t count); void wgpuRenderPassEncoderMultiDrawIndexedIndirect(WGPURenderPassEncoder encoder, WGPUBuffer buffer, uint64_t offset, uint32_t count);

View file

@ -53,6 +53,11 @@ namespace psemek::wgpu
std::uint32_t width; std::uint32_t width;
std::uint32_t height; std::uint32_t height;
surface::present_mode present_mode; surface::present_mode present_mode;
struct extras
{
bool desired_maximum_frame_latency;
};
}; };
struct capabilities struct capabilities
@ -137,6 +142,7 @@ namespace psemek::wgpu
friend struct instance; friend struct instance;
}; };
detail::chained_struct_ptr to_chained_struct(surface::configuration::extras const & value);
detail::chained_struct_ptr to_chained_struct(surface::from_android_native_window const & value); detail::chained_struct_ptr to_chained_struct(surface::from_android_native_window const & value);
detail::chained_struct_ptr to_chained_struct(surface::from_canvas_html_selected const & value); detail::chained_struct_ptr to_chained_struct(surface::from_canvas_html_selected const & value);
detail::chained_struct_ptr to_chained_struct(surface::from_metal_layer const & value); detail::chained_struct_ptr to_chained_struct(surface::from_metal_layer const & value);

View file

@ -26,7 +26,7 @@ namespace psemek::wgpu
chained.chain.sType = (WGPUSType)WGPUSType_PipelineLayoutExtras; chained.chain.sType = (WGPUSType)WGPUSType_PipelineLayoutExtras;
static_assert(sizeof(WGPUPushConstantRange) == sizeof(push_constant_range)); static_assert(sizeof(WGPUPushConstantRange) == sizeof(push_constant_range));
chained.pushConstantRangeCount = value.ranges.size(); chained.pushConstantRangeCount = value.ranges.size();
chained.pushConstantRanges = (WGPUPushConstantRange *)value.ranges.data(); chained.pushConstantRanges = (WGPUPushConstantRange const *)value.ranges.data();
return detail::make_chained_struct(chained, std::move(value)); return detail::make_chained_struct(chained, std::move(value));
} }

View file

@ -48,7 +48,7 @@ namespace psemek::wgpu
void render_pass_encoder::set_push_constants(shader_stage stages, std::uint32_t offset, util::span<char const> data) void render_pass_encoder::set_push_constants(shader_stage stages, std::uint32_t offset, util::span<char const> data)
{ {
wgpuRenderPassEncoderSetPushConstants((WGPURenderPassEncoder)get(), (WGPUShaderStageFlags)stages, offset, data.size(), (void *)data.data()); wgpuRenderPassEncoderSetPushConstants((WGPURenderPassEncoder)get(), (WGPUShaderStageFlags)stages, offset, data.size(), data.data());
} }
void render_pass_encoder::draw(std::uint32_t vertex_count, std::uint32_t instance_count, std::uint32_t first_vertex, std::uint32_t first_instance) void render_pass_encoder::draw(std::uint32_t vertex_count, std::uint32_t instance_count, std::uint32_t first_vertex, std::uint32_t first_instance)

View file

@ -1,6 +1,7 @@
#include <psemek/wgpu/surface.hpp> #include <psemek/wgpu/surface.hpp>
#include <psemek/wgpu/adapter.hpp> #include <psemek/wgpu/adapter.hpp>
#include <psemek/wgpu/external/webgpu.h> #include <psemek/wgpu/external/webgpu.h>
#include <psemek/wgpu/external/wgpu.h>
namespace psemek::wgpu namespace psemek::wgpu
{ {
@ -72,6 +73,14 @@ namespace psemek::wgpu
wgpuSurfaceRelease((WGPUSurface)ptr); wgpuSurfaceRelease((WGPUSurface)ptr);
} }
detail::chained_struct_ptr to_chained_struct(surface::configuration::extras const & value)
{
WGPUSurfaceConfigurationExtras chained = {};
chained.chain.sType = (WGPUSType)WGPUSType_SurfaceConfigurationExtras;
chained.desiredMaximumFrameLatency = value.desired_maximum_frame_latency;
return detail::make_chained_struct(chained);
}
detail::chained_struct_ptr to_chained_struct(surface::from_android_native_window const & value) detail::chained_struct_ptr to_chained_struct(surface::from_android_native_window const & value)
{ {
WGPUSurfaceDescriptorFromAndroidNativeWindow chained = {}; WGPUSurfaceDescriptorFromAndroidNativeWindow chained = {};