Skip to content

Commit fd47907

Browse files
authored
Merge pull request #4 from arhik/main
Rename for Julia Registrator
2 parents 7a66da1 + 9662de0 commit fd47907

22 files changed

+339
-359
lines changed

Manifest.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
julia_version = "1.8.2"
44
manifest_format = "2.0"
5-
project_hash = "856506fc0308c5f9da31b9ecff8a3bf884d0a1e3"
5+
project_hash = "2760e5b28ac20c0569960c8a1188e187a765d1b3"
66

77
[[deps.Aqua]]
88
deps = ["Compat", "Pkg", "Test"]

Project.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name = "WGPU"
1+
name = "WGPUCore"
22
uuid = "53d714bf-0d76-4802-84b4-6cb75cca55f5"
33
authors = ["arhik <[email protected]>"]
44
version = "0.1.1"
@@ -17,4 +17,6 @@ WGPUNative = "c14bfd16-04f9-4c2f-a915-b355584b5509"
1717
CEnum = "^0.4"
1818
Reexport = "^1.2"
1919
WGPUNative = "^0.1"
20+
GLFW = "^3.4"
21+
GLFW_jll = "^3.3"
2022
julia = "^1.8.0"

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# WGPU.jl
1+
# WGPUCore.jl
22

3-
WGPU based graphics engine
3+
WGPU Native Core based graphics engine
44

55

66

examples/capture.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## Load WGPU
2-
using WGPU
3-
using WGPU: defaultInit, partialInit, pointerRef
2+
using WGPUCore
3+
using WGPUCore: defaultInit, partialInit, pointerRef
44
using WGPUNative
55
## Constants
66
numbers = UInt32[1, 2, 3, 4]
@@ -52,7 +52,7 @@ adapter = Ref(WGPUAdapter())
5252
device = Ref(WGPUDevice())
5353

5454

55-
adapterOptions = Ref(WGPU.defaultInit(WGPURequestAdapterOptions))
55+
adapterOptions = Ref(WGPUCore.defaultInit(WGPURequestAdapterOptions))
5656

