mirror of
https://github.com/Kbz-8/Pulse.git
synced 2026-01-11 23:43:34 +00:00
cac
This commit is contained in:
@@ -15,6 +15,8 @@ void TestBackendSupport()
|
|||||||
if(!PulseSupportsBackend(PULSE_BACKEND_VULKAN, PULSE_SHADER_FORMAT_SPIRV_BIT))
|
if(!PulseSupportsBackend(PULSE_BACKEND_VULKAN, PULSE_SHADER_FORMAT_SPIRV_BIT))
|
||||||
#elif defined(WEBGPU_ENABLED)
|
#elif defined(WEBGPU_ENABLED)
|
||||||
if(!PulseSupportsBackend(PULSE_BACKEND_WEBGPU, PULSE_SHADER_FORMAT_WGSL_BIT))
|
if(!PulseSupportsBackend(PULSE_BACKEND_WEBGPU, PULSE_SHADER_FORMAT_WGSL_BIT))
|
||||||
|
#elif defined(OPENGL_ENABLED)
|
||||||
|
if(!PulseSupportsBackend(PULSE_BACKEND_WEBGPU, PULSE_SHADER_FORMAT_WGSL_BIT))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
TEST_MESSAGE("Backend is not supported");
|
TEST_MESSAGE("Backend is not supported");
|
||||||
|
|||||||
2
Tests/Shaders/.gitignore
vendored
2
Tests/Shaders/.gitignore
vendored
@@ -1,2 +1,4 @@
|
|||||||
*.spv.h
|
*.spv.h
|
||||||
*.wgsl.h
|
*.wgsl.h
|
||||||
|
*.json
|
||||||
|
*.glsl.h
|
||||||
|
|||||||
@@ -12,10 +12,16 @@ struct SSBO
|
|||||||
data: dyn_array[u32]
|
data: dyn_array[u32]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[set(0)]
|
||||||
external
|
external
|
||||||
{
|
{
|
||||||
[set(0), binding(0)] read_ssbo: storage[SSBO, readonly],
|
[binding(0)] read_ssbo: storage[SSBO, readonly],
|
||||||
[set(1), binding(0)] write_ssbo: storage[SSBO, writeonly],
|
}
|
||||||
|
|
||||||
|
[set(1)]
|
||||||
|
external
|
||||||
|
{
|
||||||
|
[binding(0)] write_ssbo: storage[SSBO, writeonly],
|
||||||
}
|
}
|
||||||
|
|
||||||
[entry(compute)]
|
[entry(compute)]
|
||||||
33
Tests/Shaders/Vulkan-OpenGL/ReadWriteBindings.nzsl
git.filemode.normal_file
33
Tests/Shaders/Vulkan-OpenGL/ReadWriteBindings.nzsl
git.filemode.normal_file
@@ -0,0 +1,33 @@
|
|||||||
|
[nzsl_version("1.0")]
|
||||||
|
module;
|
||||||
|
|
||||||
|
struct Input
|
||||||
|
{
|
||||||
|
[builtin(global_invocation_indices)] indices: vec3[u32]
|
||||||
|
}
|
||||||
|
|
||||||
|
[layout(std430)]
|
||||||
|
struct SSBO
|
||||||
|
{
|
||||||
|
data: dyn_array[u32]
|
||||||
|
}
|
||||||
|
|
||||||
|
[set(0)]
|
||||||
|
external
|
||||||
|
{
|
||||||
|
[binding(0)] read_texture: texture2D[f32, readonly, rgba8],
|
||||||
|
[binding(1)] read_ssbo: storage[SSBO, readonly],
|
||||||
|
}
|
||||||
|
|
||||||
|
[set(1)]
|
||||||
|
external
|
||||||
|
{
|
||||||
|
[binding(0)] write_texture: texture2D[f32, rgba8],
|
||||||
|
[binding(1)] write_ssbo: storage[SSBO, writeonly],
|
||||||
|
}
|
||||||
|
|
||||||
|
[entry(compute)]
|
||||||
|
[workgroup(16, 16, 1)]
|
||||||
|
fn main(input: Input)
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -12,9 +12,10 @@ struct SSBO
|
|||||||
data: dyn_array[u32]
|
data: dyn_array[u32]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[set(1)]
|
||||||
external
|
external
|
||||||
{
|
{
|
||||||
[set(1), binding(0)] ssbo: storage[SSBO],
|
[binding(0)] ssbo: storage[SSBO],
|
||||||
}
|
}
|
||||||
|
|
||||||
[entry(compute)]
|
[entry(compute)]
|
||||||
@@ -12,10 +12,11 @@ struct SSBO
|
|||||||
data: dyn_array[u32]
|
data: dyn_array[u32]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[set(0)]
|
||||||
external
|
external
|
||||||
{
|
{
|
||||||
[set(1), binding(0)] write_texture: texture2D[f32, readwrite, rgba8],
|
[binding(0)] write_texture: texture2D[f32, readwrite, rgba8],
|
||||||
[set(1), binding(1)] write_ssbo: storage[SSBO],
|
[binding(1)] write_ssbo: storage[SSBO],
|
||||||
}
|
}
|
||||||
|
|
||||||
[entry(compute)]
|
[entry(compute)]
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
[nzsl_version("1.0")]
|
|
||||||
module;
|
|
||||||
|
|
||||||
struct Input
|
|
||||||
{
|
|
||||||
[builtin(global_invocation_indices)] indices: vec3[u32]
|
|
||||||
}
|
|
||||||
|
|
||||||
[layout(std430)]
|
|
||||||
struct SSBO
|
|
||||||
{
|
|
||||||
data: dyn_array[u32]
|
|
||||||
}
|
|
||||||
|
|
||||||
external
|
|
||||||
{
|
|
||||||
[set(0), binding(0)] read_texture: texture2D[f32, readonly, rgba8],
|
|
||||||
[set(0), binding(1)] read_ssbo: storage[SSBO, readonly],
|
|
||||||
[set(1), binding(0)] write_texture: texture2D[f32, readonly, rgba8],
|
|
||||||
[set(1), binding(1)] write_ssbo: storage[SSBO, writeonly],
|
|
||||||
}
|
|
||||||
|
|
||||||
[entry(compute)]
|
|
||||||
[workgroup(16, 16, 1)]
|
|
||||||
fn main(input: Input)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
@@ -1,7 +1,10 @@
|
|||||||
local tests = {
|
Backend = {
|
||||||
Vulkan = {
|
VULKAN = 1,
|
||||||
option = "vulkan",
|
OPENGL = 2,
|
||||||
global_custom = function()
|
OPENGL_ES = 3,
|
||||||
|
}
|
||||||
|
|
||||||
|
function nzsl(backend)
|
||||||
add_repositories("nazara-engine-repo https://github.com/NazaraEngine/xmake-repo")
|
add_repositories("nazara-engine-repo https://github.com/NazaraEngine/xmake-repo")
|
||||||
add_requires("nzsl >=2023.12.31", { configs = { shared = false, nzslc = true } })
|
add_requires("nzsl >=2023.12.31", { configs = { shared = false, nzslc = true } })
|
||||||
if is_cross() then
|
if is_cross() then
|
||||||
@@ -58,7 +61,14 @@ local tests = {
|
|||||||
local runenvs = target:data("nzsl_runenv")
|
local runenvs = target:data("nzsl_runenv")
|
||||||
assert(nzslc, "nzslc not found! please install nzsl package with nzslc enabled")
|
assert(nzslc, "nzslc not found! please install nzsl package with nzslc enabled")
|
||||||
batchcmds:show_progress(opt.progress, "${color.build.object}compiling.shader %s", shaderfile)
|
batchcmds:show_progress(opt.progress, "${color.build.object}compiling.shader %s", shaderfile)
|
||||||
local argv = { "--compile=spv-header", "--optimize" }
|
local argv = {}
|
||||||
|
if backend == Backend.VULKAN then
|
||||||
|
argv = { "--compile=spv-header", "--optimize" }
|
||||||
|
elseif backend == Backend.OPENGL then
|
||||||
|
argv = { "--compile=glsl-header", "--optimize", "--gl-version", "310", "--gl-es", "--gl-bindingmap" }
|
||||||
|
else
|
||||||
|
argv = { "--compile=glsl-header", "--optimize", "--gl-version", "310", "--gl-bindingmap" }
|
||||||
|
end
|
||||||
if outputdir then
|
if outputdir then
|
||||||
batchcmds:mkdir(outputdir)
|
batchcmds:mkdir(outputdir)
|
||||||
table.insert(argv, "--output=" .. outputdir)
|
table.insert(argv, "--output=" .. outputdir)
|
||||||
@@ -76,10 +86,39 @@ local tests = {
|
|||||||
batchcmds:set_depcache(target:dependfile(outputfile))
|
batchcmds:set_depcache(target:dependfile(outputfile))
|
||||||
end)
|
end)
|
||||||
rule_end()
|
rule_end()
|
||||||
|
end
|
||||||
|
|
||||||
|
local tests = {
|
||||||
|
Vulkan = {
|
||||||
|
option = "vulkan",
|
||||||
|
global_custom = function()
|
||||||
|
nzsl(Backend.VULKAN)
|
||||||
end,
|
end,
|
||||||
custom = function()
|
custom = function()
|
||||||
add_rules("nzsl_compile_shaders")
|
add_rules("nzsl_compile_shaders")
|
||||||
add_packages("nzs")
|
add_packages("nzsl")
|
||||||
|
add_files("**.nzsl")
|
||||||
|
end
|
||||||
|
},
|
||||||
|
OpenGL = {
|
||||||
|
option = "opengl",
|
||||||
|
global_custom = function()
|
||||||
|
nzsl(backend.OPENGL)
|
||||||
|
end,
|
||||||
|
custom = function()
|
||||||
|
add_rules("nzsl_compile_shaders")
|
||||||
|
add_packages("nzsl")
|
||||||
|
add_files("**.nzsl")
|
||||||
|
end
|
||||||
|
},
|
||||||
|
OpenGLES = {
|
||||||
|
option = "opengl-es",
|
||||||
|
global_custom = function()
|
||||||
|
nzsl(Backend.OpenGLES)
|
||||||
|
end,
|
||||||
|
custom = function()
|
||||||
|
add_rules("nzsl_compile_shaders")
|
||||||
|
add_packages("nzsl")
|
||||||
add_files("**.nzsl")
|
add_files("**.nzsl")
|
||||||
end
|
end
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user