Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion capture/scripts/mainContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand All @@ -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":
Expand All @@ -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":
Expand Down Expand Up @@ -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",
Expand All @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion code_generation/code_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
8 changes: 7 additions & 1 deletion code_generation/enum_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand All @@ -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"],
Expand All @@ -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"],
Expand Down Expand Up @@ -337,4 +343,4 @@ def cleanup(self, name):
GPUQueryType = EnumType("GPUQueryType", [
["occlusion", "WGPUQueryType_Occlusion"],
["timestamp", "WGPUQueryType_Timestamp"]
])
])
6 changes: 5 additions & 1 deletion docs/LIMITATIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
2 changes: 2 additions & 0 deletions replay/Adapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ void Adapter::RequestAdapter(WGPUBackendType backendType) {
std::vector<const char*> 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;
Expand Down
4 changes: 4 additions & 0 deletions replay/Device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ Device::Device(Adapter& adapter) {
WGPUFeatureName_ClipDistances,
#if WEBGPU_BACKEND_DAWN
WGPUFeatureName_Subgroups,
WGPUFeatureName_TextureFormatsTier1,
WGPUFeatureName_TextureFormatsTier2,
WGPUFeatureName_PrimitiveIndex,
#endif
};
Expand Down Expand Up @@ -66,6 +68,8 @@ Device::Device(Adapter& adapter) {
std::vector<const char*> 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;
Expand Down
6 changes: 6 additions & 0 deletions replay/WebGPU.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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