Skip to content

Commit

Permalink
fixing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
arhik committed Nov 13, 2023
1 parent 1c986d3 commit ce2e033
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 21 deletions.
2 changes: 1 addition & 1 deletion test/bufferCopyTest.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ for i = 1:n
data[i] = i
end

canvas = WGPUCore.defaultCanvas(WGPUCore.WGPUCanvas);
canvas = WGPUCore.getCanvas(:OFFSCREEN);

gpuDevice = WGPUCore.getDefaultDevice()

Expand Down
20 changes: 3 additions & 17 deletions test/fragmentStateTest.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,27 +35,16 @@ shaderSource = Vector{UInt8}(
""",
);

canvas = WGPUCore.defaultCanvas(WGPUCore.WGPUCanvas);
canvas = WGPUCore.getCanvas(:OFFSCREEN);
gpuDevice = WGPUCore.getDefaultDevice();
shaderinfo = WGPUCore.loadWGSL(shaderSource);
cshader =
Ref(WGPUCore.createShaderModule(gpuDevice, "shadercode", shaderinfo.shaderModuleDesc, nothing, nothing));

bindingLayouts = []
bindings = []
cBindingLayoutsList = Ref(WGPUCore.makeLayoutEntryList(bindingLayouts))
cBindingsList = Ref(WGPUCore.makeBindGroupEntryList(bindings))
bindGroupLayout =
WGPUCore.createBindGroupLayout(gpuDevice, "Bind Group Layout", cBindingLayoutsList[])
bindGroup = WGPUCore.createBindGroup("BindGroup", gpuDevice, bindGroupLayout, cBindingsList[])

if bindGroupLayout.internal[] == C_NULL
bindGroupLayouts = C_NULL
else
bindGroupLayouts = map((x) -> x.internal[], [bindGroupLayout])
end

pipelineLayout = WGPUCore.createPipelineLayout(gpuDevice, "PipeLineLayout", bindGroupLayout)
pipelineLayout = WGPUCore.createPipelineLayout(gpuDevice, "PipeLineLayout", bindingLayouts, bindings)
swapChainFormat = WGPUCore.getPreferredFormat(canvas)

fStateOptions =
Expand All @@ -77,7 +66,4 @@ fs = unsafe_load(fstate.internal[] |> ptr)

Test.@testset "FragmentState" begin
Test.@test unsafe_string(fs.entryPoint) == "fs_main"
end


GLFW.DestroyWindow(canvas.windowRef[])
end
4 changes: 2 additions & 2 deletions test/renderpipelineTest.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ shaderSource =
}
""",
)
canvas = WGPUCore.defaultCanvas(WGPUCore.WGPUCanvas);
canvas = WGPUCore.getCanvas(:OFFSCREEN);
gpuDevice = WGPUCore.getDefaultDevice();
shaderInfo = WGPUCore.loadWGSL(shaderSource);
cshader = WGPUCore.createShaderModule(gpuDevice, "shadercode", shaderInfo.shaderModuleDesc, nothing, nothing);
Expand Down Expand Up @@ -168,7 +168,7 @@ Test.@testset "RenderPipeline" begin
Test.@test unsafe_string(fs.entryPoint) == "fs_main"

fsColorTarget = unsafe_load(fs.targets)
Test.@test fsColorTarget.format == WGPUCore.getEnum(WGPUCore.WGPUTextureFormat, "BGRA8Unorm")
Test.@test fsColorTarget.format == WGPUCore.getEnum(WGPUCore.WGPUTextureFormat, "RGBA8Unorm")

Test.@test fsColorTarget.writeMask == 0x0000000f
fsblend = unsafe_load(fsColorTarget.blend)
Expand Down
2 changes: 1 addition & 1 deletion test/setVertexBufferTest.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ vertexData =
dims = 2,
) .|> Float32

canvas = WGPUCore.defaultCanvas(WGPUCore.WGPUCanvas)
canvas = WGPUCore.getCanvas(:OFFSCREEN)
gpuDevice = WGPUCore.getDefaultDevice()

(vertexBuffer, tmpData) = WGPUCore.createBufferWithData(
Expand Down

0 comments on commit ce2e033

Please sign in to comment.