5757
function request_adapter_callback(
5858
a::WGPURequestAdapterStatus,

examples/compute.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## Load WGPU
2-
using WGPU
3-
using WGPU: defaultInit, partialInit, pointerRef
2+
using WGPUCore
3+
using WGPUCore: defaultInit, partialInit, pointerRef
44
using WGPUNative
55

66
## Constants
@@ -116,7 +116,7 @@ wgpuAdapterRequestDevice(adapter[], wgpuDeviceDescriptor, requestDeviceCallback,
116116

117117

118118
##
119-
b = read(pkgdir(WGPU) * "/examples/shader.wgsl")
119+
b = read(pkgdir(WGPUCore) * "/examples/shader.wgsl")
120120
wgslDescriptor = WGPUShaderModuleWGSLDescriptor(defaultInit(WGPUChainedStruct), pointer(b))
121121

122122
## WGSL loading
@@ -133,7 +133,7 @@ function load_wgsl(codeBuffer::Union{IOStream,IOBuffer})
133133
return (a, wgslDescriptor)
134134
end
135135

136-
shaderSource = WGPU.loadWGSL(open(pkgdir(WGPU) * "/examples/shader.wgsl")) |> first
136+
shaderSource = WGPUCore.loadWGSL(open(pkgdir(WGPUCore) * "/examples/shader.wgsl")) |> first
137137

138138
##
139139

examples/compute_noop.jl

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
## Load WGPU
2-
using WGPU
2+
using WGPUCore
33

44
using WGPUNative
55

6-
WGPU.SetLogLevel(WGPULogLevel_Debug)
6+
WGPUCore.SetLogLevel(WGPULogLevel_Debug)
77

88
src = """
99
@group(0) @binding(0)
@@ -29,48 +29,48 @@ for i = 1:n
2929
data[i] = i
3030
end
3131

32-
# canvas = WGPU.defaultCanvas(WGPU.WGPUCanvas);
33-
gpuDevice = WGPU.getDefaultDevice()
32+
# canvas = WGPUCore.defaultCanvas(WGPUCore.WGPUCanvas);
33+
gpuDevice = WGPUCore.getDefaultDevice()
3434

35-
shadercode = WGPU.loadWGSL(shaderSource) |> first
35+
shadercode = WGPUCore.loadWGSL(shaderSource) |> first
3636

3737
cshader =
38-
WGPU.createShaderModule(gpuDevice, "shadercode", shadercode, nothing, nothing) |> Ref
38+
WGPUCore.createShaderModule(gpuDevice, "shadercode", shadercode, nothing, nothing) |> Ref
3939

40-
(buffer1, _) = WGPU.createBufferWithData(gpuDevice, "buffer1", data, "Storage")
40+
(buffer1, _) = WGPUCore.createBufferWithData(gpuDevice, "buffer1", data, "Storage")
4141

4242
buffer2 =
43-
WGPU.createBuffer("buffer2", gpuDevice, sizeof(data), ["Storage", "CopySrc"], false)
43+
WGPUCore.createBuffer("buffer2", gpuDevice, sizeof(data), ["Storage", "CopySrc"], false)
4444

4545
bindingLayouts = [
46-
WGPU.WGPUBufferEntry =>
46+
WGPUCore.WGPUBufferEntry =>
4747
[:binding => 0, :visibility => "Compute", :type => "ReadOnlyStorage"],
48-
WGPU.WGPUBufferEntry =>
48+
WGPUCore.WGPUBufferEntry =>
4949
[:binding => 1, :visibility => "Compute", :type => "Storage"],
5050
]
5151

5252
bindings = [
53-
WGPU.GPUBuffer =>
53+
WGPUCore.GPUBuffer =>
5454
[:binding => 0, :buffer => buffer1, :offset => 0, :size => buffer1.size],
55-
WGPU.GPUBuffer =>
55+
WGPUCore.GPUBuffer =>
5656
[:binding => 1, :buffer => buffer2, :offset => 0, :size => buffer2.size],
5757
]
5858

5959

6060
(bindGroupLayouts, bindGroup) =
61-
WGPU.makeBindGroupAndLayout(gpuDevice, bindingLayouts, bindings)
61+
WGPUCore.makeBindGroupAndLayout(gpuDevice, bindingLayouts, bindings)
6262

63-
pipelineLayout = WGPU.createPipelineLayout(gpuDevice, "PipeLineLayout", bindGroupLayouts)
64-
computeStage = WGPU.createComputeStage(cshader[], "main")
63+
pipelineLayout = WGPUCore.createPipelineLayout(gpuDevice, "PipeLineLayout", bindGroupLayouts)
64+
computeStage = WGPUCore.createComputeStage(cshader[], "main")
6565
computePipeline =
66-
WGPU.createComputePipeline(gpuDevice, "computePipeline", pipelineLayout, computeStage)
66+
WGPUCore.createComputePipeline(gpuDevice, "computePipeline", pipelineLayout, computeStage)
6767

68-
commandEncoder = WGPU.createCommandEncoder(gpuDevice, "Command Encoder")
69-
computePass = WGPU.beginComputePass(commandEncoder)
68+
commandEncoder = WGPUCore.createCommandEncoder(gpuDevice, "Command Encoder")
69+
computePass = WGPUCore.beginComputePass(commandEncoder)
7070
#
71-
WGPU.setPipeline(computePass, computePipeline)
72-
WGPU.setBindGroup(computePass, 0, bindGroup, UInt32[], 0, 99999)
73-
WGPU.dispatchWorkGroups(computePass, n, 1, 1)
74-
WGPU.endComputePass(computePass)
75-
WGPU.submit(gpuDevice.queue, [WGPU.finish(commandEncoder)])
76-
WGPU.readBuffer(gpuDevice, buffer2, 0, sizeof(data))
71+
WGPUCore.setPipeline(computePass, computePipeline)
72+
WGPUCore.setBindGroup(computePass, 0, bindGroup, UInt32[], 0, 99999)
73+
WGPUCore.dispatchWorkGroups(computePass, n, 1, 1)
74+
WGPUCore.endComputePass(computePass)
75+
WGPUCore.submit(gpuDevice.queue, [WGPUCore.finish(commandEncoder)])
76+
WGPUCore.readBuffer(gpuDevice, buffer2, 0, sizeof(data))

examples/compute_noop2.jl

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
## Load WGPU
2-
using WGPU
2+
using WGPUCore
33

44
using WGPUNative
55

6-
WGPU.SetLogLevel(WGPULogLevel_Debug)
6+
WGPUCore.SetLogLevel(WGPULogLevel_Debug)
77

88
shaderSource = Vector{UInt8}(
99
"""
@@ -57,47 +57,47 @@ for i = 1:n
5757
data[i] = i
5858
end
5959

60-
# canvas = WGPU.defaultCanvas(WGPU.WGPUCanvas);
61-
gpuDevice = WGPU.getDefaultDevice()
60+
# canvas = WGPUCore.defaultCanvas(WGPUCore.WGPUCanvas);
61+
gpuDevice = WGPUCore.getDefaultDevice()
6262

63-
shadercode = WGPU.loadWGSL(shaderSource) |> first
63+
shadercode = WGPUCore.loadWGSL(shaderSource) |> first
6464

6565
cshader =
66-
WGPU.createShaderModule(gpuDevice, "shadercode", shadercode, nothing, nothing) |> Ref
66+
WGPUCore.createShaderModule(gpuDevice, "shadercode", shadercode, nothing, nothing) |> Ref
6767

68-
(buffer1, _) = WGPU.createBufferWithData(gpuDevice, "buffer1", data, "Storage")
68+
(buffer1, _) = WGPUCore.createBufferWithData(gpuDevice, "buffer1", data, "Storage")
6969

7070
buffer2 =
71-
WGPU.createBuffer("buffer2", gpuDevice, sizeof(data), ["Storage", "CopySrc"], false)
71+
WGPUCore.createBuffer("buffer2", gpuDevice, sizeof(data), ["Storage", "CopySrc"], false)
7272

7373
bindingLayouts = [
74-
WGPU.WGPUBufferEntry =>
74+
WGPUCore.WGPUBufferEntry =>
7575
[:binding => 0, :visibility => "Compute", :type => "ReadOnlyStorage"],
76-
WGPU.WGPUBufferEntry =>
76+
WGPUCore.WGPUBufferEntry =>
7777
[:binding => 1, :visibility => "Compute", :type => "Storage"],
7878
]
7979

8080
bindings = [
81-
WGPU.GPUBuffer =>
81+
WGPUCore.GPUBuffer =>
8282
[:binding => 0, :buffer => buffer1, :offset => 0, :size => buffer1.size],
83-
WGPU.GPUBuffer =>
83+
WGPUCore.GPUBuffer =>
8484
[:binding => 1, :buffer => buffer2, :offset => 0, :size => buffer2.size],
8585
]
8686

8787

8888
(bindGroupLayouts, bindGroup) =
89-
WGPU.makeBindGroupAndLayout(gpuDevice, bindingLayouts, bindings)
90-
pipelineLayout = WGPU.createPipelineLayout(gpuDevice, "PipeLineLayout", bindGroupLayouts)
91-
computeStage = WGPU.createComputeStage(cshader[], "main")
89+
WGPUCore.makeBindGroupAndLayout(gpuDevice, bindingLayouts, bindings)
90+
pipelineLayout = WGPUCore.createPipelineLayout(gpuDevice, "PipeLineLayout", bindGroupLayouts)
91+
computeStage = WGPUCore.createComputeStage(cshader[], "main")
9292
computePipeline =
93-
WGPU.createComputePipeline(gpuDevice, "computePipeline", pipelineLayout, computeStage)
93+
WGPUCore.createComputePipeline(gpuDevice, "computePipeline", pipelineLayout, computeStage)
9494

95-
commandEncoder = WGPU.createCommandEncoder(gpuDevice, "Command Encoder")
96-
computePass = WGPU.beginComputePass(commandEncoder)
95+
commandEncoder = WGPUCore.createCommandEncoder(gpuDevice, "Command Encoder")
96+
computePass = WGPUCore.beginComputePass(commandEncoder)
9797

98-
WGPU.setPipeline(computePass, computePipeline)
99-
WGPU.setBindGroup(computePass, 0, bindGroup, UInt32[], 0, 999999)
100-
WGPU.dispatchWorkGroups(computePass, n, 1, 1)
101-
WGPU.endComputePass(computePass)
102-
WGPU.submit(gpuDevice.queue, [WGPU.finish(commandEncoder)])
103-
WGPU.readBuffer(gpuDevice, buffer2, 0, sizeof(data))
98+
WGPUCore.setPipeline(computePass, computePipeline)
99+
WGPUCore.setBindGroup(computePass, 0, bindGroup, UInt32[], 0, 999999)
100+
WGPUCore.dispatchWorkGroups(computePass, n, 1, 1)
101+
WGPUCore.endComputePass(computePass)
102+
WGPUCore.submit(gpuDevice.queue, [WGPUCore.finish(commandEncoder)])
103+
WGPUCore.readBuffer(gpuDevice, buffer2, 0, sizeof(data))

0 commit comments

Comments
 (0)