Update to wgpu-native v27.0.2.0
This commit is contained in:
parent
48d756bdd5
commit
62f2adcb82
8 changed files with 68 additions and 12 deletions
|
|
@ -64,7 +64,7 @@ if(NOT DEFINED PSEMEK_GRAPHICS_API)
|
|||
endif()
|
||||
|
||||
if(PSEMEK_GRAPHICS_API STREQUAL WEBGPU)
|
||||
find_package(wgpu-native 25.0.2.1 REQUIRED)
|
||||
find_package(wgpu-native 27.0.2.0 REQUIRED)
|
||||
endif()
|
||||
|
||||
message(STATUS "Using graphics API ${PSEMEK_GRAPHICS_API}")
|
||||
|
|
|
|||
|
|
@ -46,7 +46,6 @@ namespace psemek::wgpu
|
|||
|
||||
push_constants = 0x00030001,
|
||||
texture_adapter_specific_format_features = 0x00030002,
|
||||
multi_draw_indirect = 0x00030003,
|
||||
multi_draw_indirect_count = 0x00030004,
|
||||
vertex_writable_storage = 0x00030005,
|
||||
texture_binding_array = 0x00030006,
|
||||
|
|
@ -59,10 +58,12 @@ namespace psemek::wgpu
|
|||
mappable_primary_buffers = 0x0003000e,
|
||||
buffer_binding_array = 0x0003000f,
|
||||
uniform_buffer_and_storage_texture_array_non_uniform_indexing = 0x00030010,
|
||||
polygon_mode_line = 0x00030013,
|
||||
polygon_mode_point = 0x00030014,
|
||||
conservative_rasterization = 0x00030015,
|
||||
spirv_shader_passthrough = 0x00030017,
|
||||
vertex_attribute64bit = 0x00030019,
|
||||
texture_format_nv12 = 0x0003001a,
|
||||
ray_tracing_acceleration_structure = 0x0003001b,
|
||||
ray_query = 0x0003001c,
|
||||
shader_f64 = 0x0003001d,
|
||||
shader_i16 = 0x0003001e,
|
||||
|
|
@ -73,6 +74,7 @@ namespace psemek::wgpu
|
|||
subgroup_barrier = 0x00030023,
|
||||
timestamp_query_inside_encoders = 0x00030024,
|
||||
timestamp_query_inside_passes = 0x00030025,
|
||||
shader_int64 = 0x00030026,
|
||||
};
|
||||
|
||||
struct limits
|
||||
|
|
|
|||
41
libs/wgpu/include/psemek/wgpu/external/wgpu.h
vendored
41
libs/wgpu/include/psemek/wgpu/external/wgpu.h
vendored
|
|
@ -14,13 +14,14 @@ typedef enum WGPUNativeSType {
|
|||
WGPUSType_BindGroupLayoutEntryExtras = 0x00030008,
|
||||
WGPUSType_QuerySetDescriptorExtras = 0x00030009,
|
||||
WGPUSType_SurfaceConfigurationExtras = 0x0003000A,
|
||||
WGPUSType_SurfaceSourceSwapChainPanel = 0x0003000B,
|
||||
WGPUSType_PrimitiveStateExtras = 0x0003000C,
|
||||
WGPUNativeSType_Force32 = 0x7FFFFFFF
|
||||
} WGPUNativeSType;
|
||||
|
||||
typedef enum WGPUNativeFeature {
|
||||
WGPUNativeFeature_PushConstants = 0x00030001,
|
||||
WGPUNativeFeature_TextureAdapterSpecificFormatFeatures = 0x00030002,
|
||||
WGPUNativeFeature_MultiDrawIndirect = 0x00030003,
|
||||
WGPUNativeFeature_MultiDrawIndirectCount = 0x00030004,
|
||||
WGPUNativeFeature_VertexWritableStorage = 0x00030005,
|
||||
WGPUNativeFeature_TextureBindingArray = 0x00030006,
|
||||
|
|
@ -36,15 +37,14 @@ typedef enum WGPUNativeFeature {
|
|||
// TODO: requires wgpu.h api change
|
||||
// WGPUNativeFeature_AddressModeClampToZero = 0x00030011,
|
||||
// WGPUNativeFeature_AddressModeClampToBorder = 0x00030012,
|
||||
// WGPUNativeFeature_PolygonModeLine = 0x00030013,
|
||||
// WGPUNativeFeature_PolygonModePoint = 0x00030014,
|
||||
// WGPUNativeFeature_ConservativeRasterization = 0x00030015,
|
||||
WGPUNativeFeature_PolygonModeLine = 0x00030013,
|
||||
WGPUNativeFeature_PolygonModePoint = 0x00030014,
|
||||
WGPUNativeFeature_ConservativeRasterization = 0x00030015,
|
||||
// WGPUNativeFeature_ClearTexture = 0x00030016,
|
||||
WGPUNativeFeature_SpirvShaderPassthrough = 0x00030017,
|
||||
// WGPUNativeFeature_Multiview = 0x00030018,
|
||||
WGPUNativeFeature_VertexAttribute64bit = 0x00030019,
|
||||
WGPUNativeFeature_TextureFormatNv12 = 0x0003001A,
|
||||
WGPUNativeFeature_RayTracingAccelerationStructure = 0x0003001B,
|
||||
WGPUNativeFeature_RayQuery = 0x0003001C,
|
||||
WGPUNativeFeature_ShaderF64 = 0x0003001D,
|
||||
WGPUNativeFeature_ShaderI16 = 0x0003001E,
|
||||
|
|
@ -55,6 +55,7 @@ typedef enum WGPUNativeFeature {
|
|||
WGPUNativeFeature_SubgroupBarrier = 0x00030023,
|
||||
WGPUNativeFeature_TimestampQueryInsideEncoders = 0x00030024,
|
||||
WGPUNativeFeature_TimestampQueryInsidePasses = 0x00030025,
|
||||
WGPUNativeFeature_ShaderInt64 = 0x00030026,
|
||||
WGPUNativeFeature_Force32 = 0x7FFFFFFF
|
||||
} WGPUNativeFeature;
|
||||
|
||||
|
|
@ -143,9 +144,11 @@ typedef struct WGPUInstanceExtras {
|
|||
WGPUDx12Compiler dx12ShaderCompiler;
|
||||
WGPUGles3MinorVersion gles3MinorVersion;
|
||||
WGPUGLFenceBehaviour glFenceBehaviour;
|
||||
WGPUStringView dxilPath;
|
||||
WGPUStringView dxcPath;
|
||||
WGPUDxcMaxShaderModel dxcMaxShaderModel;
|
||||
|
||||
WGPU_NULLABLE const uint8_t* budgetForDeviceCreation;
|
||||
WGPU_NULLABLE const uint8_t* budgetForDeviceLoss;
|
||||
} WGPUInstanceExtras;
|
||||
|
||||
typedef struct WGPUDeviceExtras {
|
||||
|
|
@ -256,6 +259,30 @@ typedef struct WGPUSurfaceConfigurationExtras {
|
|||
uint32_t desiredMaximumFrameLatency;
|
||||
} WGPUSurfaceConfigurationExtras WGPU_STRUCTURE_ATTRIBUTE;
|
||||
|
||||
/**
|
||||
* Chained in @ref WGPUSurfaceDescriptor to make a @ref WGPUSurface wrapping a WinUI [`SwapChainPanel`](https://learn.microsoft.com/en-us/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.controls.swapchainpanel).
|
||||
*/
|
||||
typedef struct WGPUSurfaceSourceSwapChainPanel {
|
||||
WGPUChainedStruct chain;
|
||||
/**
|
||||
* A pointer to the [`ISwapChainPanelNative`](https://learn.microsoft.com/en-us/windows/windows-app-sdk/api/win32/microsoft.ui.xaml.media.dxinterop/nn-microsoft-ui-xaml-media-dxinterop-iswapchainpanelnative)
|
||||
* interface of the SwapChainPanel that will be wrapped by the @ref WGPUSurface.
|
||||
*/
|
||||
void * panelNative;
|
||||
} WGPUSurfaceSourceSwapChainPanel WGPU_STRUCTURE_ATTRIBUTE;
|
||||
|
||||
typedef enum WGPUPolygonMode {
|
||||
WGPUPolygonMode_Fill = 0,
|
||||
WGPUPolygonMode_Line = 1,
|
||||
WGPUPolygonMode_Point = 2,
|
||||
} WGPUPolygonMode;
|
||||
|
||||
typedef struct WGPUPrimitiveStateExtras {
|
||||
WGPUChainedStruct chain;
|
||||
WGPUPolygonMode polygonMode;
|
||||
WGPUBool conservative;
|
||||
} WGPUPrimitiveStateExtras WGPU_STRUCTURE_ATTRIBUTE;
|
||||
|
||||
typedef void (*WGPULogCallback)(WGPULogLevel level, WGPUStringView message, void * userdata);
|
||||
|
||||
typedef enum WGPUNativeTextureFormat {
|
||||
|
|
@ -268,8 +295,10 @@ typedef enum WGPUNativeTextureFormat {
|
|||
WGPUNativeTextureFormat_Rgba16Snorm = 0x00030006,
|
||||
// From Features::TEXTURE_FORMAT_NV12
|
||||
WGPUNativeTextureFormat_NV12 = 0x00030007,
|
||||
WGPUNativeTextureFormat_P010 = 0x00030008,
|
||||
} WGPUNativeTextureFormat;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ namespace psemek::wgpu
|
|||
{
|
||||
std::vector<chained_struct> chain = {};
|
||||
texture_view view;
|
||||
std::uint32_t depth_slice = 0;
|
||||
std::optional<std::uint32_t> depth_slice = std::nullopt;
|
||||
texture_view resolve_target = {};
|
||||
enum load_op load_op;
|
||||
enum store_op store_op;
|
||||
|
|
|
|||
|
|
@ -125,8 +125,21 @@ namespace psemek::wgpu
|
|||
back = 0x00000003,
|
||||
};
|
||||
|
||||
enum class polygon_mode
|
||||
{
|
||||
fill = 0,
|
||||
line = 1,
|
||||
point = 2,
|
||||
};
|
||||
|
||||
struct primitive_state
|
||||
{
|
||||
struct extras
|
||||
{
|
||||
enum polygon_mode polygon_mode;
|
||||
bool conservative;
|
||||
};
|
||||
|
||||
std::vector<chained_struct> chain = {};
|
||||
primitive_topology topology;
|
||||
index_format strip_index_format = index_format::undefined;
|
||||
|
|
@ -281,4 +294,6 @@ namespace psemek::wgpu
|
|||
friend struct device;
|
||||
};
|
||||
|
||||
detail::chained_struct_ptr to_chained_struct(primitive_state::extras const &);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -126,6 +126,7 @@ namespace psemek::wgpu
|
|||
|
||||
// texture_format_nv12
|
||||
nv12 = 0x00030007,
|
||||
p010 = 0x00030008,
|
||||
};
|
||||
|
||||
enum class usage : std::uint64_t
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ namespace psemek::wgpu
|
|||
auto & dst = color_attachments.emplace_back();
|
||||
dst.nextInChain = (WGPUChainedStruct const *)detail::fill_chain(src.chain);
|
||||
dst.view = (WGPUTextureView)src.view.get();
|
||||
dst.depthSlice = src.depth_slice;
|
||||
dst.depthSlice = src.depth_slice.value_or(WGPU_DEPTH_SLICE_UNDEFINED);
|
||||
dst.resolveTarget = (WGPUTextureView)src.resolve_target.get();
|
||||
dst.loadOp = (WGPULoadOp)src.load_op;
|
||||
dst.storeOp = (WGPUStoreOp)src.store_op;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#include <psemek/wgpu/render_pipeline.hpp>
|
||||
#include <psemek/wgpu/detail/string_view.hpp>
|
||||
#include <psemek/wgpu/external/webgpu.h>
|
||||
#include <psemek/wgpu/external/wgpu.h>
|
||||
|
||||
namespace psemek::wgpu
|
||||
{
|
||||
|
|
@ -25,4 +25,13 @@ namespace psemek::wgpu
|
|||
wgpuRenderPipelineRelease((WGPURenderPipeline)ptr);
|
||||
}
|
||||
|
||||
detail::chained_struct_ptr to_chained_struct(primitive_state::extras const & extras)
|
||||
{
|
||||
WGPUPrimitiveStateExtras chained = {};
|
||||
chained.chain.sType = (WGPUSType)WGPUSType_PrimitiveStateExtras;
|
||||
chained.polygonMode = (WGPUPolygonMode)extras.polygon_mode;
|
||||
chained.conservative = extras.conservative;
|
||||
return detail::make_chained_struct(chained);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue