From 855623e1534e9114847d8df3c2be52cb348e6493 Mon Sep 17 00:00:00 2001 From: Leandro Freire Date: Tue, 13 Aug 2019 10:04:51 +0100 Subject: [PATCH] Rename VertexDecl to VertexLayout --- bindings/cs/bgfx.cs | 112 ++++++------- examples/01-cubes/cubes.cpp | 4 +- examples/02-metaballs/metaballs.cpp | 4 +- examples/03-raymarch/raymarch.cpp | 4 +- examples/05-instancing/instancing.cpp | 4 +- examples/06-bump/bump.cpp | 4 +- examples/07-callback/callback.cpp | 4 +- examples/08-update/update.cpp | 4 +- examples/09-hdr/hdr.cpp | 4 +- examples/13-stencil/stencil.cpp | 10 +- examples/14-shadowvolumes/shadowvolumes.cpp | 18 +- .../shadowmaps_simple.cpp | 4 +- examples/16-shadowmaps/shadowmaps.cpp | 14 +- examples/17-drawstress/drawstress.cpp | 4 +- examples/18-ibl/ibl.cpp | 4 +- examples/19-oit/oit.cpp | 8 +- examples/21-deferred/deferred.cpp | 12 +- examples/22-windows/windows.cpp | 4 +- examples/23-vectordisplay/main.cpp | 4 +- examples/23-vectordisplay/vectordisplay.cpp | 2 +- examples/23-vectordisplay/vectordisplay.h | 2 +- examples/24-nbody/nbody.cpp | 4 +- examples/26-occlusion/occlusion.cpp | 4 +- examples/27-terrain/terrain.cpp | 4 +- examples/31-rsm/reflectiveshadowmap.cpp | 4 +- examples/33-pom/pom.cpp | 4 +- examples/34-mvs/mvs.cpp | 8 +- examples/35-dynamic/dynamic.cpp | 4 +- examples/36-sky/sky.cpp | 6 +- .../gpudrivenrendering.cpp | 8 +- examples/38-bloom/bloom.cpp | 8 +- examples/39-assao/assao.cpp | 4 +- examples/40-svt/svt.cpp | 4 +- examples/41-tess/tess.cpp | 4 +- examples/common/bgfx_utils.cpp | 4 +- examples/common/bgfx_utils.h | 6 +- examples/common/debugdraw/debugdraw.cpp | 16 +- examples/common/example-glue.cpp | 2 +- examples/common/font/text_buffer_manager.h | 2 +- examples/common/imgui/imgui.cpp | 2 +- examples/common/nanovg/nanovg_bgfx.cpp | 2 +- examples/common/ps/particle_system.cpp | 4 +- include/bgfx/bgfx.h | 106 ++++++------ include/bgfx/c99/bgfx.h | 158 +++++++++--------- include/bgfx/defines.h | 2 +- scripts/bgfx.idl | 128 +++++++------- scripts/bgfx.natvis | 2 +- scripts/temp.bgfx.idl.inl | 2 +- src/bgfx.cpp | 76 ++++----- src/bgfx.idl.inl | 112 ++++++------- src/bgfx_p.h | 116 ++++++------- src/renderer_d3d11.cpp | 38 ++--- src/renderer_d3d11.h | 4 +- src/renderer_d3d12.cpp | 46 ++--- src/renderer_d3d12.h | 4 +- src/renderer_d3d9.cpp | 34 ++-- src/renderer_d3d9.h | 4 +- src/renderer_gl.cpp | 20 +-- src/renderer_gl.h | 6 +- src/renderer_mtl.h | 4 +- src/renderer_mtl.mm | 32 ++-- src/renderer_noop.cpp | 6 +- src/renderer_vk.cpp | 40 ++--- src/renderer_vk.h | 4 +- src/vertexdecl.cpp | 28 ++-- src/vertexdecl.h | 4 +- tools/geometryc/geometryc.cpp | 6 +- tools/texturev/texturev.cpp | 4 +- 68 files changed, 660 insertions(+), 660 deletions(-) diff --git a/bindings/cs/bgfx.cs b/bindings/cs/bgfx.cs index 70ed06a0a..093a6982c 100644 --- a/bindings/cs/bgfx.cs +++ b/bindings/cs/bgfx.cs @@ -1907,7 +1907,7 @@ public static partial class bgfx public uint maxTextures; public uint maxTextureSamplers; public uint maxComputeBindings; - public uint maxVertexDecls; + public uint maxVertexLayouts; public uint maxVertexStreams; public uint maxIndexBuffers; public uint maxVertexBuffers; @@ -1999,7 +1999,7 @@ public static partial class bgfx public uint startVertex; public ushort stride; public VertexBufferHandle handle; - public VertexDeclHandle decl; + public VertexLayoutHandle decl; } public unsafe struct InstanceDataBuffer @@ -2086,7 +2086,7 @@ public static partial class bgfx public ushort numTextures; public ushort numUniforms; public ushort numVertexBuffers; - public ushort numVertexDecls; + public ushort numVertexLayouts; public long textureMemoryUsed; public long rtMemoryUsed; public int transientVbUsed; @@ -2104,7 +2104,7 @@ public static partial class bgfx public EncoderStats* encoderStats; } - public unsafe struct VertexDecl + public unsafe struct VertexLayout { public uint hash; public ushort stride; @@ -2138,7 +2138,7 @@ public static partial class bgfx public struct VertexBufferHandle{ public ushort idx; } - public struct VertexDeclHandle{ public ushort idx; } + public struct VertexLayoutHandle{ public ushort idx; } /// @@ -2155,14 +2155,14 @@ public static partial class bgfx public static extern unsafe void attachment_init(Attachment* _this, TextureHandle _handle, Access _access, ushort _layer, ushort _mip, byte _resolve); /// - /// Start VertexDecl. + /// Start VertexLayout. /// /// - [DllImport(DllName, EntryPoint="bgfx_vertex_decl_begin", CallingConvention = CallingConvention.Cdecl)] - public static extern unsafe VertexDecl* vertex_decl_begin(VertexDecl* _this, RendererType _rendererType); + [DllImport(DllName, EntryPoint="bgfx_vertex_layout_begin", CallingConvention = CallingConvention.Cdecl)] + public static extern unsafe VertexLayout* vertex_layout_begin(VertexLayout* _this, RendererType _rendererType); /// - /// Add attribute to VertexDecl. + /// Add attribute to VertexLayout. /// @remarks Must be called between begin/end. /// /// @@ -2172,8 +2172,8 @@ public static partial class bgfx /// When using fixed point AttribType (f.e. Uint8) value will be normalized for vertex shader usage. When normalized is set to true, AttribType::Uint8 value in range 0-255 will be in range 0.0-1.0 in vertex shader. /// Packaging rule for vertexPack, vertexUnpack, and vertexConvert for AttribType::Uint8 and AttribType::Int16. Unpacking code must be implemented inside vertex shader. /// - [DllImport(DllName, EntryPoint="bgfx_vertex_decl_add", CallingConvention = CallingConvention.Cdecl)] - public static extern unsafe VertexDecl* vertex_decl_add(VertexDecl* _this, Attrib _attrib, byte _num, AttribType _type, bool _normalized, bool _asInt); + [DllImport(DllName, EntryPoint="bgfx_vertex_layout_add", CallingConvention = CallingConvention.Cdecl)] + public static extern unsafe VertexLayout* vertex_layout_add(VertexLayout* _this, Attrib _attrib, byte _num, AttribType _type, bool _normalized, bool _asInt); /// /// Decode attribute. @@ -2185,32 +2185,32 @@ public static partial class bgfx /// Attribute is normalized. /// Attribute is packed as int. /// - [DllImport(DllName, EntryPoint="bgfx_vertex_decl_decode", CallingConvention = CallingConvention.Cdecl)] - public static extern unsafe void vertex_decl_decode(VertexDecl* _this, Attrib _attrib, byte * _num, AttribType* _type, bool* _normalized, bool* _asInt); + [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 VertexDecl contains attribute. + /// Returns true if VertexLayout contains attribute. /// /// /// Attribute semantics. See: `bgfx::Attrib` /// - [DllImport(DllName, EntryPoint="bgfx_vertex_decl_has", CallingConvention = CallingConvention.Cdecl)] + [DllImport(DllName, EntryPoint="bgfx_vertex_layout_has", CallingConvention = CallingConvention.Cdecl)] [return: MarshalAs(UnmanagedType.I1)] - public static extern unsafe bool vertex_decl_has(VertexDecl* _this, Attrib _attrib); + public static extern unsafe bool vertex_layout_has(VertexLayout* _this, Attrib _attrib); /// /// Skip `_num` bytes in vertex stream. /// /// - [DllImport(DllName, EntryPoint="bgfx_vertex_decl_skip", CallingConvention = CallingConvention.Cdecl)] - public static extern unsafe VertexDecl* vertex_decl_skip(VertexDecl* _this, byte _num); + [DllImport(DllName, EntryPoint="bgfx_vertex_layout_skip", CallingConvention = CallingConvention.Cdecl)] + public static extern unsafe VertexLayout* vertex_layout_skip(VertexLayout* _this, byte _num); /// - /// End VertexDecl. + /// End VertexLayout. /// /// - [DllImport(DllName, EntryPoint="bgfx_vertex_decl_end", CallingConvention = CallingConvention.Cdecl)] - public static extern unsafe void vertex_decl_end(VertexDecl* _this); + [DllImport(DllName, EntryPoint="bgfx_vertex_layout_end", CallingConvention = CallingConvention.Cdecl)] + public static extern unsafe void vertex_layout_end(VertexLayout* _this); /// /// Pack vertex attribute into vertex stream format. @@ -2219,12 +2219,12 @@ public static partial class bgfx /// Value to be packed into vertex stream. /// `true` if input value is already normalized. /// Attribute to pack. - /// Vertex stream declaration. + /// Vertex stream layout. /// Destination vertex stream where data will be packed. /// Vertex index that will be modified. /// [DllImport(DllName, EntryPoint="bgfx_vertex_pack", CallingConvention = CallingConvention.Cdecl)] - public static extern unsafe void vertex_pack(float _input, bool _inputNormalized, Attrib _attr, VertexDecl* _decl, void* _data, uint _index); + public static extern unsafe void vertex_pack(float _input, bool _inputNormalized, Attrib _attr, VertexLayout* _decl, void* _data, uint _index); /// /// Unpack vertex attribute from vertex stream format. @@ -2232,38 +2232,38 @@ public static partial class bgfx /// /// Result of unpacking. /// Attribute to unpack. - /// Vertex stream declaration. + /// Vertex stream layout. /// Source vertex stream from where data will be unpacked. /// Vertex index that will be unpacked. /// [DllImport(DllName, EntryPoint="bgfx_vertex_unpack", CallingConvention = CallingConvention.Cdecl)] - public static extern unsafe void vertex_unpack(float _output, Attrib _attr, VertexDecl* _decl, void* _data, uint _index); + public static extern unsafe void vertex_unpack(float _output, Attrib _attr, VertexLayout* _decl, void* _data, uint _index); /// /// Converts vertex stream data from one vertex stream format to another. /// /// - /// Destination vertex stream declaration. + /// Destination vertex stream layout. /// Destination vertex stream. - /// Source vertex stream declaration. + /// Source vertex stream layout. /// Source vertex stream data. /// Number of vertices to convert from source to destination. /// [DllImport(DllName, EntryPoint="bgfx_vertex_convert", CallingConvention = CallingConvention.Cdecl)] - public static extern unsafe void vertex_convert(VertexDecl* _dstDecl, void* _dstData, VertexDecl* _srcDecl, void* _srcData, uint _num); + public static extern unsafe void vertex_convert(VertexLayout* _dstDecl, void* _dstData, VertexLayout* _srcDecl, void* _srcData, uint _num); /// /// Weld vertices. /// /// /// Welded vertices remapping table. The size of buffer must be the same as number of vertices. - /// Vertex stream declaration. + /// Vertex stream layout. /// Vertex stream. /// Number of vertices in vertex stream. /// Error tolerance for vertex position comparison. /// [DllImport(DllName, EntryPoint="bgfx_weld_vertices", CallingConvention = CallingConvention.Cdecl)] - public static extern unsafe ushort weld_vertices(ushort* _output, VertexDecl* _decl, void* _data, ushort _num, float _epsilon); + public static extern unsafe ushort weld_vertices(ushort* _output, VertexLayout* _decl, void* _data, ushort _num, float _epsilon); /// /// Convert index buffer for use with different primitive topologies. @@ -2529,33 +2529,33 @@ public static partial class bgfx public static extern unsafe void destroy_index_buffer(IndexBufferHandle _handle); /// - /// Create vertex declaration. + /// Create vertex layout. /// /// - /// Vertex declaration. + /// Vertex layout. /// - [DllImport(DllName, EntryPoint="bgfx_create_vertex_decl", CallingConvention = CallingConvention.Cdecl)] - public static extern unsafe VertexDeclHandle create_vertex_decl(VertexDecl* _decl); + [DllImport(DllName, EntryPoint="bgfx_create_vertex_layout", CallingConvention = CallingConvention.Cdecl)] + public static extern unsafe VertexLayoutHandle create_vertex_layout(VertexLayout* _decl); /// - /// Destroy vertex declaration. + /// Destroy vertex layout. /// /// - /// Vertex declaration handle. + /// Vertex layout handle. /// [DllImport(DllName, EntryPoint="bgfx_destroy_vertex_decl", CallingConvention = CallingConvention.Cdecl)] - public static extern unsafe void destroy_vertex_decl(VertexDeclHandle _handle); + public static extern unsafe void destroy_vertex_decl(VertexLayoutHandle _handle); /// /// Create static vertex buffer. /// /// /// Vertex buffer data. - /// Vertex declaration. + /// Vertex layout. /// Buffer creation flags. - `BGFX_BUFFER_NONE` - No flags. - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader. - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU. - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader. - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of data is passed. If this flag is not specified, and more data is passed on update, the buffer will be trimmed to fit the existing buffer size. This flag has effect only on dynamic buffers. - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on index buffers. /// [DllImport(DllName, EntryPoint="bgfx_create_vertex_buffer", CallingConvention = CallingConvention.Cdecl)] - public static extern unsafe VertexBufferHandle create_vertex_buffer(Memory* _mem, VertexDecl* _decl, ushort _flags); + public static extern unsafe VertexBufferHandle create_vertex_buffer(Memory* _mem, VertexLayout* _decl, ushort _flags); /// /// Set static vertex buffer debug name. @@ -2622,22 +2622,22 @@ public static partial class bgfx /// /// /// Number of vertices. - /// Vertex declaration. + /// Vertex layout. /// Buffer creation flags. - `BGFX_BUFFER_NONE` - No flags. - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader. - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU. - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader. - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of data is passed. If this flag is not specified, and more data is passed on update, the buffer will be trimmed to fit the existing buffer size. This flag has effect only on dynamic buffers. - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on index buffers. /// [DllImport(DllName, EntryPoint="bgfx_create_dynamic_vertex_buffer", CallingConvention = CallingConvention.Cdecl)] - public static extern unsafe DynamicVertexBufferHandle create_dynamic_vertex_buffer(uint _num, VertexDecl* _decl, ushort _flags); + public static extern unsafe DynamicVertexBufferHandle create_dynamic_vertex_buffer(uint _num, VertexLayout* _decl, ushort _flags); /// /// Create dynamic vertex buffer and initialize it. /// /// /// Vertex buffer data. - /// Vertex declaration. + /// Vertex layout. /// Buffer creation flags. - `BGFX_BUFFER_NONE` - No flags. - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader. - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU. - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader. - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of data is passed. If this flag is not specified, and more data is passed on update, the buffer will be trimmed to fit the existing buffer size. This flag has effect only on dynamic buffers. - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on index buffers. /// [DllImport(DllName, EntryPoint="bgfx_create_dynamic_vertex_buffer_mem", CallingConvention = CallingConvention.Cdecl)] - public static extern unsafe DynamicVertexBufferHandle create_dynamic_vertex_buffer_mem(Memory* _mem, VertexDecl* _decl, ushort _flags); + public static extern unsafe DynamicVertexBufferHandle create_dynamic_vertex_buffer_mem(Memory* _mem, VertexLayout* _decl, ushort _flags); /// /// Update dynamic vertex buffer. @@ -2673,10 +2673,10 @@ public static partial class bgfx /// /// /// Number of required vertices. - /// Vertex declaration. + /// Vertex layout. /// [DllImport(DllName, EntryPoint="bgfx_get_avail_transient_vertex_buffer", CallingConvention = CallingConvention.Cdecl)] - public static extern unsafe uint get_avail_transient_vertex_buffer(uint _num, VertexDecl* _decl); + public static extern unsafe uint get_avail_transient_vertex_buffer(uint _num, VertexLayout* _decl); /// /// Returns number of requested or maximum available instance buffer slots. @@ -2706,10 +2706,10 @@ public static partial class bgfx /// /// TransientVertexBuffer structure is filled and is valid for the duration of frame, and it can be reused for multiple draw calls. /// Number of vertices to allocate. - /// Vertex declaration. + /// Vertex layout. /// [DllImport(DllName, EntryPoint="bgfx_alloc_transient_vertex_buffer", CallingConvention = CallingConvention.Cdecl)] - public static extern unsafe void alloc_transient_vertex_buffer(TransientVertexBuffer* _tvb, uint _num, VertexDecl* _decl); + public static extern unsafe void alloc_transient_vertex_buffer(TransientVertexBuffer* _tvb, uint _num, VertexLayout* _decl); /// /// Check for required space and allocate transient vertex and index @@ -2720,14 +2720,14 @@ public static partial class bgfx /// /// /// TransientVertexBuffer structure is filled and is valid for the duration of frame, and it can be reused for multiple draw calls. - /// Number of vertices to allocate. - /// Vertex declaration. + /// Vertex layout. + /// Number of vertices to allocate. /// TransientIndexBuffer structure is filled and is valid for the duration of frame, and it can be reused for multiple draw calls. /// Number of indices to allocate. /// [DllImport(DllName, EntryPoint="bgfx_alloc_transient_buffers", CallingConvention = CallingConvention.Cdecl)] [return: MarshalAs(UnmanagedType.I1)] - public static extern unsafe bool alloc_transient_buffers(TransientVertexBuffer* _tvb, VertexDecl* _decl, uint _numVertices, TransientIndexBuffer* _tib, uint _numIndices); + public static extern unsafe bool alloc_transient_buffers(TransientVertexBuffer* _tvb, VertexLayout* _decl, uint _numVertices, TransientIndexBuffer* _tib, uint _numIndices); /// /// Allocate instance data buffer. @@ -3536,10 +3536,10 @@ public static partial class bgfx /// Vertex buffer. /// First vertex to render. /// Number of vertices to render. - /// VertexDecl handle for aliasing vertex buffer. + /// VertexLayout handle for aliasing vertex buffer. /// [DllImport(DllName, EntryPoint="bgfx_encoder_set_vertex_buffer", CallingConvention = CallingConvention.Cdecl)] - public static extern unsafe void encoder_set_vertex_buffer(Encoder* _this, byte _stream, VertexBufferHandle _handle, uint _startVertex, uint _numVertices, VertexDeclHandle _declHandle); + public static extern unsafe void encoder_set_vertex_buffer(Encoder* _this, byte _stream, VertexBufferHandle _handle, uint _startVertex, uint _numVertices, VertexLayoutHandle _declHandle); /// /// Set vertex buffer for draw primitive. @@ -3549,10 +3549,10 @@ public static partial class bgfx /// Dynamic vertex buffer. /// First vertex to render. /// Number of vertices to render. - /// VertexDecl handle for aliasing vertex buffer. + /// VertexLayout handle for aliasing vertex buffer. /// [DllImport(DllName, EntryPoint="bgfx_encoder_set_dynamic_vertex_buffer", CallingConvention = CallingConvention.Cdecl)] - public static extern unsafe void encoder_set_dynamic_vertex_buffer(Encoder* _this, byte _stream, DynamicVertexBufferHandle _handle, uint _startVertex, uint _numVertices, VertexDeclHandle _declHandle); + public static extern unsafe void encoder_set_dynamic_vertex_buffer(Encoder* _this, byte _stream, DynamicVertexBufferHandle _handle, uint _startVertex, uint _numVertices, VertexLayoutHandle _declHandle); /// /// Set vertex buffer for draw primitive. @@ -3562,10 +3562,10 @@ public static partial class bgfx /// Transient vertex buffer. /// First vertex to render. /// Number of vertices to render. - /// VertexDecl handle for aliasing vertex buffer. + /// VertexLayout handle for aliasing vertex buffer. /// [DllImport(DllName, EntryPoint="bgfx_encoder_set_transient_vertex_buffer", CallingConvention = CallingConvention.Cdecl)] - public static extern unsafe void encoder_set_transient_vertex_buffer(Encoder* _this, byte _stream, TransientVertexBuffer* _tvb, uint _startVertex, uint _numVertices, VertexDeclHandle _declHandle); + public static extern unsafe void encoder_set_transient_vertex_buffer(Encoder* _this, byte _stream, TransientVertexBuffer* _tvb, uint _startVertex, uint _numVertices, VertexLayoutHandle _declHandle); /// /// Set number of vertices for auto generated vertices use in conjuction diff --git a/examples/01-cubes/cubes.cpp b/examples/01-cubes/cubes.cpp index 21b71384c..d1243b80a 100644 --- a/examples/01-cubes/cubes.cpp +++ b/examples/01-cubes/cubes.cpp @@ -26,10 +26,10 @@ struct PosColorVertex .end(); }; - static bgfx::VertexDecl ms_decl; + static bgfx::VertexLayout ms_decl; }; -bgfx::VertexDecl PosColorVertex::ms_decl; +bgfx::VertexLayout PosColorVertex::ms_decl; static PosColorVertex s_cubeVertices[] = { diff --git a/examples/02-metaballs/metaballs.cpp b/examples/02-metaballs/metaballs.cpp index b5215e681..2c3629e65 100644 --- a/examples/02-metaballs/metaballs.cpp +++ b/examples/02-metaballs/metaballs.cpp @@ -40,10 +40,10 @@ struct PosNormalColorVertex .end(); }; - static bgfx::VertexDecl ms_decl; + static bgfx::VertexLayout ms_decl; }; -bgfx::VertexDecl PosNormalColorVertex::ms_decl; +bgfx::VertexLayout PosNormalColorVertex::ms_decl; struct Grid { diff --git a/examples/03-raymarch/raymarch.cpp b/examples/03-raymarch/raymarch.cpp index da0f85ab5..0670e5b01 100644 --- a/examples/03-raymarch/raymarch.cpp +++ b/examples/03-raymarch/raymarch.cpp @@ -29,10 +29,10 @@ struct PosColorTexCoord0Vertex .end(); } - static bgfx::VertexDecl ms_decl; + static bgfx::VertexLayout ms_decl; }; -bgfx::VertexDecl PosColorTexCoord0Vertex::ms_decl; +bgfx::VertexLayout PosColorTexCoord0Vertex::ms_decl; void renderScreenSpaceQuad(uint8_t _view, bgfx::ProgramHandle _program, float _x, float _y, float _width, float _height) { diff --git a/examples/05-instancing/instancing.cpp b/examples/05-instancing/instancing.cpp index 4c2ad4e95..d97380002 100644 --- a/examples/05-instancing/instancing.cpp +++ b/examples/05-instancing/instancing.cpp @@ -26,10 +26,10 @@ struct PosColorVertex .end(); }; - static bgfx::VertexDecl ms_decl; + static bgfx::VertexLayout ms_decl; }; -bgfx::VertexDecl PosColorVertex::ms_decl; +bgfx::VertexLayout PosColorVertex::ms_decl; static PosColorVertex s_cubeVertices[8] = { diff --git a/examples/06-bump/bump.cpp b/examples/06-bump/bump.cpp index 04931fb69..1b4500aef 100644 --- a/examples/06-bump/bump.cpp +++ b/examples/06-bump/bump.cpp @@ -31,10 +31,10 @@ struct PosNormalTangentTexcoordVertex .end(); } - static bgfx::VertexDecl ms_decl; + static bgfx::VertexLayout ms_decl; }; -bgfx::VertexDecl PosNormalTangentTexcoordVertex::ms_decl; +bgfx::VertexLayout PosNormalTangentTexcoordVertex::ms_decl; static PosNormalTangentTexcoordVertex s_cubeVertices[24] = { diff --git a/examples/07-callback/callback.cpp b/examples/07-callback/callback.cpp index 4b14e9eae..63b7b65fd 100644 --- a/examples/07-callback/callback.cpp +++ b/examples/07-callback/callback.cpp @@ -36,10 +36,10 @@ struct PosColorVertex .end(); }; - static bgfx::VertexDecl ms_decl; + static bgfx::VertexLayout ms_decl; }; -bgfx::VertexDecl PosColorVertex::ms_decl; +bgfx::VertexLayout PosColorVertex::ms_decl; static PosColorVertex s_cubeVertices[8] = { diff --git a/examples/08-update/update.cpp b/examples/08-update/update.cpp index 0558f8aab..057e4fd3c 100644 --- a/examples/08-update/update.cpp +++ b/examples/08-update/update.cpp @@ -33,10 +33,10 @@ struct PosTexcoordVertex .end(); }; - static bgfx::VertexDecl ms_decl; + static bgfx::VertexLayout ms_decl; }; -bgfx::VertexDecl PosTexcoordVertex::ms_decl; +bgfx::VertexLayout PosTexcoordVertex::ms_decl; static PosTexcoordVertex s_cubeVertices[] = { diff --git a/examples/09-hdr/hdr.cpp b/examples/09-hdr/hdr.cpp index 88fe0c419..55281bd0e 100644 --- a/examples/09-hdr/hdr.cpp +++ b/examples/09-hdr/hdr.cpp @@ -32,10 +32,10 @@ struct PosColorTexCoord0Vertex .end(); } - static bgfx::VertexDecl ms_decl; + static bgfx::VertexLayout ms_decl; }; -bgfx::VertexDecl PosColorTexCoord0Vertex::ms_decl; +bgfx::VertexLayout PosColorTexCoord0Vertex::ms_decl; void screenSpaceQuad(float _textureWidth, float _textureHeight, bool _originBottomLeft = false, float _width = 1.0f, float _height = 1.0f) { diff --git a/examples/13-stencil/stencil.cpp b/examples/13-stencil/stencil.cpp index 2f7339019..7c5fc34e2 100644 --- a/examples/13-stencil/stencil.cpp +++ b/examples/13-stencil/stencil.cpp @@ -15,7 +15,7 @@ namespace bgfx { - int32_t read(bx::ReaderI* _reader, bgfx::VertexDecl& _decl, bx::Error* _err = NULL); + int32_t read(bx::ReaderI* _reader, bgfx::VertexLayout& _decl, bx::Error* _err = NULL); } namespace @@ -51,10 +51,10 @@ struct PosNormalTexcoordVertex .end(); } - static bgfx::VertexDecl ms_decl; + static bgfx::VertexLayout ms_decl; }; -bgfx::VertexDecl PosNormalTexcoordVertex::ms_decl; +bgfx::VertexLayout PosNormalTexcoordVertex::ms_decl; static const float s_texcoord = 5.0f; static PosNormalTexcoordVertex s_hplaneVertices[] = @@ -622,7 +622,7 @@ struct Group struct Mesh { - void load(const void* _vertices, uint32_t _numVertices, const bgfx::VertexDecl _decl, const uint16_t* _indices, uint32_t _numIndices) + void load(const void* _vertices, uint32_t _numVertices, const bgfx::VertexLayout _decl, const uint16_t* _indices, uint32_t _numIndices) { Group group; const bgfx::Memory* mem; @@ -780,7 +780,7 @@ struct Mesh } } - bgfx::VertexDecl m_decl; + bgfx::VertexLayout m_decl; typedef std::vector GroupArray; GroupArray m_groups; }; diff --git a/examples/14-shadowvolumes/shadowvolumes.cpp b/examples/14-shadowvolumes/shadowvolumes.cpp index f4578d039..3102d6c0f 100644 --- a/examples/14-shadowvolumes/shadowvolumes.cpp +++ b/examples/14-shadowvolumes/shadowvolumes.cpp @@ -26,7 +26,7 @@ namespace stl = tinystl; namespace bgfx { - int32_t read(bx::ReaderI* _reader, bgfx::VertexDecl& _decl, bx::Error* _err = NULL); + int32_t read(bx::ReaderI* _reader, bgfx::VertexLayout& _decl, bx::Error* _err = NULL); } namespace @@ -60,10 +60,10 @@ struct PosNormalTexcoordVertex .end(); } - static bgfx::VertexDecl ms_decl; + static bgfx::VertexLayout ms_decl; }; -bgfx::VertexDecl PosNormalTexcoordVertex::ms_decl; +bgfx::VertexLayout PosNormalTexcoordVertex::ms_decl; static const float s_texcoord = 50.0f; static PosNormalTexcoordVertex s_hplaneVertices[] = @@ -697,7 +697,7 @@ inline float sqLength(const float _a[3], const float _b[3]) return xx*xx + yy*yy + zz*zz; } -uint16_t weldVertices(WeldedVertex* _output, const bgfx::VertexDecl& _decl, const void* _data, uint16_t _num, float _epsilon) +uint16_t weldVertices(WeldedVertex* _output, const bgfx::VertexLayout& _decl, const void* _data, uint16_t _num, float _epsilon) { const uint32_t hashSize = bx::uint32_nextpow2(_num); const uint32_t hashMask = hashSize-1; @@ -782,7 +782,7 @@ struct Group Plane m_plane[2]; }; - void fillStructures(const bgfx::VertexDecl& _decl) + void fillStructures(const bgfx::VertexLayout& _decl) { uint16_t stride = _decl.getStride(); m_faces.clear(); @@ -933,7 +933,7 @@ typedef std::vector GroupArray; struct Mesh { - void load(const void* _vertices, uint16_t _numVertices, const bgfx::VertexDecl _decl, const uint16_t* _indices, uint32_t _numIndices) + void load(const void* _vertices, uint16_t _numVertices, const bgfx::VertexLayout _decl, const uint16_t* _indices, uint32_t _numIndices) { Group group; const bgfx::Memory* mem; @@ -1011,7 +1011,7 @@ struct Mesh m_groups.clear(); } - bgfx::VertexDecl m_decl; + bgfx::VertexLayout m_decl; GroupArray m_groups; }; @@ -1023,7 +1023,7 @@ struct Model m_texture.idx = bgfx::kInvalidHandle; } - void load(const void* _vertices, uint16_t _numVertices, const bgfx::VertexDecl _decl, const uint16_t* _indices, uint32_t _numIndices) + void load(const void* _vertices, uint16_t _numVertices, const bgfx::VertexLayout _decl, const uint16_t* _indices, uint32_t _numIndices) { m_mesh.load(_vertices, _numVertices, _decl, _indices, _numIndices); } @@ -1543,7 +1543,7 @@ void shadowVolumeCreate( } } - bgfx::VertexDecl decl; + bgfx::VertexLayout decl; decl.begin() .add(bgfx::Attrib::Position, 3, bgfx::AttribType::Float) .add(bgfx::Attrib::TexCoord0, 2, bgfx::AttribType::Float) diff --git a/examples/15-shadowmaps-simple/shadowmaps_simple.cpp b/examples/15-shadowmaps-simple/shadowmaps_simple.cpp index 05befef3c..51d800423 100644 --- a/examples/15-shadowmaps-simple/shadowmaps_simple.cpp +++ b/examples/15-shadowmaps-simple/shadowmaps_simple.cpp @@ -39,10 +39,10 @@ struct PosNormalVertex .end(); }; - static bgfx::VertexDecl ms_decl; + static bgfx::VertexLayout ms_decl; }; -bgfx::VertexDecl PosNormalVertex::ms_decl; +bgfx::VertexLayout PosNormalVertex::ms_decl; static PosNormalVertex s_hplaneVertices[] = { diff --git a/examples/16-shadowmaps/shadowmaps.cpp b/examples/16-shadowmaps/shadowmaps.cpp index 31cdb9610..f2d158574 100644 --- a/examples/16-shadowmaps/shadowmaps.cpp +++ b/examples/16-shadowmaps/shadowmaps.cpp @@ -20,7 +20,7 @@ namespace bgfx { - int32_t read(bx::ReaderI* _reader, bgfx::VertexDecl& _decl, bx::Error* _err = NULL); + int32_t read(bx::ReaderI* _reader, bgfx::VertexLayout& _decl, bx::Error* _err = NULL); } namespace @@ -812,7 +812,7 @@ struct Group struct Mesh { - void load(const void* _vertices, uint32_t _numVertices, const bgfx::VertexDecl _decl, const uint16_t* _indices, uint32_t _numIndices) + void load(const void* _vertices, uint32_t _numVertices, const bgfx::VertexLayout _decl, const uint16_t* _indices, uint32_t _numIndices) { Group group; const bgfx::Memory* mem; @@ -977,7 +977,7 @@ struct Mesh } } - bgfx::VertexDecl m_decl; + bgfx::VertexLayout m_decl; typedef std::vector GroupArray; GroupArray m_groups; }; @@ -1001,10 +1001,10 @@ struct PosColorTexCoord0Vertex .end(); } - static bgfx::VertexDecl ms_decl; + static bgfx::VertexLayout ms_decl; }; -bgfx::VertexDecl PosColorTexCoord0Vertex::ms_decl; +bgfx::VertexLayout PosColorTexCoord0Vertex::ms_decl; void screenSpaceQuad(float _textureWidth, float _textureHeight, bool _originBottomLeft = true, float _width = 1.0f, float _height = 1.0f) { @@ -1344,7 +1344,7 @@ public: s_programs.init(); // Vertex declarations. - bgfx::VertexDecl PosNormalTexcoordDecl; + bgfx::VertexLayout PosNormalTexcoordDecl; PosNormalTexcoordDecl.begin() .add(bgfx::Attrib::Position, 3, bgfx::AttribType::Float) .add(bgfx::Attrib::Normal, 4, bgfx::AttribType::Uint8, true, true) @@ -3219,7 +3219,7 @@ public: ViewState m_viewState; ClearValues m_clearValues; - bgfx::VertexDecl m_posDecl; + bgfx::VertexLayout m_posDecl; bgfx::TextureHandle m_texFigure; bgfx::TextureHandle m_texFlare; diff --git a/examples/17-drawstress/drawstress.cpp b/examples/17-drawstress/drawstress.cpp index 29aba9b9e..0a4f3356d 100644 --- a/examples/17-drawstress/drawstress.cpp +++ b/examples/17-drawstress/drawstress.cpp @@ -44,10 +44,10 @@ struct PosColorVertex .end(); } - static bgfx::VertexDecl ms_decl; + static bgfx::VertexLayout ms_decl; }; -bgfx::VertexDecl PosColorVertex::ms_decl; +bgfx::VertexLayout PosColorVertex::ms_decl; static PosColorVertex s_cubeVertices[8] = { diff --git a/examples/18-ibl/ibl.cpp b/examples/18-ibl/ibl.cpp index 1293f0f22..f34f5acfe 100644 --- a/examples/18-ibl/ibl.cpp +++ b/examples/18-ibl/ibl.cpp @@ -85,10 +85,10 @@ struct PosColorTexCoord0Vertex .end(); } - static bgfx::VertexDecl ms_decl; + static bgfx::VertexLayout ms_decl; }; -bgfx::VertexDecl PosColorTexCoord0Vertex::ms_decl; +bgfx::VertexLayout PosColorTexCoord0Vertex::ms_decl; void screenSpaceQuad(float _textureWidth, float _textureHeight, bool _originBottomLeft = false, float _width = 1.0f, float _height = 1.0f) { diff --git a/examples/19-oit/oit.cpp b/examples/19-oit/oit.cpp index 7182766e6..6169e7a94 100644 --- a/examples/19-oit/oit.cpp +++ b/examples/19-oit/oit.cpp @@ -26,10 +26,10 @@ struct PosColorVertex .end(); } - static bgfx::VertexDecl ms_decl; + static bgfx::VertexLayout ms_decl; }; -bgfx::VertexDecl PosColorVertex::ms_decl; +bgfx::VertexLayout PosColorVertex::ms_decl; struct PosColorTexCoord0Vertex { @@ -50,10 +50,10 @@ struct PosColorTexCoord0Vertex .end(); } - static bgfx::VertexDecl ms_decl; + static bgfx::VertexLayout ms_decl; }; -bgfx::VertexDecl PosColorTexCoord0Vertex::ms_decl; +bgfx::VertexLayout PosColorTexCoord0Vertex::ms_decl; static PosColorVertex s_cubeVertices[8] = { diff --git a/examples/21-deferred/deferred.cpp b/examples/21-deferred/deferred.cpp index 5727fc8d7..7478429e9 100644 --- a/examples/21-deferred/deferred.cpp +++ b/examples/21-deferred/deferred.cpp @@ -41,10 +41,10 @@ struct PosNormalTangentTexcoordVertex .end(); } - static bgfx::VertexDecl ms_decl; + static bgfx::VertexLayout ms_decl; }; -bgfx::VertexDecl PosNormalTangentTexcoordVertex::ms_decl; +bgfx::VertexLayout PosNormalTangentTexcoordVertex::ms_decl; struct PosTexCoord0Vertex { @@ -63,10 +63,10 @@ struct PosTexCoord0Vertex .end(); } - static bgfx::VertexDecl ms_decl; + static bgfx::VertexLayout ms_decl; }; -bgfx::VertexDecl PosTexCoord0Vertex::ms_decl; +bgfx::VertexLayout PosTexCoord0Vertex::ms_decl; struct DebugVertex { @@ -84,10 +84,10 @@ struct DebugVertex .end(); } - static bgfx::VertexDecl ms_decl; + static bgfx::VertexLayout ms_decl; }; -bgfx::VertexDecl DebugVertex::ms_decl; +bgfx::VertexLayout DebugVertex::ms_decl; static PosNormalTangentTexcoordVertex s_cubeVertices[24] = { diff --git a/examples/22-windows/windows.cpp b/examples/22-windows/windows.cpp index 9b3a32048..97bd991a0 100644 --- a/examples/22-windows/windows.cpp +++ b/examples/22-windows/windows.cpp @@ -33,10 +33,10 @@ struct PosColorVertex .end(); }; - static bgfx::VertexDecl ms_decl; + static bgfx::VertexLayout ms_decl; }; -bgfx::VertexDecl PosColorVertex::ms_decl; +bgfx::VertexLayout PosColorVertex::ms_decl; static PosColorVertex s_cubeVertices[8] = { diff --git a/examples/23-vectordisplay/main.cpp b/examples/23-vectordisplay/main.cpp index badeeccff..f55389b0d 100644 --- a/examples/23-vectordisplay/main.cpp +++ b/examples/23-vectordisplay/main.cpp @@ -29,10 +29,10 @@ struct PosColorVertex .end(); } - static bgfx::VertexDecl ms_decl; + static bgfx::VertexLayout ms_decl; }; -bgfx::VertexDecl PosColorVertex::ms_decl; +bgfx::VertexLayout PosColorVertex::ms_decl; class ExampleVectorDisplay : public entry::AppI { diff --git a/examples/23-vectordisplay/vectordisplay.cpp b/examples/23-vectordisplay/vectordisplay.cpp index 38eb61ad2..debdb14e6 100644 --- a/examples/23-vectordisplay/vectordisplay.cpp +++ b/examples/23-vectordisplay/vectordisplay.cpp @@ -43,7 +43,7 @@ void PosColorUvVertex::init() .end(); } -bgfx::VertexDecl PosColorUvVertex::ms_decl; +bgfx::VertexLayout PosColorUvVertex::ms_decl; inline float normalizef(float _a) { diff --git a/examples/23-vectordisplay/vectordisplay.h b/examples/23-vectordisplay/vectordisplay.h index 4577894d2..8f04aedf2 100644 --- a/examples/23-vectordisplay/vectordisplay.h +++ b/examples/23-vectordisplay/vectordisplay.h @@ -22,7 +22,7 @@ struct PosColorUvVertex uint32_t m_abgr; static void init(); - static bgfx::VertexDecl ms_decl; + static bgfx::VertexLayout ms_decl; }; class VectorDisplay diff --git a/examples/24-nbody/nbody.cpp b/examples/24-nbody/nbody.cpp index 416e19a94..e977c299d 100644 --- a/examples/24-nbody/nbody.cpp +++ b/examples/24-nbody/nbody.cpp @@ -154,7 +154,7 @@ public: if (m_computeSupported) { - bgfx::VertexDecl quadVertexDecl; + bgfx::VertexLayout quadVertexDecl; quadVertexDecl.begin() .add(bgfx::Attrib::Position, 2, bgfx::AttribType::Float) .end(); @@ -176,7 +176,7 @@ public: m_particleProgram = loadProgram("vs_particle", "fs_particle"); // Setup compute buffers - bgfx::VertexDecl computeVertexDecl; + bgfx::VertexLayout computeVertexDecl; computeVertexDecl.begin() .add(bgfx::Attrib::TexCoord0, 4, bgfx::AttribType::Float) .end(); diff --git a/examples/26-occlusion/occlusion.cpp b/examples/26-occlusion/occlusion.cpp index 14040b0dc..af249048e 100644 --- a/examples/26-occlusion/occlusion.cpp +++ b/examples/26-occlusion/occlusion.cpp @@ -29,10 +29,10 @@ struct PosColorVertex .end(); }; - static bgfx::VertexDecl ms_decl; + static bgfx::VertexLayout ms_decl; }; -bgfx::VertexDecl PosColorVertex::ms_decl; +bgfx::VertexLayout PosColorVertex::ms_decl; static PosColorVertex s_cubeVertices[8] = { diff --git a/examples/27-terrain/terrain.cpp b/examples/27-terrain/terrain.cpp index 8fc60a6c4..f23460089 100644 --- a/examples/27-terrain/terrain.cpp +++ b/examples/27-terrain/terrain.cpp @@ -34,10 +34,10 @@ struct PosTexCoord0Vertex .end(); } - static bgfx::VertexDecl ms_decl; + static bgfx::VertexLayout ms_decl; }; -bgfx::VertexDecl PosTexCoord0Vertex::ms_decl; +bgfx::VertexLayout PosTexCoord0Vertex::ms_decl; struct TerrainData { diff --git a/examples/31-rsm/reflectiveshadowmap.cpp b/examples/31-rsm/reflectiveshadowmap.cpp index 8bc4c5d33..5b2eb36a7 100644 --- a/examples/31-rsm/reflectiveshadowmap.cpp +++ b/examples/31-rsm/reflectiveshadowmap.cpp @@ -123,9 +123,9 @@ struct PosTexCoord0Vertex .end(); } - static bgfx::VertexDecl ms_decl; + static bgfx::VertexLayout ms_decl; }; -bgfx::VertexDecl PosTexCoord0Vertex::ms_decl; +bgfx::VertexLayout PosTexCoord0Vertex::ms_decl; // Utility function to draw a screen space quad for deferred rendering void screenSpaceQuad(float _textureWidth, float _textureHeight, float _texelHalf, bool _originBottomLeft, float _width = 1.0f, float _height = 1.0f) diff --git a/examples/33-pom/pom.cpp b/examples/33-pom/pom.cpp index 4309e49b4..be0ced4be 100644 --- a/examples/33-pom/pom.cpp +++ b/examples/33-pom/pom.cpp @@ -32,10 +32,10 @@ struct PosTangentBitangentTexcoordVertex .end(); } - static bgfx::VertexDecl ms_decl; + static bgfx::VertexLayout ms_decl; }; -bgfx::VertexDecl PosTangentBitangentTexcoordVertex::ms_decl; +bgfx::VertexLayout PosTangentBitangentTexcoordVertex::ms_decl; uint32_t packUint32(uint8_t _x, uint8_t _y, uint8_t _z, uint8_t _w) { diff --git a/examples/34-mvs/mvs.cpp b/examples/34-mvs/mvs.cpp index c5c918f05..7d5c85422 100644 --- a/examples/34-mvs/mvs.cpp +++ b/examples/34-mvs/mvs.cpp @@ -24,10 +24,10 @@ struct PosVertex .end(); }; - static bgfx::VertexDecl ms_decl; + static bgfx::VertexLayout ms_decl; }; -bgfx::VertexDecl PosVertex::ms_decl; +bgfx::VertexLayout PosVertex::ms_decl; struct ColorVertex { @@ -41,10 +41,10 @@ struct ColorVertex .end(); }; - static bgfx::VertexDecl ms_decl; + static bgfx::VertexLayout ms_decl; }; -bgfx::VertexDecl ColorVertex::ms_decl; +bgfx::VertexLayout ColorVertex::ms_decl; static PosVertex s_cubePosVertices[] = { diff --git a/examples/35-dynamic/dynamic.cpp b/examples/35-dynamic/dynamic.cpp index 1c4963eb7..da9c581de 100644 --- a/examples/35-dynamic/dynamic.cpp +++ b/examples/35-dynamic/dynamic.cpp @@ -31,10 +31,10 @@ struct PosColorVertex .end(); }; - static bgfx::VertexDecl ms_decl; + static bgfx::VertexLayout ms_decl; }; -bgfx::VertexDecl PosColorVertex::ms_decl; +bgfx::VertexLayout PosColorVertex::ms_decl; static PosColorVertex s_cubeVertices[] = { diff --git a/examples/36-sky/sky.cpp b/examples/36-sky/sky.cpp index 7e78f3bdd..4f3d9c8ea 100644 --- a/examples/36-sky/sky.cpp +++ b/examples/36-sky/sky.cpp @@ -1,4 +1,4 @@ -/* +/* * Copyright 2017 Stanislav Pidhorskyi. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -310,10 +310,10 @@ namespace .end(); } - static bgfx::VertexDecl ms_decl; + static bgfx::VertexLayout ms_decl; }; - bgfx::VertexDecl ScreenPosVertex::ms_decl; + bgfx::VertexLayout ScreenPosVertex::ms_decl; // Renders a screen-space grid of triangles. // Because of performance reasons, and because sky color is smooth, sky color is computed in vertex shader. diff --git a/examples/37-gpudrivenrendering/gpudrivenrendering.cpp b/examples/37-gpudrivenrendering/gpudrivenrendering.cpp index ec7b2f247..58d8fd6a8 100644 --- a/examples/37-gpudrivenrendering/gpudrivenrendering.cpp +++ b/examples/37-gpudrivenrendering/gpudrivenrendering.cpp @@ -199,10 +199,10 @@ struct PosVertex .end(); }; - static bgfx::VertexDecl ms_decl; + static bgfx::VertexLayout ms_decl; }; -bgfx::VertexDecl PosVertex::ms_decl; +bgfx::VertexLayout PosVertex::ms_decl; static PosVertex s_cubeVertices[8] = { @@ -528,7 +528,7 @@ public: //bounding box for each instance, will be fed to the compute shader to calculate occlusion { - bgfx::VertexDecl computeVertexDecl; + bgfx::VertexLayout computeVertexDecl; computeVertexDecl.begin() .add(bgfx::Attrib::TexCoord0, 4, bgfx::AttribType::Float) .end(); @@ -562,7 +562,7 @@ public: //pre and post occlusion culling instance data buffers { - bgfx::VertexDecl instanceBufferVertexDecl; + bgfx::VertexLayout instanceBufferVertexDecl; instanceBufferVertexDecl.begin() .add(bgfx::Attrib::TexCoord0, 4, bgfx::AttribType::Float) .add(bgfx::Attrib::TexCoord1, 4, bgfx::AttribType::Float) diff --git a/examples/38-bloom/bloom.cpp b/examples/38-bloom/bloom.cpp index f87dda9bd..53562fe64 100644 --- a/examples/38-bloom/bloom.cpp +++ b/examples/38-bloom/bloom.cpp @@ -49,10 +49,10 @@ struct PosVertex .end(); } - static bgfx::VertexDecl ms_decl; + static bgfx::VertexLayout ms_decl; }; -bgfx::VertexDecl PosVertex::ms_decl; +bgfx::VertexLayout PosVertex::ms_decl; struct PosTexCoord0Vertex { @@ -71,10 +71,10 @@ struct PosTexCoord0Vertex .end(); } - static bgfx::VertexDecl ms_decl; + static bgfx::VertexLayout ms_decl; }; -bgfx::VertexDecl PosTexCoord0Vertex::ms_decl; +bgfx::VertexLayout PosTexCoord0Vertex::ms_decl; constexpr float cs = 0.29f; diff --git a/examples/39-assao/assao.cpp b/examples/39-assao/assao.cpp index fe9e9fe59..16b4d8b4e 100644 --- a/examples/39-assao/assao.cpp +++ b/examples/39-assao/assao.cpp @@ -78,10 +78,10 @@ namespace .end(); } - static bgfx::VertexDecl ms_decl; + static bgfx::VertexLayout ms_decl; }; - bgfx::VertexDecl PosTexCoord0Vertex::ms_decl; + bgfx::VertexLayout PosTexCoord0Vertex::ms_decl; // Utility function to draw a screen space quad for deferred rendering void screenSpaceQuad(float _textureWidth, float _textureHeight, float _texelHalf, bool _originBottomLeft, float _width = 1.0f, float _height = 1.0f) diff --git a/examples/40-svt/svt.cpp b/examples/40-svt/svt.cpp index 425637186..9bf33c64c 100644 --- a/examples/40-svt/svt.cpp +++ b/examples/40-svt/svt.cpp @@ -40,10 +40,10 @@ struct PosTexcoordVertex .end(); }; - static bgfx::VertexDecl ms_decl; + static bgfx::VertexLayout ms_decl; }; -bgfx::VertexDecl PosTexcoordVertex::ms_decl; +bgfx::VertexLayout PosTexcoordVertex::ms_decl; static const float s_planeScale = 50.0f; diff --git a/examples/41-tess/tess.cpp b/examples/41-tess/tess.cpp index cc5f0702a..214dd2adf 100644 --- a/examples/41-tess/tess.cpp +++ b/examples/41-tess/tess.cpp @@ -872,11 +872,11 @@ namespace bgfx::IndexBufferHandle m_geometryIndices; bgfx::VertexBufferHandle m_geometryVertices; - bgfx::VertexDecl m_geometryDecl; + bgfx::VertexLayout m_geometryDecl; bgfx::IndexBufferHandle m_instancedGeometryIndices; bgfx::VertexBufferHandle m_instancedGeometryVertices; - bgfx::VertexDecl m_instancedGeometryDecl; + bgfx::VertexLayout m_instancedGeometryDecl; bgfx::IndirectBufferHandle m_dispatchIndirect; diff --git a/examples/common/bgfx_utils.cpp b/examples/common/bgfx_utils.cpp index 0b31d4722..9b9a72d3a 100644 --- a/examples/common/bgfx_utils.cpp +++ b/examples/common/bgfx_utils.cpp @@ -258,7 +258,7 @@ bimg::ImageContainer* imageLoad(const char* _filePath, bgfx::TextureFormat::Enum return bimg::imageParse(entry::getAllocator(), data, size, bimg::TextureFormat::Enum(_dstFormat) ); } -void calcTangents(void* _vertices, uint16_t _numVertices, bgfx::VertexDecl _decl, const uint16_t* _indices, uint32_t _numIndices) +void calcTangents(void* _vertices, uint16_t _numVertices, bgfx::VertexLayout _decl, const uint16_t* _indices, uint32_t _numIndices) { struct PosTexcoord { @@ -375,7 +375,7 @@ void Group::reset() namespace bgfx { - int32_t read(bx::ReaderI* _reader, bgfx::VertexDecl& _decl, bx::Error* _err = NULL); + int32_t read(bx::ReaderI* _reader, bgfx::VertexLayout& _decl, bx::Error* _err = NULL); } void Mesh::load(bx::ReaderSeekerI* _reader, bool _ramcopy) diff --git a/examples/common/bgfx_utils.h b/examples/common/bgfx_utils.h index f12cc6f1b..8b43b8060 100644 --- a/examples/common/bgfx_utils.h +++ b/examples/common/bgfx_utils.h @@ -35,7 +35,7 @@ bgfx::TextureHandle loadTexture(const char* _name, uint64_t _flags = BGFX_TEXTUR bimg::ImageContainer* imageLoad(const char* _filePath, bgfx::TextureFormat::Enum _dstFormat); /// -void calcTangents(void* _vertices, uint16_t _numVertices, bgfx::VertexDecl _decl, const uint16_t* _indices, uint32_t _numIndices); +void calcTangents(void* _vertices, uint16_t _numVertices, bgfx::VertexLayout _decl, const uint16_t* _indices, uint32_t _numIndices); /// Returns true if both internal transient index and vertex buffer have /// enough space. @@ -44,7 +44,7 @@ void calcTangents(void* _vertices, uint16_t _numVertices, bgfx::VertexDecl _decl /// @param[in] _decl Vertex declaration. /// @param[in] _numIndices Number of indices. /// -inline bool checkAvailTransientBuffers(uint32_t _numVertices, const bgfx::VertexDecl& _decl, uint32_t _numIndices) +inline bool checkAvailTransientBuffers(uint32_t _numVertices, const bgfx::VertexLayout& _decl, uint32_t _numIndices) { return _numVertices == bgfx::getAvailTransientVertexBuffer(_numVertices, _decl) && (0 == _numIndices || _numIndices == bgfx::getAvailTransientIndexBuffer(_numIndices) ) @@ -123,7 +123,7 @@ struct Mesh void submit(bgfx::ViewId _id, bgfx::ProgramHandle _program, const float* _mtx, uint64_t _state) const; void submit(const MeshState*const* _state, uint8_t _numPasses, const float* _mtx, uint16_t _numMatrices) const; - bgfx::VertexDecl m_decl; + bgfx::VertexLayout m_decl; GroupArray m_groups; }; diff --git a/examples/common/debugdraw/debugdraw.cpp b/examples/common/debugdraw/debugdraw.cpp index 4f24dd9e0..f2db4f1cb 100644 --- a/examples/common/debugdraw/debugdraw.cpp +++ b/examples/common/debugdraw/debugdraw.cpp @@ -37,10 +37,10 @@ struct DebugVertex .end(); } - static bgfx::VertexDecl ms_decl; + static bgfx::VertexLayout ms_decl; }; -bgfx::VertexDecl DebugVertex::ms_decl; +bgfx::VertexLayout DebugVertex::ms_decl; struct DebugUvVertex { @@ -61,10 +61,10 @@ struct DebugUvVertex .end(); } - static bgfx::VertexDecl ms_decl; + static bgfx::VertexLayout ms_decl; }; -bgfx::VertexDecl DebugUvVertex::ms_decl; +bgfx::VertexLayout DebugUvVertex::ms_decl; struct DebugShapeVertex { @@ -82,10 +82,10 @@ struct DebugShapeVertex .end(); } - static bgfx::VertexDecl ms_decl; + static bgfx::VertexLayout ms_decl; }; -bgfx::VertexDecl DebugShapeVertex::ms_decl; +bgfx::VertexLayout DebugShapeVertex::ms_decl; struct DebugMeshVertex { @@ -101,10 +101,10 @@ struct DebugMeshVertex .end(); } - static bgfx::VertexDecl ms_decl; + static bgfx::VertexLayout ms_decl; }; -bgfx::VertexDecl DebugMeshVertex::ms_decl; +bgfx::VertexLayout DebugMeshVertex::ms_decl; static DebugShapeVertex s_quadVertices[4] = { diff --git a/examples/common/example-glue.cpp b/examples/common/example-glue.cpp index ab273eab2..214b54fd7 100644 --- a/examples/common/example-glue.cpp +++ b/examples/common/example-glue.cpp @@ -350,7 +350,7 @@ void showExampleDialog(entry::AppI* _app, const char* _errorText) resourceBar(" T", "Textures", stats->numTextures, caps->limits.maxTextures, maxWidth, itemHeight); resourceBar(" U", "Uniforms", stats->numUniforms, caps->limits.maxUniforms, maxWidth, itemHeight); resourceBar(" VB", "Vertex buffers", stats->numVertexBuffers, caps->limits.maxVertexBuffers, maxWidth, itemHeight); - resourceBar(" VD", "Vertex declarations", stats->numVertexDecls, caps->limits.maxVertexDecls, maxWidth, itemHeight); + resourceBar(" VD", "Vertex declarations", stats->numVertexLayouts, caps->limits.maxVertexLayouts, maxWidth, itemHeight); ImGui::PopFont(); } diff --git a/examples/common/font/text_buffer_manager.h b/examples/common/font/text_buffer_manager.h index 788fba800..5baf2ef9a 100644 --- a/examples/common/font/text_buffer_manager.h +++ b/examples/common/font/text_buffer_manager.h @@ -87,7 +87,7 @@ private: BufferCache* m_textBuffers; bx::HandleAllocT m_textBufferHandles; FontManager* m_fontManager; - bgfx::VertexDecl m_vertexDecl; + bgfx::VertexLayout m_vertexDecl; bgfx::UniformHandle s_texColor; bgfx::ProgramHandle m_basicProgram; bgfx::ProgramHandle m_distanceProgram; diff --git a/examples/common/imgui/imgui.cpp b/examples/common/imgui/imgui.cpp index 9017968fc..4978ad5fb 100644 --- a/examples/common/imgui/imgui.cpp +++ b/examples/common/imgui/imgui.cpp @@ -391,7 +391,7 @@ struct OcornutImguiContext ImGuiContext* m_imgui; bx::AllocatorI* m_allocator; - bgfx::VertexDecl m_decl; + bgfx::VertexLayout m_decl; bgfx::ProgramHandle m_program; bgfx::ProgramHandle m_imageProgram; bgfx::TextureHandle m_texture; diff --git a/examples/common/nanovg/nanovg_bgfx.cpp b/examples/common/nanovg/nanovg_bgfx.cpp index 858c1500f..e4cc54b07 100644 --- a/examples/common/nanovg/nanovg_bgfx.cpp +++ b/examples/common/nanovg/nanovg_bgfx.cpp @@ -48,7 +48,7 @@ static const bgfx::EmbeddedShader s_embeddedShaders[] = namespace { - static bgfx::VertexDecl s_nvgDecl; + static bgfx::VertexLayout s_nvgDecl; enum GLNVGshaderType { diff --git a/examples/common/ps/particle_system.cpp b/examples/common/ps/particle_system.cpp index 1ce0c2817..bf38c657e 100644 --- a/examples/common/ps/particle_system.cpp +++ b/examples/common/ps/particle_system.cpp @@ -45,10 +45,10 @@ struct PosColorTexCoord0Vertex .end(); } - static bgfx::VertexDecl ms_decl; + static bgfx::VertexLayout ms_decl; }; -bgfx::VertexDecl PosColorTexCoord0Vertex::ms_decl; +bgfx::VertexLayout PosColorTexCoord0Vertex::ms_decl; void EmitterUniforms::reset() { diff --git a/include/bgfx/bgfx.h b/include/bgfx/bgfx.h index edde47edf..ba4a8fd68 100644 --- a/include/bgfx/bgfx.h +++ b/include/bgfx/bgfx.h @@ -403,7 +403,7 @@ namespace bgfx BGFX_HANDLE(TextureHandle) BGFX_HANDLE(UniformHandle) BGFX_HANDLE(VertexBufferHandle) - BGFX_HANDLE(VertexDeclHandle) + BGFX_HANDLE(VertexLayoutHandle) /// Callback interface to implement application specific behavior. /// Cached items are currently used for OpenGL and Direct3D 12 binary @@ -754,7 +754,7 @@ namespace bgfx uint32_t maxTextures; //!< Maximum number of texture handles. uint32_t maxTextureSamplers; //!< Maximum number of texture samplers. uint32_t maxComputeBindings; //!< Maximum number of compute bindings. - uint32_t maxVertexDecls; //!< Maximum number of vertex format declarations. + uint32_t maxVertexLayouts; //!< Maximum number of vertex format layouts. uint32_t maxVertexStreams; //!< Maximum number of vertex streams. uint32_t maxIndexBuffers; //!< Maximum number of index buffer handles. uint32_t maxVertexBuffers; //!< Maximum number of vertex buffer handles. @@ -816,7 +816,7 @@ namespace bgfx uint32_t startVertex; //!< First vertex. uint16_t stride; //!< Vertex stride. VertexBufferHandle handle; //!< Vertex buffer handle. - VertexDeclHandle decl; //!< Vertex declaration handle. + VertexLayoutHandle decl; //!< Vertex layout handle. }; /// Instance data buffer info. @@ -961,7 +961,7 @@ namespace bgfx uint16_t numTextures; //!< Number of used textures. uint16_t numUniforms; //!< Number of used uniforms. uint16_t numVertexBuffers; //!< Number of used vertex buffers. - uint16_t numVertexDecls; //!< Number of used vertex declarations. + uint16_t numVertexLayouts; //!< Number of used vertex layouts. int64_t textureMemoryUsed; //!< Estimate of texture memory used. int64_t rtMemoryUsed; //!< Estimate of render target memory used. @@ -1225,7 +1225,7 @@ namespace bgfx /// @param[in] _handle Vertex buffer. /// @param[in] _startVertex First vertex to render. /// @param[in] _numVertices Number of vertices to render. - /// @param[in] _declHandle VertexDecl handle for aliasing vertex buffer. + /// @param[in] _declHandle VertexLayout handle for aliasing vertex buffer. /// /// @attention C99 equivalent is `bgfx_encoder_set_vertex_buffer`. /// @@ -1234,7 +1234,7 @@ namespace bgfx , VertexBufferHandle _handle , uint32_t _startVertex , uint32_t _numVertices - , VertexDeclHandle _declHandle = BGFX_INVALID_HANDLE + , VertexLayoutHandle _declHandle = BGFX_INVALID_HANDLE ); /// Set vertex buffer for draw primitive. @@ -1255,7 +1255,7 @@ namespace bgfx /// @param[in] _handle Dynamic vertex buffer. /// @param[in] _startVertex First vertex to render. /// @param[in] _numVertices Number of vertices to render. - /// @param[in] _declHandle VertexDecl handle for aliasing vertex buffer. + /// @param[in] _declHandle VertexLayout handle for aliasing vertex buffer. /// /// @attention C99 equivalent is `bgfx_encoder_set_dynamic_vertex_buffer`. /// @@ -1264,7 +1264,7 @@ namespace bgfx , DynamicVertexBufferHandle _handle , uint32_t _startVertex , uint32_t _numVertices - , VertexDeclHandle _declHandle = BGFX_INVALID_HANDLE + , VertexLayoutHandle _declHandle = BGFX_INVALID_HANDLE ); /// Set vertex buffer for draw primitive. @@ -1285,7 +1285,7 @@ namespace bgfx /// @param[in] _tvb Transient vertex buffer. /// @param[in] _startVertex First vertex to render. /// @param[in] _numVertices Number of vertices to render. - /// @param[in] _declHandle VertexDecl handle for aliasing vertex buffer. + /// @param[in] _declHandle VertexLayout handle for aliasing vertex buffer. /// /// @attention C99 equivalent is `bgfx_encoder_set_transient_vertex_buffer`. /// @@ -1294,7 +1294,7 @@ namespace bgfx , const TransientVertexBuffer* _tvb , uint32_t _startVertex , uint32_t _numVertices - , VertexDeclHandle _declHandle = BGFX_INVALID_HANDLE + , VertexLayoutHandle _declHandle = BGFX_INVALID_HANDLE ); /// Set number of vertices for auto generated vertices use in conjuction @@ -1662,27 +1662,27 @@ namespace bgfx ); }; - /// Vertex declaration. + /// Vertex layout. /// /// @attention C99 equivalent is `bgfx_vertex_decl_t`. /// - struct VertexDecl + struct VertexLayout { - VertexDecl(); + VertexLayout(); - /// Start VertexDecl. + /// Start VertexLayout. /// /// @attention C99 equivalent is `bgfx_vertex_decl_begin`. /// - VertexDecl& begin(RendererType::Enum _renderer = RendererType::Noop); + VertexLayout& begin(RendererType::Enum _renderer = RendererType::Noop); - /// End VertexDecl. + /// End VertexLayout. /// /// @attention C99 equivalent is `bgfx_vertex_decl_end`. /// void end(); - /// Add attribute to VertexDecl. + /// Add attribute to VertexLayout. /// /// @param[in] _attrib Attribute semantics. See: `bgfx::Attrib` /// @param[in] _num Number of elements 1, 2, 3 or 4. @@ -1700,7 +1700,7 @@ namespace bgfx /// /// @attention C99 equivalent is `bgfx_vertex_decl_add`. /// - VertexDecl& add( + VertexLayout& add( Attrib::Enum _attrib , uint8_t _num , AttribType::Enum _type @@ -1712,7 +1712,7 @@ namespace bgfx /// /// @attention C99 equivalent is `bgfx_vertex_decl_skip`. /// - VertexDecl& skip(uint8_t _num); + VertexLayout& skip(uint8_t _num); /// Decode attribute. /// @@ -1726,7 +1726,7 @@ namespace bgfx , bool& _asInt ) const; - /// Returns true if VertexDecl contains attribute. + /// Returns true if VertexLayout contains attribute. /// /// @attention C99 equivalent is `bgfx_vertex_decl_has`. /// @@ -1752,7 +1752,7 @@ namespace bgfx /// @param[in] _input Value to be packed into vertex stream. /// @param[in] _inputNormalized True if input value is already normalized. /// @param[in] _attr Attribute to pack. - /// @param[in] _decl Vertex stream declaration. + /// @param[in] _decl Vertex stream layout. /// @param[in] _data Destination vertex stream where data will be packed. /// @param[in] _index Vertex index that will be modified. /// @@ -1762,7 +1762,7 @@ namespace bgfx const float _input[4] , bool _inputNormalized , Attrib::Enum _attr - , const VertexDecl& _decl + , const VertexLayout& _decl , void* _data , uint32_t _index = 0 ); @@ -1771,7 +1771,7 @@ namespace bgfx /// /// @param[out] _output Result of unpacking. /// @param[in] _attr Attribute to unpack. - /// @param[in] _decl Vertex stream declaration. + /// @param[in] _decl Vertex stream layout. /// @param[in] _data Source vertex stream from where data will be unpacked. /// @param[in] _index Vertex index that will be unpacked. /// @@ -1780,25 +1780,25 @@ namespace bgfx void vertexUnpack( float _output[4] , Attrib::Enum _attr - , const VertexDecl& _decl + , const VertexLayout& _decl , const void* _data , uint32_t _index = 0 ); /// Converts vertex stream data from one vertex stream format to another. /// - /// @param[in] _destDecl Destination vertex stream declaration. + /// @param[in] _destDecl Destination vertex stream layout. /// @param[in] _destData Destination vertex stream. - /// @param[in] _srcDecl Source vertex stream declaration. + /// @param[in] _srcDecl Source vertex stream layout. /// @param[in] _srcData Source vertex stream data. /// @param[in] _num Number of vertices to convert from source to destination. /// /// @attention C99 equivalent is `bgfx_vertex_convert`. /// void vertexConvert( - const VertexDecl& _destDecl + const VertexLayout& _destDecl , void* _destData - , const VertexDecl& _srcDecl + , const VertexLayout& _srcDecl , const void* _srcData , uint32_t _num = 1 ); @@ -1807,7 +1807,7 @@ namespace bgfx /// /// @param[in] _output Welded vertices remapping table. The size of buffer /// must be the same as number of vertices. - /// @param[in] _decl Vertex stream declaration. + /// @param[in] _decl Vertex stream layout. /// @param[in] _data Vertex stream. /// @param[in] _num Number of vertices in vertex stream. /// @param[in] _epsilon Error tolerance for vertex position comparison. @@ -1817,7 +1817,7 @@ namespace bgfx /// uint16_t weldVertices( uint16_t* _output - , const VertexDecl& _decl + , const VertexLayout& _decl , const void* _data , uint16_t _num , float _epsilon = 0.001f @@ -2166,22 +2166,22 @@ namespace bgfx /// void destroy(IndexBufferHandle _handle); - /// Create vertex declaration. + /// Create vertex layout. /// - /// @attention C99 equivalent is `bgfx_create_vertex_decl`. + /// @attention C99 equivalent is `bgfx_create_vertex_layout`. /// - VertexDeclHandle createVertexDecl(const VertexDecl& _decl); + VertexLayoutHandle createVertexLayout(const VertexLayout& _decl); - /// Destroy vertex declaration. + /// Destroy vertex layout. /// - /// @attention C99 equivalent is `bgfx_destroy_vertex_decl`. + /// @attention C99 equivalent is `bgfx_destroy_vertex_layout`. /// - void destroy(VertexDeclHandle _handle); + void destroy(VertexLayoutHandle _handle); /// Create static vertex buffer. /// /// @param[in] _mem Vertex buffer data. - /// @param[in] _decl Vertex declaration. + /// @param[in] _decl Vertex layout. /// @param[in] _flags Buffer creation flags. /// - `BGFX_BUFFER_NONE` - No flags. /// - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader. @@ -2200,7 +2200,7 @@ namespace bgfx /// VertexBufferHandle createVertexBuffer( const Memory* _mem - , const VertexDecl& _decl + , const VertexLayout& _decl , uint16_t _flags = BGFX_BUFFER_NONE ); @@ -2300,7 +2300,7 @@ namespace bgfx /// Create empty dynamic vertex buffer. /// /// @param[in] _num Number of vertices. - /// @param[in] _decl Vertex declaration. + /// @param[in] _decl Vertex layout. /// @param[in] _flags Buffer creation flags. /// - `BGFX_BUFFER_NONE` - No flags. /// - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader. @@ -2319,14 +2319,14 @@ namespace bgfx /// DynamicVertexBufferHandle createDynamicVertexBuffer( uint32_t _num - , const VertexDecl& _decl + , const VertexLayout& _decl , uint16_t _flags = BGFX_BUFFER_NONE ); /// Create dynamic vertex buffer and initialize it. /// /// @param[in] _mem Vertex buffer data. - /// @param[in] _decl Vertex declaration. + /// @param[in] _decl Vertex layout. /// @param[in] _flags Buffer creation flags. /// - `BGFX_BUFFER_NONE` - No flags. /// - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader. @@ -2345,7 +2345,7 @@ namespace bgfx /// DynamicVertexBufferHandle createDynamicVertexBuffer( const Memory* _mem - , const VertexDecl& _decl + , const VertexLayout& _decl , uint16_t _flags = BGFX_BUFFER_NONE ); @@ -2382,13 +2382,13 @@ namespace bgfx /// Returns number of requested or maximum available vertices. /// /// @param[in] _num Number of required vertices. - /// @param[in] _decl Vertex declaration. + /// @param[in] _decl Vertex layout. /// /// @attention C99 equivalent is `bgfx_get_avail_transient_vertex_buffer`. /// uint32_t getAvailTransientVertexBuffer( uint32_t _num - , const VertexDecl& _decl + , const VertexLayout& _decl ); /// Returns number of requested or maximum available instance buffer slots. @@ -2426,14 +2426,14 @@ namespace bgfx /// for the duration of frame, and it can be reused for multiple draw /// calls. /// @param[in] _num Number of vertices to allocate. - /// @param[in] _decl Vertex declaration. + /// @param[in] _decl Vertex layout. /// /// @attention C99 equivalent is `bgfx_alloc_transient_vertex_buffer`. /// void allocTransientVertexBuffer( TransientVertexBuffer* _tvb , uint32_t _num - , const VertexDecl& _decl + , const VertexLayout& _decl ); /// Check for required space and allocate transient vertex and index @@ -2447,7 +2447,7 @@ namespace bgfx /// bool allocTransientBuffers( TransientVertexBuffer* _tvb - , const VertexDecl& _decl + , const VertexLayout& _decl , uint32_t _numVertices , TransientIndexBuffer* _tib , uint32_t _numIndices @@ -3621,7 +3621,7 @@ namespace bgfx /// @param[in] _handle Vertex buffer. /// @param[in] _startVertex First vertex to render. /// @param[in] _numVertices Number of vertices to render. - /// @param[in] _declHandle VertexDecl handle for aliasing vertex buffer. + /// @param[in] _declHandle VertexLayout handle for aliasing vertex buffer. /// /// @attention C99 equivalent is `bgfx_set_vertex_buffer`. /// @@ -3630,7 +3630,7 @@ namespace bgfx , VertexBufferHandle _handle , uint32_t _startVertex , uint32_t _numVertices - , VertexDeclHandle _declHandle = BGFX_INVALID_HANDLE + , VertexLayoutHandle _declHandle = BGFX_INVALID_HANDLE ); /// Set vertex buffer for draw primitive. @@ -3651,7 +3651,7 @@ namespace bgfx /// @param[in] _handle Dynamic vertex buffer. /// @param[in] _startVertex First vertex to render. /// @param[in] _numVertices Number of vertices to render. - /// @param[in] _declHandle VertexDecl handle for aliasing vertex buffer. + /// @param[in] _declHandle VertexLayout handle for aliasing vertex buffer. /// /// @attention C99 equivalent is `bgfx_set_dynamic_vertex_buffer`. /// @@ -3660,7 +3660,7 @@ namespace bgfx , DynamicVertexBufferHandle _handle , uint32_t _startVertex , uint32_t _numVertices - , VertexDeclHandle _declHandle = BGFX_INVALID_HANDLE + , VertexLayoutHandle _declHandle = BGFX_INVALID_HANDLE ); /// Set vertex buffer for draw primitive. @@ -3681,7 +3681,7 @@ namespace bgfx /// @param[in] _tvb Transient vertex buffer. /// @param[in] _startVertex First vertex to render. /// @param[in] _numVertices Number of vertices to render. - /// @param[in] _declHandle VertexDecl handle for aliasing vertex buffer. + /// @param[in] _declHandle VertexLayout handle for aliasing vertex buffer. /// /// @attention C99 equivalent is `bgfx_set_transient_vertex_buffer`. /// @@ -3690,7 +3690,7 @@ namespace bgfx , const TransientVertexBuffer* _tvb , uint32_t _startVertex , uint32_t _numVertices - , VertexDeclHandle _declHandle = BGFX_INVALID_HANDLE + , VertexLayoutHandle _declHandle = BGFX_INVALID_HANDLE ); /// Set number of vertices for auto generated vertices use in conjuction diff --git a/include/bgfx/c99/bgfx.h b/include/bgfx/c99/bgfx.h index 7d03ec903..696ee719c 100644 --- a/include/bgfx/c99/bgfx.h +++ b/include/bgfx/c99/bgfx.h @@ -460,7 +460,7 @@ typedef struct bgfx_uniform_handle_s { uint16_t idx; } bgfx_uniform_handle_t; typedef struct bgfx_vertex_buffer_handle_s { uint16_t idx; } bgfx_vertex_buffer_handle_t; -typedef struct bgfx_vertex_decl_handle_s { uint16_t idx; } bgfx_vertex_decl_handle_t; +typedef struct bgfx_vertex_layout_handle_s { uint16_t idx; } bgfx_vertex_layout_handle_t; #define BGFX_HANDLE_IS_VALID(h) ((h).idx != UINT16_MAX) @@ -503,7 +503,7 @@ typedef struct bgfx_caps_limits_s uint32_t maxTextures; /** Maximum number of texture handles. */ uint32_t maxTextureSamplers; /** Maximum number of texture samplers. */ uint32_t maxComputeBindings; /** Maximum number of compute bindings. */ - uint32_t maxVertexDecls; /** Maximum number of vertex format declarations. */ + uint32_t maxVertexLayouts; /** Maximum number of vertex format layouts. */ uint32_t maxVertexStreams; /** Maximum number of vertex streams. */ uint32_t maxIndexBuffers; /** Maximum number of index buffer handles. */ uint32_t maxVertexBuffers; /** Maximum number of vertex buffer handles. */ @@ -700,7 +700,7 @@ typedef struct bgfx_transient_vertex_buffer_s uint32_t startVertex; /** First vertex. */ uint16_t stride; /** Vertex stride. */ bgfx_vertex_buffer_handle_t handle; /** Vertex buffer handle. */ - bgfx_vertex_decl_handle_t decl; /** Vertex declaration handle. */ + bgfx_vertex_layout_handle_t decl; /** Vertex layout handle. */ } bgfx_transient_vertex_buffer_t; @@ -829,7 +829,7 @@ typedef struct bgfx_stats_s uint16_t numTextures; /** Number of used textures. */ uint16_t numUniforms; /** Number of used uniforms. */ uint16_t numVertexBuffers; /** Number of used vertex buffers. */ - uint16_t numVertexDecls; /** Number of used vertex declarations. */ + uint16_t numVertexLayouts; /** Number of used vertex layouts. */ int64_t textureMemoryUsed; /** Estimate of texture memory used. */ int64_t rtMemoryUsed; /** Estimate of render target memory used. */ int32_t transientVbUsed; /** Amount of transient vertex buffer used. */ @@ -849,17 +849,17 @@ typedef struct bgfx_stats_s } bgfx_stats_t; /** - * Vertex declaration. + * Vertex layout. * */ -typedef struct bgfx_vertex_decl_s +typedef struct bgfx_vertex_layout_s { uint32_t hash; /** Hash. */ uint16_t stride; /** Stride. */ uint16_t offset[BGFX_ATTRIB_COUNT]; /** Attribute offsets. */ uint16_t attributes[BGFX_ATTRIB_COUNT]; /** Used attributes. */ -} bgfx_vertex_decl_t; +} bgfx_vertex_layout_t; /** * Encoders are used for submitting draw calls from multiple threads. Only one encoder @@ -884,15 +884,15 @@ typedef struct bgfx_encoder_s bgfx_encoder_t; BGFX_C_API void bgfx_attachment_init(bgfx_attachment_t* _this, bgfx_texture_handle_t _handle, bgfx_access_t _access, uint16_t _layer, uint16_t _mip, uint8_t _resolve); /** - * Start VertexDecl. + * Start VertexLayout. * * @param[in] _rendererType * */ -BGFX_C_API bgfx_vertex_decl_t* bgfx_vertex_decl_begin(bgfx_vertex_decl_t* _this, bgfx_renderer_type_t _rendererType); +BGFX_C_API bgfx_vertex_layout_t* bgfx_vertex_layout_begin(bgfx_vertex_layout_t* _this, bgfx_renderer_type_t _rendererType); /** - * Add attribute to VertexDecl. + * Add attribute to VertexLayout. * @remarks Must be called between begin/end. * * @param[in] _attrib Attribute semantics. See: `bgfx::Attrib` @@ -907,7 +907,7 @@ BGFX_C_API bgfx_vertex_decl_t* bgfx_vertex_decl_begin(bgfx_vertex_decl_t* _this, * Unpacking code must be implemented inside vertex shader. * */ -BGFX_C_API bgfx_vertex_decl_t* bgfx_vertex_decl_add(bgfx_vertex_decl_t* _this, bgfx_attrib_t _attrib, uint8_t _num, bgfx_attrib_type_t _type, bool _normalized, bool _asInt); +BGFX_C_API bgfx_vertex_layout_t* bgfx_vertex_layout_add(bgfx_vertex_layout_t* _this, bgfx_attrib_t _attrib, uint8_t _num, bgfx_attrib_type_t _type, bool _normalized, bool _asInt); /** * Decode attribute. @@ -919,15 +919,15 @@ BGFX_C_API bgfx_vertex_decl_t* bgfx_vertex_decl_add(bgfx_vertex_decl_t* _this, b * @param[out] _asInt Attribute is packed as int. * */ -BGFX_C_API void bgfx_vertex_decl_decode(const bgfx_vertex_decl_t* _this, bgfx_attrib_t _attrib, uint8_t * _num, bgfx_attrib_type_t * _type, bool * _normalized, bool * _asInt); +BGFX_C_API void bgfx_vertex_layout_decode(const bgfx_vertex_layout_t* _this, bgfx_attrib_t _attrib, uint8_t * _num, bgfx_attrib_type_t * _type, bool * _normalized, bool * _asInt); /** - * Returns true if VertexDecl contains attribute. + * Returns true if VertexLayout contains attribute. * * @param[in] _attrib Attribute semantics. See: `bgfx::Attrib` * */ -BGFX_C_API bool bgfx_vertex_decl_has(const bgfx_vertex_decl_t* _this, bgfx_attrib_t _attrib); +BGFX_C_API bool bgfx_vertex_layout_has(const bgfx_vertex_layout_t* _this, bgfx_attrib_t _attrib); /** * Skip `_num` bytes in vertex stream. @@ -935,13 +935,13 @@ BGFX_C_API bool bgfx_vertex_decl_has(const bgfx_vertex_decl_t* _this, bgfx_attri * @param[in] _num * */ -BGFX_C_API bgfx_vertex_decl_t* bgfx_vertex_decl_skip(bgfx_vertex_decl_t* _this, uint8_t _num); +BGFX_C_API bgfx_vertex_layout_t* bgfx_vertex_layout_skip(bgfx_vertex_layout_t* _this, uint8_t _num); /** - * End VertexDecl. + * End VertexLayout. * */ -BGFX_C_API void bgfx_vertex_decl_end(bgfx_vertex_decl_t* _this); +BGFX_C_API void bgfx_vertex_layout_end(bgfx_vertex_layout_t* _this); /** * Pack vertex attribute into vertex stream format. @@ -949,43 +949,43 @@ BGFX_C_API void bgfx_vertex_decl_end(bgfx_vertex_decl_t* _this); * @param[in] _input Value to be packed into vertex stream. * @param[in] _inputNormalized `true` if input value is already normalized. * @param[in] _attr Attribute to pack. - * @param[in] _decl Vertex stream declaration. + * @param[in] _decl Vertex stream layout. * @param[in] _data Destination vertex stream where data will be packed. * @param[in] _index Vertex index that will be modified. * */ -BGFX_C_API void bgfx_vertex_pack(const float _input[4], bool _inputNormalized, bgfx_attrib_t _attr, const bgfx_vertex_decl_t * _decl, void* _data, uint32_t _index); +BGFX_C_API void bgfx_vertex_pack(const float _input[4], bool _inputNormalized, bgfx_attrib_t _attr, const bgfx_vertex_layout_t * _decl, void* _data, uint32_t _index); /** * Unpack vertex attribute from vertex stream format. * * @param[out] _output Result of unpacking. * @param[in] _attr Attribute to unpack. - * @param[in] _decl Vertex stream declaration. + * @param[in] _decl Vertex stream layout. * @param[in] _data Source vertex stream from where data will be unpacked. * @param[in] _index Vertex index that will be unpacked. * */ -BGFX_C_API void bgfx_vertex_unpack(float _output[4], bgfx_attrib_t _attr, const bgfx_vertex_decl_t * _decl, const void* _data, uint32_t _index); +BGFX_C_API void bgfx_vertex_unpack(float _output[4], bgfx_attrib_t _attr, const bgfx_vertex_layout_t * _decl, const void* _data, uint32_t _index); /** * Converts vertex stream data from one vertex stream format to another. * - * @param[in] _dstDecl Destination vertex stream declaration. + * @param[in] _dstDecl Destination vertex stream layout. * @param[in] _dstData Destination vertex stream. - * @param[in] _srcDecl Source vertex stream declaration. + * @param[in] _srcDecl Source vertex stream layout. * @param[in] _srcData Source vertex stream data. * @param[in] _num Number of vertices to convert from source to destination. * */ -BGFX_C_API void bgfx_vertex_convert(const bgfx_vertex_decl_t * _dstDecl, void* _dstData, const bgfx_vertex_decl_t * _srcDecl, const void* _srcData, uint32_t _num); +BGFX_C_API void bgfx_vertex_convert(const bgfx_vertex_layout_t * _dstDecl, void* _dstData, const bgfx_vertex_layout_t * _srcDecl, const void* _srcData, uint32_t _num); /** * Weld vertices. * * @param[in] _output Welded vertices remapping table. The size of buffer * must be the same as number of vertices. - * @param[in] _decl Vertex stream declaration. + * @param[in] _decl Vertex stream layout. * @param[in] _data Vertex stream. * @param[in] _num Number of vertices in vertex stream. * @param[in] _epsilon Error tolerance for vertex position comparison. @@ -993,7 +993,7 @@ BGFX_C_API void bgfx_vertex_convert(const bgfx_vertex_decl_t * _dstDecl, void* _ * @returns Number of unique vertices after vertex welding. * */ -BGFX_C_API uint16_t bgfx_weld_vertices(uint16_t* _output, const bgfx_vertex_decl_t * _decl, const void* _data, uint16_t _num, float _epsilon); +BGFX_C_API uint16_t bgfx_weld_vertices(uint16_t* _output, const bgfx_vertex_layout_t * _decl, const void* _data, uint16_t _num, float _epsilon); /** * Convert index buffer for use with different primitive topologies. @@ -1294,26 +1294,26 @@ BGFX_C_API void bgfx_set_index_buffer_name(bgfx_index_buffer_handle_t _handle, c BGFX_C_API void bgfx_destroy_index_buffer(bgfx_index_buffer_handle_t _handle); /** - * Create vertex declaration. + * Create vertex layout. * - * @param[in] _decl Vertex declaration. + * @param[in] _decl Vertex layout. * */ -BGFX_C_API bgfx_vertex_decl_handle_t bgfx_create_vertex_decl(const bgfx_vertex_decl_t * _decl); +BGFX_C_API bgfx_vertex_layout_handle_t bgfx_create_vertex_layout(const bgfx_vertex_layout_t * _decl); /** - * Destroy vertex declaration. + * Destroy vertex layout. * - * @param[in] _handle Vertex declaration handle. + * @param[in] _handle Vertex layout handle. * */ -BGFX_C_API void bgfx_destroy_vertex_decl(bgfx_vertex_decl_handle_t _handle); +BGFX_C_API void bgfx_destroy_vertex_decl(bgfx_vertex_layout_handle_t _handle); /** * Create static vertex buffer. * * @param[in] _mem Vertex buffer data. - * @param[in] _decl Vertex declaration. + * @param[in] _decl Vertex layout. * @param[in] _flags Buffer creation flags. * - `BGFX_BUFFER_NONE` - No flags. * - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader. @@ -1328,7 +1328,7 @@ BGFX_C_API void bgfx_destroy_vertex_decl(bgfx_vertex_decl_handle_t _handle); * @returns Static vertex buffer handle. * */ -BGFX_C_API bgfx_vertex_buffer_handle_t bgfx_create_vertex_buffer(const bgfx_memory_t* _mem, const bgfx_vertex_decl_t * _decl, uint16_t _flags); +BGFX_C_API bgfx_vertex_buffer_handle_t bgfx_create_vertex_buffer(const bgfx_memory_t* _mem, const bgfx_vertex_layout_t * _decl, uint16_t _flags); /** * Set static vertex buffer debug name. @@ -1415,7 +1415,7 @@ BGFX_C_API void bgfx_destroy_dynamic_index_buffer(bgfx_dynamic_index_buffer_hand * Create empty dynamic vertex buffer. * * @param[in] _num Number of vertices. - * @param[in] _decl Vertex declaration. + * @param[in] _decl Vertex layout. * @param[in] _flags Buffer creation flags. * - `BGFX_BUFFER_NONE` - No flags. * - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader. @@ -1432,13 +1432,13 @@ BGFX_C_API void bgfx_destroy_dynamic_index_buffer(bgfx_dynamic_index_buffer_hand * @returns Dynamic vertex buffer handle. * */ -BGFX_C_API bgfx_dynamic_vertex_buffer_handle_t bgfx_create_dynamic_vertex_buffer(uint32_t _num, const bgfx_vertex_decl_t* _decl, uint16_t _flags); +BGFX_C_API bgfx_dynamic_vertex_buffer_handle_t bgfx_create_dynamic_vertex_buffer(uint32_t _num, const bgfx_vertex_layout_t* _decl, uint16_t _flags); /** * Create dynamic vertex buffer and initialize it. * * @param[in] _mem Vertex buffer data. - * @param[in] _decl Vertex declaration. + * @param[in] _decl Vertex layout. * @param[in] _flags Buffer creation flags. * - `BGFX_BUFFER_NONE` - No flags. * - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader. @@ -1455,7 +1455,7 @@ BGFX_C_API bgfx_dynamic_vertex_buffer_handle_t bgfx_create_dynamic_vertex_buffer * @returns Dynamic vertex buffer handle. * */ -BGFX_C_API bgfx_dynamic_vertex_buffer_handle_t bgfx_create_dynamic_vertex_buffer_mem(const bgfx_memory_t* _mem, const bgfx_vertex_decl_t* _decl, uint16_t _flags); +BGFX_C_API bgfx_dynamic_vertex_buffer_handle_t bgfx_create_dynamic_vertex_buffer_mem(const bgfx_memory_t* _mem, const bgfx_vertex_layout_t* _decl, uint16_t _flags); /** * Update dynamic vertex buffer. @@ -1489,12 +1489,12 @@ BGFX_C_API uint32_t bgfx_get_avail_transient_index_buffer(uint32_t _num); * Returns number of requested or maximum available vertices. * * @param[in] _num Number of required vertices. - * @param[in] _decl Vertex declaration. + * @param[in] _decl Vertex layout. * * @returns Number of requested or maximum available vertices. * */ -BGFX_C_API uint32_t bgfx_get_avail_transient_vertex_buffer(uint32_t _num, const bgfx_vertex_decl_t * _decl); +BGFX_C_API uint32_t bgfx_get_avail_transient_vertex_buffer(uint32_t _num, const bgfx_vertex_layout_t * _decl); /** * Returns number of requested or maximum available instance buffer slots. @@ -1527,10 +1527,10 @@ BGFX_C_API void bgfx_alloc_transient_index_buffer(bgfx_transient_index_buffer_t* * for the duration of frame, and it can be reused for multiple draw * calls. * @param[in] _num Number of vertices to allocate. - * @param[in] _decl Vertex declaration. + * @param[in] _decl Vertex layout. * */ -BGFX_C_API void bgfx_alloc_transient_vertex_buffer(bgfx_transient_vertex_buffer_t* _tvb, uint32_t _num, const bgfx_vertex_decl_t * _decl); +BGFX_C_API void bgfx_alloc_transient_vertex_buffer(bgfx_transient_vertex_buffer_t* _tvb, uint32_t _num, const bgfx_vertex_layout_t * _decl); /** * Check for required space and allocate transient vertex and index @@ -1542,15 +1542,15 @@ BGFX_C_API void bgfx_alloc_transient_vertex_buffer(bgfx_transient_vertex_buffer_ * @param[out] _tvb TransientVertexBuffer structure is filled and is valid * for the duration of frame, and it can be reused for multiple draw * calls. - * @param[in] _decl Number of vertices to allocate. - * @param[in] _numVertices Vertex declaration. + * @param[in] _decl Vertex layout. + * @param[in] _numVertices Number of vertices to allocate. * @param[out] _tib TransientIndexBuffer structure is filled and is valid * for the duration of frame, and it can be reused for multiple draw * calls. * @param[in] _numIndices Number of indices to allocate. * */ -BGFX_C_API bool bgfx_alloc_transient_buffers(bgfx_transient_vertex_buffer_t* _tvb, const bgfx_vertex_decl_t * _decl, uint32_t _numVertices, bgfx_transient_index_buffer_t* _tib, uint32_t _numIndices); +BGFX_C_API bool bgfx_alloc_transient_buffers(bgfx_transient_vertex_buffer_t* _tvb, const bgfx_vertex_layout_t * _decl, uint32_t _numVertices, bgfx_transient_index_buffer_t* _tib, uint32_t _numIndices); /** * Allocate instance data buffer. @@ -2435,10 +2435,10 @@ BGFX_C_API void bgfx_encoder_set_transient_index_buffer(bgfx_encoder_t* _this, c * @param[in] _handle Vertex buffer. * @param[in] _startVertex First vertex to render. * @param[in] _numVertices Number of vertices to render. - * @param[in] _declHandle VertexDecl handle for aliasing vertex buffer. + * @param[in] _declHandle VertexLayout handle for aliasing vertex buffer. * */ -BGFX_C_API void bgfx_encoder_set_vertex_buffer(bgfx_encoder_t* _this, uint8_t _stream, bgfx_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _numVertices, bgfx_vertex_decl_handle_t _declHandle); +BGFX_C_API void bgfx_encoder_set_vertex_buffer(bgfx_encoder_t* _this, uint8_t _stream, bgfx_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _numVertices, bgfx_vertex_layout_handle_t _declHandle); /** * Set vertex buffer for draw primitive. @@ -2447,10 +2447,10 @@ BGFX_C_API void bgfx_encoder_set_vertex_buffer(bgfx_encoder_t* _this, uint8_t _s * @param[in] _handle Dynamic vertex buffer. * @param[in] _startVertex First vertex to render. * @param[in] _numVertices Number of vertices to render. - * @param[in] _declHandle VertexDecl handle for aliasing vertex buffer. + * @param[in] _declHandle VertexLayout handle for aliasing vertex buffer. * */ -BGFX_C_API void bgfx_encoder_set_dynamic_vertex_buffer(bgfx_encoder_t* _this, uint8_t _stream, bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _numVertices, bgfx_vertex_decl_handle_t _declHandle); +BGFX_C_API void bgfx_encoder_set_dynamic_vertex_buffer(bgfx_encoder_t* _this, uint8_t _stream, bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _numVertices, bgfx_vertex_layout_handle_t _declHandle); /** * Set vertex buffer for draw primitive. @@ -2459,10 +2459,10 @@ BGFX_C_API void bgfx_encoder_set_dynamic_vertex_buffer(bgfx_encoder_t* _this, ui * @param[in] _tvb Transient vertex buffer. * @param[in] _startVertex First vertex to render. * @param[in] _numVertices Number of vertices to render. - * @param[in] _declHandle VertexDecl handle for aliasing vertex buffer. + * @param[in] _declHandle VertexLayout handle for aliasing vertex buffer. * */ -BGFX_C_API void bgfx_encoder_set_transient_vertex_buffer(bgfx_encoder_t* _this, uint8_t _stream, const bgfx_transient_vertex_buffer_t* _tvb, uint32_t _startVertex, uint32_t _numVertices, bgfx_vertex_decl_handle_t _declHandle); +BGFX_C_API void bgfx_encoder_set_transient_vertex_buffer(bgfx_encoder_t* _this, uint8_t _stream, const bgfx_transient_vertex_buffer_t* _tvb, uint32_t _startVertex, uint32_t _numVertices, bgfx_vertex_layout_handle_t _declHandle); /** * Set number of vertices for auto generated vertices use in conjuction @@ -3220,12 +3220,12 @@ BGFX_C_API void bgfx_blit(bgfx_view_id_t _id, bgfx_texture_handle_t _dst, uint8_ typedef enum bgfx_function_id { BGFX_FUNCTION_ID_ATTACHMENT_INIT, - BGFX_FUNCTION_ID_VERTEX_DECL_BEGIN, - BGFX_FUNCTION_ID_VERTEX_DECL_ADD, - BGFX_FUNCTION_ID_VERTEX_DECL_DECODE, - BGFX_FUNCTION_ID_VERTEX_DECL_HAS, - BGFX_FUNCTION_ID_VERTEX_DECL_SKIP, - BGFX_FUNCTION_ID_VERTEX_DECL_END, + BGFX_FUNCTION_ID_VERTEX_LAYOUT_BEGIN, + BGFX_FUNCTION_ID_VERTEX_LAYOUT_ADD, + BGFX_FUNCTION_ID_VERTEX_LAYOUT_DECODE, + BGFX_FUNCTION_ID_VERTEX_LAYOUT_HAS, + BGFX_FUNCTION_ID_VERTEX_LAYOUT_SKIP, + BGFX_FUNCTION_ID_VERTEX_LAYOUT_END, BGFX_FUNCTION_ID_VERTEX_PACK, BGFX_FUNCTION_ID_VERTEX_UNPACK, BGFX_FUNCTION_ID_VERTEX_CONVERT, @@ -3254,7 +3254,7 @@ typedef enum bgfx_function_id BGFX_FUNCTION_ID_CREATE_INDEX_BUFFER, BGFX_FUNCTION_ID_SET_INDEX_BUFFER_NAME, BGFX_FUNCTION_ID_DESTROY_INDEX_BUFFER, - BGFX_FUNCTION_ID_CREATE_VERTEX_DECL, + BGFX_FUNCTION_ID_CREATE_VERTEX_LAYOUT, BGFX_FUNCTION_ID_DESTROY_VERTEX_DECL, BGFX_FUNCTION_ID_CREATE_VERTEX_BUFFER, BGFX_FUNCTION_ID_SET_VERTEX_BUFFER_NAME, @@ -3412,16 +3412,16 @@ typedef enum bgfx_function_id struct bgfx_interface_vtbl { void (*attachment_init)(bgfx_attachment_t* _this, bgfx_texture_handle_t _handle, bgfx_access_t _access, uint16_t _layer, uint16_t _mip, uint8_t _resolve); - bgfx_vertex_decl_t* (*vertex_decl_begin)(bgfx_vertex_decl_t* _this, bgfx_renderer_type_t _rendererType); - bgfx_vertex_decl_t* (*vertex_decl_add)(bgfx_vertex_decl_t* _this, bgfx_attrib_t _attrib, uint8_t _num, bgfx_attrib_type_t _type, bool _normalized, bool _asInt); - void (*vertex_decl_decode)(const bgfx_vertex_decl_t* _this, bgfx_attrib_t _attrib, uint8_t * _num, bgfx_attrib_type_t * _type, bool * _normalized, bool * _asInt); - bool (*vertex_decl_has)(const bgfx_vertex_decl_t* _this, bgfx_attrib_t _attrib); - bgfx_vertex_decl_t* (*vertex_decl_skip)(bgfx_vertex_decl_t* _this, uint8_t _num); - void (*vertex_decl_end)(bgfx_vertex_decl_t* _this); - void (*vertex_pack)(const float _input[4], bool _inputNormalized, bgfx_attrib_t _attr, const bgfx_vertex_decl_t * _decl, void* _data, uint32_t _index); - void (*vertex_unpack)(float _output[4], bgfx_attrib_t _attr, const bgfx_vertex_decl_t * _decl, const void* _data, uint32_t _index); - void (*vertex_convert)(const bgfx_vertex_decl_t * _dstDecl, void* _dstData, const bgfx_vertex_decl_t * _srcDecl, const void* _srcData, uint32_t _num); - uint16_t (*weld_vertices)(uint16_t* _output, const bgfx_vertex_decl_t * _decl, const void* _data, uint16_t _num, float _epsilon); + bgfx_vertex_layout_t* (*vertex_layout_begin)(bgfx_vertex_layout_t* _this, bgfx_renderer_type_t _rendererType); + bgfx_vertex_layout_t* (*vertex_layout_add)(bgfx_vertex_layout_t* _this, bgfx_attrib_t _attrib, uint8_t _num, bgfx_attrib_type_t _type, bool _normalized, bool _asInt); + void (*vertex_layout_decode)(const bgfx_vertex_layout_t* _this, bgfx_attrib_t _attrib, uint8_t * _num, bgfx_attrib_type_t * _type, bool * _normalized, bool * _asInt); + 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); + void (*vertex_pack)(const float _input[4], bool _inputNormalized, bgfx_attrib_t _attr, const bgfx_vertex_layout_t * _decl, void* _data, uint32_t _index); + void (*vertex_unpack)(float _output[4], bgfx_attrib_t _attr, const bgfx_vertex_layout_t * _decl, const void* _data, uint32_t _index); + void (*vertex_convert)(const bgfx_vertex_layout_t * _dstDecl, void* _dstData, const bgfx_vertex_layout_t * _srcDecl, const void* _srcData, uint32_t _num); + uint16_t (*weld_vertices)(uint16_t* _output, const bgfx_vertex_layout_t * _decl, const void* _data, uint16_t _num, float _epsilon); uint32_t (*topology_convert)(bgfx_topology_convert_t _conversion, void* _dst, uint32_t _dstSize, const void* _indices, uint32_t _numIndices, bool _index32); void (*topology_sort_tri_list)(bgfx_topology_sort_t _sort, void* _dst, uint32_t _dstSize, const float _dir[3], const float _pos[3], const void* _vertices, uint32_t _stride, const void* _indices, uint32_t _numIndices, bool _index32); uint8_t (*get_supported_renderers)(uint8_t _max, bgfx_renderer_type_t* _enum); @@ -3446,25 +3446,25 @@ struct bgfx_interface_vtbl bgfx_index_buffer_handle_t (*create_index_buffer)(const bgfx_memory_t* _mem, uint16_t _flags); void (*set_index_buffer_name)(bgfx_index_buffer_handle_t _handle, const char* _name, int32_t _len); void (*destroy_index_buffer)(bgfx_index_buffer_handle_t _handle); - bgfx_vertex_decl_handle_t (*create_vertex_decl)(const bgfx_vertex_decl_t * _decl); - void (*destroy_vertex_decl)(bgfx_vertex_decl_handle_t _handle); - bgfx_vertex_buffer_handle_t (*create_vertex_buffer)(const bgfx_memory_t* _mem, const bgfx_vertex_decl_t * _decl, uint16_t _flags); + bgfx_vertex_layout_handle_t (*create_vertex_layout)(const bgfx_vertex_layout_t * _decl); + void (*destroy_vertex_decl)(bgfx_vertex_layout_handle_t _handle); + bgfx_vertex_buffer_handle_t (*create_vertex_buffer)(const bgfx_memory_t* _mem, const bgfx_vertex_layout_t * _decl, uint16_t _flags); void (*set_vertex_buffer_name)(bgfx_vertex_buffer_handle_t _handle, const char* _name, int32_t _len); void (*destroy_vertex_buffer)(bgfx_vertex_buffer_handle_t _handle); bgfx_dynamic_index_buffer_handle_t (*create_dynamic_index_buffer)(uint32_t _num, uint16_t _flags); bgfx_dynamic_index_buffer_handle_t (*create_dynamic_index_buffer_mem)(const bgfx_memory_t* _mem, uint16_t _flags); void (*update_dynamic_index_buffer)(bgfx_dynamic_index_buffer_handle_t _handle, uint32_t _startIndex, const bgfx_memory_t* _mem); void (*destroy_dynamic_index_buffer)(bgfx_dynamic_index_buffer_handle_t _handle); - bgfx_dynamic_vertex_buffer_handle_t (*create_dynamic_vertex_buffer)(uint32_t _num, const bgfx_vertex_decl_t* _decl, uint16_t _flags); - bgfx_dynamic_vertex_buffer_handle_t (*create_dynamic_vertex_buffer_mem)(const bgfx_memory_t* _mem, const bgfx_vertex_decl_t* _decl, uint16_t _flags); + bgfx_dynamic_vertex_buffer_handle_t (*create_dynamic_vertex_buffer)(uint32_t _num, const bgfx_vertex_layout_t* _decl, uint16_t _flags); + bgfx_dynamic_vertex_buffer_handle_t (*create_dynamic_vertex_buffer_mem)(const bgfx_memory_t* _mem, const bgfx_vertex_layout_t* _decl, uint16_t _flags); void (*update_dynamic_vertex_buffer)(bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _startVertex, const bgfx_memory_t* _mem); void (*destroy_dynamic_vertex_buffer)(bgfx_dynamic_vertex_buffer_handle_t _handle); uint32_t (*get_avail_transient_index_buffer)(uint32_t _num); - uint32_t (*get_avail_transient_vertex_buffer)(uint32_t _num, const bgfx_vertex_decl_t * _decl); + uint32_t (*get_avail_transient_vertex_buffer)(uint32_t _num, const bgfx_vertex_layout_t * _decl); uint32_t (*get_avail_instance_data_buffer)(uint32_t _num, uint16_t _stride); void (*alloc_transient_index_buffer)(bgfx_transient_index_buffer_t* _tib, uint32_t _num); - void (*alloc_transient_vertex_buffer)(bgfx_transient_vertex_buffer_t* _tvb, uint32_t _num, const bgfx_vertex_decl_t * _decl); - bool (*alloc_transient_buffers)(bgfx_transient_vertex_buffer_t* _tvb, const bgfx_vertex_decl_t * _decl, uint32_t _numVertices, bgfx_transient_index_buffer_t* _tib, uint32_t _numIndices); + void (*alloc_transient_vertex_buffer)(bgfx_transient_vertex_buffer_t* _tvb, uint32_t _num, const bgfx_vertex_layout_t * _decl); + bool (*alloc_transient_buffers)(bgfx_transient_vertex_buffer_t* _tvb, const bgfx_vertex_layout_t * _decl, uint32_t _numVertices, bgfx_transient_index_buffer_t* _tib, uint32_t _numIndices); void (*alloc_instance_data_buffer)(bgfx_instance_data_buffer_t* _idb, uint32_t _num, uint16_t _stride); bgfx_indirect_buffer_handle_t (*create_indirect_buffer)(uint32_t _num); void (*destroy_indirect_buffer)(bgfx_indirect_buffer_handle_t _handle); @@ -3530,9 +3530,9 @@ struct bgfx_interface_vtbl void (*encoder_set_index_buffer)(bgfx_encoder_t* _this, bgfx_index_buffer_handle_t _handle, uint32_t _firstIndex, uint32_t _numIndices); void (*encoder_set_dynamic_index_buffer)(bgfx_encoder_t* _this, bgfx_dynamic_index_buffer_handle_t _handle, uint32_t _firstIndex, uint32_t _numIndices); void (*encoder_set_transient_index_buffer)(bgfx_encoder_t* _this, const bgfx_transient_index_buffer_t* _tib, uint32_t _firstIndex, uint32_t _numIndices); - void (*encoder_set_vertex_buffer)(bgfx_encoder_t* _this, uint8_t _stream, bgfx_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _numVertices, bgfx_vertex_decl_handle_t _declHandle); - void (*encoder_set_dynamic_vertex_buffer)(bgfx_encoder_t* _this, uint8_t _stream, bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _numVertices, bgfx_vertex_decl_handle_t _declHandle); - void (*encoder_set_transient_vertex_buffer)(bgfx_encoder_t* _this, uint8_t _stream, const bgfx_transient_vertex_buffer_t* _tvb, uint32_t _startVertex, uint32_t _numVertices, bgfx_vertex_decl_handle_t _declHandle); + void (*encoder_set_vertex_buffer)(bgfx_encoder_t* _this, uint8_t _stream, bgfx_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _numVertices, bgfx_vertex_layout_handle_t _declHandle); + void (*encoder_set_dynamic_vertex_buffer)(bgfx_encoder_t* _this, uint8_t _stream, bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _numVertices, bgfx_vertex_layout_handle_t _declHandle); + void (*encoder_set_transient_vertex_buffer)(bgfx_encoder_t* _this, uint8_t _stream, const bgfx_transient_vertex_buffer_t* _tvb, uint32_t _startVertex, uint32_t _numVertices, bgfx_vertex_layout_handle_t _declHandle); void (*encoder_set_vertex_count)(bgfx_encoder_t* _this, uint32_t _numVertices); void (*encoder_set_instance_data_buffer)(bgfx_encoder_t* _this, const bgfx_instance_data_buffer_t* _idb, uint32_t _start, uint32_t _num); void (*encoder_set_instance_data_from_vertex_buffer)(bgfx_encoder_t* _this, bgfx_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _num); diff --git a/include/bgfx/defines.h b/include/bgfx/defines.h index 390f0ce29..bbf0c71a0 100644 --- a/include/bgfx/defines.h +++ b/include/bgfx/defines.h @@ -6,7 +6,7 @@ #ifndef BGFX_DEFINES_H_HEADER_GUARD #define BGFX_DEFINES_H_HEADER_GUARD -#define BGFX_API_VERSION UINT32_C(99) +#define BGFX_API_VERSION UINT32_C(100) /** * Color RGB/alpha/depth write. When it's not specified write will be disabled. diff --git a/scripts/bgfx.idl b/scripts/bgfx.idl index 56d6a7784..e1b1b5b8a 100644 --- a/scripts/bgfx.idl +++ b/scripts/bgfx.idl @@ -1,7 +1,7 @@ -- vim: syntax=lua -- bgfx interface -version(99) +version(100) typedef "bool" typedef "char" @@ -669,7 +669,7 @@ struct.Limits { namespace = "Caps" } .maxTextures "uint32_t" --- Maximum number of texture handles. .maxTextureSamplers "uint32_t" --- Maximum number of texture samplers. .maxComputeBindings "uint32_t" --- Maximum number of compute bindings. - .maxVertexDecls "uint32_t" --- Maximum number of vertex format declarations. + .maxVertexLayouts "uint32_t" --- Maximum number of vertex format layouts. .maxVertexStreams "uint32_t" --- Maximum number of vertex streams. .maxIndexBuffers "uint32_t" --- Maximum number of index buffer handles. .maxVertexBuffers "uint32_t" --- Maximum number of vertex buffer handles. @@ -793,7 +793,7 @@ struct.TransientVertexBuffer .startVertex "uint32_t" --- First vertex. .stride "uint16_t" --- Vertex stride. .handle "VertexBufferHandle" --- Vertex buffer handle. - .decl "VertexDeclHandle" --- Vertex declaration handle. + .decl "VertexLayoutHandle" --- Vertex layout handle. --- Instance data buffer info. struct.InstanceDataBuffer @@ -892,7 +892,7 @@ struct.Stats .numTextures "uint16_t" --- Number of used textures. .numUniforms "uint16_t" --- Number of used uniforms. .numVertexBuffers "uint16_t" --- Number of used vertex buffers. - .numVertexDecls "uint16_t" --- Number of used vertex declarations. + .numVertexLayouts "uint16_t" --- Number of used vertex layouts. .textureMemoryUsed "int64_t" --- Estimate of texture memory used. .rtMemoryUsed "int64_t" --- Estimate of render target memory used. @@ -915,8 +915,8 @@ struct.Stats .numEncoders "uint8_t" --- Number of encoders used during frame. .encoderStats "EncoderStats*" --- Array of encoder stats. ---- Vertex declaration. -struct.VertexDecl { ctor } +--- Vertex layout. +struct.VertexLayout { ctor } .hash "uint32_t" --- Hash. .stride "uint16_t" --- Stride. .offset "uint16_t[Attrib::Count]" --- Attribute offsets. @@ -937,20 +937,20 @@ handle "ShaderHandle" handle "TextureHandle" handle "UniformHandle" handle "VertexBufferHandle" -handle "VertexDeclHandle" +handle "VertexLayoutHandle" ---- Start VertexDecl. -func.VertexDecl.begin - "VertexDecl&" +--- Start VertexLayout. +func.VertexLayout.begin + "VertexLayout&" .rendererType "RendererType::Enum" { default = "RendererType::Noop" } ---- Add attribute to VertexDecl. +--- Add attribute to VertexLayout. --- --- @remarks Must be called between begin/end. --- -func.VertexDecl.add - "VertexDecl&" +func.VertexLayout.add + "VertexLayout&" .attrib "Attrib::Enum" --- Attribute semantics. See: `bgfx::Attrib` .num "uint8_t" --- Number of elements 1, 2, 3 or 4. .type "AttribType::Enum" --- Element type. @@ -963,7 +963,7 @@ func.VertexDecl.add --- Unpacking code must be implemented inside vertex shader. --- Decode attribute. -func.VertexDecl.decode { const } +func.VertexLayout.decode { const } "void" .attrib "Attrib::Enum" --- Attribute semantics. See: `bgfx::Attrib` .num "uint8_t &" { out } --- Number of elements. @@ -971,75 +971,75 @@ func.VertexDecl.decode { const } .normalized "bool &" { out } --- Attribute is normalized. .asInt "bool &" { out } --- Attribute is packed as int. ---- Returns true if VertexDecl contains attribute. -func.VertexDecl.has { const } +--- Returns true if VertexLayout contains attribute. +func.VertexLayout.has { const } "bool" .attrib "Attrib::Enum" --- Attribute semantics. See: `bgfx::Attrib` --- Skip `_num` bytes in vertex stream. -func.VertexDecl.skip - "VertexDecl&" +func.VertexLayout.skip + "VertexLayout&" .num "uint8_t" -- Notice: `end` is a keyword in lua. ---- End VertexDecl. -func.VertexDecl["end"] +--- End VertexLayout. +func.VertexLayout["end"] "void" --- Returns relative attribute offset from the vertex. -func.VertexDecl.getOffset { const , cpponly } +func.VertexLayout.getOffset { const , cpponly } "uint16_t" .attrib "Attrib::Enum" --- Attribute semantics. See: `bgfx::Attrib` --- Returns vertex stride. -func.VertexDecl.getStride { const , cpponly } +func.VertexLayout.getStride { const , cpponly } "uint16_t" --- Returns size of vertex buffer for number of vertices. -func.VertexDecl.getSize { const, cpponly } +func.VertexLayout.getSize { const, cpponly } "uint32_t" .num "uint32_t" --- Pack vertex attribute into vertex stream format. func.vertexPack "void" - .input "const float[4]" --- Value to be packed into vertex stream. - .inputNormalized "bool" --- `true` if input value is already normalized. - .attr "Attrib::Enum" --- Attribute to pack. - .decl "const VertexDecl &" --- Vertex stream declaration. - .data "void*" --- Destination vertex stream where data will be packed. - .index "uint32_t" --- Vertex index that will be modified. + .input "const float[4]" --- Value to be packed into vertex stream. + .inputNormalized "bool" --- `true` if input value is already normalized. + .attr "Attrib::Enum" --- Attribute to pack. + .decl "const VertexLayout &" --- Vertex stream layout. + .data "void*" --- Destination vertex stream where data will be packed. + .index "uint32_t" --- Vertex index that will be modified. { default = 0 } --- Unpack vertex attribute from vertex stream format. func.vertexUnpack "void" - .output "float[4]" { out } --- Result of unpacking. - .attr "Attrib::Enum" --- Attribute to unpack. - .decl "const VertexDecl &" --- Vertex stream declaration. - .data "const void*" --- Source vertex stream from where data will be unpacked. - .index "uint32_t" --- Vertex index that will be unpacked. + .output "float[4]" { out } --- Result of unpacking. + .attr "Attrib::Enum" --- Attribute to unpack. + .decl "const VertexLayout &" --- Vertex stream layout. + .data "const void*" --- Source vertex stream from where data will be unpacked. + .index "uint32_t" --- Vertex index that will be unpacked. { default = 0 } --- Converts vertex stream data from one vertex stream format to another. func.vertexConvert "void" - .dstDecl "const VertexDecl &" --- Destination vertex stream declaration. - .dstData "void*" --- Destination vertex stream. - .srcDecl "const VertexDecl &" --- Source vertex stream declaration. - .srcData "const void*" --- Source vertex stream data. - .num "uint32_t" --- Number of vertices to convert from source to destination. + .dstDecl "const VertexLayout &" --- Destination vertex stream layout. + .dstData "void*" --- Destination vertex stream. + .srcDecl "const VertexLayout &" --- Source vertex stream layout. + .srcData "const void*" --- Source vertex stream data. + .num "uint32_t" --- Number of vertices to convert from source to destination. { default = 1 } --- Weld vertices. func.weldVertices - "uint16_t" --- Number of unique vertices after vertex welding. - .output "uint16_t*" --- Welded vertices remapping table. The size of buffer - --- must be the same as number of vertices. - .decl "const VertexDecl &" --- Vertex stream declaration. - .data "const void*" --- Vertex stream. - .num "uint16_t" --- Number of vertices in vertex stream. - .epsilon "float" --- Error tolerance for vertex position comparison. + "uint16_t" --- Number of unique vertices after vertex welding. + .output "uint16_t*" --- Welded vertices remapping table. The size of buffer + --- must be the same as number of vertices. + .decl "const VertexLayout &" --- Vertex stream layout. + .data "const void*" --- Vertex stream. + .num "uint16_t" --- Number of vertices in vertex stream. + .epsilon "float" --- Error tolerance for vertex position comparison. { default = "0.001f" } --- Convert index buffer for use with different primitive topologies. @@ -1279,21 +1279,21 @@ func.destroy { cname = "destroy_index_buffer" } "void" .handle "IndexBufferHandle" --- Static index buffer handle. ---- Create vertex declaration. -func.createVertexDecl - "VertexDeclHandle" - .decl "const VertexDecl &" --- Vertex declaration. +--- Create vertex layout. +func.createVertexLayout + "VertexLayoutHandle" + .decl "const VertexLayout &" --- Vertex layout. ---- Destroy vertex declaration. +--- Destroy vertex layout. func.destroy { cname = "destroy_vertex_decl" } "void" - .handle "VertexDeclHandle" --- Vertex declaration handle. + .handle "VertexLayoutHandle" --- Vertex layout handle. --- Create static vertex buffer. func.createVertexBuffer "VertexBufferHandle" --- Static vertex buffer handle. .mem "const Memory*" --- Vertex buffer data. - .decl "const VertexDecl &" --- Vertex declaration. + .decl "const VertexLayout &" --- Vertex layout. .flags "uint16_t" --- Buffer creation flags. { default = "BGFX_BUFFER_NONE" } --- - `BGFX_BUFFER_NONE` - No flags. --- - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader. @@ -1368,7 +1368,7 @@ func.destroy { cname = "destroy_dynamic_index_buffer" } func.createDynamicVertexBuffer "DynamicVertexBufferHandle" --- Dynamic vertex buffer handle. .num "uint32_t" --- Number of vertices. - .decl "const VertexDecl&" --- Vertex declaration. + .decl "const VertexLayout&" --- Vertex layout. .flags "uint16_t" --- Buffer creation flags. { default = "BGFX_BUFFER_NONE" } --- - `BGFX_BUFFER_NONE` - No flags. --- - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader. @@ -1386,7 +1386,7 @@ func.createDynamicVertexBuffer func.createDynamicVertexBuffer { cname = "create_dynamic_vertex_buffer_mem" } "DynamicVertexBufferHandle" --- Dynamic vertex buffer handle. .mem "const Memory*" --- Vertex buffer data. - .decl "const VertexDecl&" --- Vertex declaration. + .decl "const VertexLayout&" --- Vertex layout. .flags "uint16_t" --- Buffer creation flags. { default = "BGFX_BUFFER_NONE" } --- - `BGFX_BUFFER_NONE` - No flags. --- - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader. @@ -1419,9 +1419,9 @@ func.getAvailTransientIndexBuffer --- Returns number of requested or maximum available vertices. func.getAvailTransientVertexBuffer - "uint32_t" --- Number of requested or maximum available vertices. - .num "uint32_t" --- Number of required vertices. - .decl "const VertexDecl &" --- Vertex declaration. + "uint32_t" --- Number of requested or maximum available vertices. + .num "uint32_t" --- Number of required vertices. + .decl "const VertexLayout &" --- Vertex layout. --- Returns number of requested or maximum available instance buffer slots. func.getAvailInstanceDataBuffer @@ -1448,7 +1448,7 @@ func.allocTransientVertexBuffer --- for the duration of frame, and it can be reused for multiple draw --- calls. .num "uint32_t" --- Number of vertices to allocate. - .decl "const VertexDecl &" --- Vertex declaration. + .decl "const VertexLayout &" --- Vertex layout. --- Check for required space and allocate transient vertex and index --- buffers. If both space requirements are satisfied function returns @@ -1462,8 +1462,8 @@ func.allocTransientBuffers .tvb "TransientVertexBuffer*" { out } --- TransientVertexBuffer structure is filled and is valid --- for the duration of frame, and it can be reused for multiple draw --- calls. - .decl "const VertexDecl &" --- Number of vertices to allocate. - .numVertices "uint32_t" --- Vertex declaration. + .decl "const VertexLayout &" --- Vertex layout. + .numVertices "uint32_t" --- Number of vertices to allocate. .tib "TransientIndexBuffer*" { out } --- TransientIndexBuffer structure is filled and is valid --- for the duration of frame, and it can be reused for multiple draw --- calls. @@ -2211,7 +2211,7 @@ func.Encoder.setVertexBuffer .handle "VertexBufferHandle" --- Vertex buffer. .startVertex "uint32_t" --- First vertex to render. .numVertices "uint32_t" --- Number of vertices to render. - .declHandle "VertexDeclHandle" --- VertexDecl handle for aliasing vertex buffer. + .declHandle "VertexLayoutHandle" --- VertexLayout handle for aliasing vertex buffer. { default = "BGFX_INVALID_HANDLE" } --- Set vertex buffer for draw primitive. @@ -2227,7 +2227,7 @@ func.Encoder.setVertexBuffer { cname = "set_dynamic_vertex_buffer" } .handle "DynamicVertexBufferHandle" --- Dynamic vertex buffer. .startVertex "uint32_t" --- First vertex to render. .numVertices "uint32_t" --- Number of vertices to render. - .declHandle "VertexDeclHandle" --- VertexDecl handle for aliasing vertex buffer. + .declHandle "VertexLayoutHandle" --- VertexLayout handle for aliasing vertex buffer. { default = "BGFX_INVALID_HANDLE" } --- Set vertex buffer for draw primitive. @@ -2243,7 +2243,7 @@ func.Encoder.setVertexBuffer { cname = "set_transient_vertex_buffer" } .tvb "const TransientVertexBuffer*" --- Transient vertex buffer. .startVertex "uint32_t" --- First vertex to render. .numVertices "uint32_t" --- Number of vertices to render. - .declHandle "VertexDeclHandle" --- VertexDecl handle for aliasing vertex buffer. + .declHandle "VertexLayoutHandle" --- VertexLayout handle for aliasing vertex buffer. { default = "BGFX_INVALID_HANDLE" } --- Set number of vertices for auto generated vertices use in conjuction diff --git a/scripts/bgfx.natvis b/scripts/bgfx.natvis index e53c087b8..b1cb554f4 100644 --- a/scripts/bgfx.natvis +++ b/scripts/bgfx.natvis @@ -106,7 +106,7 @@ - + {{ idx={idx} (INVALID) }} {{ idx={idx} }} diff --git a/scripts/temp.bgfx.idl.inl b/scripts/temp.bgfx.idl.inl index d86172597..63e180c27 100644 --- a/scripts/temp.bgfx.idl.inl +++ b/scripts/temp.bgfx.idl.inl @@ -31,7 +31,7 @@ BGFX_C99_ENUM_CHECK(bgfx::RenderFrame, BGFX_RENDER_FRAME_COUNT); BGFX_C99_STRUCT_SIZE_CHECK(bgfx::Memory, bgfx_memory_t); BGFX_C99_STRUCT_SIZE_CHECK(bgfx::Transform, bgfx_transform_t); BGFX_C99_STRUCT_SIZE_CHECK(bgfx::Stats, bgfx_stats_t); -BGFX_C99_STRUCT_SIZE_CHECK(bgfx::VertexDecl, bgfx_vertex_decl_t); +BGFX_C99_STRUCT_SIZE_CHECK(bgfx::VertexLayout, bgfx_vertex_layout_t); BGFX_C99_STRUCT_SIZE_CHECK(bgfx::TransientIndexBuffer, bgfx_transient_index_buffer_t); BGFX_C99_STRUCT_SIZE_CHECK(bgfx::TransientVertexBuffer, bgfx_transient_vertex_buffer_t); BGFX_C99_STRUCT_SIZE_CHECK(bgfx::InstanceDataBuffer, bgfx_instance_data_buffer_t); diff --git a/src/bgfx.cpp b/src/bgfx.cpp index 9691bf2f8..c8973795a 100644 --- a/src/bgfx.cpp +++ b/src/bgfx.cpp @@ -511,11 +511,11 @@ namespace bgfx return handle; } - void dump(const VertexDecl& _decl) + void dump(const VertexLayout& _decl) { if (BX_ENABLED(BGFX_CONFIG_DEBUG) ) { - BX_TRACE("vertexdecl %08x (%08x), stride %d" + BX_TRACE("vertexlayout %08x (%08x), stride %d" , _decl.m_hash , bx::hash(_decl.m_attributes) , _decl.m_stride @@ -1576,7 +1576,7 @@ namespace bgfx LIMITS(maxTextures); LIMITS(maxTextureSamplers); LIMITS(maxComputeBindings); - LIMITS(maxVertexDecls); + LIMITS(maxVertexLayouts); LIMITS(maxVertexStreams); LIMITS(maxIndexBuffers); LIMITS(maxVertexBuffers); @@ -1918,7 +1918,7 @@ namespace bgfx frame(); } - frame(); // If any VertexDecls needs to be destroyed. + frame(); // If any VertexLayouts needs to be destroyed. getCommandBuffer(CommandBuffer::RendererShutdownEnd); frame(); @@ -1939,7 +1939,7 @@ namespace bgfx m_dynIndexBufferAllocator.compact(); BX_CHECK(m_vertexDeclHandle.getNumHandles() == m_declRef.m_vertexDeclMap.getNumElements() - , "VertexDeclRef mismatch, num handles %d, handles in hash map %d." + , "VertexLayoutRef mismatch, num handles %d, handles in hash map %d." , m_vertexDeclHandle.getNumHandles() , m_declRef.m_vertexDeclMap.getNumElements() ); @@ -2032,7 +2032,7 @@ namespace bgfx CHECK_HANDLE_LEAK ("DynamicIndexBufferHandle", m_dynamicIndexBufferHandle ); CHECK_HANDLE_LEAK ("DynamicVertexBufferHandle", m_dynamicVertexBufferHandle ); CHECK_HANDLE_LEAK_NAME ("IndexBufferHandle", m_indexBufferHandle, IndexBuffer, m_indexBuffers ); - CHECK_HANDLE_LEAK ("VertexDeclHandle", m_vertexDeclHandle ); + CHECK_HANDLE_LEAK ("VertexLayoutHandle", m_vertexDeclHandle ); CHECK_HANDLE_LEAK_NAME ("VertexBufferHandle", m_vertexBufferHandle, VertexBuffer, m_vertexBuffers ); CHECK_HANDLE_LEAK_RC_NAME("ShaderHandle", m_shaderHandle, ShaderRef, m_shaderRef ); CHECK_HANDLE_LEAK ("ProgramHandle", m_programHandle ); @@ -2720,28 +2720,28 @@ namespace bgfx } break; - case CommandBuffer::CreateVertexDecl: + case CommandBuffer::CreateVertexLayout: { - BGFX_PROFILER_SCOPE("CreateVertexDecl", 0xff2040ff); + BGFX_PROFILER_SCOPE("CreateVertexLayout", 0xff2040ff); - VertexDeclHandle handle; + VertexLayoutHandle handle; _cmdbuf.read(handle); - VertexDecl decl; + VertexLayout decl; _cmdbuf.read(decl); - m_renderCtx->createVertexDecl(handle, decl); + m_renderCtx->createVertexLayout(handle, decl); } break; - case CommandBuffer::DestroyVertexDecl: + case CommandBuffer::DestroyVertexLayout: { - BGFX_PROFILER_SCOPE("DestroyVertexDecl", 0xff2040ff); + BGFX_PROFILER_SCOPE("DestroyVertexLayout", 0xff2040ff); - VertexDeclHandle handle; + VertexLayoutHandle handle; _cmdbuf.read(handle); - m_renderCtx->destroyVertexDecl(handle); + m_renderCtx->destroyVertexLayout(handle); } break; @@ -2755,7 +2755,7 @@ namespace bgfx const Memory* mem; _cmdbuf.read(mem); - VertexDeclHandle declHandle; + VertexLayoutHandle declHandle; _cmdbuf.read(declHandle); uint16_t flags; @@ -3375,7 +3375,7 @@ namespace bgfx g_caps.limits.maxTextures = BGFX_CONFIG_MAX_TEXTURES; g_caps.limits.maxTextureSamplers = BGFX_CONFIG_MAX_TEXTURE_SAMPLERS; g_caps.limits.maxComputeBindings = 0; - g_caps.limits.maxVertexDecls = BGFX_CONFIG_MAX_VERTEX_DECLS; + g_caps.limits.maxVertexLayouts = BGFX_CONFIG_MAX_VERTEX_DECLS; g_caps.limits.maxVertexStreams = 1; g_caps.limits.maxIndexBuffers = BGFX_CONFIG_MAX_INDEX_BUFFERS; g_caps.limits.maxVertexBuffers = BGFX_CONFIG_MAX_VERTEX_BUFFERS; @@ -3581,7 +3581,7 @@ namespace bgfx , VertexBufferHandle _handle , uint32_t _startVertex , uint32_t _numVertices - , VertexDeclHandle _declHandle + , VertexLayoutHandle _declHandle ) { BGFX_CHECK_HANDLE("setVertexBuffer", s_ctx->m_vertexBufferHandle, _handle); @@ -3599,7 +3599,7 @@ namespace bgfx , DynamicVertexBufferHandle _handle , uint32_t _startVertex , uint32_t _numVertices - , VertexDeclHandle _declHandle + , VertexLayoutHandle _declHandle ) { BGFX_CHECK_HANDLE("setVertexBuffer", s_ctx->m_dynamicVertexBufferHandle, _handle); @@ -3618,7 +3618,7 @@ namespace bgfx , const TransientVertexBuffer* _tvb , uint32_t _startVertex , uint32_t _numVertices - , VertexDeclHandle _declHandle + , VertexLayoutHandle _declHandle ) { BX_CHECK(NULL != _tvb, "_tvb can't be NULL"); @@ -3937,20 +3937,20 @@ namespace bgfx s_ctx->destroyIndexBuffer(_handle); } - VertexDeclHandle createVertexDecl(const VertexDecl& _decl) + VertexLayoutHandle createVertexLayout(const VertexLayout& _decl) { - return s_ctx->createVertexDecl(_decl); + return s_ctx->createVertexLayout(_decl); } - void destroy(VertexDeclHandle _handle) + void destroy(VertexLayoutHandle _handle) { - s_ctx->destroyVertexDecl(_handle); + s_ctx->destroyVertexLayout(_handle); } - VertexBufferHandle createVertexBuffer(const Memory* _mem, const VertexDecl& _decl, uint16_t _flags) + VertexBufferHandle createVertexBuffer(const Memory* _mem, const VertexLayout& _decl, uint16_t _flags) { BX_CHECK(NULL != _mem, "_mem can't be NULL"); - BX_CHECK(isValid(_decl), "Invalid VertexDecl."); + BX_CHECK(isValid(_decl), "Invalid VertexLayout."); return s_ctx->createVertexBuffer(_mem, _decl, _flags); } @@ -3986,16 +3986,16 @@ namespace bgfx s_ctx->destroyDynamicIndexBuffer(_handle); } - DynamicVertexBufferHandle createDynamicVertexBuffer(uint32_t _num, const VertexDecl& _decl, uint16_t _flags) + DynamicVertexBufferHandle createDynamicVertexBuffer(uint32_t _num, const VertexLayout& _decl, uint16_t _flags) { - BX_CHECK(isValid(_decl), "Invalid VertexDecl."); + BX_CHECK(isValid(_decl), "Invalid VertexLayout."); return s_ctx->createDynamicVertexBuffer(_num, _decl, _flags); } - DynamicVertexBufferHandle createDynamicVertexBuffer(const Memory* _mem, const VertexDecl& _decl, uint16_t _flags) + DynamicVertexBufferHandle createDynamicVertexBuffer(const Memory* _mem, const VertexLayout& _decl, uint16_t _flags) { BX_CHECK(NULL != _mem, "_mem can't be NULL"); - BX_CHECK(isValid(_decl), "Invalid VertexDecl."); + BX_CHECK(isValid(_decl), "Invalid VertexLayout."); return s_ctx->createDynamicVertexBuffer(_mem, _decl, _flags); } @@ -4016,10 +4016,10 @@ namespace bgfx return s_ctx->getAvailTransientIndexBuffer(_num); } - uint32_t getAvailTransientVertexBuffer(uint32_t _num, const VertexDecl& _decl) + uint32_t getAvailTransientVertexBuffer(uint32_t _num, const VertexLayout& _decl) { BX_CHECK(0 < _num, "Requesting 0 vertices."); - BX_CHECK(isValid(_decl), "Invalid VertexDecl."); + BX_CHECK(isValid(_decl), "Invalid VertexLayout."); return s_ctx->getAvailTransientVertexBuffer(_num, _decl.m_stride); } @@ -4042,11 +4042,11 @@ namespace bgfx ); } - void allocTransientVertexBuffer(TransientVertexBuffer* _tvb, uint32_t _num, const VertexDecl& _decl) + void allocTransientVertexBuffer(TransientVertexBuffer* _tvb, uint32_t _num, const VertexLayout& _decl) { BX_CHECK(NULL != _tvb, "_tvb can't be NULL"); BX_CHECK(0 < _num, "Requesting 0 vertices."); - BX_CHECK(isValid(_decl), "Invalid VertexDecl."); + BX_CHECK(isValid(_decl), "Invalid VertexLayout."); s_ctx->allocTransientVertexBuffer(_tvb, _num, _decl); BX_CHECK(_num == _tvb->size / _decl.m_stride , "Failed to allocate transient vertex buffer (requested %d, available %d). " @@ -4056,7 +4056,7 @@ namespace bgfx ); } - bool allocTransientBuffers(bgfx::TransientVertexBuffer* _tvb, const bgfx::VertexDecl& _decl, uint32_t _numVertices, bgfx::TransientIndexBuffer* _tib, uint32_t _numIndices) + bool allocTransientBuffers(bgfx::TransientVertexBuffer* _tvb, const bgfx::VertexLayout& _decl, uint32_t _numVertices, bgfx::TransientIndexBuffer* _tib, uint32_t _numIndices) { BGFX_MUTEX_SCOPE(s_ctx->m_resourceApiLock); @@ -4833,7 +4833,7 @@ namespace bgfx , VertexBufferHandle _handle , uint32_t _startVertex , uint32_t _numVertices - , VertexDeclHandle _declHandle + , VertexLayoutHandle _declHandle ) { BGFX_CHECK_API_THREAD(); @@ -4850,7 +4850,7 @@ namespace bgfx , DynamicVertexBufferHandle _handle , uint32_t _startVertex , uint32_t _numVertices - , VertexDeclHandle _declHandle + , VertexLayoutHandle _declHandle ) { BGFX_CHECK_API_THREAD(); @@ -4867,7 +4867,7 @@ namespace bgfx , const TransientVertexBuffer* _tvb , uint32_t _startVertex , uint32_t _numVertices - , VertexDeclHandle _declHandle + , VertexLayoutHandle _declHandle ) { BGFX_CHECK_API_THREAD(); diff --git a/src/bgfx.idl.inl b/src/bgfx.idl.inl index 2ce7fa69a..6956cda1c 100644 --- a/src/bgfx.idl.inl +++ b/src/bgfx.idl.inl @@ -31,7 +31,7 @@ BGFX_C99_ENUM_CHECK(bgfx::RenderFrame, BGFX_RENDER_FRAME_COUNT); BGFX_C99_STRUCT_SIZE_CHECK(bgfx::Memory, bgfx_memory_t); BGFX_C99_STRUCT_SIZE_CHECK(bgfx::Transform, bgfx_transform_t); BGFX_C99_STRUCT_SIZE_CHECK(bgfx::Stats, bgfx_stats_t); -BGFX_C99_STRUCT_SIZE_CHECK(bgfx::VertexDecl, bgfx_vertex_decl_t); +BGFX_C99_STRUCT_SIZE_CHECK(bgfx::VertexLayout, bgfx_vertex_layout_t); BGFX_C99_STRUCT_SIZE_CHECK(bgfx::TransientIndexBuffer, bgfx_transient_index_buffer_t); BGFX_C99_STRUCT_SIZE_CHECK(bgfx::TransientVertexBuffer, bgfx_transient_vertex_buffer_t); BGFX_C99_STRUCT_SIZE_CHECK(bgfx::InstanceDataBuffer, bgfx_instance_data_buffer_t); @@ -53,66 +53,66 @@ BGFX_C_API void bgfx_attachment_init(bgfx_attachment_t* _this, bgfx_texture_hand This->init(handle.cpp, (bgfx::Access::Enum)_access, _layer, _mip, _resolve); } -BGFX_C_API bgfx_vertex_decl_t* bgfx_vertex_decl_begin(bgfx_vertex_decl_t* _this, bgfx_renderer_type_t _rendererType) +BGFX_C_API bgfx_vertex_layout_t* bgfx_vertex_layout_begin(bgfx_vertex_layout_t* _this, bgfx_renderer_type_t _rendererType) { - bgfx::VertexDecl* This = (bgfx::VertexDecl*)_this; - return (bgfx_vertex_decl_t*)&This->begin((bgfx::RendererType::Enum)_rendererType); + bgfx::VertexLayout* This = (bgfx::VertexLayout*)_this; + return (bgfx_vertex_layout_t*)&This->begin((bgfx::RendererType::Enum)_rendererType); } -BGFX_C_API bgfx_vertex_decl_t* bgfx_vertex_decl_add(bgfx_vertex_decl_t* _this, bgfx_attrib_t _attrib, uint8_t _num, bgfx_attrib_type_t _type, bool _normalized, bool _asInt) +BGFX_C_API bgfx_vertex_layout_t* bgfx_vertex_layout_add(bgfx_vertex_layout_t* _this, bgfx_attrib_t _attrib, uint8_t _num, bgfx_attrib_type_t _type, bool _normalized, bool _asInt) { - bgfx::VertexDecl* This = (bgfx::VertexDecl*)_this; - return (bgfx_vertex_decl_t*)&This->add((bgfx::Attrib::Enum)_attrib, _num, (bgfx::AttribType::Enum)_type, _normalized, _asInt); + bgfx::VertexLayout* This = (bgfx::VertexLayout*)_this; + return (bgfx_vertex_layout_t*)&This->add((bgfx::Attrib::Enum)_attrib, _num, (bgfx::AttribType::Enum)_type, _normalized, _asInt); } -BGFX_C_API void bgfx_vertex_decl_decode(const bgfx_vertex_decl_t* _this, bgfx_attrib_t _attrib, uint8_t * _num, bgfx_attrib_type_t * _type, bool * _normalized, bool * _asInt) +BGFX_C_API void bgfx_vertex_layout_decode(const bgfx_vertex_layout_t* _this, bgfx_attrib_t _attrib, uint8_t * _num, bgfx_attrib_type_t * _type, bool * _normalized, bool * _asInt) { - const bgfx::VertexDecl* This = (const bgfx::VertexDecl*)_this; + const bgfx::VertexLayout* This = (const bgfx::VertexLayout*)_this; bgfx::AttribType::Enum type; This->decode((bgfx::Attrib::Enum)_attrib, *_num, type, *_normalized, *_asInt); *_type = (bgfx_attrib_type_t)type; } -BGFX_C_API bool bgfx_vertex_decl_has(const bgfx_vertex_decl_t* _this, bgfx_attrib_t _attrib) +BGFX_C_API bool bgfx_vertex_layout_has(const bgfx_vertex_layout_t* _this, bgfx_attrib_t _attrib) { - const bgfx::VertexDecl* This = (const bgfx::VertexDecl*)_this; + const bgfx::VertexLayout* This = (const bgfx::VertexLayout*)_this; return This->has((bgfx::Attrib::Enum)_attrib); } -BGFX_C_API bgfx_vertex_decl_t* bgfx_vertex_decl_skip(bgfx_vertex_decl_t* _this, uint8_t _num) +BGFX_C_API bgfx_vertex_layout_t* bgfx_vertex_layout_skip(bgfx_vertex_layout_t* _this, uint8_t _num) { - bgfx::VertexDecl* This = (bgfx::VertexDecl*)_this; - return (bgfx_vertex_decl_t*)&This->skip(_num); + bgfx::VertexLayout* This = (bgfx::VertexLayout*)_this; + return (bgfx_vertex_layout_t*)&This->skip(_num); } -BGFX_C_API void bgfx_vertex_decl_end(bgfx_vertex_decl_t* _this) +BGFX_C_API void bgfx_vertex_layout_end(bgfx_vertex_layout_t* _this) { - bgfx::VertexDecl* This = (bgfx::VertexDecl*)_this; + bgfx::VertexLayout* This = (bgfx::VertexLayout*)_this; This->end(); } -BGFX_C_API void bgfx_vertex_pack(const float _input[4], bool _inputNormalized, bgfx_attrib_t _attr, const bgfx_vertex_decl_t * _decl, void* _data, uint32_t _index) +BGFX_C_API void bgfx_vertex_pack(const float _input[4], bool _inputNormalized, bgfx_attrib_t _attr, const bgfx_vertex_layout_t * _decl, void* _data, uint32_t _index) { - const bgfx::VertexDecl & decl = *(const bgfx::VertexDecl *)_decl; + const bgfx::VertexLayout & decl = *(const bgfx::VertexLayout *)_decl; bgfx::vertexPack(_input, _inputNormalized, (bgfx::Attrib::Enum)_attr, decl, _data, _index); } -BGFX_C_API void bgfx_vertex_unpack(float _output[4], bgfx_attrib_t _attr, const bgfx_vertex_decl_t * _decl, const void* _data, uint32_t _index) +BGFX_C_API void bgfx_vertex_unpack(float _output[4], bgfx_attrib_t _attr, const bgfx_vertex_layout_t * _decl, const void* _data, uint32_t _index) { - const bgfx::VertexDecl & decl = *(const bgfx::VertexDecl *)_decl; + const bgfx::VertexLayout & decl = *(const bgfx::VertexLayout *)_decl; bgfx::vertexUnpack(_output, (bgfx::Attrib::Enum)_attr, decl, _data, _index); } -BGFX_C_API void bgfx_vertex_convert(const bgfx_vertex_decl_t * _dstDecl, void* _dstData, const bgfx_vertex_decl_t * _srcDecl, const void* _srcData, uint32_t _num) +BGFX_C_API void bgfx_vertex_convert(const bgfx_vertex_layout_t * _dstDecl, void* _dstData, const bgfx_vertex_layout_t * _srcDecl, const void* _srcData, uint32_t _num) { - const bgfx::VertexDecl & dstDecl = *(const bgfx::VertexDecl *)_dstDecl; - const bgfx::VertexDecl & srcDecl = *(const bgfx::VertexDecl *)_srcDecl; + const bgfx::VertexLayout & dstDecl = *(const bgfx::VertexLayout *)_dstDecl; + const bgfx::VertexLayout & srcDecl = *(const bgfx::VertexLayout *)_srcDecl; bgfx::vertexConvert(dstDecl, _dstData, srcDecl, _srcData, _num); } -BGFX_C_API uint16_t bgfx_weld_vertices(uint16_t* _output, const bgfx_vertex_decl_t * _decl, const void* _data, uint16_t _num, float _epsilon) +BGFX_C_API uint16_t bgfx_weld_vertices(uint16_t* _output, const bgfx_vertex_layout_t * _decl, const void* _data, uint16_t _num, float _epsilon) { - const bgfx::VertexDecl & decl = *(const bgfx::VertexDecl *)_decl; + const bgfx::VertexLayout & decl = *(const bgfx::VertexLayout *)_decl; return bgfx::weldVertices(_output, decl, _data, _num, _epsilon); } @@ -237,23 +237,23 @@ BGFX_C_API void bgfx_destroy_index_buffer(bgfx_index_buffer_handle_t _handle) bgfx::destroy(handle.cpp); } -BGFX_C_API bgfx_vertex_decl_handle_t bgfx_create_vertex_decl(const bgfx_vertex_decl_t * _decl) +BGFX_C_API bgfx_vertex_layout_handle_t bgfx_create_vertex_layout(const bgfx_vertex_layout_t * _decl) { - const bgfx::VertexDecl & decl = *(const bgfx::VertexDecl *)_decl; - union { bgfx_vertex_decl_handle_t c; bgfx::VertexDeclHandle cpp; } handle_ret; - handle_ret.cpp = bgfx::createVertexDecl(decl); + const bgfx::VertexLayout & decl = *(const bgfx::VertexLayout *)_decl; + union { bgfx_vertex_layout_handle_t c; bgfx::VertexLayoutHandle cpp; } handle_ret; + handle_ret.cpp = bgfx::createVertexLayout(decl); return handle_ret.c; } -BGFX_C_API void bgfx_destroy_vertex_decl(bgfx_vertex_decl_handle_t _handle) +BGFX_C_API void bgfx_destroy_vertex_decl(bgfx_vertex_layout_handle_t _handle) { - union { bgfx_vertex_decl_handle_t c; bgfx::VertexDeclHandle cpp; } handle = { _handle }; + union { bgfx_vertex_layout_handle_t c; bgfx::VertexLayoutHandle cpp; } handle = { _handle }; bgfx::destroy(handle.cpp); } -BGFX_C_API bgfx_vertex_buffer_handle_t bgfx_create_vertex_buffer(const bgfx_memory_t* _mem, const bgfx_vertex_decl_t * _decl, uint16_t _flags) +BGFX_C_API bgfx_vertex_buffer_handle_t bgfx_create_vertex_buffer(const bgfx_memory_t* _mem, const bgfx_vertex_layout_t * _decl, uint16_t _flags) { - const bgfx::VertexDecl & decl = *(const bgfx::VertexDecl *)_decl; + const bgfx::VertexLayout & decl = *(const bgfx::VertexLayout *)_decl; union { bgfx_vertex_buffer_handle_t c; bgfx::VertexBufferHandle cpp; } handle_ret; handle_ret.cpp = bgfx::createVertexBuffer((const bgfx::Memory*)_mem, decl, _flags); return handle_ret.c; @@ -297,17 +297,17 @@ BGFX_C_API void bgfx_destroy_dynamic_index_buffer(bgfx_dynamic_index_buffer_hand bgfx::destroy(handle.cpp); } -BGFX_C_API bgfx_dynamic_vertex_buffer_handle_t bgfx_create_dynamic_vertex_buffer(uint32_t _num, const bgfx_vertex_decl_t* _decl, uint16_t _flags) +BGFX_C_API bgfx_dynamic_vertex_buffer_handle_t bgfx_create_dynamic_vertex_buffer(uint32_t _num, const bgfx_vertex_layout_t* _decl, uint16_t _flags) { - const bgfx::VertexDecl& decl = *(const bgfx::VertexDecl*)_decl; + const bgfx::VertexLayout& decl = *(const bgfx::VertexLayout*)_decl; union { bgfx_dynamic_vertex_buffer_handle_t c; bgfx::DynamicVertexBufferHandle cpp; } handle_ret; handle_ret.cpp = bgfx::createDynamicVertexBuffer(_num, decl, _flags); return handle_ret.c; } -BGFX_C_API bgfx_dynamic_vertex_buffer_handle_t bgfx_create_dynamic_vertex_buffer_mem(const bgfx_memory_t* _mem, const bgfx_vertex_decl_t* _decl, uint16_t _flags) +BGFX_C_API bgfx_dynamic_vertex_buffer_handle_t bgfx_create_dynamic_vertex_buffer_mem(const bgfx_memory_t* _mem, const bgfx_vertex_layout_t* _decl, uint16_t _flags) { - const bgfx::VertexDecl& decl = *(const bgfx::VertexDecl*)_decl; + const bgfx::VertexLayout& decl = *(const bgfx::VertexLayout*)_decl; union { bgfx_dynamic_vertex_buffer_handle_t c; bgfx::DynamicVertexBufferHandle cpp; } handle_ret; handle_ret.cpp = bgfx::createDynamicVertexBuffer((const bgfx::Memory*)_mem, decl, _flags); return handle_ret.c; @@ -330,9 +330,9 @@ BGFX_C_API uint32_t bgfx_get_avail_transient_index_buffer(uint32_t _num) return bgfx::getAvailTransientIndexBuffer(_num); } -BGFX_C_API uint32_t bgfx_get_avail_transient_vertex_buffer(uint32_t _num, const bgfx_vertex_decl_t * _decl) +BGFX_C_API uint32_t bgfx_get_avail_transient_vertex_buffer(uint32_t _num, const bgfx_vertex_layout_t * _decl) { - const bgfx::VertexDecl & decl = *(const bgfx::VertexDecl *)_decl; + const bgfx::VertexLayout & decl = *(const bgfx::VertexLayout *)_decl; return bgfx::getAvailTransientVertexBuffer(_num, decl); } @@ -346,15 +346,15 @@ BGFX_C_API void bgfx_alloc_transient_index_buffer(bgfx_transient_index_buffer_t* bgfx::allocTransientIndexBuffer((bgfx::TransientIndexBuffer*)_tib, _num); } -BGFX_C_API void bgfx_alloc_transient_vertex_buffer(bgfx_transient_vertex_buffer_t* _tvb, uint32_t _num, const bgfx_vertex_decl_t * _decl) +BGFX_C_API void bgfx_alloc_transient_vertex_buffer(bgfx_transient_vertex_buffer_t* _tvb, uint32_t _num, const bgfx_vertex_layout_t * _decl) { - const bgfx::VertexDecl & decl = *(const bgfx::VertexDecl *)_decl; + const bgfx::VertexLayout & decl = *(const bgfx::VertexLayout *)_decl; bgfx::allocTransientVertexBuffer((bgfx::TransientVertexBuffer*)_tvb, _num, decl); } -BGFX_C_API bool bgfx_alloc_transient_buffers(bgfx_transient_vertex_buffer_t* _tvb, const bgfx_vertex_decl_t * _decl, uint32_t _numVertices, bgfx_transient_index_buffer_t* _tib, uint32_t _numIndices) +BGFX_C_API bool bgfx_alloc_transient_buffers(bgfx_transient_vertex_buffer_t* _tvb, const bgfx_vertex_layout_t * _decl, uint32_t _numVertices, bgfx_transient_index_buffer_t* _tib, uint32_t _numIndices) { - const bgfx::VertexDecl & decl = *(const bgfx::VertexDecl *)_decl; + const bgfx::VertexLayout & decl = *(const bgfx::VertexLayout *)_decl; return bgfx::allocTransientBuffers((bgfx::TransientVertexBuffer*)_tvb, decl, _numVertices, (bgfx::TransientIndexBuffer*)_tib, _numIndices); } @@ -759,26 +759,26 @@ BGFX_C_API void bgfx_encoder_set_transient_index_buffer(bgfx_encoder_t* _this, c This->setIndexBuffer((const bgfx::TransientIndexBuffer*)_tib, _firstIndex, _numIndices); } -BGFX_C_API void bgfx_encoder_set_vertex_buffer(bgfx_encoder_t* _this, uint8_t _stream, bgfx_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _numVertices, bgfx_vertex_decl_handle_t _declHandle) +BGFX_C_API void bgfx_encoder_set_vertex_buffer(bgfx_encoder_t* _this, uint8_t _stream, bgfx_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _numVertices, bgfx_vertex_layout_handle_t _declHandle) { bgfx::Encoder* This = (bgfx::Encoder*)_this; union { bgfx_vertex_buffer_handle_t c; bgfx::VertexBufferHandle cpp; } handle = { _handle }; - union { bgfx_vertex_decl_handle_t c; bgfx::VertexDeclHandle cpp; } declHandle = { _declHandle }; + union { bgfx_vertex_layout_handle_t c; bgfx::VertexLayoutHandle cpp; } declHandle = { _declHandle }; This->setVertexBuffer(_stream, handle.cpp, _startVertex, _numVertices, declHandle.cpp); } -BGFX_C_API void bgfx_encoder_set_dynamic_vertex_buffer(bgfx_encoder_t* _this, uint8_t _stream, bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _numVertices, bgfx_vertex_decl_handle_t _declHandle) +BGFX_C_API void bgfx_encoder_set_dynamic_vertex_buffer(bgfx_encoder_t* _this, uint8_t _stream, bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _numVertices, bgfx_vertex_layout_handle_t _declHandle) { bgfx::Encoder* This = (bgfx::Encoder*)_this; union { bgfx_dynamic_vertex_buffer_handle_t c; bgfx::DynamicVertexBufferHandle cpp; } handle = { _handle }; - union { bgfx_vertex_decl_handle_t c; bgfx::VertexDeclHandle cpp; } declHandle = { _declHandle }; + union { bgfx_vertex_layout_handle_t c; bgfx::VertexLayoutHandle cpp; } declHandle = { _declHandle }; This->setVertexBuffer(_stream, handle.cpp, _startVertex, _numVertices, declHandle.cpp); } -BGFX_C_API void bgfx_encoder_set_transient_vertex_buffer(bgfx_encoder_t* _this, uint8_t _stream, const bgfx_transient_vertex_buffer_t* _tvb, uint32_t _startVertex, uint32_t _numVertices, bgfx_vertex_decl_handle_t _declHandle) +BGFX_C_API void bgfx_encoder_set_transient_vertex_buffer(bgfx_encoder_t* _this, uint8_t _stream, const bgfx_transient_vertex_buffer_t* _tvb, uint32_t _startVertex, uint32_t _numVertices, bgfx_vertex_layout_handle_t _declHandle) { bgfx::Encoder* This = (bgfx::Encoder*)_this; - union { bgfx_vertex_decl_handle_t c; bgfx::VertexDeclHandle cpp; } declHandle = { _declHandle }; + union { bgfx_vertex_layout_handle_t c; bgfx::VertexLayoutHandle cpp; } declHandle = { _declHandle }; This->setVertexBuffer(_stream, (const bgfx::TransientVertexBuffer*)_tvb, _startVertex, _numVertices, declHandle.cpp); } @@ -1203,12 +1203,12 @@ BGFX_C_API bgfx_interface_vtbl_t* bgfx_get_interface(uint32_t _version) static bgfx_interface_vtbl_t s_bgfx_interface = { bgfx_attachment_init, - bgfx_vertex_decl_begin, - bgfx_vertex_decl_add, - bgfx_vertex_decl_decode, - bgfx_vertex_decl_has, - bgfx_vertex_decl_skip, - bgfx_vertex_decl_end, + bgfx_vertex_layout_begin, + bgfx_vertex_layout_add, + bgfx_vertex_layout_decode, + bgfx_vertex_layout_has, + bgfx_vertex_layout_skip, + bgfx_vertex_layout_end, bgfx_vertex_pack, bgfx_vertex_unpack, bgfx_vertex_convert, @@ -1237,7 +1237,7 @@ BGFX_C_API bgfx_interface_vtbl_t* bgfx_get_interface(uint32_t _version) bgfx_create_index_buffer, bgfx_set_index_buffer_name, bgfx_destroy_index_buffer, - bgfx_create_vertex_decl, + bgfx_create_vertex_layout, bgfx_destroy_vertex_decl, bgfx_create_vertex_buffer, bgfx_set_vertex_buffer_name, diff --git a/src/bgfx_p.h b/src/bgfx_p.h index dccb76ca3..ba745d53b 100644 --- a/src/bgfx_p.h +++ b/src/bgfx_p.h @@ -74,7 +74,7 @@ namespace bgfx void trace(const char* _filePath, uint16_t _line, const char* _format, ...); - inline bool operator==(const VertexDeclHandle& _lhs, const VertexDeclHandle& _rhs) { return _lhs.idx == _rhs.idx; } + inline bool operator==(const VertexLayoutHandle& _lhs, const VertexLayoutHandle& _rhs) { return _lhs.idx == _rhs.idx; } inline bool operator==(const UniformHandle& _lhs, const UniformHandle& _rhs) { return _lhs.idx == _rhs.idx; } } @@ -313,7 +313,7 @@ namespace bgfx const char* getTypeName(Handle _handle); - inline bool isValid(const VertexDecl& _decl) + inline bool isValid(const VertexLayout& _decl) { return 0 != _decl.m_stride; } @@ -543,7 +543,7 @@ namespace bgfx } /// Dump vertex declaration into debug output. - void dump(const VertexDecl& _decl); + void dump(const VertexLayout& _decl); struct TextVideoMem { @@ -657,7 +657,7 @@ namespace bgfx TextureHandle m_texture; TransientVertexBuffer* m_vb; TransientIndexBuffer* m_ib; - VertexDecl m_decl; + VertexLayout m_decl; ProgramHandle m_program; }; @@ -727,7 +727,7 @@ namespace bgfx void shutdown(); VertexBufferHandle m_vb; - VertexDecl m_decl; + VertexLayout m_decl; ProgramHandle m_program[BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS]; }; @@ -779,7 +779,7 @@ namespace bgfx { RendererInit, RendererShutdownBegin, - CreateVertexDecl, + CreateVertexLayout, CreateIndexBuffer, CreateVertexBuffer, CreateDynamicIndexBuffer, @@ -798,7 +798,7 @@ namespace bgfx SetName, End, RendererShutdownEnd, - DestroyVertexDecl, + DestroyVertexLayout, DestroyIndexBuffer, DestroyVertexBuffer, DestroyDynamicIndexBuffer, @@ -1538,7 +1538,7 @@ constexpr uint64_t kSortKeyComputeProgramMask = uint64_t(BGFX_CONFIG_MAX_PROGRA uint32_t m_startVertex; VertexBufferHandle m_handle; - VertexDeclHandle m_decl; + VertexLayoutHandle m_decl; }; BX_ALIGN_DECL_CACHE_LINE(struct) RenderBind @@ -1710,7 +1710,7 @@ constexpr uint64_t kSortKeyComputeProgramMask = uint64_t(BGFX_CONFIG_MAX_PROGRA uint32_t m_startVertex; uint32_t m_numVertices; uint16_t m_stride; - VertexDeclHandle m_decl; + VertexLayoutHandle m_decl; uint16_t m_flags; }; @@ -2024,7 +2024,7 @@ constexpr uint64_t kSortKeyComputeProgramMask = uint64_t(BGFX_CONFIG_MAX_PROGRA return m_freeIndexBuffer.queue(_handle); } - bool free(VertexDeclHandle _handle) + bool free(VertexLayoutHandle _handle) { return m_freeVertexDecl.queue(_handle); } @@ -2160,7 +2160,7 @@ constexpr uint64_t kSortKeyComputeProgramMask = uint64_t(BGFX_CONFIG_MAX_PROGRA }; FreeHandle m_freeIndexBuffer; - FreeHandle m_freeVertexDecl; + FreeHandle m_freeVertexDecl; FreeHandle m_freeVertexBuffer; FreeHandle m_freeShader; FreeHandle m_freeProgram; @@ -2339,7 +2339,7 @@ constexpr uint64_t kSortKeyComputeProgramMask = uint64_t(BGFX_CONFIG_MAX_PROGRA , VertexBufferHandle _handle , uint32_t _startVertex , uint32_t _numVertices - , VertexDeclHandle _declHandle + , VertexLayoutHandle _declHandle ) { BX_CHECK(UINT8_MAX != m_draw.m_streamMask, ""); @@ -2359,7 +2359,7 @@ constexpr uint64_t kSortKeyComputeProgramMask = uint64_t(BGFX_CONFIG_MAX_PROGRA , const DynamicVertexBuffer& _dvb , uint32_t _startVertex , uint32_t _numVertices - , VertexDeclHandle _declHandle + , VertexLayoutHandle _declHandle ) { BX_CHECK(UINT8_MAX != m_draw.m_streamMask, ""); @@ -2381,7 +2381,7 @@ constexpr uint64_t kSortKeyComputeProgramMask = uint64_t(BGFX_CONFIG_MAX_PROGRA , const TransientVertexBuffer* _tvb , uint32_t _startVertex , uint32_t _numVertices - , VertexDeclHandle _declHandle + , VertexLayoutHandle _declHandle ) { BX_CHECK(UINT8_MAX != m_draw.m_streamMask, ""); @@ -2541,9 +2541,9 @@ constexpr uint64_t kSortKeyComputeProgramMask = uint64_t(BGFX_CONFIG_MAX_PROGRA int64_t m_cpuTimeEnd; }; - struct VertexDeclRef + struct VertexLayoutRef { - VertexDeclRef() + VertexLayoutRef() { } @@ -2559,7 +2559,7 @@ constexpr uint64_t kSortKeyComputeProgramMask = uint64_t(BGFX_CONFIG_MAX_PROGRA { for (uint16_t ii = 0, num = _handleAlloc.getNumHandles(); ii < num; ++ii) { - VertexDeclHandle handle = { _handleAlloc.getHandleAt(ii) }; + VertexLayoutHandle handle = { _handleAlloc.getHandleAt(ii) }; m_vertexDeclRef[handle.idx] = 0; m_vertexDeclMap.removeByHandle(handle.idx); _handleAlloc.free(handle.idx); @@ -2568,19 +2568,19 @@ constexpr uint64_t kSortKeyComputeProgramMask = uint64_t(BGFX_CONFIG_MAX_PROGRA m_vertexDeclMap.reset(); } - VertexDeclHandle find(uint32_t _hash) + VertexLayoutHandle find(uint32_t _hash) { - VertexDeclHandle handle = { m_vertexDeclMap.find(_hash) }; + VertexLayoutHandle handle = { m_vertexDeclMap.find(_hash) }; return handle; } - void add(VertexDeclHandle _declHandle, uint32_t _hash) + void add(VertexLayoutHandle _declHandle, uint32_t _hash) { m_vertexDeclRef[_declHandle.idx]++; m_vertexDeclMap.insert(_hash, _declHandle.idx); } - void add(VertexBufferHandle _handle, VertexDeclHandle _declHandle, uint32_t _hash) + void add(VertexBufferHandle _handle, VertexLayoutHandle _declHandle, uint32_t _hash) { BX_CHECK(m_vertexBufferRef[_handle.idx].idx == kInvalidHandle, ""); m_vertexBufferRef[_handle.idx] = _declHandle; @@ -2588,7 +2588,7 @@ constexpr uint64_t kSortKeyComputeProgramMask = uint64_t(BGFX_CONFIG_MAX_PROGRA m_vertexDeclMap.insert(_hash, _declHandle.idx); } - void add(DynamicVertexBufferHandle _handle, VertexDeclHandle _declHandle, uint32_t _hash) + void add(DynamicVertexBufferHandle _handle, VertexLayoutHandle _declHandle, uint32_t _hash) { BX_CHECK(m_dynamicVertexBufferRef[_handle.idx].idx == kInvalidHandle, ""); m_dynamicVertexBufferRef[_handle.idx] = _declHandle; @@ -2596,7 +2596,7 @@ constexpr uint64_t kSortKeyComputeProgramMask = uint64_t(BGFX_CONFIG_MAX_PROGRA m_vertexDeclMap.insert(_hash, _declHandle.idx); } - VertexDeclHandle release(VertexDeclHandle _declHandle) + VertexLayoutHandle release(VertexLayoutHandle _declHandle) { if (isValid(_declHandle) ) { @@ -2612,30 +2612,30 @@ constexpr uint64_t kSortKeyComputeProgramMask = uint64_t(BGFX_CONFIG_MAX_PROGRA return BGFX_INVALID_HANDLE; } - VertexDeclHandle release(VertexBufferHandle _handle) + VertexLayoutHandle release(VertexBufferHandle _handle) { - VertexDeclHandle declHandle = m_vertexBufferRef[_handle.idx]; + VertexLayoutHandle declHandle = m_vertexBufferRef[_handle.idx]; declHandle = release(declHandle); m_vertexBufferRef[_handle.idx].idx = kInvalidHandle; return declHandle; } - VertexDeclHandle release(DynamicVertexBufferHandle _handle) + VertexLayoutHandle release(DynamicVertexBufferHandle _handle) { - VertexDeclHandle declHandle = m_dynamicVertexBufferRef[_handle.idx]; + VertexLayoutHandle declHandle = m_dynamicVertexBufferRef[_handle.idx]; declHandle = release(declHandle); m_dynamicVertexBufferRef[_handle.idx].idx = kInvalidHandle; return declHandle; } - typedef bx::HandleHashMapT VertexDeclMap; - VertexDeclMap m_vertexDeclMap; + typedef bx::HandleHashMapT VertexLayoutMap; + VertexLayoutMap m_vertexDeclMap; uint16_t m_vertexDeclRef[BGFX_CONFIG_MAX_VERTEX_DECLS]; - VertexDeclHandle m_vertexBufferRef[BGFX_CONFIG_MAX_VERTEX_BUFFERS]; - VertexDeclHandle m_dynamicVertexBufferRef[BGFX_CONFIG_MAX_DYNAMIC_VERTEX_BUFFERS]; + VertexLayoutHandle m_vertexBufferRef[BGFX_CONFIG_MAX_VERTEX_BUFFERS]; + VertexLayoutHandle m_dynamicVertexBufferRef[BGFX_CONFIG_MAX_DYNAMIC_VERTEX_BUFFERS]; }; // First-fit non-local allocator. @@ -2772,9 +2772,9 @@ constexpr uint64_t kSortKeyComputeProgramMask = uint64_t(BGFX_CONFIG_MAX_PROGRA virtual void flip() = 0; virtual void createIndexBuffer(IndexBufferHandle _handle, const Memory* _mem, uint16_t _flags) = 0; virtual void destroyIndexBuffer(IndexBufferHandle _handle) = 0; - virtual void createVertexDecl(VertexDeclHandle _handle, const VertexDecl& _decl) = 0; - virtual void destroyVertexDecl(VertexDeclHandle _handle) = 0; - virtual void createVertexBuffer(VertexBufferHandle _handle, const Memory* _mem, VertexDeclHandle _declHandle, uint16_t _flags) = 0; + virtual void createVertexLayout(VertexLayoutHandle _handle, const VertexLayout& _decl) = 0; + virtual void destroyVertexLayout(VertexLayoutHandle _handle) = 0; + virtual void createVertexBuffer(VertexBufferHandle _handle, const Memory* _mem, VertexLayoutHandle _declHandle, uint16_t _flags) = 0; virtual void destroyVertexBuffer(VertexBufferHandle _handle) = 0; virtual void createDynamicIndexBuffer(IndexBufferHandle _handle, uint32_t _size, uint16_t _flags) = 0; virtual void updateDynamicIndexBuffer(IndexBufferHandle _handle, uint32_t _offset, uint32_t _size, const Memory* _mem) = 0; @@ -2964,7 +2964,7 @@ constexpr uint64_t kSortKeyComputeProgramMask = uint64_t(BGFX_CONFIG_MAX_PROGRA stats.numTextures = m_textureHandle.getNumHandles(); stats.numUniforms = m_uniformHandle.getNumHandles(); stats.numVertexBuffers = m_vertexBufferHandle.getNumHandles(); - stats.numVertexDecls = m_vertexDeclHandle.getNumHandles(); + stats.numVertexLayouts = m_vertexDeclHandle.getNumHandles(); stats.textureMemoryUsed = m_textureMemoryUsed; stats.rtMemoryUsed = m_rtMemoryUsed; @@ -3026,9 +3026,9 @@ constexpr uint64_t kSortKeyComputeProgramMask = uint64_t(BGFX_CONFIG_MAX_PROGRA cmdbuf.write(_handle); } - VertexDeclHandle findVertexDecl(const VertexDecl& _decl) + VertexLayoutHandle findVertexLayout(const VertexLayout& _decl) { - VertexDeclHandle declHandle = m_declRef.find(_decl.m_hash); + VertexLayoutHandle declHandle = m_declRef.find(_decl.m_hash); if (!isValid(declHandle) ) { @@ -3038,7 +3038,7 @@ constexpr uint64_t kSortKeyComputeProgramMask = uint64_t(BGFX_CONFIG_MAX_PROGRA return declHandle; } - CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::CreateVertexDecl); + CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::CreateVertexLayout); cmdbuf.write(declHandle); cmdbuf.write(_decl); } @@ -3046,11 +3046,11 @@ constexpr uint64_t kSortKeyComputeProgramMask = uint64_t(BGFX_CONFIG_MAX_PROGRA return declHandle; } - BGFX_API_FUNC(VertexDeclHandle createVertexDecl(const VertexDecl& _decl) ) + BGFX_API_FUNC(VertexLayoutHandle createVertexLayout(const VertexLayout& _decl) ) { BGFX_MUTEX_SCOPE(m_resourceApiLock); - VertexDeclHandle handle = findVertexDecl(_decl); + VertexLayoutHandle handle = findVertexLayout(_decl); if (!isValid(handle) ) { BX_TRACE("WARNING: Failed to allocate vertex decl handle (BGFX_CONFIG_MAX_VERTEX_DECLS, max: %d).", BGFX_CONFIG_MAX_VERTEX_DECLS); @@ -3062,13 +3062,13 @@ constexpr uint64_t kSortKeyComputeProgramMask = uint64_t(BGFX_CONFIG_MAX_PROGRA return handle; } - BGFX_API_FUNC(void destroyVertexDecl(VertexDeclHandle _handle) ) + BGFX_API_FUNC(void destroyVertexLayout(VertexLayoutHandle _handle) ) { BGFX_MUTEX_SCOPE(m_resourceApiLock); m_declRef.release(_handle); } - BGFX_API_FUNC(VertexBufferHandle createVertexBuffer(const Memory* _mem, const VertexDecl& _decl, uint16_t _flags) ) + BGFX_API_FUNC(VertexBufferHandle createVertexBuffer(const Memory* _mem, const VertexLayout& _decl, uint16_t _flags) ) { BGFX_MUTEX_SCOPE(m_resourceApiLock); @@ -3076,7 +3076,7 @@ constexpr uint64_t kSortKeyComputeProgramMask = uint64_t(BGFX_CONFIG_MAX_PROGRA if (isValid(handle) ) { - VertexDeclHandle declHandle = findVertexDecl(_decl); + VertexLayoutHandle declHandle = findVertexLayout(_decl); if (!isValid(declHandle) ) { BX_TRACE("WARNING: Failed to allocate vertex decl handle (BGFX_CONFIG_MAX_VERTEX_DECLS, max: %d).", BGFX_CONFIG_MAX_VERTEX_DECLS); @@ -3136,10 +3136,10 @@ constexpr uint64_t kSortKeyComputeProgramMask = uint64_t(BGFX_CONFIG_MAX_PROGRA void destroyVertexBufferInternal(VertexBufferHandle _handle) { - VertexDeclHandle declHandle = m_declRef.release(_handle); + VertexLayoutHandle declHandle = m_declRef.release(_handle); if (isValid(declHandle) ) { - CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::DestroyVertexDecl); + CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::DestroyVertexLayout); cmdbuf.write(declHandle); m_render->free(declHandle); } @@ -3353,11 +3353,11 @@ constexpr uint64_t kSortKeyComputeProgramMask = uint64_t(BGFX_CONFIG_MAX_PROGRA return ptr; } - BGFX_API_FUNC(DynamicVertexBufferHandle createDynamicVertexBuffer(uint32_t _num, const VertexDecl& _decl, uint16_t _flags) ) + BGFX_API_FUNC(DynamicVertexBufferHandle createDynamicVertexBuffer(uint32_t _num, const VertexLayout& _decl, uint16_t _flags) ) { BGFX_MUTEX_SCOPE(m_resourceApiLock); - VertexDeclHandle declHandle = findVertexDecl(_decl); + VertexLayoutHandle declHandle = findVertexLayout(_decl); if (!isValid(declHandle) ) { BX_TRACE("WARNING: Failed to allocate vertex decl handle (BGFX_CONFIG_MAX_VERTEX_DECLS, max: %d).", BGFX_CONFIG_MAX_VERTEX_DECLS); @@ -3421,7 +3421,7 @@ constexpr uint64_t kSortKeyComputeProgramMask = uint64_t(BGFX_CONFIG_MAX_PROGRA return handle; } - BGFX_API_FUNC(DynamicVertexBufferHandle createDynamicVertexBuffer(const Memory* _mem, const VertexDecl& _decl, uint16_t _flags) ) + BGFX_API_FUNC(DynamicVertexBufferHandle createDynamicVertexBuffer(const Memory* _mem, const VertexLayout& _decl, uint16_t _flags) ) { BGFX_MUTEX_SCOPE(m_resourceApiLock); @@ -3492,12 +3492,12 @@ constexpr uint64_t kSortKeyComputeProgramMask = uint64_t(BGFX_CONFIG_MAX_PROGRA void destroyDynamicVertexBufferInternal(DynamicVertexBufferHandle _handle) { - VertexDeclHandle declHandle = m_declRef.release(_handle); + VertexLayoutHandle declHandle = m_declRef.release(_handle); BGFX_CHECK_HANDLE_INVALID_OK("destroyDynamicVertexBufferInternal", m_vertexDeclHandle, declHandle); if (isValid(declHandle) ) { - CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::DestroyVertexDecl); + CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::DestroyVertexLayout); cmdbuf.write(declHandle); m_render->free(declHandle); } @@ -3587,7 +3587,7 @@ constexpr uint64_t kSortKeyComputeProgramMask = uint64_t(BGFX_CONFIG_MAX_PROGRA _tib->startIndex = bx::strideAlign(offset, 2)/2; } - TransientVertexBuffer* createTransientVertexBuffer(uint32_t _size, const VertexDecl* _decl = NULL) + TransientVertexBuffer* createTransientVertexBuffer(uint32_t _size, const VertexLayout* _decl = NULL) { TransientVertexBuffer* tvb = NULL; @@ -3597,11 +3597,11 @@ constexpr uint64_t kSortKeyComputeProgramMask = uint64_t(BGFX_CONFIG_MAX_PROGRA if (isValid(handle) ) { uint16_t stride = 0; - VertexDeclHandle declHandle = BGFX_INVALID_HANDLE; + VertexLayoutHandle declHandle = BGFX_INVALID_HANDLE; if (NULL != _decl) { - declHandle = findVertexDecl(*_decl); + declHandle = findVertexLayout(*_decl); m_declRef.add(handle, declHandle, _decl->m_hash); stride = _decl->m_stride; @@ -3637,19 +3637,19 @@ constexpr uint64_t kSortKeyComputeProgramMask = uint64_t(BGFX_CONFIG_MAX_PROGRA BX_ALIGNED_FREE(g_allocator, _tvb, 16); } - BGFX_API_FUNC(void allocTransientVertexBuffer(TransientVertexBuffer* _tvb, uint32_t _num, const VertexDecl& _decl) ) + BGFX_API_FUNC(void allocTransientVertexBuffer(TransientVertexBuffer* _tvb, uint32_t _num, const VertexLayout& _decl) ) { BGFX_MUTEX_SCOPE(m_resourceApiLock); - VertexDeclHandle declHandle = m_declRef.find(_decl.m_hash); + VertexLayoutHandle declHandle = m_declRef.find(_decl.m_hash); TransientVertexBuffer& dvb = *m_submit->m_transientVb; if (!isValid(declHandle) ) { - VertexDeclHandle temp = { m_vertexDeclHandle.alloc() }; + VertexLayoutHandle temp = { m_vertexDeclHandle.alloc() }; declHandle = temp; - CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::CreateVertexDecl); + CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::CreateVertexLayout); cmdbuf.write(declHandle); cmdbuf.write(_decl); m_declRef.add(declHandle, _decl.m_hash); @@ -4949,7 +4949,7 @@ constexpr uint64_t kSortKeyComputeProgramMask = uint64_t(BGFX_CONFIG_MAX_PROGRA TextureRef m_textureRef[BGFX_CONFIG_MAX_TEXTURES]; FrameBufferRef m_frameBufferRef[BGFX_CONFIG_MAX_FRAME_BUFFERS]; - VertexDeclRef m_declRef; + VertexLayoutRef m_declRef; ViewId m_viewRemap[BGFX_CONFIG_MAX_VIEWS]; uint32_t m_seq[BGFX_CONFIG_MAX_VIEWS]; diff --git a/src/renderer_d3d11.cpp b/src/renderer_d3d11.cpp index cb91e3f27..6ff92100e 100644 --- a/src/renderer_d3d11.cpp +++ b/src/renderer_d3d11.cpp @@ -348,7 +348,7 @@ namespace bgfx { namespace d3d11 }; BX_STATIC_ASSERT(AttribType::Count == BX_COUNTOF(s_attribType) ); - static D3D11_INPUT_ELEMENT_DESC* fillVertexDecl(uint8_t _stream, D3D11_INPUT_ELEMENT_DESC* _out, const VertexDecl& _decl) + static D3D11_INPUT_ELEMENT_DESC* fillVertexLayout(uint8_t _stream, D3D11_INPUT_ELEMENT_DESC* _out, const VertexLayout& _decl) { D3D11_INPUT_ELEMENT_DESC* elem = _out; @@ -1688,18 +1688,18 @@ namespace bgfx { namespace d3d11 m_indexBuffers[_handle.idx].destroy(); } - void createVertexDecl(VertexDeclHandle _handle, const VertexDecl& _decl) override + void createVertexLayout(VertexLayoutHandle _handle, const VertexLayout& _decl) override { - VertexDecl& decl = m_vertexDecls[_handle.idx]; - bx::memCopy(&decl, &_decl, sizeof(VertexDecl) ); + VertexLayout& decl = m_vertexDecls[_handle.idx]; + bx::memCopy(&decl, &_decl, sizeof(VertexLayout) ); dump(decl); } - void destroyVertexDecl(VertexDeclHandle /*_handle*/) override + void destroyVertexLayout(VertexLayoutHandle /*_handle*/) override { } - void createVertexBuffer(VertexBufferHandle _handle, const Memory* _mem, VertexDeclHandle _declHandle, uint16_t _flags) override + void createVertexBuffer(VertexBufferHandle _handle, const Memory* _mem, VertexLayoutHandle _declHandle, uint16_t _flags) override { m_vertexBuffers[_handle.idx].create(_mem->size, _mem->data, _declHandle, _flags); } @@ -1726,7 +1726,7 @@ namespace bgfx { namespace d3d11 void createDynamicVertexBuffer(VertexBufferHandle _handle, uint32_t _size, uint16_t _flags) override { - VertexDeclHandle decl = BGFX_INVALID_HANDLE; + VertexLayoutHandle decl = BGFX_INVALID_HANDLE; m_vertexBuffers[_handle.idx].create(_size, NULL, decl, _flags); } @@ -2095,7 +2095,7 @@ namespace bgfx { namespace d3d11 deviceCtx->PSSetConstantBuffers(0, 1, &program.m_fsh->m_buffer); VertexBufferD3D11& vb = m_vertexBuffers[_blitter.m_vb->handle.idx]; - VertexDecl& vertexDecl = m_vertexDecls[_blitter.m_vb->decl.idx]; + VertexLayout& vertexDecl = m_vertexDecls[_blitter.m_vb->decl.idx]; uint32_t stride = vertexDecl.m_stride; uint32_t offset = 0; deviceCtx->IASetVertexBuffers(0, 1, &vb.m_ptr, &stride, &offset); @@ -2578,7 +2578,7 @@ namespace bgfx { namespace d3d11 } } - void setInputLayout(uint8_t _numStreams, const VertexDecl** _vertexDecls, const ProgramD3D11& _program, uint16_t _numInstanceData) + void setInputLayout(uint8_t _numStreams, const VertexLayout** _vertexDecls, const ProgramD3D11& _program, uint16_t _numInstanceData) { bx::HashMurmur2A murmur; murmur.begin(); @@ -2600,8 +2600,8 @@ namespace bgfx { namespace d3d11 for (uint8_t stream = 0; stream < _numStreams; ++stream) { - VertexDecl decl; - bx::memCopy(&decl, _vertexDecls[stream], sizeof(VertexDecl) ); + VertexLayout decl; + bx::memCopy(&decl, _vertexDecls[stream], sizeof(VertexLayout) ); const bool last = stream == _numStreams-1; @@ -2620,7 +2620,7 @@ namespace bgfx { namespace d3d11 } } - elem = fillVertexDecl(stream, elem, decl); + elem = fillVertexLayout(stream, elem, decl); } uint32_t num = uint32_t(elem-vertexElements); @@ -2668,9 +2668,9 @@ namespace bgfx { namespace d3d11 m_deviceCtx->IASetInputLayout(layout); } - void setInputLayout(const VertexDecl& _vertexDecl, const ProgramD3D11& _program, uint16_t _numInstanceData) + void setInputLayout(const VertexLayout& _vertexDecl, const ProgramD3D11& _program, uint16_t _numInstanceData) { - const VertexDecl* decls[1] = { &_vertexDecl }; + const VertexLayout* decls[1] = { &_vertexDecl }; setInputLayout(BX_COUNTOF(decls), decls, _program, _numInstanceData); } @@ -3409,7 +3409,7 @@ namespace bgfx { namespace d3d11 } VertexBufferD3D11& vb = m_vertexBuffers[_clearQuad.m_vb.idx]; - const VertexDecl& vertexDecl = _clearQuad.m_decl; + const VertexLayout& vertexDecl = _clearQuad.m_decl; const uint32_t stride = vertexDecl.m_stride; const uint32_t offset = 0; @@ -3473,7 +3473,7 @@ namespace bgfx { namespace d3d11 ShaderD3D11 m_shaders[BGFX_CONFIG_MAX_SHADERS]; ProgramD3D11 m_program[BGFX_CONFIG_MAX_PROGRAMS]; TextureD3D11 m_textures[BGFX_CONFIG_MAX_TEXTURES]; - VertexDecl m_vertexDecls[BGFX_CONFIG_MAX_VERTEX_DECLS]; + VertexLayout m_vertexDecls[BGFX_CONFIG_MAX_VERTEX_DECLS]; FrameBufferD3D11 m_frameBuffers[BGFX_CONFIG_MAX_FRAME_BUFFERS]; void* m_uniforms[BGFX_CONFIG_MAX_UNIFORMS]; Matrix4 m_predefinedUniforms[PredefinedUniform::Count]; @@ -3827,7 +3827,7 @@ namespace bgfx { namespace d3d11 #endif // 0 } - void VertexBufferD3D11::create(uint32_t _size, void* _data, VertexDeclHandle _declHandle, uint16_t _flags) + void VertexBufferD3D11::create(uint32_t _size, void* _data, VertexLayoutHandle _declHandle, uint16_t _flags) { m_decl = _declHandle; uint16_t stride = isValid(_declHandle) @@ -5877,7 +5877,7 @@ namespace bgfx { namespace d3d11 ID3D11Buffer* buffers[BGFX_CONFIG_MAX_VERTEX_STREAMS]; uint32_t strides[BGFX_CONFIG_MAX_VERTEX_STREAMS]; uint32_t offsets[BGFX_CONFIG_MAX_VERTEX_STREAMS]; - const VertexDecl* decls[BGFX_CONFIG_MAX_VERTEX_STREAMS]; + const VertexLayout* decls[BGFX_CONFIG_MAX_VERTEX_STREAMS]; uint32_t numVertices = draw.m_numVertices; uint8_t numStreams = 0; @@ -5902,7 +5902,7 @@ namespace bgfx { namespace d3d11 const uint16_t decl = isValid(draw.m_stream[idx].m_decl) ? draw.m_stream[idx].m_decl.idx : vb.m_decl.idx; - const VertexDecl& vertexDecl = m_vertexDecls[decl]; + const VertexLayout& vertexDecl = m_vertexDecls[decl]; const uint32_t stride = vertexDecl.m_stride; buffers[numStreams] = vb.m_ptr; diff --git a/src/renderer_d3d11.h b/src/renderer_d3d11.h index 39bdf7490..f292cfbe0 100644 --- a/src/renderer_d3d11.h +++ b/src/renderer_d3d11.h @@ -127,9 +127,9 @@ namespace bgfx { namespace d3d11 { } - void create(uint32_t _size, void* _data, VertexDeclHandle _declHandle, uint16_t _flags); + void create(uint32_t _size, void* _data, VertexLayoutHandle _declHandle, uint16_t _flags); - VertexDeclHandle m_decl; + VertexLayoutHandle m_decl; }; struct ShaderD3D11 diff --git a/src/renderer_d3d12.cpp b/src/renderer_d3d12.cpp index 94c56b932..5cc18d2aa 100644 --- a/src/renderer_d3d12.cpp +++ b/src/renderer_d3d12.cpp @@ -332,7 +332,7 @@ namespace bgfx { namespace d3d12 }; BX_STATIC_ASSERT(AttribType::Count == BX_COUNTOF(s_attribType) ); - static D3D12_INPUT_ELEMENT_DESC* fillVertexDecl(uint8_t _stream, D3D12_INPUT_ELEMENT_DESC* _out, const VertexDecl& _decl) + static D3D12_INPUT_ELEMENT_DESC* fillVertexLayout(uint8_t _stream, D3D12_INPUT_ELEMENT_DESC* _out, const VertexLayout& _decl) { D3D12_INPUT_ELEMENT_DESC* elem = _out; @@ -1530,18 +1530,18 @@ namespace bgfx { namespace d3d12 m_indexBuffers[_handle.idx].destroy(); } - void createVertexDecl(VertexDeclHandle _handle, const VertexDecl& _decl) override + void createVertexLayout(VertexLayoutHandle _handle, const VertexLayout& _decl) override { - VertexDecl& decl = m_vertexDecls[_handle.idx]; - bx::memCopy(&decl, &_decl, sizeof(VertexDecl) ); + VertexLayout& decl = m_vertexDecls[_handle.idx]; + bx::memCopy(&decl, &_decl, sizeof(VertexLayout) ); dump(decl); } - void destroyVertexDecl(VertexDeclHandle /*_handle*/) override + void destroyVertexLayout(VertexLayoutHandle /*_handle*/) override { } - void createVertexBuffer(VertexBufferHandle _handle, const Memory* _mem, VertexDeclHandle _declHandle, uint16_t _flags) override + void createVertexBuffer(VertexBufferHandle _handle, const Memory* _mem, VertexLayoutHandle _declHandle, uint16_t _flags) override { m_vertexBuffers[_handle.idx].create(_mem->size, _mem->data, _declHandle, _flags); } @@ -1568,7 +1568,7 @@ namespace bgfx { namespace d3d12 void createDynamicVertexBuffer(VertexBufferHandle _handle, uint32_t _size, uint16_t _flags) override { - VertexDeclHandle decl = BGFX_INVALID_HANDLE; + VertexLayoutHandle decl = BGFX_INVALID_HANDLE; m_vertexBuffers[_handle.idx].create(_size, NULL, decl, _flags); } @@ -1954,7 +1954,7 @@ namespace bgfx { namespace d3d12 | BGFX_STATE_DEPTH_TEST_ALWAYS ; - const VertexDecl* decls[1] = { &m_vertexDecls[_blitter.m_vb->decl.idx] }; + const VertexLayout* decls[1] = { &m_vertexDecls[_blitter.m_vb->decl.idx] }; ID3D12PipelineState* pso = getPipelineState(state , packStencil(BGFX_STENCIL_DEFAULT, BGFX_STENCIL_DEFAULT) , 1 @@ -1993,7 +1993,7 @@ namespace bgfx { namespace d3d12 m_commandList->SetGraphicsRootDescriptorTable(Rdt::SRV, srvHandle); VertexBufferD3D12& vb = m_vertexBuffers[_blitter.m_vb->handle.idx]; - const VertexDecl& vertexDecl = m_vertexDecls[_blitter.m_vb->decl.idx]; + const VertexLayout& vertexDecl = m_vertexDecls[_blitter.m_vb->decl.idx]; D3D12_VERTEX_BUFFER_VIEW viewDesc; viewDesc.BufferLocation = vb.m_gpuVA; viewDesc.StrideInBytes = vertexDecl.m_stride; @@ -2604,7 +2604,7 @@ namespace bgfx { namespace d3d12 _desc.BackFace.StencilFunc = s_cmpFunc[(bstencil&BGFX_STENCIL_TEST_MASK) >> BGFX_STENCIL_TEST_SHIFT]; } - uint32_t setInputLayout(D3D12_INPUT_ELEMENT_DESC* _vertexElements, uint8_t _numStreams, const VertexDecl** _vertexDecls, const ProgramD3D12& _program, uint16_t _numInstanceData) + uint32_t setInputLayout(D3D12_INPUT_ELEMENT_DESC* _vertexElements, uint8_t _numStreams, const VertexLayout** _vertexDecls, const ProgramD3D12& _program, uint16_t _numInstanceData) { uint16_t attrMask[Attrib::Count]; bx::memCopy(attrMask, _program.m_vsh->m_attrMask, sizeof(attrMask)); @@ -2613,8 +2613,8 @@ namespace bgfx { namespace d3d12 for (uint8_t stream = 0; stream < _numStreams; ++stream) { - VertexDecl decl; - bx::memCopy(&decl, _vertexDecls[stream], sizeof(VertexDecl)); + VertexLayout decl; + bx::memCopy(&decl, _vertexDecls[stream], sizeof(VertexLayout)); const bool last = stream == _numStreams-1; @@ -2633,7 +2633,7 @@ namespace bgfx { namespace d3d12 } } - elem = fillVertexDecl(stream, elem, decl); + elem = fillVertexLayout(stream, elem, decl); } uint32_t num = uint32_t(elem-_vertexElements); @@ -2671,9 +2671,9 @@ namespace bgfx { namespace d3d12 return uint32_t(elem-_vertexElements); } - uint32_t setInputLayout(D3D12_INPUT_ELEMENT_DESC* _vertexElements, const VertexDecl& _vertexDecl, const ProgramD3D12& _program, uint16_t _numInstanceData) + uint32_t setInputLayout(D3D12_INPUT_ELEMENT_DESC* _vertexElements, const VertexLayout& _vertexDecl, const ProgramD3D12& _program, uint16_t _numInstanceData) { - const VertexDecl* decls[1] = { &_vertexDecl }; + const VertexLayout* decls[1] = { &_vertexDecl }; return setInputLayout(_vertexElements, BX_COUNTOF(decls), decls, _program, _numInstanceData); } @@ -2792,7 +2792,7 @@ namespace bgfx { namespace d3d12 uint64_t _state , uint64_t _stencil , uint8_t _numStreams - , const VertexDecl** _vertexDecls + , const VertexLayout** _vertexDecls , ProgramHandle _program , uint8_t _numInstanceData ) @@ -2817,10 +2817,10 @@ namespace bgfx { namespace d3d12 _stencil &= packStencil(~BGFX_STENCIL_FUNC_REF_MASK, ~BGFX_STENCIL_FUNC_REF_MASK); - VertexDecl decl; + VertexLayout decl; if (0 < _numStreams) { - bx::memCopy(&decl, _vertexDecls[0], sizeof(VertexDecl) ); + bx::memCopy(&decl, _vertexDecls[0], sizeof(VertexLayout) ); const uint16_t* attrMask = program.m_vsh->m_attrMask; for (uint32_t ii = 0; ii < Attrib::Count; ++ii) @@ -3356,7 +3356,7 @@ namespace bgfx { namespace d3d12 ShaderD3D12 m_shaders[BGFX_CONFIG_MAX_SHADERS]; ProgramD3D12 m_program[BGFX_CONFIG_MAX_PROGRAMS]; TextureD3D12 m_textures[BGFX_CONFIG_MAX_TEXTURES]; - VertexDecl m_vertexDecls[BGFX_CONFIG_MAX_VERTEX_DECLS]; + VertexLayout m_vertexDecls[BGFX_CONFIG_MAX_VERTEX_DECLS]; FrameBufferD3D12 m_frameBuffers[BGFX_CONFIG_MAX_FRAME_BUFFERS]; void* m_uniforms[BGFX_CONFIG_MAX_UNIFORMS]; Matrix4 m_predefinedUniforms[PredefinedUniform::Count]; @@ -3971,7 +3971,7 @@ namespace bgfx { namespace d3d12 vb.setState(_commandList, D3D12_RESOURCE_STATE_GENERIC_READ); uint16_t decl = !isValid(vb.m_decl) ? stream.m_decl.idx : vb.m_decl.idx; - const VertexDecl& vertexDecl = s_renderD3D12->m_vertexDecls[decl]; + const VertexLayout& vertexDecl = s_renderD3D12->m_vertexDecls[decl]; uint32_t stride = vertexDecl.m_stride; D3D12_VERTEX_BUFFER_VIEW& vbv = _vbv[numStreams]; @@ -4442,7 +4442,7 @@ namespace bgfx { namespace d3d12 return _state; } - void VertexBufferD3D12::create(uint32_t _size, void* _data, VertexDeclHandle _declHandle, uint16_t _flags) + void VertexBufferD3D12::create(uint32_t _size, void* _data, VertexLayoutHandle _declHandle, uint16_t _flags) { BufferD3D12::create(_size, _data, _flags, true); m_decl = _declHandle; @@ -6254,7 +6254,7 @@ namespace bgfx { namespace d3d12 || f3 == (state & f3) ; - const VertexDecl* decls[BGFX_CONFIG_MAX_VERTEX_STREAMS]; + const VertexLayout* decls[BGFX_CONFIG_MAX_VERTEX_STREAMS]; uint8_t numStreams = 0; if (UINT8_MAX != draw.m_streamMask) @@ -6277,7 +6277,7 @@ namespace bgfx { namespace d3d12 const uint16_t decl = isValid(draw.m_stream[idx].m_decl) ? draw.m_stream[idx].m_decl.idx : vb.m_decl.idx; - const VertexDecl& vertexDecl = m_vertexDecls[decl]; + const VertexLayout& vertexDecl = m_vertexDecls[decl]; decls[numStreams] = &vertexDecl; } diff --git a/src/renderer_d3d12.h b/src/renderer_d3d12.h index dec401899..ac14b7b60 100644 --- a/src/renderer_d3d12.h +++ b/src/renderer_d3d12.h @@ -224,9 +224,9 @@ namespace bgfx { namespace d3d12 struct VertexBufferD3D12 : public BufferD3D12 { - void create(uint32_t _size, void* _data, VertexDeclHandle _declHandle, uint16_t _flags); + void create(uint32_t _size, void* _data, VertexLayoutHandle _declHandle, uint16_t _flags); - VertexDeclHandle m_decl; + VertexLayoutHandle m_decl; }; struct ShaderD3D12 diff --git a/src/renderer_d3d9.cpp b/src/renderer_d3d9.cpp index 35629e3a3..84f328703 100644 --- a/src/renderer_d3d9.cpp +++ b/src/renderer_d3d9.cpp @@ -335,7 +335,7 @@ namespace bgfx { namespace d3d9 }; BX_STATIC_ASSERT(AttribType::Count == BX_COUNTOF(s_attribType) ); - static D3DVERTEXELEMENT9* fillVertexDecl(uint8_t _stream, D3DVERTEXELEMENT9* _out, const VertexDecl& _decl) + static D3DVERTEXELEMENT9* fillVertexLayout(uint8_t _stream, D3DVERTEXELEMENT9* _out, const VertexLayout& _decl) { D3DVERTEXELEMENT9* elem = _out; @@ -998,18 +998,18 @@ namespace bgfx { namespace d3d9 m_indexBuffers[_handle.idx].destroy(); } - void createVertexDecl(VertexDeclHandle _handle, const VertexDecl& _decl) override + void createVertexLayout(VertexLayoutHandle _handle, const VertexLayout& _decl) override { - VertexDecl& decl = m_vertexDecls[_handle.idx]; - bx::memCopy(&decl, &_decl, sizeof(VertexDecl) ); + VertexLayout& decl = m_vertexDecls[_handle.idx]; + bx::memCopy(&decl, &_decl, sizeof(VertexLayout) ); dump(decl); } - void destroyVertexDecl(VertexDeclHandle /*_handle*/) override + void destroyVertexLayout(VertexLayoutHandle /*_handle*/) override { } - void createVertexBuffer(VertexBufferHandle _handle, const Memory* _mem, VertexDeclHandle _declHandle, uint16_t /*_flags*/) override + void createVertexBuffer(VertexBufferHandle _handle, const Memory* _mem, VertexLayoutHandle _declHandle, uint16_t /*_flags*/) override { m_vertexBuffers[_handle.idx].create(_mem->size, _mem->data, _declHandle); } @@ -1036,7 +1036,7 @@ namespace bgfx { namespace d3d9 void createDynamicVertexBuffer(VertexBufferHandle _handle, uint32_t _size, uint16_t /*_flags*/) override { - VertexDeclHandle decl = BGFX_INVALID_HANDLE; + VertexLayoutHandle decl = BGFX_INVALID_HANDLE; m_vertexBuffers[_handle.idx].create(_size, NULL, decl); } @@ -1373,7 +1373,7 @@ namespace bgfx { namespace d3d9 DX_CHECK(device->SetPixelShader(program.m_fsh->m_pixelShader) ); VertexBufferD3D9& vb = m_vertexBuffers[_blitter.m_vb->handle.idx]; - VertexDecl& vertexDecl = m_vertexDecls[_blitter.m_vb->decl.idx]; + VertexLayout& vertexDecl = m_vertexDecls[_blitter.m_vb->decl.idx]; DX_CHECK(device->SetStreamSource(0, vb.m_ptr, 0, vertexDecl.m_stride) ); setInputLayout(vertexDecl, 0); @@ -2088,7 +2088,7 @@ namespace bgfx { namespace d3d9 } VertexBufferD3D9& vb = m_vertexBuffers[_clearQuad.m_vb.idx]; - VertexDecl& vertexDecl = _clearQuad.m_decl; + VertexLayout& vertexDecl = _clearQuad.m_decl; uint32_t stride = _clearQuad.m_decl.m_stride; ProgramD3D9& program = m_program[_clearQuad.m_program[numMrt-1].idx]; @@ -2138,7 +2138,7 @@ namespace bgfx { namespace d3d9 } } - void setInputLayout(uint8_t _numStreams, const VertexDecl** _vertexDecls, uint16_t _numInstanceData) + void setInputLayout(uint8_t _numStreams, const VertexLayout** _vertexDecls, uint16_t _numInstanceData) { bx::HashMurmur2A murmur; murmur.begin(); @@ -2157,7 +2157,7 @@ namespace bgfx { namespace d3d9 for (uint8_t stream = 0; stream < _numStreams; ++stream) { - elem = fillVertexDecl(stream, elem, *_vertexDecls[stream]); + elem = fillVertexLayout(stream, elem, *_vertexDecls[stream]); } const D3DVERTEXELEMENT9 inst = { _numStreams, 0, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0 }; @@ -2180,9 +2180,9 @@ namespace bgfx { namespace d3d9 DX_CHECK(m_device->SetVertexDeclaration(layout) ); } - void setInputLayout(const VertexDecl& _vertexDecl, uint16_t _numInstanceData) + void setInputLayout(const VertexLayout& _vertexDecl, uint16_t _numInstanceData) { - const VertexDecl* decls[1] = { &_vertexDecl }; + const VertexLayout* decls[1] = { &_vertexDecl }; setInputLayout(BX_COUNTOF(decls), decls, _numInstanceData); } @@ -2237,7 +2237,7 @@ namespace bgfx { namespace d3d9 ShaderD3D9 m_shaders[BGFX_CONFIG_MAX_SHADERS]; ProgramD3D9 m_program[BGFX_CONFIG_MAX_PROGRAMS]; TextureD3D9 m_textures[BGFX_CONFIG_MAX_TEXTURES]; - VertexDecl m_vertexDecls[BGFX_CONFIG_MAX_VERTEX_DECLS]; + VertexLayout m_vertexDecls[BGFX_CONFIG_MAX_VERTEX_DECLS]; FrameBufferD3D9 m_frameBuffers[BGFX_CONFIG_MAX_FRAME_BUFFERS]; UniformRegistry m_uniformReg; void* m_uniforms[BGFX_CONFIG_MAX_UNIFORMS]; @@ -2341,7 +2341,7 @@ namespace bgfx { namespace d3d9 } } - void VertexBufferD3D9::create(uint32_t _size, void* _data, VertexDeclHandle _declHandle) + void VertexBufferD3D9::create(uint32_t _size, void* _data, VertexLayoutHandle _declHandle) { m_size = _size; m_decl = _declHandle; @@ -4214,7 +4214,7 @@ namespace bgfx { namespace d3d9 currentState.m_instanceDataOffset = draw.m_instanceDataOffset; currentState.m_instanceDataStride = draw.m_instanceDataStride; - const VertexDecl* decls[BGFX_CONFIG_MAX_VERTEX_STREAMS]; + const VertexLayout* decls[BGFX_CONFIG_MAX_VERTEX_STREAMS]; const bool instanced = true && isValid(draw.m_instanceDataBuffer) @@ -4246,7 +4246,7 @@ namespace bgfx { namespace d3d9 const uint16_t decl = isValid(draw.m_stream[idx].m_decl) ? draw.m_stream[idx].m_decl.idx : vb.m_decl.idx; - const VertexDecl& vertexDecl = m_vertexDecls[decl]; + const VertexLayout& vertexDecl = m_vertexDecls[decl]; const uint32_t stride = vertexDecl.m_stride; decls[numStreams] = &vertexDecl; diff --git a/src/renderer_d3d9.h b/src/renderer_d3d9.h index 572bcd5bd..9cb97c158 100644 --- a/src/renderer_d3d9.h +++ b/src/renderer_d3d9.h @@ -191,7 +191,7 @@ namespace bgfx { namespace d3d9 { } - void create(uint32_t _size, void* _data, VertexDeclHandle _declHandle); + void create(uint32_t _size, void* _data, VertexLayoutHandle _declHandle); void update(uint32_t _offset, uint32_t _size, void* _data, bool _discard = false) { if (NULL != m_dynamic @@ -232,7 +232,7 @@ namespace bgfx { namespace d3d9 IDirect3DVertexBuffer9* m_ptr; uint8_t* m_dynamic; uint32_t m_size; - VertexDeclHandle m_decl; + VertexLayoutHandle m_decl; }; struct ShaderD3D9 diff --git a/src/renderer_gl.cpp b/src/renderer_gl.cpp index 16c244ba1..dadbca09e 100644 --- a/src/renderer_gl.cpp +++ b/src/renderer_gl.cpp @@ -2686,18 +2686,18 @@ BX_TRACE("%d, %d, %d, %s", _array, _srgb, _mipAutogen, getName(_format) ); m_indexBuffers[_handle.idx].destroy(); } - void createVertexDecl(VertexDeclHandle _handle, const VertexDecl& _decl) override + void createVertexLayout(VertexLayoutHandle _handle, const VertexLayout& _decl) override { - VertexDecl& decl = m_vertexDecls[_handle.idx]; - bx::memCopy(&decl, &_decl, sizeof(VertexDecl) ); + VertexLayout& decl = m_vertexDecls[_handle.idx]; + bx::memCopy(&decl, &_decl, sizeof(VertexLayout) ); dump(decl); } - void destroyVertexDecl(VertexDeclHandle /*_handle*/) override + void destroyVertexLayout(VertexLayoutHandle /*_handle*/) override { } - void createVertexBuffer(VertexBufferHandle _handle, const Memory* _mem, VertexDeclHandle _declHandle, uint16_t _flags) override + void createVertexBuffer(VertexBufferHandle _handle, const Memory* _mem, VertexLayoutHandle _declHandle, uint16_t _flags) override { m_vertexBuffers[_handle.idx].create(_mem->size, _mem->data, _declHandle, _flags); } @@ -2724,7 +2724,7 @@ BX_TRACE("%d, %d, %d, %s", _array, _srgb, _mipAutogen, getName(_format) ); void createDynamicVertexBuffer(VertexBufferHandle _handle, uint32_t _size, uint16_t _flags) override { - VertexDeclHandle decl = BGFX_INVALID_HANDLE; + VertexLayoutHandle decl = BGFX_INVALID_HANDLE; m_vertexBuffers[_handle.idx].create(_size, NULL, decl, _flags); } @@ -3794,7 +3794,7 @@ BX_TRACE("%d, %d, %d, %s", _array, _srgb, _mipAutogen, getName(_format) ); } VertexBufferGL& vb = m_vertexBuffers[_clearQuad.m_vb.idx]; - VertexDecl& vertexDecl = _clearQuad.m_decl; + VertexLayout& vertexDecl = _clearQuad.m_decl; GL_CHECK(glBindBuffer(GL_ARRAY_BUFFER, vb.m_id) ); @@ -3868,7 +3868,7 @@ BX_TRACE("%d, %d, %d, %s", _array, _srgb, _mipAutogen, getName(_format) ); ShaderGL m_shaders[BGFX_CONFIG_MAX_SHADERS]; ProgramGL m_program[BGFX_CONFIG_MAX_PROGRAMS]; TextureGL m_textures[BGFX_CONFIG_MAX_TEXTURES]; - VertexDecl m_vertexDecls[BGFX_CONFIG_MAX_VERTEX_DECLS]; + VertexLayout m_vertexDecls[BGFX_CONFIG_MAX_VERTEX_DECLS]; FrameBufferGL m_frameBuffers[BGFX_CONFIG_MAX_FRAME_BUFFERS]; UniformRegistry m_uniformReg; void* m_uniforms[BGFX_CONFIG_MAX_UNIFORMS]; @@ -4508,7 +4508,7 @@ BX_TRACE("%d, %d, %d, %s", _array, _srgb, _mipAutogen, getName(_format) ); m_instanceData[used] = 0xffff; } - void ProgramGL::bindAttributes(const VertexDecl& _vertexDecl, uint32_t _baseVertex) + void ProgramGL::bindAttributes(const VertexLayout& _vertexDecl, uint32_t _baseVertex) { for (uint32_t ii = 0, iiEnd = m_usedCount; ii < iiEnd; ++ii) { @@ -7265,7 +7265,7 @@ BX_TRACE("%d, %d, %d, %s", _array, _srgb, _mipAutogen, getName(_format) ); const VertexBufferGL& vb = m_vertexBuffers[draw.m_stream[idx].m_handle.idx]; uint16_t decl = !isValid(vb.m_decl) ? draw.m_stream[idx].m_decl.idx : vb.m_decl.idx; - const VertexDecl& vertexDecl = m_vertexDecls[decl]; + const VertexLayout& vertexDecl = m_vertexDecls[decl]; numVertices = bx::uint32_min(numVertices, vb.m_size/vertexDecl.m_stride); } diff --git a/src/renderer_gl.h b/src/renderer_gl.h index d74a53ee6..595c6b0be 100644 --- a/src/renderer_gl.h +++ b/src/renderer_gl.h @@ -1214,7 +1214,7 @@ namespace bgfx { namespace gl struct VertexBufferGL { - void create(uint32_t _size, void* _data, VertexDeclHandle _declHandle, uint16_t _flags) + void create(uint32_t _size, void* _data, VertexLayoutHandle _declHandle, uint16_t _flags) { m_size = _size; m_decl = _declHandle; @@ -1258,7 +1258,7 @@ namespace bgfx { namespace gl GLuint m_id; GLenum m_target; uint32_t m_size; - VertexDeclHandle m_decl; + VertexLayoutHandle m_decl; }; struct TextureGL @@ -1375,7 +1375,7 @@ namespace bgfx { namespace gl bx::memCopy(m_unboundUsedAttrib, m_used, sizeof(m_unboundUsedAttrib) ); } - void bindAttributes(const VertexDecl& _vertexDecl, uint32_t _baseVertex = 0); + void bindAttributes(const VertexLayout& _vertexDecl, uint32_t _baseVertex = 0); void bindAttributesEnd() { diff --git a/src/renderer_mtl.h b/src/renderer_mtl.h index 0d0a840ae..1c1ca5724 100644 --- a/src/renderer_mtl.h +++ b/src/renderer_mtl.h @@ -822,9 +822,9 @@ namespace bgfx { namespace mtl { } - void create(uint32_t _size, void* _data, VertexDeclHandle _declHandle, uint16_t _flags); + void create(uint32_t _size, void* _data, VertexLayoutHandle _declHandle, uint16_t _flags); - VertexDeclHandle m_decl; + VertexLayoutHandle m_decl; }; diff --git a/src/renderer_mtl.mm b/src/renderer_mtl.mm index 35d107376..6171075a0 100644 --- a/src/renderer_mtl.mm +++ b/src/renderer_mtl.mm @@ -732,18 +732,18 @@ namespace bgfx { namespace mtl m_indexBuffers[_handle.idx].destroy(); } - void createVertexDecl(VertexDeclHandle _handle, const VertexDecl& _decl) override + void createVertexLayout(VertexLayoutHandle _handle, const VertexLayout& _decl) override { - VertexDecl& decl = m_vertexDecls[_handle.idx]; - bx::memCopy(&decl, &_decl, sizeof(VertexDecl) ); + VertexLayout& decl = m_vertexDecls[_handle.idx]; + bx::memCopy(&decl, &_decl, sizeof(VertexLayout) ); dump(decl); } - void destroyVertexDecl(VertexDeclHandle /*_handle*/) override + void destroyVertexLayout(VertexLayoutHandle /*_handle*/) override { } - void createVertexBuffer(VertexBufferHandle _handle, const Memory* _mem, VertexDeclHandle _declHandle, uint16_t _flags) override + void createVertexBuffer(VertexBufferHandle _handle, const Memory* _mem, VertexLayoutHandle _declHandle, uint16_t _flags) override { m_vertexBuffers[_handle.idx].create(_mem->size, _mem->data, _declHandle, _flags); } @@ -770,7 +770,7 @@ namespace bgfx { namespace mtl void createDynamicVertexBuffer(VertexBufferHandle _handle, uint32_t _size, uint16_t _flags) override { - VertexDeclHandle decl = BGFX_INVALID_HANDLE; + VertexLayoutHandle decl = BGFX_INVALID_HANDLE; m_vertexBuffers[_handle.idx].create(_size, NULL, decl, _flags); } @@ -1512,7 +1512,7 @@ namespace bgfx { namespace mtl numMrt = bx::uint32_max(1, fb.m_num); } - const VertexDecl* decl = &_clearQuad.m_decl; + const VertexLayout* decl = &_clearQuad.m_decl; const PipelineStateMtl* pso = getPipelineState( state , 0 @@ -1894,7 +1894,7 @@ namespace bgfx { namespace mtl , uint32_t _rgba , FrameBufferHandle _fbh , uint8_t _numStreams - , const VertexDecl** _vertexDecls + , const VertexLayout** _vertexDecls , ProgramHandle _program , uint8_t _numInstanceData ) @@ -2071,7 +2071,7 @@ namespace bgfx { namespace mtl uint8_t stream = 0; for (; stream < _numStreams; ++stream) { - const VertexDecl& vertexDecl = *_vertexDecls[stream]; + const VertexLayout& vertexDecl = *_vertexDecls[stream]; bool streamUsed = false; for (uint32_t ii = 0; Attrib::Count != program.m_used[ii]; ++ii) { @@ -2155,12 +2155,12 @@ namespace bgfx { namespace mtl uint64_t _state , uint32_t _rgba , FrameBufferHandle _fbh - , VertexDeclHandle _declHandle + , VertexLayoutHandle _declHandle , ProgramHandle _program , uint16_t _numInstanceData ) { - const VertexDecl* decl = &m_vertexDecls[_declHandle.idx]; + const VertexLayout* decl = &m_vertexDecls[_declHandle.idx]; return getPipelineState( _state , _rgba @@ -2300,7 +2300,7 @@ namespace bgfx { namespace mtl TextureMtl m_textures[BGFX_CONFIG_MAX_TEXTURES]; FrameBufferMtl m_mainFrameBuffer; FrameBufferMtl m_frameBuffers[BGFX_CONFIG_MAX_FRAME_BUFFERS]; - VertexDecl m_vertexDecls[BGFX_CONFIG_MAX_VERTEX_DECLS]; + VertexLayout m_vertexDecls[BGFX_CONFIG_MAX_VERTEX_DECLS]; UniformRegistry m_uniformReg; void* m_uniforms[BGFX_CONFIG_MAX_UNIFORMS]; @@ -2565,7 +2565,7 @@ namespace bgfx { namespace mtl } } - void VertexBufferMtl::create(uint32_t _size, void* _data, VertexDeclHandle _declHandle, uint16_t _flags) + void VertexBufferMtl::create(uint32_t _size, void* _data, VertexLayoutHandle _declHandle, uint16_t _flags) { m_decl = _declHandle; uint16_t stride = isValid(_declHandle) @@ -4263,7 +4263,7 @@ namespace bgfx { namespace mtl currentState.m_instanceDataOffset = draw.m_instanceDataOffset; currentState.m_instanceDataStride = draw.m_instanceDataStride; - const VertexDecl* decls[BGFX_CONFIG_MAX_VERTEX_STREAMS]; + const VertexLayout* decls[BGFX_CONFIG_MAX_VERTEX_STREAMS]; uint32_t numVertices = draw.m_numVertices; uint8_t numStreams = 0; @@ -4285,7 +4285,7 @@ namespace bgfx { namespace mtl const uint16_t decl = isValid(draw.m_stream[idx].m_decl) ? draw.m_stream[idx].m_decl.idx : vb.m_decl.idx; - const VertexDecl& vertexDecl = m_vertexDecls[decl]; + const VertexLayout& vertexDecl = m_vertexDecls[decl]; const uint32_t stride = vertexDecl.m_stride; decls[numStreams] = &vertexDecl; @@ -4415,7 +4415,7 @@ namespace bgfx { namespace mtl { const VertexBufferMtl& vb = m_vertexBuffers[currentState.m_stream[0].m_handle.idx]; uint16_t decl = !isValid(vb.m_decl) ? draw.m_stream[0].m_decl.idx : vb.m_decl.idx; - const VertexDecl& vertexDecl = m_vertexDecls[decl]; + const VertexLayout& vertexDecl = m_vertexDecls[decl]; numVertices = vb.m_size/vertexDecl.m_stride; } diff --git a/src/renderer_noop.cpp b/src/renderer_noop.cpp index 6ce95ffe1..f6c2c8f19 100644 --- a/src/renderer_noop.cpp +++ b/src/renderer_noop.cpp @@ -100,15 +100,15 @@ namespace bgfx { namespace noop { } - void createVertexDecl(VertexDeclHandle /*_handle*/, const VertexDecl& /*_decl*/) override + void createVertexLayout(VertexLayoutHandle /*_handle*/, const VertexLayout& /*_decl*/) override { } - void destroyVertexDecl(VertexDeclHandle /*_handle*/) override + void destroyVertexLayout(VertexLayoutHandle /*_handle*/) override { } - void createVertexBuffer(VertexBufferHandle /*_handle*/, const Memory* /*_mem*/, VertexDeclHandle /*_declHandle*/, uint16_t /*_flags*/) override + void createVertexBuffer(VertexBufferHandle /*_handle*/, const Memory* /*_mem*/, VertexLayoutHandle /*_declHandle*/, uint16_t /*_flags*/) override { } diff --git a/src/renderer_vk.cpp b/src/renderer_vk.cpp index f78575c08..d61e327fa 100644 --- a/src/renderer_vk.cpp +++ b/src/renderer_vk.cpp @@ -327,7 +327,7 @@ VK_IMPORT_DEVICE }; BX_STATIC_ASSERT(AttribType::Count == BX_COUNTOF(s_attribType) ); - void fillVertexDecl(const ShaderVK* _vsh, VkPipelineVertexInputStateCreateInfo& _vertexInputState, const VertexDecl& _decl) + void fillVertexLayout(const ShaderVK* _vsh, VkPipelineVertexInputStateCreateInfo& _vertexInputState, const VertexLayout& _decl) { uint32_t numBindings = _vertexInputState.vertexBindingDescriptionCount; uint32_t numAttribs = _vertexInputState.vertexAttributeDescriptionCount; @@ -2324,18 +2324,18 @@ VK_IMPORT_DEVICE m_indexBuffers[_handle.idx].destroy(); } - void createVertexDecl(VertexDeclHandle _handle, const VertexDecl& _decl) override + void createVertexLayout(VertexLayoutHandle _handle, const VertexLayout& _decl) override { - VertexDecl& decl = m_vertexDecls[_handle.idx]; - bx::memCopy(&decl, &_decl, sizeof(VertexDecl) ); + VertexLayout& decl = m_vertexDecls[_handle.idx]; + bx::memCopy(&decl, &_decl, sizeof(VertexLayout) ); dump(decl); } - void destroyVertexDecl(VertexDeclHandle /*_handle*/) override + void destroyVertexLayout(VertexLayoutHandle /*_handle*/) override { } - void createVertexBuffer(VertexBufferHandle _handle, const Memory* _mem, VertexDeclHandle _declHandle, uint16_t _flags) override + void createVertexBuffer(VertexBufferHandle _handle, const Memory* _mem, VertexLayoutHandle _declHandle, uint16_t _flags) override { m_vertexBuffers[_handle.idx].create(_mem->size, _mem->data, _declHandle, _flags); } @@ -2363,7 +2363,7 @@ VK_IMPORT_DEVICE void createDynamicVertexBuffer(VertexBufferHandle _handle, uint32_t _size, uint16_t _flags) override { - VertexDeclHandle decl = BGFX_INVALID_HANDLE; + VertexLayoutHandle decl = BGFX_INVALID_HANDLE; m_vertexBuffers[_handle.idx].create(_size, NULL, decl, _flags); } @@ -2571,7 +2571,7 @@ VK_IMPORT_DEVICE | BGFX_STATE_DEPTH_TEST_ALWAYS ; - const VertexDecl* vertexDecl = &m_vertexDecls[_blitter.m_vb->decl.idx]; + const VertexLayout* vertexDecl = &m_vertexDecls[_blitter.m_vb->decl.idx]; VkPipeline pso = getPipeline(state , packStencil(BGFX_STENCIL_DEFAULT, BGFX_STENCIL_DEFAULT) , 1 @@ -3084,7 +3084,7 @@ VK_IMPORT_DEVICE _desc.maxDepthBounds = 1.0f; } - void setInputLayout(VkPipelineVertexInputStateCreateInfo& _vertexInputState, uint8_t _numStream, const VertexDecl** _vertexDecl, const ProgramVK& _program, uint8_t _numInstanceData) + void setInputLayout(VkPipelineVertexInputStateCreateInfo& _vertexInputState, uint8_t _numStream, const VertexLayout** _vertexDecl, const ProgramVK& _program, uint8_t _numInstanceData) { _vertexInputState.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO; _vertexInputState.pNext = NULL; @@ -3097,8 +3097,8 @@ VK_IMPORT_DEVICE bx::memCopy(unsettedAttr, _program.m_vsh->m_attrMask, sizeof(uint16_t) * Attrib::Count); for (uint8_t stream = 0; stream < _numStream; ++stream) { - VertexDecl decl; - bx::memCopy(&decl, _vertexDecl[stream], sizeof(VertexDecl) ); + VertexLayout decl; + bx::memCopy(&decl, _vertexDecl[stream], sizeof(VertexLayout) ); const uint16_t* attrMask = _program.m_vsh->m_attrMask; for (uint32_t ii = 0; ii < Attrib::Count; ++ii) @@ -3112,7 +3112,7 @@ VK_IMPORT_DEVICE } } - fillVertexDecl(_program.m_vsh, _vertexInputState, decl); + fillVertexLayout(_program.m_vsh, _vertexInputState, decl); } for (uint32_t ii = 0; ii < Attrib::Count; ++ii) @@ -3302,7 +3302,7 @@ VK_IMPORT_DEVICE return VK_NULL_HANDLE; } - VkPipeline getPipeline(uint64_t _state, uint64_t _stencil, uint8_t _numStreams, const VertexDecl** _vertexDecls, ProgramHandle _program, uint8_t _numInstanceData) + VkPipeline getPipeline(uint64_t _state, uint64_t _stencil, uint8_t _numStreams, const VertexLayout** _vertexDecls, ProgramHandle _program, uint8_t _numInstanceData) { ProgramVK& program = m_program[_program.idx]; @@ -3324,10 +3324,10 @@ VK_IMPORT_DEVICE _stencil &= packStencil(~BGFX_STENCIL_FUNC_REF_MASK, ~BGFX_STENCIL_FUNC_REF_MASK); - VertexDecl decl; + VertexLayout decl; if (0 < _numStreams) { - bx::memCopy(&decl, _vertexDecls[0], sizeof(VertexDecl) ); + bx::memCopy(&decl, _vertexDecls[0], sizeof(VertexLayout) ); const uint16_t* attrMask = program.m_vsh->m_attrMask; for (uint32_t ii = 0; ii < Attrib::Count; ++ii) @@ -3825,7 +3825,7 @@ VK_IMPORT_DEVICE ShaderVK m_shaders[BGFX_CONFIG_MAX_SHADERS]; ProgramVK m_program[BGFX_CONFIG_MAX_PROGRAMS]; TextureVK m_textures[BGFX_CONFIG_MAX_TEXTURES]; - VertexDecl m_vertexDecls[BGFX_CONFIG_MAX_VERTEX_DECLS]; + VertexLayout m_vertexDecls[BGFX_CONFIG_MAX_VERTEX_DECLS]; FrameBufferVK m_frameBuffers[BGFX_CONFIG_MAX_FRAME_BUFFERS]; void* m_uniforms[BGFX_CONFIG_MAX_UNIFORMS]; Matrix4 m_predefinedUniforms[PredefinedUniform::Count]; @@ -4275,7 +4275,7 @@ VK_DESTROY } } - void VertexBufferVK::create(uint32_t _size, void* _data, VertexDeclHandle _declHandle, uint16_t _flags) + void VertexBufferVK::create(uint32_t _size, void* _data, VertexLayoutHandle _declHandle, uint16_t _flags) { BufferVK::create(_size, _data, _flags, true); m_decl = _declHandle; @@ -5741,7 +5741,7 @@ BX_UNUSED(currentSamplerStateIdx); || f3 == (state & f3) ; - const VertexDecl* decls[BGFX_CONFIG_MAX_VERTEX_STREAMS]; + const VertexLayout* decls[BGFX_CONFIG_MAX_VERTEX_STREAMS]; uint8_t numStreams = 0; if (UINT8_MAX != draw.m_streamMask) { @@ -5763,7 +5763,7 @@ BX_UNUSED(currentSamplerStateIdx); const uint16_t decl = isValid(draw.m_stream[idx].m_decl) ? draw.m_stream[idx].m_decl.idx : vb.m_decl.idx; - const VertexDecl& vertexDecl = m_vertexDecls[decl]; + const VertexLayout& vertexDecl = m_vertexDecls[decl]; decls[numStreams] = &vertexDecl; } @@ -6139,7 +6139,7 @@ BX_UNUSED(currentSamplerStateIdx); if (!isValid(draw.m_indexBuffer) ) { const VertexBufferVK& vertexBuffer = m_vertexBuffers[draw.m_stream[0].m_handle.idx]; - const VertexDecl& vertexDecl = m_vertexDecls[draw.m_stream[0].m_decl.idx]; + const VertexLayout& vertexDecl = m_vertexDecls[draw.m_stream[0].m_decl.idx]; const uint32_t numVertices = UINT32_MAX == draw.m_numVertices ? vertexBuffer.m_size / vertexDecl.m_stride diff --git a/src/renderer_vk.h b/src/renderer_vk.h index 6ca68f5dd..66cdac80a 100644 --- a/src/renderer_vk.h +++ b/src/renderer_vk.h @@ -378,9 +378,9 @@ VK_DESTROY struct VertexBufferVK : public BufferVK { - void create(uint32_t _size, void* _data, VertexDeclHandle _declHandle, uint16_t _flags); + void create(uint32_t _size, void* _data, VertexLayoutHandle _declHandle, uint16_t _flags); - VertexDeclHandle m_decl; + VertexLayoutHandle m_decl; }; struct ShaderVK diff --git a/src/vertexdecl.cpp b/src/vertexdecl.cpp index 4a67b71c3..b1d4b2fc7 100644 --- a/src/vertexdecl.cpp +++ b/src/vertexdecl.cpp @@ -63,16 +63,16 @@ namespace bgfx s_attribTypeSize[RendererType::Count] = s_attribTypeSize[_type]; } - VertexDecl::VertexDecl() + VertexLayout::VertexLayout() : m_stride(0) { // BK - struct need to have ctor to qualify as non-POD data. // Need this to catch programming errors when serializing struct. } - VertexDecl& VertexDecl::begin(RendererType::Enum _renderer) + VertexLayout& VertexLayout::begin(RendererType::Enum _renderer) { - m_hash = _renderer; // use hash to store renderer type while building VertexDecl. + m_hash = _renderer; // use hash to store renderer type while building VertexLayout. m_stride = 0; bx::memSet(m_attributes, 0xff, sizeof(m_attributes) ); bx::memSet(m_offset, 0, sizeof(m_offset) ); @@ -80,7 +80,7 @@ namespace bgfx return *this; } - void VertexDecl::end() + void VertexLayout::end() { bx::HashMurmur2A murmur; murmur.begin(); @@ -90,7 +90,7 @@ namespace bgfx m_hash = murmur.end(); } - VertexDecl& VertexDecl::add(Attrib::Enum _attrib, uint8_t _num, AttribType::Enum _type, bool _normalized, bool _asInt) + VertexLayout& VertexLayout::add(Attrib::Enum _attrib, uint8_t _num, AttribType::Enum _type, bool _normalized, bool _asInt) { const uint16_t encodedNorm = (_normalized&1)<<7; const uint16_t encodedType = (_type&7)<<3; @@ -104,14 +104,14 @@ namespace bgfx return *this; } - VertexDecl& VertexDecl::skip(uint8_t _num) + VertexLayout& VertexLayout::skip(uint8_t _num) { m_stride += _num; return *this; } - void VertexDecl::decode(Attrib::Enum _attrib, uint8_t& _num, AttribType::Enum& _type, bool& _normalized, bool& _asInt) const + void VertexLayout::decode(Attrib::Enum _attrib, uint8_t& _num, AttribType::Enum& _type, bool& _normalized, bool& _asInt) const { uint16_t val = m_attributes[_attrib]; _num = (val&3)+1; @@ -241,7 +241,7 @@ namespace bgfx return s_attribTypeToId[_attr].id; } - int32_t write(bx::WriterI* _writer, const VertexDecl& _decl, bx::Error* _err) + int32_t write(bx::WriterI* _writer, const VertexLayout& _decl, bx::Error* _err) { BX_ERROR_SCOPE(_err); @@ -277,7 +277,7 @@ namespace bgfx return total; } - int32_t read(bx::ReaderI* _reader, VertexDecl& _decl, bx::Error* _err) + int32_t read(bx::ReaderI* _reader, VertexLayout& _decl, bx::Error* _err) { BX_ERROR_SCOPE(_err); @@ -337,7 +337,7 @@ namespace bgfx return total; } - void vertexPack(const float _input[4], bool _inputNormalized, Attrib::Enum _attr, const VertexDecl& _decl, void* _data, uint32_t _index) + void vertexPack(const float _input[4], bool _inputNormalized, Attrib::Enum _attr, const VertexLayout& _decl, void* _data, uint32_t _index) { if (!_decl.has(_attr) ) { @@ -493,7 +493,7 @@ namespace bgfx } } - void vertexUnpack(float _output[4], Attrib::Enum _attr, const VertexDecl& _decl, const void* _data, uint32_t _index) + void vertexUnpack(float _output[4], Attrib::Enum _attr, const VertexLayout& _decl, const void* _data, uint32_t _index) { if (!_decl.has(_attr) ) { @@ -619,7 +619,7 @@ namespace bgfx } } - void vertexConvert(const VertexDecl& _destDecl, void* _destData, const VertexDecl& _srcDecl, const void* _srcData, uint32_t _num) + void vertexConvert(const VertexLayout& _destDecl, void* _destData, const VertexLayout& _srcDecl, const void* _srcData, uint32_t _num) { if (_destDecl.m_hash == _srcDecl.m_hash) { @@ -724,7 +724,7 @@ namespace bgfx return xx*xx + yy*yy + zz*zz; } - uint16_t weldVerticesRef(uint16_t* _output, const VertexDecl& _decl, const void* _data, uint16_t _num, float _epsilon) + uint16_t weldVerticesRef(uint16_t* _output, const VertexLayout& _decl, const void* _data, uint16_t _num, float _epsilon) { // Brute force slow vertex welding... const float epsilonSq = _epsilon*_epsilon; @@ -765,7 +765,7 @@ namespace bgfx return (uint16_t)numVertices; } - uint16_t weldVertices(uint16_t* _output, const VertexDecl& _decl, const void* _data, uint16_t _num, float _epsilon) + uint16_t weldVertices(uint16_t* _output, const VertexLayout& _decl, const void* _data, uint16_t _num, float _epsilon) { const uint32_t hashSize = bx::uint32_nextpow2(_num); const uint32_t hashMask = hashSize-1; diff --git a/src/vertexdecl.h b/src/vertexdecl.h index f82917dca..1ea34bc13 100644 --- a/src/vertexdecl.h +++ b/src/vertexdecl.h @@ -30,10 +30,10 @@ namespace bgfx AttribType::Enum idToAttribType(uint16_t id); /// - int32_t write(bx::WriterI* _writer, const bgfx::VertexDecl& _decl, bx::Error* _err = NULL); + int32_t write(bx::WriterI* _writer, const bgfx::VertexLayout& _decl, bx::Error* _err = NULL); /// - int32_t read(bx::ReaderI* _reader, bgfx::VertexDecl& _decl, bx::Error* _err = NULL); + int32_t read(bx::ReaderI* _reader, bgfx::VertexLayout& _decl, bx::Error* _err = NULL); } // namespace bgfx diff --git a/tools/geometryc/geometryc.cpp b/tools/geometryc/geometryc.cpp index c6ed8ada9..2d625682e 100644 --- a/tools/geometryc/geometryc.cpp +++ b/tools/geometryc/geometryc.cpp @@ -150,7 +150,7 @@ void writeCompressedVertices(bx::WriterI* _writer, const uint8_t* _vertices, ui free(compressedVertices); } -void calcTangents(void* _vertices, uint16_t _numVertices, bgfx::VertexDecl _decl, const uint16_t* _indices, uint32_t _numIndices) +void calcTangents(void* _vertices, uint16_t _numVertices, bgfx::VertexLayout _decl, const uint16_t* _indices, uint32_t _numIndices) { struct PosTexcoord { @@ -276,7 +276,7 @@ void write(bx::WriterI* _writer, const void* _vertices, uint32_t _numVertices, u void write(bx::WriterI* _writer , const uint8_t* _vertices , uint32_t _numVertices - , const bgfx::VertexDecl& _decl + , const bgfx::VertexLayout& _decl , const uint16_t* _indices , uint32_t _numIndices , bool _compress @@ -793,7 +793,7 @@ int main(int _argc, const char* _argv[]) } } - bgfx::VertexDecl decl; + bgfx::VertexLayout decl; decl.begin(); decl.add(bgfx::Attrib::Position, 3, bgfx::AttribType::Float); diff --git a/tools/texturev/texturev.cpp b/tools/texturev/texturev.cpp index c9a6455e9..67f17cbff 100644 --- a/tools/texturev/texturev.cpp +++ b/tools/texturev/texturev.cpp @@ -906,10 +906,10 @@ struct PosUvwColorVertex m_abgr = _abgr; } - static bgfx::VertexDecl ms_decl; + static bgfx::VertexLayout ms_decl; }; -bgfx::VertexDecl PosUvwColorVertex::ms_decl; +bgfx::VertexLayout PosUvwColorVertex::ms_decl; static uint32_t addQuad(uint16_t* _indices, uint16_t _idx0, uint16_t _idx1, uint16_t _idx2, uint16_t _idx3) {