Tools¶
Geometry Compiler (geometryc)¶
Converts Wavefront .obj mesh file to format optimal for using with bgfx.
Shader Compiler (shaderc)¶
bgfx cross-platform shader language is based on GLSL syntax. It’s uses ANSI C preprocessor to transform GLSL like language syntax into HLSL. This technique has certain drawbacks, but overall it’s simple and allows quick authoring of cross-platform shaders.
Some differences between bgfx’s shaderc flavor of GLSL and regular GLSL:
No
bool/int
uniforms, all uniforms must befloat
.Attributes and varyings can be accessed only from
main()
function.Must use
SAMPLER2D/3D/CUBE/etc.
macros instead ofsampler2D/3D/Cube/etc.
tokens.Must use
vec2/3/4_splat(<value>)
instead ofvec2/3/4(<value>)
.Must use
mtxFromCols/mtxFromRows
when constructing matrices in shaders.Must use
mul(x, y)
when multiplying vectors and matrices.Must use
varying.def.sc
to define input/output semantic and precission instead of usingattribute/in
andvarying/in/out
.$input/$output
tokens must appear at the begining of shader.
For more info see shader helper macros.
Building shaders¶
Shaders must be compiled for all renderers by using shaderc tool. Makefile to simplify building shaders is provided in examples. D3D9 and D3D11 shaders can be only compiled on Windows.
Texture Compiler (texturec)¶
Convert PNG, TGA, DDS, KTX, PVR texture into bgfx supported texture formats.
Texture Viewer (texturev)¶
Texture viewer.