Skip to content

Commit 5c502ba

Browse files
committed
update to wgpu-native v0.19.1.1
1 parent a06213f commit 5c502ba

File tree

8 files changed

+14
-8
lines changed

8 files changed

+14
-8
lines changed

examples/capture.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
## Load WGPU
22
using WGPUCore
33
using WGPUNative
4-
adapter = WGPUCore.requestAdapter()
4+
using WGPUCanvas
5+
canvas = WGPUCore.getCanvas(:GLFW)
6+
adapter = WGPUCore.requestAdapter(canvas=canvas)
57
gpuDevice = WGPUCore.requestDevice(adapter)
68

79
width, height = (200, 200)

examples/cube.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ shaderSource = Vector{UInt8}(
5050
);
5151

5252
canvas = WGPUCore.getCanvas(:GLFW)
53-
gpuDevice = WGPUCore.getDefaultDevice()
53+
gpuDevice = WGPUCore.getDefaultDevice(canvas)
5454
canvas.device = gpuDevice
5555
shadercode = WGPUCore.loadWGSL(shaderSource);
5656
cshader =

examples/image.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ using WGPUCore
22
using LinearAlgebra
33
using Rotations
44
using WGPUNative
5+
using WGPUCanvas
56
using GLFW
67
using StaticArrays
78
using Images
@@ -51,7 +52,7 @@ shaderSource = Vector{UInt8}(
5152
);
5253

5354
canvas = WGPUCore.getCanvas(:GLFW)
54-
gpuDevice = WGPUCore.getDefaultDevice()
55+
gpuDevice = WGPUCore.getDefaultDevice(canvas)
5556
shadercode = WGPUCore.loadWGSL(shaderSource);
5657
cshader =
5758
Ref(WGPUCore.createShaderModule(gpuDevice, "shadercode", shadercode.shaderModuleDesc, nothing, nothing));

examples/saveTriangle.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ using WGPUCore
33
using GLFW
44

55
using WGPUNative
6+
using WGPUCanvas
67
using Images
78
using Debugger
89

@@ -38,7 +39,7 @@ shaderSource = Vector{UInt8}(
3839
);
3940

4041
canvas = WGPUCore.getCanvas(:GLFW);
41-
gpuDevice = WGPUCore.getDefaultDevice();
42+
gpuDevice = WGPUCore.getDefaultDevice(canvas);
4243
shadercode = WGPUCore.loadWGSL(shaderSource);
4344
cshader =
4445
Ref(WGPUCore.createShaderModule(gpuDevice, "shadercode", shadercode.shaderModuleDesc, nothing, nothing));

examples/triangle.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ shaderSource = Vector{UInt8}(
3737
);
3838

3939
canvas = WGPUCore.getCanvas(:GLFW);
40-
gpuDevice = WGPUCore.getDefaultDevice();
40+
gpuDevice = WGPUCore.getDefaultDevice(canvas);
4141
shadercode = WGPUCore.loadWGSL(shaderSource);
4242
cshader =
4343
Ref(WGPUCore.createShaderModule(gpuDevice, "shadercode", shadercode.shaderModuleDesc, nothing, nothing));

examples/triangleOffscreen.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ using GLFW
55
using WGPUNative
66
using Images
77
using Debugger
8+
using WGPUCanvas
89

910
WGPUCore.SetLogLevel(WGPULogLevel_Debug)
1011

src/adapter.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ function requestAdapter(;
4040
backendType = getDefaultBackendType()
4141

4242
adapterOptions = cStruct(WGPURequestAdapterOptions)
43-
adapterOptions.compatibleSurface = C_NULL
43+
adapterOptions.compatibleSurface = canvas.surfaceRef[]
4444
adapterOptions.powerPreference = powerPreference
4545
adapterOptions.forceFallbackAdapter = false
4646

src/device.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,9 @@ function requestDevice(
122122
)
123123
end
124124

125-
function getDefaultDevice(; backendType = getDefaultBackendType())
126-
adapter = WGPUCore.requestAdapter()
125+
function getDefaultDevice(canvas; backendType = getDefaultBackendType())
126+
adapter = WGPUCore.requestAdapter(;canvas=canvas)
127127
device = requestDevice(adapter)
128+
canvas.device = device
128129
return device
129130
end

0 commit comments

Comments
 (0)