Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bgfx: rename header to array_name #5159

Merged
merged 1 commit into from
Sep 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions packages/b/bgfx/rules/shaders.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,15 @@
-- Usage:
--
-- add_rules("@bgfx/shaders")
--
-- -- generate binary file:
-- add_files("shader.vert", {type = "vertex", output_dir = "shaders", output_name = "shader.vert.bin", profiles = {glsl = "330"}})
-- add_files("vs_shader.sc", {type = "vertex", output_dir = "shaders", output_name = "shader.vert.h", header = true, profiles = {glsl = "330"}})
-- -- generate header file:
-- add_files("vs_shader.sc", {type = "vertex", output_dir = "shaders", output_name = "vs_shader.h", profiles = {glsl = "330"}})
-- -- generate header file exporting variable "vertex_src":
-- add_files("vs_shader.sc", {type = "vertex", output_dir = "shaders", output_name = "vs_shader.h", array_name = "vertex_src", profiles = {glsl = "330"}})
-- -- force to generate header file with default variable name:
-- add_files("vs_shader.sc", {type = "vertex", output_dir = "shaders", output_name = "vs_shader.inc", array_name = true, profiles = {glsl = "330"}})

rule("shaders")
set_extensions(".sc", ".vert", ".frag", ".comp")
Expand All @@ -27,7 +34,7 @@ rule("shaders")
else
local filename = path.filename(shaderfile)
output_filename = filename:match("^(.*)%.sc$") or filename
if fileconfig and fileconfig.header then
if fileconfig and fileconfig.array_name then
output_filename = output_filename .. ".h"
else
output_filename = output_filename .. ".bin"
Expand Down Expand Up @@ -102,10 +109,10 @@ rule("shaders")
"--platform", bgfx_platforms[target:plat()],
}

if fileconfig and fileconfig.header then
if fileconfig and fileconfig.array_name then
table.insert(args, "--bin2c")
if fileconfig.header ~= true then
table.insert(args, fileconfig.header)
if fileconfig.array_name ~= true then
table.insert(args, fileconfig.array_name)
end
end

Expand Down
Loading