Skip to content

Commit 4062704

Browse files
Update Dawn to 6723
1 parent e07c9e3 commit 4062704

7 files changed

Lines changed: 55 additions & 26 deletions

File tree

code_generation/commands.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,8 +331,8 @@ def add_set_bind_group_command(classType, methodName):
331331
DebugOutput(code);
332332
DebugOutput("\\n");
333333
334-
WGPUShaderModuleWGSLDescriptor wgsl = {};
335-
wgsl.chain.sType = WGPUSType_ShaderModuleWGSLDescriptor;
334+
WGPUShaderSourceWGSL wgsl = {};
335+
wgsl.chain.sType = WGPUSType_ShaderSourceWGSL;
336336
wgsl.code = code;
337337
338338
WGPUShaderModuleDescriptor descriptor = {};

code_generation/custom_types.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,4 +189,16 @@ def cleanup(self, name):
189189
+ Uint32DefaultMax.load("$name.layout.bytesPerRow") + "\n"
190190
+ Uint32DefaultMax.load("$name.layout.rowsPerImage"),
191191
"WGPUImageCopyBuffer $name;",
192-
"&$name")
192+
"&$name")
193+
194+
# TODO Remove and use GPUOptionalBool instead once wgpu-native updates to latest headers.
195+
DepthWriteEnabled = CustomType("""
196+
__WebGPUReconstruct_file.writeUint8($name);
197+
""",
198+
"""
199+
#if WEBGPU_BACKEND_DAWN
200+
$name = reader.ReadUint8() ? WGPUOptionalBool_True : WGPUOptionalBool_False;
201+
#else
202+
$name = reader.ReadUint8();
203+
#endif
204+
""")

code_generation/struct_types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ def cleanup(self, name):
286286

