diff --git a/capture/scripts/mainContent.js b/capture/scripts/mainContent.js index 873f1d0..03560e2 100644 --- a/capture/scripts/mainContent.js +++ b/capture/scripts/mainContent.js @@ -251,6 +251,8 @@ function __WebGPUReconstruct_get_bytes_per_block(format) { return 1; // 16-bit formats + case "r16unorm": + case "r16snorm": case "r16uint": case "r16sint": case "r16float": @@ -265,6 +267,8 @@ function __WebGPUReconstruct_get_bytes_per_block(format) { case "r32uint": case "r32sint": case "r32float": + case "rg16unorm": + case "rg16snorm": case "rg16uint": case "rg16sint": case "rg16float": @@ -285,6 +289,8 @@ function __WebGPUReconstruct_get_bytes_per_block(format) { case "rg32uint": case "rg32sint": case "rg32float": + case "rgba16unorm": + case "rgba16snorm": case "rgba16uint": case "rgba16sint": case "rgba16float": @@ -374,7 +380,7 @@ function __WebGPUReconstruct_get_bytes_per_block(format) { } // Features supported by WebGPUReconstruct. We will pretend the adapter doesn't support any other features. -// TODO: dual-source-blending, texture-formats-tier1, texture-formats-tier2, texture-component-swizzle +// TODO: dual-source-blending, texture-component-swizzle const __WebGPUReconstruct_supportedFeatures = new Set([ "core-features-and-limits", "depth-clip-control", @@ -394,6 +400,8 @@ const __WebGPUReconstruct_supportedFeatures = new Set([ "clip-distances", "subgroups", "primitive-index", + "texture-formats-tier1", + "texture-formats-tier2" ]); function __WebGPUReconstruct_GPUAdapter_requestDevice(originalMethod, descriptor) { diff --git a/code_generation/code_generation.py b/code_generation/code_generation.py index 7de2f4c..9de7a90 100644 --- a/code_generation/code_generation.py +++ b/code_generation/code_generation.py @@ -5,7 +5,7 @@ version = (1, 0) # Increment the file version whenever a change is introduced. -fileVersion = 15 +fileVersion = 16 versionString = str(version[0]) + "." + str(version[1]) versionInt = version[0] * 10000 + version[1] diff --git a/code_generation/enum_types.py b/code_generation/enum_types.py index 509802f..a3d6922 100644 --- a/code_generation/enum_types.py +++ b/code_generation/enum_types.py @@ -54,6 +54,8 @@ def cleanup(self, name): ["r8snorm", "WGPUTextureFormat_R8Snorm"], ["r8uint", "WGPUTextureFormat_R8Uint"], ["r8sint", "WGPUTextureFormat_R8Sint"], + ["r16unorm", "WGPUTextureFormat_R16Unorm"], + ["r16snorm", "WGPUTextureFormat_R16Snorm"], ["r16uint", "WGPUTextureFormat_R16Uint"], ["r16sint", "WGPUTextureFormat_R16Sint"], ["r16float", "WGPUTextureFormat_R16Float"], @@ -64,6 +66,8 @@ def cleanup(self, name): ["r32uint", "WGPUTextureFormat_R32Uint"], ["r32sint", "WGPUTextureFormat_R32Sint"], ["r32float", "WGPUTextureFormat_R32Float"], + ["rg16unorm", "WGPUTextureFormat_RG16Unorm"], + ["rg16snorm", "WGPUTextureFormat_RG16Snorm"], ["rg16uint", "WGPUTextureFormat_RG16Uint"], ["rg16sint", "WGPUTextureFormat_RG16Sint"], ["rg16float", "WGPUTextureFormat_RG16Float"], @@ -81,6 +85,8 @@ def cleanup(self, name): ["rg32uint", "WGPUTextureFormat_RG32Uint"], ["rg32sint", "WGPUTextureFormat_RG32Sint"], ["rg32float", "WGPUTextureFormat_RG32Float"], + ["rgba16unorm", "WGPUTextureFormat_RGBA16Unorm"], + ["rgba16snorm", "WGPUTextureFormat_RGBA16Snorm"], ["rgba16uint", "WGPUTextureFormat_RGBA16Uint"], ["rgba16sint", "WGPUTextureFormat_RGBA16Sint"], ["rgba16float", "WGPUTextureFormat_RGBA16Float"], @@ -337,4 +343,4 @@ def cleanup(self, name): GPUQueryType = EnumType("GPUQueryType", [ ["occlusion", "WGPUQueryType_Occlusion"], ["timestamp", "WGPUQueryType_Timestamp"] -]) \ No newline at end of file +]) diff --git a/docs/LIMITATIONS.md b/docs/LIMITATIONS.md index 411db23..1a88dba 100644 --- a/docs/LIMITATIONS.md +++ b/docs/LIMITATIONS.md @@ -9,9 +9,13 @@ Since workers run in a separate context, WebGPUReconstruct is not able to captur ## Unsupported features The following optional WebGPU features are not supported: - `dual-source-blending` +- `texture-component-swizzle` + +The following optional WebGPU features are not supported during WGPU playback: +- `primitive-index` +- `subgroups` - `texture-formats-tier1` - `texture-formats-tier2` -- `texture-component-swizzle` During capture, `GPUAdapter` will behave as if these features are not supported, even if the device supports them. diff --git a/replay/Adapter.cpp b/replay/Adapter.cpp index 2ab9ff4..46b3ee2 100644 --- a/replay/Adapter.cpp +++ b/replay/Adapter.cpp @@ -132,6 +132,8 @@ void Adapter::RequestAdapter(WGPUBackendType backendType) { std::vector toggles; toggles.push_back("use_user_defined_labels_in_backend"); toggles.push_back("use_dxc"); + // Needed for experimental features like TextureFormatsTier1 and TextureFormatsTier2 + toggles.push_back("allow_unsafe_apis"); WGPUDawnTogglesDescriptor dawnToggles = {}; dawnToggles.chain.sType = WGPUSType_DawnTogglesDescriptor; diff --git a/replay/Device.cpp b/replay/Device.cpp index a16cb15..91759c4 100644 --- a/replay/Device.cpp +++ b/replay/Device.cpp @@ -31,6 +31,8 @@ Device::Device(Adapter& adapter) { WGPUFeatureName_ClipDistances, #if WEBGPU_BACKEND_DAWN WGPUFeatureName_Subgroups, + WGPUFeatureName_TextureFormatsTier1, + WGPUFeatureName_TextureFormatsTier2, WGPUFeatureName_PrimitiveIndex, #endif }; @@ -66,6 +68,8 @@ Device::Device(Adapter& adapter) { std::vector toggles; toggles.push_back("use_user_defined_labels_in_backend"); toggles.push_back("use_dxc"); + // Needed for experimental features like TextureFormatsTier1 and TextureFormatsTier2 + toggles.push_back("allow_unsafe_apis"); WGPUDawnTogglesDescriptor dawnToggles = {}; dawnToggles.chain.sType = WGPUSType_DawnTogglesDescriptor; diff --git a/replay/WebGPU.hpp b/replay/WebGPU.hpp index 7d2ce2b..2f18395 100644 --- a/replay/WebGPU.hpp +++ b/replay/WebGPU.hpp @@ -19,4 +19,10 @@ typedef struct { WGPUChainedStruct chain; } WGPUExternalTextureBindingLayout; #define WGPUSType_ExternalTextureBindingLayout WGPUSType_Force32 +#define WGPUTextureFormat_R16Unorm WGPUTextureFormat_Force32 +#define WGPUTextureFormat_R16Snorm WGPUTextureFormat_Force32 +#define WGPUTextureFormat_RG16Unorm WGPUTextureFormat_Force32 +#define WGPUTextureFormat_RG16Snorm WGPUTextureFormat_Force32 +#define WGPUTextureFormat_RGBA16Unorm WGPUTextureFormat_Force32 +#define WGPUTextureFormat_RGBA16Snorm WGPUTextureFormat_Force32 #endif