Skip to content

Commit 4f29428

Browse files
committed
examples: Update
1 parent 8ef02e1 commit 4f29428

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

examples/boids/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ func InitState(window *glfw.Window) (s *State, err error) {
110110

111111
computeShader, err := s.device.CreateShaderModule(&wgpu.ShaderModuleDescriptor{
112112
Label: "compute.wgsl",
113-
WGSLDescriptor: &wgpu.ShaderModuleWGSLDescriptor{
113+
WGSLSource: &wgpu.ShaderSourceWGSL{
114114
Code: compute,
115115
},
116116
})
@@ -121,7 +121,7 @@ func InitState(window *glfw.Window) (s *State, err error) {
121121

122122
drawShader, err := s.device.CreateShaderModule(&wgpu.ShaderModuleDescriptor{
123123
Label: "draw.wgsl",
124-
WGSLDescriptor: &wgpu.ShaderModuleWGSLDescriptor{
124+
WGSLSource: &wgpu.ShaderSourceWGSL{
125125
Code: draw,
126126
},
127127
})

examples/capture/main.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,9 @@ func main() {
132132
// Copy the data from the texture to the buffer
133133
encoder.CopyTextureToBuffer(
134134
texture.AsImageCopy(),
135-
&wgpu.ImageCopyBuffer{
135+
&wgpu.TexelCopyBufferInfo{
136136
Buffer: outputBuffer,
137-
Layout: wgpu.TextureDataLayout{
137+
Layout: wgpu.TexelCopyBufferLayout{
138138
Offset: 0,
139139
BytesPerRow: uint32(bufferDimensions.paddedBytesPerRow),
140140
RowsPerImage: wgpu.CopyStrideUndefined,
@@ -151,14 +151,14 @@ func main() {
151151

152152
queue.Submit(cmdBuffer)
153153

154-
outputBuffer.MapAsync(wgpu.MapModeRead, 0, bufferSize, func(status wgpu.BufferMapAsyncStatus) {
155-
if status != wgpu.BufferMapAsyncStatusSuccess {
154+
outputBuffer.MapAsync(wgpu.MapModeRead, 0, bufferSize, func(status wgpu.MapAsyncStatus) {
155+
if status != wgpu.MapAsyncStatusSuccess {
156156
panic("failed to map buffer")
157157
}
158158
})
159159
defer outputBuffer.Unmap()
160160

161-
device.Poll(true, nil)
161+
device.Poll(true, 0)
162162

163163
data := outputBuffer.GetMappedRange(0, uint(bufferSize))
164164

examples/compute/main.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func main() {
6060

6161
shaderModule, err := device.CreateShaderModule(&wgpu.ShaderModuleDescriptor{
6262
Label: "shader.wgsl",
63-
WGSLDescriptor: &wgpu.ShaderModuleWGSLDescriptor{
63+
WGSLSource: &wgpu.ShaderSourceWGSL{
6464
Code: shader,
6565
},
6666
})
@@ -141,18 +141,18 @@ func main() {
141141
}
142142
queue.Submit(cmdBuffer)
143143

144-
var status wgpu.BufferMapAsyncStatus
145-
err = stagingBuffer.MapAsync(wgpu.MapModeRead, 0, size, func(s wgpu.BufferMapAsyncStatus) {
144+
var status wgpu.MapAsyncStatus
145+
err = stagingBuffer.MapAsync(wgpu.MapModeRead, 0, size, func(s wgpu.MapAsyncStatus) {
146146
status = s
147147
})
148148
if err != nil {
149149
panic(err)
150150
}
151151
defer stagingBuffer.Unmap()
152152

153-
device.Poll(true, nil)
153+
device.Poll(true, 0)
154154

155-
if status != wgpu.BufferMapAsyncStatusSuccess {
155+
if status != wgpu.MapAsyncStatusSuccess {
156156
panic(status)
157157
}
158158

examples/cube/main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ func InitState(window *glfw.Window) (s *State, err error) {
243243
s.queue.WriteTexture(
244244
texture.AsImageCopy(),
245245
wgpu.ToBytes(texels[:]),
246-
&wgpu.TextureDataLayout{
246+
&wgpu.TexelCopyBufferLayout{
247247
Offset: 0,
248248
BytesPerRow: texelsSize,
249249
RowsPerImage: wgpu.CopyStrideUndefined,
@@ -262,8 +262,8 @@ func InitState(window *glfw.Window) (s *State, err error) {
262262
}
263263

264264
shader, err := s.device.CreateShaderModule(&wgpu.ShaderModuleDescriptor{
265-
Label: "shader.wgsl",
266-
WGSLDescriptor: &wgpu.ShaderModuleWGSLDescriptor{Code: shader},
265+
Label: "shader.wgsl",
266+
WGSLSource: &wgpu.ShaderSourceWGSL{Code: shader},
267267
})
268268
if err != nil {
269269
return s, err

0 commit comments

Comments
 (0)