diff --git a/bindings/bf/bgfx.bf b/bindings/bf/bgfx.bf
index 22159e4fd..f3ff2415f 100644
--- a/bindings/bf/bgfx.bf
+++ b/bindings/bf/bgfx.bf
@@ -2434,15 +2434,6 @@ public static class bgfx
[LinkName("bgfx_vertex_layout_decode")]
public static extern void vertex_layout_decode(VertexLayout* _this, Attrib _attrib, uint8 * _num, AttribType* _type, bool* _normalized, bool* _asInt);
- ///
- /// Returns `true` if VertexLayout contains attribute.
- ///
- ///
- /// Attribute semantics. See: `bgfx::Attrib`
- ///
- [LinkName("bgfx_vertex_layout_has")]
- public static extern bool vertex_layout_has(VertexLayout* _this, Attrib _attrib);
-
///
/// Skip `_num` bytes in vertex stream.
///
@@ -3473,6 +3464,19 @@ public static class bgfx
[LinkName("bgfx_set_palette_color")]
public static extern void set_palette_color(uint8 _index, float _rgba);
+ ///
+ /// Set palette color value.
+ ///
+ ///
+ /// Index into palette.
+ /// Red value (RGBA floating point values)
+ /// Green value (RGBA floating point values)
+ /// Blue value (RGBA floating point values)
+ /// Alpha value (RGBA floating point values)
+ ///
+ [LinkName("bgfx_set_palette_color_rgba32f")]
+ public static extern void set_palette_color_rgba32f(uint8 _index, float _r, float _g, float _b, float _a);
+
///
/// Set palette color value.
///
diff --git a/bindings/cs/bgfx.cs b/bindings/cs/bgfx.cs
index 683412345..499439e6e 100644
--- a/bindings/cs/bgfx.cs
+++ b/bindings/cs/bgfx.cs
@@ -2385,16 +2385,6 @@ public static partial class bgfx
[DllImport(DllName, EntryPoint="bgfx_vertex_layout_decode", CallingConvention = CallingConvention.Cdecl)]
public static extern unsafe void vertex_layout_decode(VertexLayout* _this, Attrib _attrib, byte * _num, AttribType* _type, bool* _normalized, bool* _asInt);
- ///
- /// Returns `true` if VertexLayout contains attribute.
- ///
- ///
- /// Attribute semantics. See: `bgfx::Attrib`
- ///
- [DllImport(DllName, EntryPoint="bgfx_vertex_layout_has", CallingConvention = CallingConvention.Cdecl)]
- [return: MarshalAs(UnmanagedType.I1)]
- public static extern unsafe bool vertex_layout_has(VertexLayout* _this, Attrib _attrib);
-
///
/// Skip `_num` bytes in vertex stream.
///
@@ -3429,6 +3419,19 @@ public static partial class bgfx
[DllImport(DllName, EntryPoint="bgfx_set_palette_color", CallingConvention = CallingConvention.Cdecl)]
public static extern unsafe void set_palette_color(byte _index, float _rgba);
+ ///
+ /// Set palette color value.
+ ///
+ ///
+ /// Index into palette.
+ /// Red value (RGBA floating point values)
+ /// Green value (RGBA floating point values)
+ /// Blue value (RGBA floating point values)
+ /// Alpha value (RGBA floating point values)
+ ///
+ [DllImport(DllName, EntryPoint="bgfx_set_palette_color_rgba32f", CallingConvention = CallingConvention.Cdecl)]
+ public static extern unsafe void set_palette_color_rgba32f(byte _index, float _r, float _g, float _b, float _a);
+
///
/// Set palette color value.
///
diff --git a/bindings/d/package.d b/bindings/d/package.d
index c26af2ad1..36ab49f64 100644
--- a/bindings/d/package.d
+++ b/bindings/d/package.d
@@ -10,7 +10,7 @@ import bindbc.bgfx.config;
import bindbc.common.types: c_int64, c_uint64, va_list;
static import bgfx.fakeenum;
-enum uint apiVersion = 128;
+enum uint apiVersion = 129;
alias ViewID = ushort;
@@ -1105,6 +1105,12 @@ extern(C++, "bgfx") struct Init{
uint minResourceCBSize; ///Minimum resource command buffer size.
uint transientVBSize; ///Maximum transient vertex buffer size.
uint transientIBSize; ///Maximum transient index buffer size.
+ extern(D) mixin(joinFnBinds((){
+ FnBind[] ret = [
+ {q{void}, q{this}, q{}, ext: `C++`},
+ ];
+ return ret;
+ }()));
}
/**
@@ -2503,7 +2509,7 @@ mixin(joinFnBinds((){
skip = Skip top level mips when parsing texture.
info = When non-`NULL` is specified it returns parsed texture information.
*/
- {q{TextureHandle}, q{createTexture}, q{const(Memory)* mem, c_uint64 flags, ubyte skip=0, TextureInfo* info=null}, ext: `C++, "bgfx"`},
+ {q{TextureHandle}, q{createTexture}, q{const(Memory)* mem, c_uint64 flags=Texture.none|Sampler.none, ubyte skip=0, TextureInfo* info=null}, ext: `C++, "bgfx"`},
/**
* Create 2D texture.
@@ -2524,7 +2530,7 @@ mixin(joinFnBinds((){
`_mem` is NULL content of the texture is uninitialized. When `_numLayers` is more than
1, expected memory layout is texture and all mips together for each array element.
*/
- {q{TextureHandle}, q{createTexture2D}, q{ushort width, ushort height, bool hasMIPs, ushort numLayers, bgfx.fakeenum.TextureFormat.Enum format, c_uint64 flags, const(Memory)* mem=null}, ext: `C++, "bgfx"`},
+ {q{TextureHandle}, q{createTexture2D}, q{ushort width, ushort height, bool hasMIPs, ushort numLayers, bgfx.fakeenum.TextureFormat.Enum format, c_uint64 flags=Texture.none|Sampler.none, const(Memory)* mem=null}, ext: `C++, "bgfx"`},
/**
* Create texture with size based on back-buffer ratio. Texture will maintain ratio
@@ -2854,6 +2860,17 @@ mixin(joinFnBinds((){
*/
{q{void}, q{setPaletteColor}, q{ubyte index, const(float)* rgba}, ext: `C++, "bgfx"`},
+ /**
+ * Set palette color value.
+ Params:
+ index = Index into palette.
+ r = Red value (RGBA floating point values)
+ g = Green value (RGBA floating point values)
+ b = Blue value (RGBA floating point values)
+ a = Alpha value (RGBA floating point values)
+ */
+ {q{void}, q{setPaletteColor}, q{ubyte index, float r, float g, float b, float a}, ext: `C++, "bgfx"`},
+
/**
* Set palette color value.
Params:
@@ -3568,7 +3585,7 @@ mixin(joinFnBinds((){
];
return ret;
-}(), "Resolution, Init, Attachment, VertexLayout, Encoder, "));
+}(), "Resolution, Limits, Init, Attachment, VertexLayout, Encoder, "));
static if(!staticBinding):
import bindbc.loader;
diff --git a/bindings/zig/bgfx.zig b/bindings/zig/bgfx.zig
index 0dd08f5e7..8f721f160 100644
--- a/bindings/zig/bgfx.zig
+++ b/bindings/zig/bgfx.zig
@@ -1530,11 +1530,6 @@ pub const Init = extern struct {
pub inline fn decode(self: *const VertexLayout, _attrib: Attrib, _num: [*c]u8 , _type: [*c]AttribType, _normalized: [*c]bool, _asInt: [*c]bool) void {
return bgfx_vertex_layout_decode(self, _attrib, _num, _type, _normalized, _asInt);
}
- /// Returns `true` if VertexLayout contains attribute.
- /// Attribute semantics. See: `bgfx::Attrib`
- pub inline fn has(self: *const VertexLayout, _attrib: Attrib) bool {
- return bgfx_vertex_layout_has(self, _attrib);
- }
/// Skip `_num` bytes in vertex stream.
/// Number of bytes to skip.
pub inline fn skip(self: *VertexLayout, _num: u8) *VertexLayout {
@@ -1959,10 +1954,6 @@ extern fn bgfx_vertex_layout_add(self: [*c]VertexLayout, _attrib: Attrib, _num:
/// Attribute is packed as int.
extern fn bgfx_vertex_layout_decode(self: [*c]const VertexLayout, _attrib: Attrib, _num: [*c]u8 , _type: [*c]AttribType, _normalized: [*c]bool, _asInt: [*c]bool) void;
-/// Returns `true` if VertexLayout contains attribute.
-/// Attribute semantics. See: `bgfx::Attrib`
-extern fn bgfx_vertex_layout_has(self: [*c]const VertexLayout, _attrib: Attrib) bool;
-
/// Skip `_num` bytes in vertex stream.
/// Number of bytes to skip.
extern fn bgfx_vertex_layout_skip(self: [*c]VertexLayout, _num: u8) [*c]VertexLayout;
@@ -2794,6 +2785,17 @@ pub inline fn setPaletteColor(_index: u8, _rgba: [4]f32) void {
}
extern fn bgfx_set_palette_color(_index: u8, _rgba: [4]f32) void;
+/// Set palette color value.
+/// Index into palette.
+/// Red value (RGBA floating point values)
+/// Green value (RGBA floating point values)
+/// Blue value (RGBA floating point values)
+/// Alpha value (RGBA floating point values)
+pub inline fn setPaletteColorRgba32f(_index: u8, _r: f32, _g: f32, _b: f32, _a: f32) void {
+ return bgfx_set_palette_color_rgba32f(_index, _r, _g, _b, _a);
+}
+extern fn bgfx_set_palette_color_rgba32f(_index: u8, _r: f32, _g: f32, _b: f32, _a: f32) void;
+
/// Set palette color value.
/// Index into palette.
/// Packed 32-bit RGBA value.
diff --git a/include/bgfx/bgfx.h b/include/bgfx/bgfx.h
index 50de46ba9..99f6ae096 100644
--- a/include/bgfx/bgfx.h
+++ b/include/bgfx/bgfx.h
@@ -6,6 +6,8 @@
#ifndef BGFX_H_HEADER_GUARD
#define BGFX_H_HEADER_GUARD
+#define BGFX_IDL_CPP 0
+
#include // va_list
#include // uint32_t
#include // NULL
diff --git a/include/bgfx/c99/bgfx.h b/include/bgfx/c99/bgfx.h
index 83354d46d..8c6a13fa9 100644
--- a/include/bgfx/c99/bgfx.h
+++ b/include/bgfx/c99/bgfx.h
@@ -1016,6 +1016,32 @@ BGFX_C_API bgfx_vertex_layout_t* bgfx_vertex_layout_skip(bgfx_vertex_layout_t* _
*/
BGFX_C_API void bgfx_vertex_layout_end(bgfx_vertex_layout_t* _this);
+/**
+ * Returns relative attribute offset from the vertex.
+ *
+ * @param[in] _attrib Attribute semantics. See: `bgfx::Attrib`
+ *
+ * @returns Relative attribute offset from the vertex.
+ *
+ */
+BGFX_C_API uint16_t bgfx_vertex_layout_get_offset(const bgfx_vertex_layout_t* _this, bgfx_attrib_t _attrib);
+
+/**
+ * Returns vertex stride.
+ *
+ */
+BGFX_C_API uint16_t bgfx_vertex_layout_get_stride(const bgfx_vertex_layout_t* _this);
+
+/**
+ * Returns size of vertex buffer for number of vertices.
+ *
+ * @param[in] _num Number of vertices.
+ *
+ * @returns Size of vertex buffer for number of vertices.
+ *
+ */
+BGFX_C_API uint32_t bgfx_vertex_layout_get_size(const bgfx_vertex_layout_t* _this, uint32_t _num);
+
/**
* Pack vertex attribute into vertex stream format.
*
@@ -2204,6 +2230,18 @@ BGFX_C_API void bgfx_destroy_occlusion_query(bgfx_occlusion_query_handle_t _hand
*/
BGFX_C_API void bgfx_set_palette_color(uint8_t _index, const float _rgba[4]);
+/**
+ * Set palette color value.
+ *
+ * @param[in] _index Index into palette.
+ * @param[in] _r Red value (RGBA floating point values)
+ * @param[in] _g Green value (RGBA floating point values)
+ * @param[in] _b Blue value (RGBA floating point values)
+ * @param[in] _a Alpha value (RGBA floating point values)
+ *
+ */
+BGFX_C_API void bgfx_set_palette_color_rgba32f(uint8_t _index, float _r, float _g, float _b, float _a);
+
/**
* Set palette color value.
*
@@ -3449,6 +3487,9 @@ typedef enum bgfx_function_id
BGFX_FUNCTION_ID_VERTEX_LAYOUT_HAS,
BGFX_FUNCTION_ID_VERTEX_LAYOUT_SKIP,
BGFX_FUNCTION_ID_VERTEX_LAYOUT_END,
+ BGFX_FUNCTION_ID_VERTEX_LAYOUT_GET_OFFSET,
+ BGFX_FUNCTION_ID_VERTEX_LAYOUT_GET_STRIDE,
+ BGFX_FUNCTION_ID_VERTEX_LAYOUT_GET_SIZE,
BGFX_FUNCTION_ID_VERTEX_PACK,
BGFX_FUNCTION_ID_VERTEX_UNPACK,
BGFX_FUNCTION_ID_VERTEX_CONVERT,
@@ -3536,6 +3577,7 @@ typedef enum bgfx_function_id
BGFX_FUNCTION_ID_GET_RESULT,
BGFX_FUNCTION_ID_DESTROY_OCCLUSION_QUERY,
BGFX_FUNCTION_ID_SET_PALETTE_COLOR,
+ BGFX_FUNCTION_ID_SET_PALETTE_COLOR_RGBA32F,
BGFX_FUNCTION_ID_SET_PALETTE_COLOR_RGBA8,
BGFX_FUNCTION_ID_SET_VIEW_NAME,
BGFX_FUNCTION_ID_SET_VIEW_RECT,
@@ -3651,6 +3693,9 @@ struct bgfx_interface_vtbl
bool (*vertex_layout_has)(const bgfx_vertex_layout_t* _this, bgfx_attrib_t _attrib);
bgfx_vertex_layout_t* (*vertex_layout_skip)(bgfx_vertex_layout_t* _this, uint8_t _num);
void (*vertex_layout_end)(bgfx_vertex_layout_t* _this);
+ uint16_t (*vertex_layout_get_offset)(const bgfx_vertex_layout_t* _this, bgfx_attrib_t _attrib);
+ uint16_t (*vertex_layout_get_stride)(const bgfx_vertex_layout_t* _this);
+ uint32_t (*vertex_layout_get_size)(const bgfx_vertex_layout_t* _this, uint32_t _num);
void (*vertex_pack)(const float _input[4], bool _inputNormalized, bgfx_attrib_t _attr, const bgfx_vertex_layout_t * _layout, void* _data, uint32_t _index);
void (*vertex_unpack)(float _output[4], bgfx_attrib_t _attr, const bgfx_vertex_layout_t * _layout, const void* _data, uint32_t _index);
void (*vertex_convert)(const bgfx_vertex_layout_t * _dstLayout, void* _dstData, const bgfx_vertex_layout_t * _srcLayout, const void* _srcData, uint32_t _num);
@@ -3738,6 +3783,7 @@ struct bgfx_interface_vtbl
bgfx_occlusion_query_result_t (*get_result)(bgfx_occlusion_query_handle_t _handle, int32_t* _result);
void (*destroy_occlusion_query)(bgfx_occlusion_query_handle_t _handle);
void (*set_palette_color)(uint8_t _index, const float _rgba[4]);
+ void (*set_palette_color_rgba32f)(uint8_t _index, float _r, float _g, float _b, float _a);
void (*set_palette_color_rgba8)(uint8_t _index, uint32_t _rgba);
void (*set_view_name)(bgfx_view_id_t _id, const char* _name, int32_t _len);
void (*set_view_rect)(bgfx_view_id_t _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height);
diff --git a/include/bgfx/defines.h b/include/bgfx/defines.h
index ce3830f25..32f4bab9c 100644
--- a/include/bgfx/defines.h
+++ b/include/bgfx/defines.h
@@ -15,7 +15,7 @@
#ifndef BGFX_DEFINES_H_HEADER_GUARD
#define BGFX_DEFINES_H_HEADER_GUARD
-#define BGFX_API_VERSION UINT32_C(128)
+#define BGFX_API_VERSION UINT32_C(129)
/**
* Color RGB/alpha/depth write. When it's not specified write will be disabled.
diff --git a/include/bgfx/platform.h b/include/bgfx/platform.h
index a7b006262..c352cce0d 100644
--- a/include/bgfx/platform.h
+++ b/include/bgfx/platform.h
@@ -12,6 +12,8 @@
#include "bgfx.h"
+#if !BGFX_IDL_CPP
+
namespace bgfx
{
/// Render frame enum.
@@ -133,4 +135,6 @@ namespace bgfx
} // namespace bgfx
+#endif // BGFX_IDL_CPP
+
#endif // BGFX_PLATFORM_H_HEADER_GUARD
diff --git a/scripts/bgfx-codegen.lua b/scripts/bgfx-codegen.lua
index 508481dd8..526841eea 100644
--- a/scripts/bgfx-codegen.lua
+++ b/scripts/bgfx-codegen.lua
@@ -32,7 +32,7 @@ local type_actions = {
local function cfunc(f)
return function(func)
- if (not func.cpponly) and (not func.cppinline or func.conly) then
+ if (not func.cpponly) or func.conly then
return f(func)
end
end
@@ -177,7 +177,9 @@ function typegen.structs(typedef)
if methods then
local m = {}
for _, func in ipairs(methods) do
- m[#m+1] = cppdecl(func)
+ if not func.conly then
+ m[#m+1] = cppdecl(func)
+ end
end
methods = m
end
diff --git a/scripts/bgfx.idl b/scripts/bgfx.idl
index a98da9d36..e87b841bd 100644
--- a/scripts/bgfx.idl
+++ b/scripts/bgfx.idl
@@ -1,7 +1,7 @@
-- vim: syntax=lua
-- bgfx interface
-version(128)
+version(129)
typedef "bool"
typedef "char"
@@ -801,7 +801,7 @@ struct.Resolution { ctor }
.debugTextScale "uint8_t" --- Scale factor for debug text.
--- Configurable runtime limits parameters.
-struct.Limits { namespace = "Init" }
+struct.Limits { ctor, namespace = "Init" }
.maxEncoders "uint16_t" --- Maximum number of encoder threads.
.minResourceCbSize "uint32_t" --- Minimum resource command buffer size.
.transientVbSize "uint32_t" --- Maximum transient vertex buffer size.
@@ -1046,7 +1046,7 @@ func.VertexLayout.decode { const }
.asInt "bool &" { out } --- Attribute is packed as int.
--- Returns `true` if VertexLayout contains attribute.
-func.VertexLayout.has { const, conly, cppinline }
+func.VertexLayout.has { const, cppinline }
"bool" --- True if VertexLayout contains attribute.
.attrib "Attrib::Enum" --- Attribute semantics. See: `bgfx::Attrib`
@@ -1656,7 +1656,7 @@ func.createTexture
"TextureHandle" --- Texture handle.
.mem "const Memory*" --- DDS, KTX or PVR texture binary data.
.flags "uint64_t" --- Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`)
- { "BGFX_TEXTURE_NONE|BGFX_SAMPLER_NONE" } --- flags. Default texture sampling mode is linear, and wrap mode is repeat.
+ { default = "BGFX_TEXTURE_NONE|BGFX_SAMPLER_NONE" } --- flags. Default texture sampling mode is linear, and wrap mode is repeat.
--- - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap
--- mode.
--- - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
@@ -1676,7 +1676,7 @@ func.createTexture2D
--- `BGFX_CAPS_TEXTURE_2D_ARRAY` flag is not set.
.format "TextureFormat::Enum" --- Texture format. See: `TextureFormat::Enum`.
.flags "uint64_t" --- Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`)
- { "BGFX_TEXTURE_NONE|BGFX_SAMPLER_NONE" } --- flags. Default texture sampling mode is linear, and wrap mode is repeat.
+ { default = "BGFX_TEXTURE_NONE|BGFX_SAMPLER_NONE" } --- flags. Default texture sampling mode is linear, and wrap mode is repeat.
--- - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap
--- mode.
--- - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
@@ -1998,6 +1998,15 @@ func.setPaletteColor
.index "uint8_t" --- Index into palette.
.rgba "const float[4]" --- RGBA floating point values.
+--- Set palette color value.
+func.setPaletteColor { cname = "set_palette_color_rgba32f" }
+ "void"
+ .index "uint8_t" --- Index into palette.
+ .r "float" --- Red value (RGBA floating point values)
+ .g "float" --- Green value (RGBA floating point values)
+ .b "float" --- Blue value (RGBA floating point values)
+ .a "float" --- Alpha value (RGBA floating point values)
+
--- Set palette color value.
func.setPaletteColor { cname = "set_palette_color_rgba8" }
"void"
diff --git a/scripts/genie.lua b/scripts/genie.lua
index 3624f66b5..9eb10a7b0 100644
--- a/scripts/genie.lua
+++ b/scripts/genie.lua
@@ -65,6 +65,7 @@ newaction {
end
generate("temp.bgfx.h" , "../include/bgfx/c99/bgfx.h", " ")
+-- generate("temp.bgfx.hpp" , "../include/bgfx/bgfx.h", "\t")
generate("temp.bgfx.idl.inl", "../src/bgfx.idl.inl", "\t")
generate("temp.defines.h", "../include/bgfx/defines.h", "\t")
diff --git a/scripts/temp.bgfx.hpp b/scripts/temp.bgfx.hpp
new file mode 100644
index 000000000..1040d85db
--- /dev/null
+++ b/scripts/temp.bgfx.hpp
@@ -0,0 +1,258 @@
+/*
+ * Copyright 2011-2019 Branimir Karadzic. All rights reserved.
+ * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE
+ */
+
+/*
+ *
+ * AUTO GENERATED! DO NOT EDIT! ( source : $source )
+ *
+ */
+
+#ifndef BGFX_H_HEADER_GUARD
+#define BGFX_H_HEADER_GUARD
+
+#define BGFX_IDL_CPP 1
+
+#include // va_list
+#include // uint32_t
+#include // NULL
+
+#include "defines.h"
+
+///
+#define BGFX_HANDLE(_name) \
+ struct _name { uint16_t idx; }; \
+ inline bool isValid(_name _handle) { return bgfx::kInvalidHandle != _handle.idx; }
+
+#define BGFX_INVALID_HANDLE { bgfx::kInvalidHandle }
+
+namespace bx { struct AllocatorI; }
+
+/// BGFX
+namespace bgfx
+{
+ struct CallbackI;
+
+$enums
+
+static const uint16_t kInvalidHandle = UINT16_MAX;
+
+ /// View id.
+ typedef uint16_t ViewId;
+
+$handles
+
+$structs
+
+ /// Callback interface to implement application specific behavior.
+ /// Cached items are currently used for OpenGL and Direct3D 12 binary
+ /// shaders.
+ ///
+ /// @remarks
+ /// 'fatal' and 'trace' callbacks can be called from any thread. Other
+ /// callbacks are called from the render thread.
+ ///
+ /// @attention C99's equivalent binding is `bgfx_callback_interface_t`.
+ ///
+ struct CallbackI
+ {
+ virtual ~CallbackI() = 0;
+
+ /// This callback is called on unrecoverable errors.
+ /// It's not safe to continue (Excluding _code `Fatal::DebugCheck`),
+ /// inform the user and terminate the application.
+ ///
+ /// @param[in] _filePath File path where fatal message was generated.
+ /// @param[in] _line Line where fatal message was generated.
+ /// @param[in] _code Fatal error code.
+ /// @param[in] _str More information about error.
+ ///
+ /// @remarks
+ /// Not thread safe and it can be called from any thread.
+ ///
+ /// @attention C99's equivalent binding is `bgfx_callback_vtbl.fatal`.
+ ///
+ virtual void fatal(
+ const char* _filePath
+ , uint16_t _line
+ , Fatal::Enum _code
+ , const char* _str
+ ) = 0;
+
+ /// Print debug message.
+ ///
+ /// @param[in] _filePath File path where debug message was generated.
+ /// @param[in] _line Line where debug message was generated.
+ /// @param[in] _format `printf` style format.
+ /// @param[in] _argList Variable arguments list initialized with
+ /// `va_start`.
+ ///
+ /// @remarks
+ /// Not thread safe and it can be called from any thread.
+ ///
+ /// @attention C99's equivalent binding is `bgfx_callback_vtbl.trace_vargs`.
+ ///
+ virtual void traceVargs(
+ const char* _filePath
+ , uint16_t _line
+ , const char* _format
+ , va_list _argList
+ ) = 0;
+
+ /// Profiler region begin.
+ ///
+ /// @param[in] _name Region name, contains dynamic string.
+ /// @param[in] _abgr Color of profiler region.
+ /// @param[in] _filePath File path where `profilerBegin` was called.
+ /// @param[in] _line Line where `profilerBegin` was called.
+ ///
+ /// @remarks
+ /// Not thread safe and it can be called from any thread.
+ ///
+ /// @attention C99's equivalent binding is `bgfx_callback_vtbl.profiler_begin`.
+ ///
+ virtual void profilerBegin(
+ const char* _name
+ , uint32_t _abgr
+ , const char* _filePath
+ , uint16_t _line
+ ) = 0;
+
+ /// Profiler region begin with string literal name.
+ ///
+ /// @param[in] _name Region name, contains string literal.
+ /// @param[in] _abgr Color of profiler region.
+ /// @param[in] _filePath File path where `profilerBeginLiteral` was called.
+ /// @param[in] _line Line where `profilerBeginLiteral` was called.
+ ///
+ /// @remarks
+ /// Not thread safe and it can be called from any thread.
+ ///
+ /// @attention C99's equivalent binding is `bgfx_callback_vtbl.profiler_begin_literal`.
+ ///
+ virtual void profilerBeginLiteral(
+ const char* _name
+ , uint32_t _abgr
+ , const char* _filePath
+ , uint16_t _line
+ ) = 0;
+
+ /// Profiler region end.
+ ///
+ /// @remarks
+ /// Not thread safe and it can be called from any thread.
+ ///
+ /// @attention C99's equivalent binding is `bgfx_callback_vtbl.profiler_end`.
+ ///
+ virtual void profilerEnd() = 0;
+
+ /// Returns the size of a cached item. Returns 0 if no cached item was
+ /// found.
+ ///
+ /// @param[in] _id Cache id.
+ /// @returns Number of bytes to read.
+ ///
+ /// @attention C99's equivalent binding is `bgfx_callback_vtbl.cache_read_size`.
+ ///
+ virtual uint32_t cacheReadSize(uint64_t _id) = 0;
+
+ /// Read cached item.
+ ///
+ /// @param[in] _id Cache id.
+ /// @param[in] _data Buffer where to read data.
+ /// @param[in] _size Size of data to read.
+ ///
+ /// @returns True if data is read.
+ ///
+ /// @attention C99's equivalent binding is `bgfx_callback_vtbl.cache_read`.
+ ///
+ virtual bool cacheRead(uint64_t _id, void* _data, uint32_t _size) = 0;
+
+ /// Write cached item.
+ ///
+ /// @param[in] _id Cache id.
+ /// @param[in] _data Data to write.
+ /// @param[in] _size Size of data to write.
+ ///
+ /// @attention C99's equivalent binding is `bgfx_callback_vtbl.cache_write`.
+ ///
+ virtual void cacheWrite(uint64_t _id, const void* _data, uint32_t _size) = 0;
+
+ /// Screenshot captured. Screenshot format is always 4-byte BGRA.
+ ///
+ /// @param[in] _filePath File path.
+ /// @param[in] _width Image width.
+ /// @param[in] _height Image height.
+ /// @param[in] _pitch Number of bytes to skip between the start of
+ /// each horizontal line of the image.
+ /// @param[in] _data Image data.
+ /// @param[in] _size Image size.
+ /// @param[in] _yflip If true, image origin is bottom left.
+ ///
+ /// @attention C99's equivalent binding is `bgfx_callback_vtbl.screen_shot`.
+ ///
+ virtual void screenShot(
+ const char* _filePath
+ , uint32_t _width
+ , uint32_t _height
+ , uint32_t _pitch
+ , const void* _data
+ , uint32_t _size
+ , bool _yflip
+ ) = 0;
+
+ /// Called when a video capture begins.
+ ///
+ /// @param[in] _width Image width.
+ /// @param[in] _height Image height.
+ /// @param[in] _pitch Number of bytes to skip between the start of
+ /// each horizontal line of the image.
+ /// @param[in] _format Texture format. See: `TextureFormat::Enum`.
+ /// @param[in] _yflip If true, image origin is bottom left.
+ ///
+ /// @attention C99's equivalent binding is `bgfx_callback_vtbl.capture_begin`.
+ ///
+ virtual void captureBegin(
+ uint32_t _width
+ , uint32_t _height
+ , uint32_t _pitch
+ , TextureFormat::Enum _format
+ , bool _yflip
+ ) = 0;
+
+ /// Called when a video capture ends.
+ ///
+ /// @attention C99's equivalent binding is `bgfx_callback_vtbl.capture_end`.
+ ///
+ virtual void captureEnd() = 0;
+
+ /// Captured frame.
+ ///
+ /// @param[in] _data Image data.
+ /// @param[in] _size Image size.
+ ///
+ /// @attention C99's equivalent binding is `bgfx_callback_vtbl.capture_frame`.
+ ///
+ virtual void captureFrame(const void* _data, uint32_t _size) = 0;
+ };
+
+ inline CallbackI::~CallbackI()
+ {
+ }
+
+$funcptrs
+
+$cppdecl
+
+inline bool VertexLayout::has(Attrib::Enum _attrib) const { return UINT16_MAX != m_attributes[_attrib]; }
+
+inline uint16_t VertexLayout::getOffset(Attrib::Enum _attrib) const { return m_offset[_attrib]; }
+
+inline uint16_t VertexLayout::getStride() const { return m_stride; }
+
+inline uint32_t VertexLayout::getSize(uint32_t _num) const { return _num*m_stride; }
+
+} // namespace bgfx
+
+#endif // BGFX_H_HEADER_GUARD
diff --git a/src/bgfx.idl.inl b/src/bgfx.idl.inl
index 929f179b6..820b1a2df 100644
--- a/src/bgfx.idl.inl
+++ b/src/bgfx.idl.inl
@@ -95,6 +95,24 @@ BGFX_C_API void bgfx_vertex_layout_end(bgfx_vertex_layout_t* _this)
This->end();
}
+BGFX_C_API uint16_t bgfx_vertex_layout_get_offset(const bgfx_vertex_layout_t* _this, bgfx_attrib_t _attrib)
+{
+ const bgfx::VertexLayout* This = (const bgfx::VertexLayout*)_this;
+ return This->getOffset((bgfx::Attrib::Enum)_attrib);
+}
+
+BGFX_C_API uint16_t bgfx_vertex_layout_get_stride(const bgfx_vertex_layout_t* _this)
+{
+ const bgfx::VertexLayout* This = (const bgfx::VertexLayout*)_this;
+ return This->getStride();
+}
+
+BGFX_C_API uint32_t bgfx_vertex_layout_get_size(const bgfx_vertex_layout_t* _this, uint32_t _num)
+{
+ const bgfx::VertexLayout* This = (const bgfx::VertexLayout*)_this;
+ return This->getSize(_num);
+}
+
BGFX_C_API void bgfx_vertex_pack(const float _input[4], bool _inputNormalized, bgfx_attrib_t _attr, const bgfx_vertex_layout_t * _layout, void* _data, uint32_t _index)
{
const bgfx::VertexLayout & layout = *(const bgfx::VertexLayout *)_layout;
@@ -620,6 +638,11 @@ BGFX_C_API void bgfx_set_palette_color(uint8_t _index, const float _rgba[4])
bgfx::setPaletteColor(_index, _rgba);
}
+BGFX_C_API void bgfx_set_palette_color_rgba32f(uint8_t _index, float _r, float _g, float _b, float _a)
+{
+ bgfx::setPaletteColor(_index, _r, _g, _b, _a);
+}
+
BGFX_C_API void bgfx_set_palette_color_rgba8(uint8_t _index, uint32_t _rgba)
{
bgfx::setPaletteColor(_index, _rgba);
@@ -1280,6 +1303,9 @@ BGFX_C_API bgfx_interface_vtbl_t* bgfx_get_interface(uint32_t _version)
bgfx_vertex_layout_has,
bgfx_vertex_layout_skip,
bgfx_vertex_layout_end,
+ bgfx_vertex_layout_get_offset,
+ bgfx_vertex_layout_get_stride,
+ bgfx_vertex_layout_get_size,
bgfx_vertex_pack,
bgfx_vertex_unpack,
bgfx_vertex_convert,
@@ -1367,6 +1393,7 @@ BGFX_C_API bgfx_interface_vtbl_t* bgfx_get_interface(uint32_t _version)
bgfx_get_result,
bgfx_destroy_occlusion_query,
bgfx_set_palette_color,
+ bgfx_set_palette_color_rgba32f,
bgfx_set_palette_color_rgba8,
bgfx_set_view_name,
bgfx_set_view_rect,