@@ -82,7 +82,7 @@ function defaultCanvas(::Type{GLFWLinuxCanvas}; windowSize = (500, 500))
8282 nothing ,
8383 initMouse (MouseState),
8484 )
85- getContext (canvas)
85+ WGPUCore . getContext (canvas)
8686 setJoystickCallback (canvas)
8787 setMonitorCallback (canvas)
8888 setWindowCloseCallback (canvas)
@@ -118,7 +118,7 @@ mutable struct GPUCanvasContext <: AbstractWGPUCanvasContext
118118 logicalSize:: Any
119119end
120120
121- function getContext (gpuCanvas:: GLFWLinuxCanvas )
121+ function WGPUCore . getContext (gpuCanvas:: GLFWLinuxCanvas )
122122 if gpuCanvas. context == nothing
123123 context = GPUCanvasContext (
124124 Ref (gpuCanvas),
@@ -128,7 +128,7 @@ function getContext(gpuCanvas::GLFWLinuxCanvas)
128128 nothing ,
129129 gpuCanvas. device,
130130 WGPUTextureFormat_R8Unorm,
131- WGPUTextureUsage ( 0 ),
131+ WGPUCore . getEnum (WGPUTextureUsage, [ " RenderAttachment " , " CopySrc " ] ),
132132 nothing ,
133133 nothing ,
134134 gpuCanvas. size,
@@ -141,7 +141,7 @@ function getContext(gpuCanvas::GLFWLinuxCanvas)
141141 end
142142end
143143
144- function configure (
144+ function WGPUCore . configure (
145145 canvasContext:: GPUCanvasContext ;
146146 device,
147147 format,
@@ -150,23 +150,23 @@ function configure(
150150 compositingAlphaMode,
151151 size,
152152)
153- unconfig (canvasContext)
153+ WGPUCore . unconfig (canvasContext)
154154 canvasContext. device = device
155155 canvasContext. format = format
156156 canvasContext. usage = usage
157157 canvasContext. compositingAlphaMode = compositingAlphaMode
158158 canvasContext. size = size
159159end
160160
161- function unconfigure (canvasContext:: GPUCanvasContext )
161+ function WGPUCore . unconfigure (canvasContext:: GPUCanvasContext )
162162 canvasContext. device = nothing
163163 canvasContext. format = nothing
164164 canvasContext. usage = nothing
165165 canvasContext. compositingAlphaMode = nothing
166166 canvasContext. size = nothing
167167end
168168
169- function determineSize (cntxt:: GPUCanvasContext )
169+ function WGPUCore . determineSize (cntxt:: GPUCanvasContext )
170170 pixelRatio = GLFW. GetWindowContentScale (cntxt. canvasRef[]. windowRef[]) |> first
171171 psize = GLFW. GetFramebufferSize (cntxt. canvasRef[]. windowRef[])
172172 cntxt. pixelRatio = pixelRatio
@@ -176,11 +176,11 @@ function determineSize(cntxt::GPUCanvasContext)
176176end
177177
178178
179- function getPreferredFormat (canvas:: GLFWLinuxCanvas )
179+ function WGPUCore . getPreferredFormat (canvas:: GLFWLinuxCanvas )
180180 return WGPUCore. getEnum (WGPUTextureFormat, " BGRA8Unorm" )
181181end
182182
183- function getPreferredFormat (canvasContext:: GPUCanvasContext )
183+ function WGPUCore . getPreferredFormat (canvasContext:: GPUCanvasContext )
184184 canvas = canvasCntxt. canvasRef[]
185185 if canvas != nothing
186186 return getPreferredFormat (canvas)
@@ -192,7 +192,7 @@ function getSurfaceIdFromCanvas(cntxt::GPUCanvasContext)
192192 # TODO return cntxt
193193end
194194
195- function getCurrentTexture (cntxt:: GPUCanvasContext )
195+ function WGPUCore . getCurrentTexture (cntxt:: GPUCanvasContext )
196196 # TODO this expensive so commenting it. Only first run though
197197 # if cntxt.device.internal[] == C_NULL
198198 # @error "context must be configured before request for texture"
@@ -202,16 +202,16 @@ function getCurrentTexture(cntxt::GPUCanvasContext)
202202 id = wgpuSwapChainGetCurrentTextureView (cntxt. internal[]) |> Ref
203203 size = (cntxt. surfaceSize... , 1 )
204204 cntxt. currentTexture =
205- GPUTextureView (" swap chain" , id, cntxt. device, nothing , size, nothing |> Ref)
205+ WGPUCore . GPUTextureView (" swap chain" , id, cntxt. device, nothing , size, nothing |> Ref)
206206 end
207207 return cntxt. currentTexture
208208end
209209
210- function present (cntxt:: GPUCanvasContext )
210+ function WGPUCore . present (cntxt:: GPUCanvasContext )
211211 if cntxt. internal[] != C_NULL && cntxt. currentTexture. internal[] != C_NULL
212212 wgpuSwapChainPresent (cntxt. internal[])
213213 end
214- destroy (cntxt. currentTexture)
214+ WGPUCore . destroy (cntxt. currentTexture)
215215 cntxt. currentTexture = nothing
216216end
217217
@@ -244,7 +244,7 @@ function createNativeSwapChainMaybe(canvasCntxt::GPUCanvasContext)
244244 ) |> Ref
245245end
246246
247- function destroyWindow (canvas:: GLFWLinuxCanvas )
247+ function WGPUCore . destroyWindow (canvas:: GLFWLinuxCanvas )
248248 GLFW. DestroyWindow (canvas. windowRef[])
249249end
250250
0 commit comments