@@ -9,7 +9,7 @@ import bindbc.common.types: c_int64, c_uint64, va_list;
99import bindbc.bgfx.config;
1010static import bgfx.impl;
1111
12- enum uint apiVersion = 133 ;
12+ enum uint apiVersion = 134 ;
1313
1414alias ViewID = ushort ;
1515
@@ -771,6 +771,14 @@ enum UniformType: bgfx.impl.UniformType.Enum{
771771 count = bgfx.impl.UniformType.Enum.count,
772772}
773773
774+ // /Uniform frequency enum.
775+ enum UniformFreq: bgfx.impl.UniformFreq.Enum{
776+ draw = bgfx.impl.UniformFreq.Enum.draw,
777+ view = bgfx.impl.UniformFreq.Enum.view,
778+ frame = bgfx.impl.UniformFreq.Enum.frame,
779+ count = bgfx.impl.UniformFreq.Enum.count,
780+ }
781+
774782// /Backbuffer ratio enum.
775783enum BackbufferRatio: bgfx.impl.BackbufferRatio.Enum{
776784 equal = bgfx.impl.BackbufferRatio.Enum.equal,
@@ -2848,6 +2856,39 @@ mixin(joinFnBinds((){
28482856 */
28492857 {q{UniformHandle}, q{createUniform}, q{const (char )* name, bgfx.impl.UniformType.Enum type, ushort num=1 }, ext: ` C++, "bgfx"` },
28502858
2859+ /**
2860+ * Create shader uniform parameter.
2861+ * Remarks:
2862+ * 1. Uniform names are unique. It's valid to call `bgfx::createUniform`
2863+ * multiple times with the same uniform name. The library will always
2864+ * return the same handle, but the handle reference count will be
2865+ * incremented. This means that the same number of `bgfx::destroyUniform`
2866+ * must be called to properly destroy the uniform.
2867+ * 2. Predefined uniforms (declared in `bgfx_shader.sh`):
2868+ * - `u_viewRect vec4(x, y, width, height)` - view rectangle for current
2869+ * view, in pixels.
2870+ * - `u_viewTexel vec4(1.0/width, 1.0/height, undef, undef)` - inverse
2871+ * width and height
2872+ * - `u_view mat4` - view matrix
2873+ * - `u_invView mat4` - inverted view matrix
2874+ * - `u_proj mat4` - projection matrix
2875+ * - `u_invProj mat4` - inverted projection matrix
2876+ * - `u_viewProj mat4` - concatenated view projection matrix
2877+ * - `u_invViewProj mat4` - concatenated inverted view projection matrix
2878+ * - `u_model mat4[BGFX_CONFIG_MAX_BONES]` - array of model matrices.
2879+ * - `u_modelView mat4` - concatenated model view matrix, only first
2880+ * model matrix from array is used.
2881+ * - `u_invModelView mat4` - inverted concatenated model view matrix.
2882+ * - `u_modelViewProj mat4` - concatenated model view projection matrix.
2883+ * - `u_alphaRef float` - alpha reference value for alpha test.
2884+ Params:
2885+ name = Uniform name in shader.
2886+ freq = Uniform change frequency (See: `bgfx::UniformFreq`).
2887+ type = Type of uniform (See: `bgfx::UniformType`).
2888+ num = Number of elements in array.
2889+ */
2890+ {q{UniformHandle}, q{createUniform}, q{const (char )* name, bgfx.impl.UniformFreq.Enum freq, bgfx.impl.UniformType.Enum type, ushort num=1 }, ext: ` C++, "bgfx"` },
2891+
28512892 /**
28522893 * Retrieve uniform info.
28532894 Params:
@@ -3065,6 +3106,29 @@ mixin(joinFnBinds((){
30653106 */
30663107 {q{void }, q{end}, q{Encoder* encoder}, ext: ` C++, "bgfx"` },
30673108
3109+ /**
3110+ * Set shader uniform parameter for view.
3111+ * Attention: Uniform must be created with `bgfx::UniformFreq::View` argument.
3112+ Params:
3113+ id = View id.
3114+ handle = Uniform.
3115+ value = Pointer to uniform data.
3116+ num = Number of elements. Passing `UINT16_MAX` will
3117+ use the _num passed on uniform creation.
3118+ */
3119+ {q{void }, q{setViewUniform}, q{ViewID id, UniformHandle handle, const (void )* value, ushort num=1 }, ext: ` C++, "bgfx"` },
3120+
3121+ /**
3122+ * Set shader uniform parameter for frame.
3123+ * Attention: Uniform must be created with `bgfx::UniformFreq::View` argument.
3124+ Params:
3125+ handle = Uniform.
3126+ value = Pointer to uniform data.
3127+ num = Number of elements. Passing `UINT16_MAX` will
3128+ use the _num passed on uniform creation.
3129+ */
3130+ {q{void }, q{setFrameUniform}, q{UniformHandle handle, const (void )* value, ushort num=1 }, ext: ` C++, "bgfx"` },
3131+
30683132 /**
30693133 * Request screen shot of window back buffer.
30703134 * Remarks:
0 commit comments