mirror of
https://github.com/bkaradzic/bgfx.git
synced 2026-02-17 20:52:36 +01:00
Added uniform frequency. (#3485)
* Added uniform frequency. * Cleanup. * Cleanup.
This commit is contained in:
committed by
GitHub
parent
8a9bc3ed65
commit
35911ac2d9
@@ -1,7 +1,7 @@
|
||||
-- vim: syntax=lua
|
||||
-- bgfx interface
|
||||
|
||||
version(133)
|
||||
version(134)
|
||||
|
||||
typedef "bool"
|
||||
typedef "char"
|
||||
@@ -631,6 +631,13 @@ enum.UniformType { comment = "Uniform types:" }
|
||||
.Mat4 --- 4x4 matrix.
|
||||
()
|
||||
|
||||
--- Uniform frequency enum.
|
||||
enum.UniformFreq { comment = "Uniform frequency:" }
|
||||
.Draw --- Changing per draw call.
|
||||
.View --- Changing per view.
|
||||
.Frame --- Changing per frame.
|
||||
()
|
||||
|
||||
--- Backbuffer ratio enum.
|
||||
enum.BackbufferRatio { comment = "Backbuffer ratios:" }
|
||||
.Equal --- Equal to backbuffer.
|
||||
@@ -1980,6 +1987,41 @@ func.createUniform
|
||||
.num "uint16_t" --- Number of elements in array.
|
||||
{ default = 1 }
|
||||
|
||||
--- Create shader uniform parameter.
|
||||
---
|
||||
--- @remarks
|
||||
--- 1. Uniform names are unique. It's valid to call `bgfx::createUniform`
|
||||
--- multiple times with the same uniform name. The library will always
|
||||
--- return the same handle, but the handle reference count will be
|
||||
--- incremented. This means that the same number of `bgfx::destroyUniform`
|
||||
--- must be called to properly destroy the uniform.
|
||||
---
|
||||
--- 2. Predefined uniforms (declared in `bgfx_shader.sh`):
|
||||
--- - `u_viewRect vec4(x, y, width, height)` - view rectangle for current
|
||||
--- view, in pixels.
|
||||
--- - `u_viewTexel vec4(1.0/width, 1.0/height, undef, undef)` - inverse
|
||||
--- width and height
|
||||
--- - `u_view mat4` - view matrix
|
||||
--- - `u_invView mat4` - inverted view matrix
|
||||
--- - `u_proj mat4` - projection matrix
|
||||
--- - `u_invProj mat4` - inverted projection matrix
|
||||
--- - `u_viewProj mat4` - concatenated view projection matrix
|
||||
--- - `u_invViewProj mat4` - concatenated inverted view projection matrix
|
||||
--- - `u_model mat4[BGFX_CONFIG_MAX_BONES]` - array of model matrices.
|
||||
--- - `u_modelView mat4` - concatenated model view matrix, only first
|
||||
--- model matrix from array is used.
|
||||
--- - `u_invModelView mat4` - inverted concatenated model view matrix.
|
||||
--- - `u_modelViewProj mat4` - concatenated model view projection matrix.
|
||||
--- - `u_alphaRef float` - alpha reference value for alpha test.
|
||||
---
|
||||
func.createUniform { cname = "create_uniform_with_freq" }
|
||||
"UniformHandle" --- Handle to uniform object.
|
||||
.name "const char*" --- Uniform name in shader.
|
||||
.freq "UniformFreq::Enum" --- Uniform change frequency (See: `bgfx::UniformFreq`).
|
||||
.type "UniformType::Enum" --- Type of uniform (See: `bgfx::UniformType`).
|
||||
.num "uint16_t" --- Number of elements in array.
|
||||
{ default = 1 }
|
||||
|
||||
--- Retrieve uniform info.
|
||||
func.getUniformInfo
|
||||
"void"
|
||||
@@ -2294,6 +2336,31 @@ func.Encoder.setUniform
|
||||
--- use the _num passed on uniform creation.
|
||||
{ default = 1 }
|
||||
|
||||
--- Set shader uniform parameter for view.
|
||||
---
|
||||
--- @attention Uniform must be created with `bgfx::UniformFreq::View` argument.
|
||||
---
|
||||
func.setViewUniform
|
||||
"void"
|
||||
.id "ViewId" --- View id.
|
||||
.handle "UniformHandle" --- Uniform.
|
||||
.value "const void*" --- Pointer to uniform data.
|
||||
.num "uint16_t" --- Number of elements. Passing `UINT16_MAX` will
|
||||
--- use the _num passed on uniform creation.
|
||||
{ default = 1 }
|
||||
|
||||
--- Set shader uniform parameter for frame.
|
||||
---
|
||||
--- @attention Uniform must be created with `bgfx::UniformFreq::View` argument.
|
||||
---
|
||||
func.setFrameUniform
|
||||
"void"
|
||||
.handle "UniformHandle" --- Uniform.
|
||||
.value "const void*" --- Pointer to uniform data.
|
||||
.num "uint16_t" --- Number of elements. Passing `UINT16_MAX` will
|
||||
--- use the _num passed on uniform creation.
|
||||
{ default = 1 }
|
||||
|
||||
--- Set index buffer for draw primitive.
|
||||
func.Encoder.setIndexBuffer { cpponly }
|
||||
"void"
|
||||
|
||||
Reference in New Issue
Block a user