287287
GPUDepthStencilState = StructType("GPUDepthStencilState", [
288288
[GPUTextureFormat, "format"],
289-
[Bool, "depthWriteEnabled"],
289+
[DepthWriteEnabled, "depthWriteEnabled"],
290290
[GPUCompareFunction, "depthCompare"],
291291
[GPUStencilFaceState, "stencilFront", '{}'],
292292
[GPUStencilFaceState, "stencilBack", '{}'],

replay/Adapter.cpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -66,32 +66,32 @@ void Adapter::CreateInstance() {
6666

6767
void Adapter::CreateSurface(const Window& window) {
6868
#if __ANDROID__
69-
WGPUSurfaceDescriptorFromAndroidNativeWindow platformSurfaceDescriptor = {};
70-
platformSurfaceDescriptor.chain.next = nullptr;
71-
platformSurfaceDescriptor.chain.sType = WGPUSType_SurfaceDescriptorFromAndroidNativeWindow;
72-
platformSurfaceDescriptor.window = window.window;
69+
WGPUSurfaceSourceAndroidNativeWindow platformSurfaceSource = {};
70+
platformSurfaceSource.chain.next = nullptr;
71+
platformSurfaceSource.chain.sType = WGPUSType_SurfaceSourceAndroidNativeWindow;
72+
platformSurfaceSource.window = window.window;
7373
#elif defined(_WIN32) || defined(WIN32)
74-
WGPUSurfaceDescriptorFromWindowsHWND platformSurfaceDescriptor = {};
75-
platformSurfaceDescriptor.chain.next = nullptr;
76-
platformSurfaceDescriptor.chain.sType = WGPUSType_SurfaceDescriptorFromWindowsHWND;
77-
platformSurfaceDescriptor.hinstance = GetModuleHandle(NULL);
78-
platformSurfaceDescriptor.hwnd = glfwGetWin32Window(window.window);
74+
WGPUSurfaceDescriptorFromWindowsHWND platformSurfaceSource = {};
75+
platformSurfaceSource.chain.next = nullptr;
76+
platformSurfaceSource.chain.sType = WGPUSType_SurfaceSourceWindowsHWND;
77+
platformSurfaceSource.hinstance = GetModuleHandle(NULL);
78+
platformSurfaceSource.hwnd = glfwGetWin32Window(window.window);
7979
#elif __APPLE__
8080
#error "WebGPU surface support has not been implemented on Mac."
81-
/// @todo Implement WGPUSurfaceDescriptorFromMetalLayer
81+
/// @todo Implement WGPUSurfaceSourceMetalLayer
8282
#elif __linux__
83-
WGPUSurfaceDescriptorFromXlibWindow platformSurfaceDescriptor = {};
84-
platformSurfaceDescriptor.chain.next = nullptr;
85-
platformSurfaceDescriptor.chain.sType = WGPUSType_SurfaceDescriptorFromXlibWindow;
86-
platformSurfaceDescriptor.display = glfwGetX11Display();
87-
platformSurfaceDescriptor.window = glfwGetX11Window(window.window);
83+
WGPUSurfaceDescriptorFromXlibWindow platformSurfaceSource = {};
84+
platformSurfaceSource.chain.next = nullptr;
85+
platformSurfaceSource.chain.sType = WGPUSType_SurfaceSourceXlibWindow;
86+
platformSurfaceSource.display = glfwGetX11Display();
87+
platformSurfaceSource.window = glfwGetX11Window(window.window);
8888
#else
8989
#error "Unsupported platform"
9090
#endif
9191

9292
WGPUSurfaceDescriptor surfaceDescriptor = {};
9393
surfaceDescriptor.label = nullptr;
94-
surfaceDescriptor.nextInChain = reinterpret_cast<const WGPUChainedStruct*>(&platformSurfaceDescriptor);
94+
surfaceDescriptor.nextInChain = reinterpret_cast<const WGPUChainedStruct*>(&platformSurfaceSource);
9595

9696
surface = wgpuInstanceCreateSurface(instance, &surfaceDescriptor);
9797
}

replay/Capture.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ Capture::Capture(string_view filename, Adapter& adapter, Device& device, SwapCha
3737
}
3838

3939
// Create render pipeline to copy "swapchain" texture to actual swapchain texture.
40-
WGPUShaderModuleWGSLDescriptor wgslDescriptor = {};
41-
wgslDescriptor.chain.sType = WGPUSType_ShaderModuleWGSLDescriptor;
42-
wgslDescriptor.code = R"(
40+
WGPUShaderSourceWGSL wgslSource = {};
41+
wgslSource.chain.sType = WGPUSType_ShaderSourceWGSL;
42+
wgslSource.code = R"(
4343
struct VertexOutput {
4444
@builtin(position) Position : vec4f,
4545
@location(0) fragUV : vec2f,
@@ -69,10 +69,10 @@ fn main(
6969
)";
7070

7171
WGPUShaderModuleDescriptor moduleDescriptor = {};
72-
moduleDescriptor.nextInChain = reinterpret_cast<const WGPUChainedStruct*>(&wgslDescriptor);
72+
moduleDescriptor.nextInChain = reinterpret_cast<const WGPUChainedStruct*>(&wgslSource);
7373
copyVertexShader = wgpuDeviceCreateShaderModule(device.GetDevice(), &moduleDescriptor);
7474

75-
wgslDescriptor.code = R"(
75+
wgslSource.code = R"(
7676
@group(0) @binding(0) var mySampler: sampler;
7777
@group(0) @binding(1) var myTexture: texture_2d<f32>;
7878

replay/WebGPU.hpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
#if WEBGPU_BACKEND_DAWN
44
#include <dawn/webgpu.h>
5+
6+
// TODO Remove once wgpu-native has updated to latest headers.
7+
typedef WGPUBufferUsage WGPUBufferUsageFlags;
8+
typedef WGPUTextureUsage WGPUTextureUsageFlags;
59
#endif
610

711
#if WEBGPU_BACKEND_WGPU
@@ -10,4 +14,17 @@
1014
inline void wgpuDeviceTick(WGPUDevice device) {
1115
wgpuDevicePoll(device, false, nullptr);
1216
}
17+
18+
// TODO Remove once wgpu-native has update to latest headers.
19+
typedef WGPUSurfaceDescriptorFromAndroidNativeWindow WGPUSurfaceSourceAndroidNativeWindow;
20+
typedef WGPUSurfaceDescriptorFromWindowsHWND WGPUSurfaceSourceWindowsHWND;
21+
typedef WGPUSurfaceDescriptorFromXlibWindow WGPUSurfaceSourceXlibWindow;
22+
23+
const WGPUSType WGPUSType_SurfaceSourceAndroidNativeWindow = WGPUSType_SurfaceDescriptorFromAndroidNativeWindow;
24+
const WGPUSType WGPUSType_SurfaceSourceWindowsHWND = WGPUSType_SurfaceDescriptorFromWindowsHWND;
25+
const WGPUSType WGPUSType_SurfaceSourceXlibWindow = WGPUSType_SurfaceDescriptorFromXlibWindow;
26+
27+
typedef WGPUShaderModuleWGSLDescriptor WGPUShaderSourceWGSL;
28+
29+
const WGPUSType WGPUSType_ShaderSourceWGSL = WGPUSType_ShaderModuleWGSLDescriptor;
1330
#endif

replay/dawn

Submodule dawn updated from 60a1cbb to 70a01d2

0 commit comments

Comments
 (0)