A package for ZeroBraneStudio to aid graphics programming in Lua (OpenGL, Vulkan etc.). Its content originates from the Estrela Editor from which zbstudio was forked. The installation of this package supercedes the "estrela" configuration that zbstudio used previously.
ZeroBraneStudio 1.51 or a version from this commit onwards.
There is two differnt options:
-
Install like a regular package, put the lua file and the subdirectory of this repository into zbstudio's package directory
-
Put a dummy file into the package directory that simply forwards to the content of this repository:
return dofile([[Absolute filepath to graphicscodepack.lua]])
This package comes with a spec, api tooltips, and tools for GLSL.
Uses glslc, which makes use of the system's OpenGL driver to compile the files (not recommended anymore, prefer to use GLSLANG, see below)
To make the GLSLC menu working either modify your zbstudio's cfg/user.lua
and add path.glslcbin = [[path to glslc.exe (excluded)]]
or set the GLSLC_BIN_PATH
environment variable.
The GLASM output from glslc is also analyzed and formated by the tool. However, be aware that this is just an intermediate format for NVIDIA and not the actual assembly.
Depending on the shadertype a define is set, e.g. -D_VERTEX_SHADER_ -D_IDE_
.
Uses the official Khronos glslangValidator from the installed VulkanSDK.
To get the GLSLANG menu, modify cfg/user.lua
and add path.glslangbin = [[path to glslangValidator.exe (excluded)]]
otherwise (os.getenv("VULKAN_SDK") and os.getenv("VULKAN_SDK").."/Bin")
is used.
The menu looks similar to the above tool. On success two files are generated <inputfile>.spv
and <inputfile>.txt
(humand readable spir-v).
By default shaders are compiled targeting Vulkan 1.1. The tool does support raytracing and mesh shaders.
Depending on the shadertype a define is set, e.g. -D_VERTEX_SHADER_ -D_IDE_
.
To add project specific include directories:
- put
zbsgfxpack.lua
file in project directory - return include paths through the lua file:
return { glslang = { includes = { "myIncludeDirectory", ...} } }
Similar as above is provided for the DirectX HLSL (however not maintained as much as GLSL).
To get the DXC menu entry, modify cfg/user.lua
and add path.dxcbin = [[path to dxc.exe (excluded)]]
To get the FXC menu entry, modify cfg/user.lua
and add path.fxcbin = [[path to fxc.exe (excluded)]]
otherwise (os.getenv("DXSDK_DIR") and os.getenv("DXSDK_DIR").."/Utilities/bin/x86/")
is used.
Depending on the shadertype a define is set, e.g. -D_VERTEX_SHADER_ -D_IDE_
.
There is api completion for various lua-ffi bindings:
An interpreter for the LuaJIT gfx sandbox is provided, which makes use of the above bindings. It can be used by setting path.luajitgfxsandbox = [[path to luajit gfx runtime directory]]
in the config file or via LUAJIT_GFX_SANDBOX_PATH
environment variable. The interpreter does support debugging.
A tool is provided to turn a LuaJIT ffi C header into an api specification that zbstudio can use. This makes adding auto completion and tooltips for C apis easier. Ensure the ffi header is in the active editor tab when running the tool.
To some basic perforce operations with the current file
Surrounds every line of the active editor file by quotes and new line symbol: " original content \n"