diff --git a/examples/13-stencil/stencil.cpp b/examples/13-stencil/stencil.cpp index 522eebf9c..a1af5aceb 100644 --- a/examples/13-stencil/stencil.cpp +++ b/examples/13-stencil/stencil.cpp @@ -542,7 +542,7 @@ struct ClearValues uint8_t m_clearStencil; }; -void clearView(uint8_t _id, uint8_t _flags, const ClearValues& _clearValues) +void clearView(bgfx::ViewId _id, uint8_t _flags, const ClearValues& _clearValues) { bgfx::setViewClear(_id , _flags @@ -746,13 +746,13 @@ struct Mesh m_groups.clear(); } - void submit(uint8_t _viewId, float* _mtx, bgfx::ProgramHandle _program, const RenderState& _renderState) + void submit(bgfx::ViewId _id, float* _mtx, bgfx::ProgramHandle _program, const RenderState& _renderState) { bgfx::TextureHandle texture = BGFX_INVALID_HANDLE; - submit(_viewId, _mtx, _program, _renderState, texture); + submit(_id, _mtx, _program, _renderState, texture); } - void submit(uint8_t _viewId, float* _mtx, bgfx::ProgramHandle _program, const RenderState& _renderState, bgfx::TextureHandle _texture) + void submit(bgfx::ViewId _id, float* _mtx, bgfx::ProgramHandle _program, const RenderState& _renderState, bgfx::TextureHandle _texture) { for (GroupArray::const_iterator it = m_groups.begin(), itEnd = m_groups.end(); it != itEnd; ++it) { @@ -774,10 +774,10 @@ struct Mesh bgfx::setState(_renderState.m_state, _renderState.m_blendFactorRgba); // Submit - bgfx::submit(_viewId, _program); + bgfx::submit(_id, _program); // Keep track of submited view ids - s_viewMask |= 1 << _viewId; + s_viewMask |= 1 << _id; } } diff --git a/examples/14-shadowvolumes/shadowvolumes.cpp b/examples/14-shadowvolumes/shadowvolumes.cpp index 9bc131373..d6195526d 100644 --- a/examples/14-shadowvolumes/shadowvolumes.cpp +++ b/examples/14-shadowvolumes/shadowvolumes.cpp @@ -544,7 +544,7 @@ struct ClearValues uint8_t m_clearStencil; }; -void submit(uint8_t _id, bgfx::ProgramHandle _handle, int32_t _depth = 0) +void submit(bgfx::ViewId _id, bgfx::ProgramHandle _handle, int32_t _depth = 0) { bgfx::submit(_id, _handle, _depth); @@ -552,7 +552,7 @@ void submit(uint8_t _id, bgfx::ProgramHandle _handle, int32_t _depth = 0) s_viewMask |= 1 << _id; } -void touch(uint8_t _id) +void touch(bgfx::ViewId _id) { bgfx::ProgramHandle handle = BGFX_INVALID_HANDLE; ::submit(_id, handle); diff --git a/examples/common/bgfx_utils.cpp b/examples/common/bgfx_utils.cpp index 9e8f79092..befcd3250 100644 --- a/examples/common/bgfx_utils.cpp +++ b/examples/common/bgfx_utils.cpp @@ -547,7 +547,7 @@ struct Mesh m_groups.clear(); } - void submit(uint8_t _id, bgfx::ProgramHandle _program, const float* _mtx, uint64_t _state) const + void submit(bgfx::ViewId _id, bgfx::ProgramHandle _program, const float* _mtx, uint64_t _state) const { if (BGFX_STATE_MASK == _state) { @@ -648,7 +648,7 @@ void meshStateDestroy(MeshState* _meshState) BX_FREE(entry::getAllocator(), _meshState); } -void meshSubmit(const Mesh* _mesh, uint8_t _id, bgfx::ProgramHandle _program, const float* _mtx, uint64_t _state) +void meshSubmit(const Mesh* _mesh, bgfx::ViewId _id, bgfx::ProgramHandle _program, const float* _mtx, uint64_t _state) { _mesh->submit(_id, _program, _mtx, _state); } diff --git a/examples/common/bgfx_utils.h b/examples/common/bgfx_utils.h index 92b8a5b6d..5fba167bc 100644 --- a/examples/common/bgfx_utils.h +++ b/examples/common/bgfx_utils.h @@ -75,7 +75,7 @@ struct MeshState uint64_t m_state; bgfx::ProgramHandle m_program; uint8_t m_numTextures; - uint8_t m_viewId; + bgfx::ViewId m_viewId; }; struct Mesh; @@ -93,7 +93,7 @@ MeshState* meshStateCreate(); void meshStateDestroy(MeshState* _meshState); /// -void meshSubmit(const Mesh* _mesh, uint8_t _id, bgfx::ProgramHandle _program, const float* _mtx, uint64_t _state = BGFX_STATE_MASK); +void meshSubmit(const Mesh* _mesh, bgfx::ViewId _id, bgfx::ProgramHandle _program, const float* _mtx, uint64_t _state = BGFX_STATE_MASK); /// void meshSubmit(const Mesh* _mesh, const MeshState*const* _state, uint8_t _numPasses, const float* _mtx, uint16_t _numMatrices = 1); diff --git a/examples/common/font/text_buffer_manager.cpp b/examples/common/font/text_buffer_manager.cpp index 4c1187683..b442a811b 100644 --- a/examples/common/font/text_buffer_manager.cpp +++ b/examples/common/font/text_buffer_manager.cpp @@ -678,7 +678,7 @@ void TextBufferManager::destroyTextBuffer(TextBufferHandle _handle) } } -void TextBufferManager::submitTextBuffer(TextBufferHandle _handle, uint8_t _id, int32_t _depth) +void TextBufferManager::submitTextBuffer(TextBufferHandle _handle, bgfx::ViewId _id, int32_t _depth) { BX_CHECK(bgfx::isValid(_handle), "Invalid handle used"); diff --git a/examples/common/font/text_buffer_manager.h b/examples/common/font/text_buffer_manager.h index 0183b39ee..788fba800 100644 --- a/examples/common/font/text_buffer_manager.h +++ b/examples/common/font/text_buffer_manager.h @@ -47,7 +47,7 @@ public: TextBufferHandle createTextBuffer(uint32_t _type, BufferType::Enum _bufferType); void destroyTextBuffer(TextBufferHandle _handle); - void submitTextBuffer(TextBufferHandle _handle, uint8_t _id, int32_t _depth = 0); + void submitTextBuffer(TextBufferHandle _handle, bgfx::ViewId _id, int32_t _depth = 0); void setStyle(TextBufferHandle _handle, uint32_t _flags = STYLE_NORMAL); void setTextColor(TextBufferHandle _handle, uint32_t _rgba = 0x000000FF); @@ -64,16 +64,16 @@ public: /// Append a wide char unicode string to the buffer using current pen position and color. void appendText(TextBufferHandle _handle, FontHandle _fontHandle, const wchar_t* _string, const wchar_t* _end = NULL); - + /// Append a whole face of the atlas cube, mostly used for debugging and visualizing atlas. void appendAtlasFace(TextBufferHandle _handle, uint16_t _faceIndex); /// Clear the text buffer and reset its state (pen/color). void clearTextBuffer(TextBufferHandle _handle); - + /// Return the rectangular size of the current text buffer (including all its content). - TextRectangle getRectangle(TextBufferHandle _handle) const; - + TextRectangle getRectangle(TextBufferHandle _handle) const; + private: struct BufferCache { diff --git a/include/bgfx/bgfx.h b/include/bgfx/bgfx.h index 2d3e29f44..38a965abb 100644 --- a/include/bgfx/bgfx.h +++ b/include/bgfx/bgfx.h @@ -834,6 +834,9 @@ namespace bgfx EncoderStats* encoderStats; //!< Encoder stats. }; + /// + typedef uint16_t ViewId; + /// Encoder for submitting draw calls from multiple threads. Use `bgfx::begin()` /// to obtain encoder for thread. /// @@ -1223,7 +1226,7 @@ namespace bgfx /// /// @param[in] _id View id. /// - void touch(uint8_t _id); + void touch(ViewId _id); /// Submit primitive for rendering. /// @@ -1236,7 +1239,7 @@ namespace bgfx /// @attention C99 equivalent is `bgfx_submit`. /// void submit( - uint8_t _id + ViewId _id , ProgramHandle _program , int32_t _depth = 0 , bool _preserveState = false @@ -1254,7 +1257,7 @@ namespace bgfx /// @attention C99 equivalent is `bgfx_submit_occlusion_query`. /// void submit( - uint8_t _id + ViewId _id , ProgramHandle _program , OcclusionQueryHandle _occlusionQuery , int32_t _depth = 0 @@ -1276,7 +1279,7 @@ namespace bgfx /// @attention C99 equivalent is `bgfx_submit_indirect`. /// void submit( - uint8_t _id + ViewId _id , ProgramHandle _program , IndirectBufferHandle _indirectHandle , uint16_t _start = 0 @@ -1390,7 +1393,7 @@ namespace bgfx /// @attention C99 equivalent is `bgfx_dispatch`. /// void dispatch( - uint8_t _id + ViewId _id , ProgramHandle _handle , uint32_t _numX = 1 , uint32_t _numY = 1 @@ -1413,7 +1416,7 @@ namespace bgfx /// @attention C99 equivalent is `bgfx_dispatch_indirect`. /// void dispatch( - uint8_t _id + ViewId _id , ProgramHandle _handle , IndirectBufferHandle _indirectHandle , uint16_t _start = 0 @@ -1444,7 +1447,7 @@ namespace bgfx /// @attention C99 equivalent is `bgfx_blit`. /// void blit( - uint8_t _id + ViewId _id , TextureHandle _dst , uint16_t _dstX , uint16_t _dstY @@ -1482,7 +1485,7 @@ namespace bgfx /// @attention C99 equivalent is `bgfx_blit`. /// void blit( - uint8_t _id + ViewId _id , TextureHandle _dst , uint8_t _dstMip , uint16_t _dstX @@ -2974,7 +2977,7 @@ namespace bgfx /// @attention C99 equivalent is `bgfx_set_view_name`. /// void setViewName( - uint8_t _id + ViewId _id , const char* _name ); @@ -2989,7 +2992,7 @@ namespace bgfx /// @attention C99 equivalent is `bgfx_set_view_rect`. /// void setViewRect( - uint8_t _id + ViewId _id , uint16_t _x , uint16_t _y , uint16_t _width @@ -3007,7 +3010,7 @@ namespace bgfx /// @attention C99 equivalent is `bgfx_set_view_rect_auto`. /// void setViewRect( - uint8_t _id + ViewId _id , uint16_t _x , uint16_t _y , BackbufferRatio::Enum _ratio @@ -3025,7 +3028,7 @@ namespace bgfx /// @attention C99 equivalent is `bgfx_set_view_scissor`. /// void setViewScissor( - uint8_t _id + ViewId _id , uint16_t _x = 0 , uint16_t _y = 0 , uint16_t _width = 0 @@ -3044,7 +3047,7 @@ namespace bgfx /// @attention C99 equivalent is `bgfx_set_view_clear`. /// void setViewClear( - uint8_t _id + ViewId _id , uint16_t _flags , uint32_t _rgba = 0x000000ff , float _depth = 1.0f @@ -3072,7 +3075,7 @@ namespace bgfx /// @attention C99 equivalent is `bgfx_set_view_clear_mrt`. /// void setViewClear( - uint8_t _id + ViewId _id , uint16_t _flags , float _depth , uint8_t _stencil @@ -3097,7 +3100,7 @@ namespace bgfx /// @attention C99 equivalent is `bgfx_set_view_mode`. /// void setViewMode( - uint8_t _id + ViewId _id , ViewMode::Enum _mode = ViewMode::Default ); @@ -3114,7 +3117,7 @@ namespace bgfx /// @attention C99 equivalent is `bgfx_set_view_frame_buffer`. /// void setViewFrameBuffer( - uint8_t _id + ViewId _id , FrameBufferHandle _handle ); @@ -3134,7 +3137,7 @@ namespace bgfx /// @attention C99 equivalent are `bgfx_set_view_transform`, `bgfx_set_view_transform_stereo`. /// void setViewTransform( - uint8_t _id + ViewId _id , const void* _view , const void* _projL , uint8_t _flags = BGFX_VIEW_STEREO @@ -3151,7 +3154,7 @@ namespace bgfx /// @attention C99 equivalent is `bgfx_set_view_order`. /// void setViewOrder( - uint8_t _id = 0 + ViewId _id = 0 , uint8_t _num = UINT8_MAX , const uint8_t* _remap = NULL ); @@ -3162,7 +3165,7 @@ namespace bgfx /// /// @attention C99 equivalent is `bgfx_reset_view`. /// - void resetView(uint8_t _id); + void resetView(ViewId _id); /// Sets debug marker. /// @@ -3546,7 +3549,7 @@ namespace bgfx /// /// @param[in] _id View id. /// - void touch(uint8_t _id); + void touch(ViewId _id); /// Submit primitive for rendering. /// @@ -3559,7 +3562,7 @@ namespace bgfx /// @attention C99 equivalent is `bgfx_submit`. /// void submit( - uint8_t _id + ViewId _id , ProgramHandle _program , int32_t _depth = 0 , bool _preserveState = false @@ -3577,7 +3580,7 @@ namespace bgfx /// @attention C99 equivalent is `bgfx_submit_occlusion_query`. /// void submit( - uint8_t _id + ViewId _id , ProgramHandle _program , OcclusionQueryHandle _occlusionQuery , int32_t _depth = 0 @@ -3599,7 +3602,7 @@ namespace bgfx /// @attention C99 equivalent is `bgfx_submit_indirect`. /// void submit( - uint8_t _id + ViewId _id , ProgramHandle _program , IndirectBufferHandle _indirectHandle , uint16_t _start = 0 @@ -3713,7 +3716,7 @@ namespace bgfx /// @attention C99 equivalent is `bgfx_dispatch`. /// void dispatch( - uint8_t _id + ViewId _id , ProgramHandle _handle , uint32_t _numX = 1 , uint32_t _numY = 1 @@ -3736,7 +3739,7 @@ namespace bgfx /// @attention C99 equivalent is `bgfx_dispatch_indirect`. /// void dispatch( - uint8_t _id + ViewId _id , ProgramHandle _handle , IndirectBufferHandle _indirectHandle , uint16_t _start = 0 @@ -3767,7 +3770,7 @@ namespace bgfx /// @attention C99 equivalent is `bgfx_blit`. /// void blit( - uint8_t _id + ViewId _id , TextureHandle _dst , uint16_t _dstX , uint16_t _dstY @@ -3805,7 +3808,7 @@ namespace bgfx /// @attention C99 equivalent is `bgfx_blit`. /// void blit( - uint8_t _id + ViewId _id , TextureHandle _dst , uint8_t _dstMip , uint16_t _dstX diff --git a/include/bgfx/c99/bgfx.h b/include/bgfx/c99/bgfx.h index 74e158d80..7d3e05abc 100644 --- a/include/bgfx/c99/bgfx.h +++ b/include/bgfx/c99/bgfx.h @@ -387,6 +387,9 @@ typedef struct bgfx_stats } bgfx_stats_t; +/**/ +typedef uint16_t bgfx_view_id_t; + /**/ struct bgfx_encoder; @@ -830,40 +833,40 @@ BGFX_C_API void bgfx_destroy_occlusion_query(bgfx_occlusion_query_handle_t _hand BGFX_C_API void bgfx_set_palette_color(uint8_t _index, const float _rgba[4]); /**/ -BGFX_C_API void bgfx_set_view_name(uint8_t _id, const char* _name); +BGFX_C_API void bgfx_set_view_name(bgfx_view_id_t _id, const char* _name); /**/ -BGFX_C_API void bgfx_set_view_rect(uint8_t _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height); +BGFX_C_API void bgfx_set_view_rect(bgfx_view_id_t _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height); /**/ -BGFX_C_API void bgfx_set_view_rect_auto(uint8_t _id, uint16_t _x, uint16_t _y, bgfx_backbuffer_ratio_t _ratio); +BGFX_C_API void bgfx_set_view_rect_auto(bgfx_view_id_t _id, uint16_t _x, uint16_t _y, bgfx_backbuffer_ratio_t _ratio); /**/ -BGFX_C_API void bgfx_set_view_scissor(uint8_t _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height); +BGFX_C_API void bgfx_set_view_scissor(bgfx_view_id_t _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height); /**/ -BGFX_C_API void bgfx_set_view_clear(uint8_t _id, uint16_t _flags, uint32_t _rgba, float _depth, uint8_t _stencil); +BGFX_C_API void bgfx_set_view_clear(bgfx_view_id_t _id, uint16_t _flags, uint32_t _rgba, float _depth, uint8_t _stencil); /**/ -BGFX_C_API void bgfx_set_view_clear_mrt(uint8_t _id, uint16_t _flags, float _depth, uint8_t _stencil, uint8_t _0, uint8_t _1, uint8_t _2, uint8_t _3, uint8_t _4, uint8_t _5, uint8_t _6, uint8_t _7); +BGFX_C_API void bgfx_set_view_clear_mrt(bgfx_view_id_t _id, uint16_t _flags, float _depth, uint8_t _stencil, uint8_t _0, uint8_t _1, uint8_t _2, uint8_t _3, uint8_t _4, uint8_t _5, uint8_t _6, uint8_t _7); /**/ -BGFX_C_API void bgfx_set_view_mode(uint8_t _id, bgfx_view_mode_t _mode); +BGFX_C_API void bgfx_set_view_mode(bgfx_view_id_t _id, bgfx_view_mode_t _mode); /**/ -BGFX_C_API void bgfx_set_view_frame_buffer(uint8_t _id, bgfx_frame_buffer_handle_t _handle); +BGFX_C_API void bgfx_set_view_frame_buffer(bgfx_view_id_t _id, bgfx_frame_buffer_handle_t _handle); /**/ -BGFX_C_API void bgfx_set_view_transform(uint8_t _id, const void* _view, const void* _proj); +BGFX_C_API void bgfx_set_view_transform(bgfx_view_id_t _id, const void* _view, const void* _proj); /**/ -BGFX_C_API void bgfx_set_view_transform_stereo(uint8_t _id, const void* _view, const void* _projL, uint8_t _flags, const void* _projR); +BGFX_C_API void bgfx_set_view_transform_stereo(bgfx_view_id_t _id, const void* _view, const void* _projL, uint8_t _flags, const void* _projR); /**/ -BGFX_C_API void bgfx_set_view_order(uint8_t _id, uint8_t _num, const uint8_t* _order); +BGFX_C_API void bgfx_set_view_order(bgfx_view_id_t _id, uint8_t _num, const uint8_t* _order); /**/ -BGFX_C_API void bgfx_reset_view(uint8_t _id); +BGFX_C_API void bgfx_reset_view(bgfx_view_id_t _id); /**/ BGFX_C_API void bgfx_set_marker(const char* _marker); @@ -926,16 +929,16 @@ BGFX_C_API void bgfx_set_instance_data_from_dynamic_vertex_buffer(bgfx_dynamic_v BGFX_C_API void bgfx_set_texture(uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint32_t _flags); /**/ -BGFX_C_API void bgfx_touch(uint8_t _id); +BGFX_C_API void bgfx_touch(bgfx_view_id_t _id); /**/ -BGFX_C_API void bgfx_submit(uint8_t _id, bgfx_program_handle_t _handle, int32_t _depth, bool _preserveState); +BGFX_C_API void bgfx_submit(bgfx_view_id_t _id, bgfx_program_handle_t _handle, int32_t _depth, bool _preserveState); /**/ -BGFX_C_API void bgfx_submit_occlusion_query(uint8_t _id, bgfx_program_handle_t _program, bgfx_occlusion_query_handle_t _occlusionQuery, int32_t _depth, bool _preserveState); +BGFX_C_API void bgfx_submit_occlusion_query(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_occlusion_query_handle_t _occlusionQuery, int32_t _depth, bool _preserveState); /**/ -BGFX_C_API void bgfx_submit_indirect(uint8_t _id, bgfx_program_handle_t _handle, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, int32_t _depth, bool _preserveState); +BGFX_C_API void bgfx_submit_indirect(bgfx_view_id_t _id, bgfx_program_handle_t _handle, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, int32_t _depth, bool _preserveState); /**/ BGFX_C_API void bgfx_set_image(uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint8_t _mip, bgfx_access_t _access, bgfx_texture_format_t _format); @@ -956,16 +959,16 @@ BGFX_C_API void bgfx_set_compute_dynamic_vertex_buffer(uint8_t _stage, bgfx_dyna BGFX_C_API void bgfx_set_compute_indirect_buffer(uint8_t _stage, bgfx_indirect_buffer_handle_t _handle, bgfx_access_t _access); /**/ -BGFX_C_API void bgfx_dispatch(uint8_t _id, bgfx_program_handle_t _handle, uint32_t _numX, uint32_t _numY, uint32_t _numZ, uint8_t _flags); +BGFX_C_API void bgfx_dispatch(bgfx_view_id_t _id, bgfx_program_handle_t _handle, uint32_t _numX, uint32_t _numY, uint32_t _numZ, uint8_t _flags); /**/ -BGFX_C_API void bgfx_dispatch_indirect(uint8_t _id, bgfx_program_handle_t _handle, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, uint8_t _flags); +BGFX_C_API void bgfx_dispatch_indirect(bgfx_view_id_t _id, bgfx_program_handle_t _handle, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, uint8_t _flags); /**/ BGFX_C_API void bgfx_discard(); /**/ -BGFX_C_API void bgfx_blit(uint8_t _id, bgfx_texture_handle_t _dst, uint8_t _dstMip, uint16_t _dstX, uint16_t _dstY, uint16_t _dstZ, bgfx_texture_handle_t _src, uint8_t _srcMip, uint16_t _srcX, uint16_t _srcY, uint16_t _srcZ, uint16_t _width, uint16_t _height, uint16_t _depth); +BGFX_C_API void bgfx_blit(bgfx_view_id_t _id, bgfx_texture_handle_t _dst, uint8_t _dstMip, uint16_t _dstX, uint16_t _dstY, uint16_t _dstZ, bgfx_texture_handle_t _src, uint8_t _srcMip, uint16_t _srcX, uint16_t _srcY, uint16_t _srcZ, uint16_t _width, uint16_t _height, uint16_t _depth); /**/ BGFX_C_API void bgfx_encoder_set_marker(struct bgfx_encoder* _encoder, const char* _marker); @@ -1028,16 +1031,16 @@ BGFX_C_API void bgfx_encoder_set_instance_data_from_dynamic_vertex_buffer(struct BGFX_C_API void bgfx_encoder_set_texture(struct bgfx_encoder* _encoder, uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint32_t _flags); /**/ -BGFX_C_API void bgfx_encoder_touch(struct bgfx_encoder* _encoder, uint8_t _id); +BGFX_C_API void bgfx_encoder_touch(struct bgfx_encoder* _encoder, bgfx_view_id_t _id); /**/ -BGFX_C_API void bgfx_encoder_submit(struct bgfx_encoder* _encoder, uint8_t _id, bgfx_program_handle_t _handle, int32_t _depth, bool _preserveState); +BGFX_C_API void bgfx_encoder_submit(struct bgfx_encoder* _encoder, bgfx_view_id_t _id, bgfx_program_handle_t _handle, int32_t _depth, bool _preserveState); /**/ -BGFX_C_API void bgfx_encoder_submit_occlusion_query(struct bgfx_encoder* _encoder, uint8_t _id, bgfx_program_handle_t _program, bgfx_occlusion_query_handle_t _occlusionQuery, int32_t _depth, bool _preserveState); +BGFX_C_API void bgfx_encoder_submit_occlusion_query(struct bgfx_encoder* _encoder, bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_occlusion_query_handle_t _occlusionQuery, int32_t _depth, bool _preserveState); /**/ -BGFX_C_API void bgfx_encoder_submit_indirect(struct bgfx_encoder* _encoder, uint8_t _id, bgfx_program_handle_t _handle, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, int32_t _depth, bool _preserveState); +BGFX_C_API void bgfx_encoder_submit_indirect(struct bgfx_encoder* _encoder, bgfx_view_id_t _id, bgfx_program_handle_t _handle, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, int32_t _depth, bool _preserveState); /**/ BGFX_C_API void bgfx_encoder_set_image(struct bgfx_encoder* _encoder, uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint8_t _mip, bgfx_access_t _access, bgfx_texture_format_t _format); @@ -1058,16 +1061,16 @@ BGFX_C_API void bgfx_encoder_set_compute_dynamic_vertex_buffer(struct bgfx_encod BGFX_C_API void bgfx_encoder_set_compute_indirect_buffer(struct bgfx_encoder* _encoder, uint8_t _stage, bgfx_indirect_buffer_handle_t _handle, bgfx_access_t _access); /**/ -BGFX_C_API void bgfx_encoder_dispatch(struct bgfx_encoder* _encoder, uint8_t _id, bgfx_program_handle_t _handle, uint32_t _numX, uint32_t _numY, uint32_t _numZ, uint8_t _flags); +BGFX_C_API void bgfx_encoder_dispatch(struct bgfx_encoder* _encoder, bgfx_view_id_t _id, bgfx_program_handle_t _handle, uint32_t _numX, uint32_t _numY, uint32_t _numZ, uint8_t _flags); /**/ -BGFX_C_API void bgfx_encoder_dispatch_indirect(struct bgfx_encoder* _encoder, uint8_t _id, bgfx_program_handle_t _handle, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, uint8_t _flags); +BGFX_C_API void bgfx_encoder_dispatch_indirect(struct bgfx_encoder* _encoder, bgfx_view_id_t _id, bgfx_program_handle_t _handle, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, uint8_t _flags); /**/ BGFX_C_API void bgfx_encoder_discard(struct bgfx_encoder* _encoder); /**/ -BGFX_C_API void bgfx_encoder_blit(struct bgfx_encoder* _encoder, uint8_t _id, bgfx_texture_handle_t _dst, uint8_t _dstMip, uint16_t _dstX, uint16_t _dstY, uint16_t _dstZ, bgfx_texture_handle_t _src, uint8_t _srcMip, uint16_t _srcX, uint16_t _srcY, uint16_t _srcZ, uint16_t _width, uint16_t _height, uint16_t _depth); +BGFX_C_API void bgfx_encoder_blit(struct bgfx_encoder* _encoder, bgfx_view_id_t _id, bgfx_texture_handle_t _dst, uint8_t _dstMip, uint16_t _dstX, uint16_t _dstY, uint16_t _dstZ, bgfx_texture_handle_t _src, uint8_t _srcMip, uint16_t _srcX, uint16_t _srcY, uint16_t _srcZ, uint16_t _width, uint16_t _height, uint16_t _depth); /**/ BGFX_C_API void bgfx_request_screen_shot(bgfx_frame_buffer_handle_t _handle, const char* _filePath); diff --git a/include/bgfx/c99/platform.h b/include/bgfx/c99/platform.h index bbdeaad8b..aa6e613a3 100644 --- a/include/bgfx/c99/platform.h +++ b/include/bgfx/c99/platform.h @@ -154,16 +154,16 @@ typedef struct bgfx_interface_vtbl bgfx_occlusion_query_result_t (*get_result)(bgfx_occlusion_query_handle_t _handle, int32_t* _result); void (*destroy_occlusion_query)(bgfx_occlusion_query_handle_t _handle); void (*set_palette_color)(uint8_t _index, const float _rgba[4]); - void (*set_view_name)(uint8_t _id, const char* _name); - void (*set_view_rect)(uint8_t _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height); - void (*set_view_scissor)(uint8_t _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height); - void (*set_view_clear)(uint8_t _id, uint16_t _flags, uint32_t _rgba, float _depth, uint8_t _stencil); - void (*set_view_clear_mrt)(uint8_t _id, uint16_t _flags, float _depth, uint8_t _stencil, uint8_t _0, uint8_t _1, uint8_t _2, uint8_t _3, uint8_t _4, uint8_t _5, uint8_t _6, uint8_t _7); - void (*set_view_mode)(uint8_t _id, bgfx_view_mode_t _mode); - void (*set_view_frame_buffer)(uint8_t _id, bgfx_frame_buffer_handle_t _handle); - void (*set_view_transform)(uint8_t _id, const void* _view, const void* _proj); - void (*set_view_transform_stereo)(uint8_t _id, const void* _view, const void* _projL, uint8_t _flags, const void* _projR); - void (*set_view_order)(uint8_t _id, uint8_t _num, const uint8_t* _order); + void (*set_view_name)(bgfx_view_id_t _id, const char* _name); + void (*set_view_rect)(bgfx_view_id_t _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height); + void (*set_view_scissor)(bgfx_view_id_t _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height); + void (*set_view_clear)(bgfx_view_id_t _id, uint16_t _flags, uint32_t _rgba, float _depth, uint8_t _stencil); + void (*set_view_clear_mrt)(bgfx_view_id_t _id, uint16_t _flags, float _depth, uint8_t _stencil, uint8_t _0, uint8_t _1, uint8_t _2, uint8_t _3, uint8_t _4, uint8_t _5, uint8_t _6, uint8_t _7); + void (*set_view_mode)(bgfx_view_id_t _id, bgfx_view_mode_t _mode); + void (*set_view_frame_buffer)(bgfx_view_id_t _id, bgfx_frame_buffer_handle_t _handle); + void (*set_view_transform)(bgfx_view_id_t _id, const void* _view, const void* _proj); + void (*set_view_transform_stereo)(bgfx_view_id_t _id, const void* _view, const void* _projL, uint8_t _flags, const void* _projR); + void (*set_view_order)(bgfx_view_id_t _id, uint8_t _num, const uint8_t* _order); void (*encoder_set_marker)(struct bgfx_encoder* _encoder, const char* _marker); void (*encoder_set_state)(struct bgfx_encoder* _encoder, uint64_t _state, uint32_t _rgba); void (*encoder_set_condition)(struct bgfx_encoder* _encoder, bgfx_occlusion_query_handle_t _handle, bool _visible); @@ -184,20 +184,20 @@ typedef struct bgfx_interface_vtbl void (*encoder_set_instance_data_from_vertex_buffer)(struct bgfx_encoder* _encoder, bgfx_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _num); void (*encoder_set_instance_data_from_dynamic_vertex_buffer)(struct bgfx_encoder* _encoder, bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _num); void (*encoder_set_texture)(struct bgfx_encoder* _encoder, uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint32_t _flags); - void (*encoder_touch)(struct bgfx_encoder* _encoder, uint8_t _id); - void (*encoder_submit)(struct bgfx_encoder* _encoder, uint8_t _id, bgfx_program_handle_t _handle, int32_t _depth, bool _preserveState); - void (*encoder_submit_occlusion_query)(struct bgfx_encoder* _encoder, uint8_t _id, bgfx_program_handle_t _program, bgfx_occlusion_query_handle_t _occlusionQuery, int32_t _depth, bool _preserveState); - void (*encoder_submit_indirect)(struct bgfx_encoder* _encoder, uint8_t _id, bgfx_program_handle_t _handle, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, int32_t _depth, bool _preserveState); + void (*encoder_touch)(struct bgfx_encoder* _encoder, bgfx_view_id_t _id); + void (*encoder_submit)(struct bgfx_encoder* _encoder, bgfx_view_id_t _id, bgfx_program_handle_t _handle, int32_t _depth, bool _preserveState); + void (*encoder_submit_occlusion_query)(struct bgfx_encoder* _encoder, bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_occlusion_query_handle_t _occlusionQuery, int32_t _depth, bool _preserveState); + void (*encoder_submit_indirect)(struct bgfx_encoder* _encoder, bgfx_view_id_t _id, bgfx_program_handle_t _handle, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, int32_t _depth, bool _preserveState); void (*encoder_set_image)(struct bgfx_encoder* _encoder, uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint8_t _mip, bgfx_access_t _access, bgfx_texture_format_t _format); void (*encoder_set_compute_index_buffer)(struct bgfx_encoder* _encoder, uint8_t _stage, bgfx_index_buffer_handle_t _handle, bgfx_access_t _access); void (*encoder_set_compute_vertex_buffer)(struct bgfx_encoder* _encoder, uint8_t _stage, bgfx_vertex_buffer_handle_t _handle, bgfx_access_t _access); void (*encoder_set_compute_dynamic_index_buffer)(struct bgfx_encoder* _encoder, uint8_t _stage, bgfx_dynamic_index_buffer_handle_t _handle, bgfx_access_t _access); void (*encoder_set_compute_dynamic_vertex_buffer)(struct bgfx_encoder* _encoder, uint8_t _stage, bgfx_dynamic_vertex_buffer_handle_t _handle, bgfx_access_t _access); void (*encoder_set_compute_indirect_buffer)(struct bgfx_encoder* _encoder, uint8_t _stage, bgfx_indirect_buffer_handle_t _handle, bgfx_access_t _access); - void (*encoder_dispatch)(struct bgfx_encoder* _encoder, uint8_t _id, bgfx_program_handle_t _handle, uint32_t _numX, uint32_t _numY, uint32_t _numZ, uint8_t _flags); - void (*encoder_dispatch_indirect)(struct bgfx_encoder* _encoder, uint8_t _id, bgfx_program_handle_t _handle, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, uint8_t _flags); + void (*encoder_dispatch)(struct bgfx_encoder* _encoder, bgfx_view_id_t _id, bgfx_program_handle_t _handle, uint32_t _numX, uint32_t _numY, uint32_t _numZ, uint8_t _flags); + void (*encoder_dispatch_indirect)(struct bgfx_encoder* _encoder, bgfx_view_id_t _id, bgfx_program_handle_t _handle, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, uint8_t _flags); void (*encoder_discard)(struct bgfx_encoder* _encoder); - void (*encoder_blit)(struct bgfx_encoder* _encoder, uint8_t _id, bgfx_texture_handle_t _dst, uint8_t _dstMip, uint16_t _dstX, uint16_t _dstY, uint16_t _dstZ, bgfx_texture_handle_t _src, uint8_t _srcMip, uint16_t _srcX, uint16_t _srcY, uint16_t _srcZ, uint16_t _width, uint16_t _height, uint16_t _depth); + void (*encoder_blit)(struct bgfx_encoder* _encoder, bgfx_view_id_t _id, bgfx_texture_handle_t _dst, uint8_t _dstMip, uint16_t _dstX, uint16_t _dstY, uint16_t _dstZ, bgfx_texture_handle_t _src, uint8_t _srcMip, uint16_t _srcX, uint16_t _srcY, uint16_t _srcZ, uint16_t _width, uint16_t _height, uint16_t _depth); void (*request_screen_shot)(bgfx_frame_buffer_handle_t _handle, const char* _filePath); } bgfx_interface_vtbl_t; diff --git a/include/bgfx/defines.h b/include/bgfx/defines.h index 175e829fc..49c2dccc3 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(55) +#define BGFX_API_VERSION UINT32_C(56) /// Color RGB/alpha/depth write. When it's not specified write will be disabled. #define BGFX_STATE_RGB_WRITE UINT64_C(0x0000000000000001) //!< Enable RGB write. diff --git a/src/bgfx.cpp b/src/bgfx.cpp index c1ecf925a..43f929559 100644 --- a/src/bgfx.cpp +++ b/src/bgfx.cpp @@ -859,7 +859,7 @@ namespace bgfx return PredefinedUniform::Count; } - void EncoderImpl::submit(uint8_t _id, ProgramHandle _program, OcclusionQueryHandle _occlusionQuery, int32_t _depth, bool _preserveState) + void EncoderImpl::submit(ViewId _id, ProgramHandle _program, OcclusionQueryHandle _occlusionQuery, int32_t _depth, bool _preserveState) { if (BX_ENABLED(BGFX_CONFIG_DEBUG_UNIFORM) && !_preserveState) @@ -958,7 +958,7 @@ namespace bgfx } } - void EncoderImpl::dispatch(uint8_t _id, ProgramHandle _handle, uint32_t _numX, uint32_t _numY, uint32_t _numZ, uint8_t _flags) + void EncoderImpl::dispatch(ViewId _id, ProgramHandle _handle, uint32_t _numX, uint32_t _numY, uint32_t _numZ, uint8_t _flags) { if (BX_ENABLED(BGFX_CONFIG_DEBUG_UNIFORM) ) { @@ -1011,7 +1011,7 @@ namespace bgfx m_uniformBegin = m_uniformEnd; } - void EncoderImpl::blit(uint8_t _id, TextureHandle _dst, uint8_t _dstMip, uint16_t _dstX, uint16_t _dstY, uint16_t _dstZ, TextureHandle _src, uint8_t _srcMip, uint16_t _srcX, uint16_t _srcY, uint16_t _srcZ, uint16_t _width, uint16_t _height, uint16_t _depth) + void EncoderImpl::blit(ViewId _id, TextureHandle _dst, uint8_t _dstMip, uint16_t _dstX, uint16_t _dstY, uint16_t _dstZ, TextureHandle _src, uint8_t _srcMip, uint16_t _srcX, uint16_t _srcY, uint16_t _srcZ, uint16_t _width, uint16_t _height, uint16_t _depth) { BX_WARN(m_frame->m_numBlitItems < BGFX_CONFIG_MAX_BLIT_ITEMS , "Exceed number of available blit items per frame. BGFX_CONFIG_MAX_BLIT_ITEMS is %d. Skipping blit." @@ -2645,7 +2645,7 @@ namespace bgfx case CommandBuffer::UpdateViewName: { - uint8_t id; + ViewId id; _cmdbuf.read(id); uint16_t len; @@ -3062,19 +3062,19 @@ error: BGFX_ENCODER(setTexture(_stage, _sampler, _handle, _flags) ); } - void Encoder::touch(uint8_t _id) + void Encoder::touch(ViewId _id) { ProgramHandle handle = BGFX_INVALID_HANDLE; submit(_id, handle); } - void Encoder::submit(uint8_t _id, ProgramHandle _program, int32_t _depth, bool _preserveState) + void Encoder::submit(ViewId _id, ProgramHandle _program, int32_t _depth, bool _preserveState) { OcclusionQueryHandle handle = BGFX_INVALID_HANDLE; submit(_id, _program, handle, _depth, _preserveState); } - void Encoder::submit(uint8_t _id, ProgramHandle _program, OcclusionQueryHandle _occlusionQuery, int32_t _depth, bool _preserveState) + void Encoder::submit(ViewId _id, ProgramHandle _program, OcclusionQueryHandle _occlusionQuery, int32_t _depth, bool _preserveState) { BX_CHECK(false || !isValid(_occlusionQuery) @@ -3086,7 +3086,7 @@ error: BGFX_ENCODER(submit(_id, _program, _occlusionQuery, _depth, _preserveState) ); } - void Encoder::submit(uint8_t _id, ProgramHandle _program, IndirectBufferHandle _indirectHandle, uint16_t _start, uint16_t _num, int32_t _depth, bool _preserveState) + void Encoder::submit(ViewId _id, ProgramHandle _program, IndirectBufferHandle _indirectHandle, uint16_t _start, uint16_t _num, int32_t _depth, bool _preserveState) { BGFX_CHECK_HANDLE_INVALID_OK("submit", s_ctx->m_programHandle, _program); BGFX_CHECK_HANDLE("submit", s_ctx->m_vertexBufferHandle, _indirectHandle); @@ -3145,14 +3145,14 @@ error: BGFX_ENCODER(setImage(_stage, _sampler, _handle, _mip, _access, _format) ); } - void Encoder::dispatch(uint8_t _id, ProgramHandle _program, uint32_t _numX, uint32_t _numY, uint32_t _numZ, uint8_t _flags) + void Encoder::dispatch(ViewId _id, ProgramHandle _program, uint32_t _numX, uint32_t _numY, uint32_t _numZ, uint8_t _flags) { BGFX_CHECK_CAPS(BGFX_CAPS_COMPUTE, "Compute is not supported!"); BGFX_CHECK_HANDLE_INVALID_OK("dispatch", s_ctx->m_programHandle, _program); BGFX_ENCODER(dispatch(_id, _program, _numX, _numY, _numZ, _flags) ); } - void Encoder::dispatch(uint8_t _id, ProgramHandle _program, IndirectBufferHandle _indirectHandle, uint16_t _start, uint16_t _num, uint8_t _flags) + void Encoder::dispatch(ViewId _id, ProgramHandle _program, IndirectBufferHandle _indirectHandle, uint16_t _start, uint16_t _num, uint8_t _flags) { BGFX_CHECK_CAPS(BGFX_CAPS_DRAW_INDIRECT, "Dispatch indirect is not supported!"); BGFX_CHECK_CAPS(BGFX_CAPS_COMPUTE, "Compute is not supported!"); @@ -3166,12 +3166,12 @@ error: BGFX_ENCODER(discard() ); } - void Encoder::blit(uint8_t _id, TextureHandle _dst, uint16_t _dstX, uint16_t _dstY, TextureHandle _src, uint16_t _srcX, uint16_t _srcY, uint16_t _width, uint16_t _height) + void Encoder::blit(ViewId _id, TextureHandle _dst, uint16_t _dstX, uint16_t _dstY, TextureHandle _src, uint16_t _srcX, uint16_t _srcY, uint16_t _width, uint16_t _height) { blit(_id, _dst, 0, _dstX, _dstY, 0, _src, 0, _srcX, _srcY, 0, _width, _height, 0); } - void Encoder::blit(uint8_t _id, TextureHandle _dst, uint8_t _dstMip, uint16_t _dstX, uint16_t _dstY, uint16_t _dstZ, TextureHandle _src, uint8_t _srcMip, uint16_t _srcX, uint16_t _srcY, uint16_t _srcZ, uint16_t _width, uint16_t _height, uint16_t _depth) + void Encoder::blit(ViewId _id, TextureHandle _dst, uint8_t _dstMip, uint16_t _dstX, uint16_t _dstY, uint16_t _dstZ, TextureHandle _src, uint8_t _srcMip, uint16_t _srcX, uint16_t _srcY, uint16_t _srcZ, uint16_t _width, uint16_t _height, uint16_t _depth) { BGFX_CHECK_CAPS(BGFX_CAPS_TEXTURE_BLIT, "Texture blit is not supported!"); const Context::TextureRef& src = s_ctx->m_textureRef[_src.idx]; @@ -3978,26 +3978,26 @@ error: s_ctx->setPaletteColor(_index, _rgba); } - bool checkView(uint8_t _id) + bool checkView(ViewId _id) { // workaround GCC 4.9 type-limit check. const uint32_t id = _id; return id < BGFX_CONFIG_MAX_VIEWS; } - void setViewName(uint8_t _id, const char* _name) + void setViewName(ViewId _id, const char* _name) { BX_CHECK(checkView(_id), "Invalid view id: %d", _id); s_ctx->setViewName(_id, _name); } - void setViewRect(uint8_t _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height) + void setViewRect(ViewId _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height) { BX_CHECK(checkView(_id), "Invalid view id: %d", _id); s_ctx->setViewRect(_id, _x, _y, _width, _height); } - void setViewRect(uint8_t _id, uint16_t _x, uint16_t _y, BackbufferRatio::Enum _ratio) + void setViewRect(ViewId _id, uint16_t _x, uint16_t _y, BackbufferRatio::Enum _ratio) { BX_CHECK(checkView(_id), "Invalid view id: %d", _id); @@ -4007,49 +4007,49 @@ error: setViewRect(_id, _x, _y, width, height); } - void setViewScissor(uint8_t _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height) + void setViewScissor(ViewId _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height) { BX_CHECK(checkView(_id), "Invalid view id: %d", _id); s_ctx->setViewScissor(_id, _x, _y, _width, _height); } - void setViewClear(uint8_t _id, uint16_t _flags, uint32_t _rgba, float _depth, uint8_t _stencil) + void setViewClear(ViewId _id, uint16_t _flags, uint32_t _rgba, float _depth, uint8_t _stencil) { BX_CHECK(checkView(_id), "Invalid view id: %d", _id); s_ctx->setViewClear(_id, _flags, _rgba, _depth, _stencil); } - void setViewClear(uint8_t _id, uint16_t _flags, float _depth, uint8_t _stencil, uint8_t _0, uint8_t _1, uint8_t _2, uint8_t _3, uint8_t _4, uint8_t _5, uint8_t _6, uint8_t _7) + void setViewClear(ViewId _id, uint16_t _flags, float _depth, uint8_t _stencil, uint8_t _0, uint8_t _1, uint8_t _2, uint8_t _3, uint8_t _4, uint8_t _5, uint8_t _6, uint8_t _7) { BX_CHECK(checkView(_id), "Invalid view id: %d", _id); s_ctx->setViewClear(_id, _flags, _depth, _stencil, _0, _1, _2, _3, _4, _5, _6, _7); } - void setViewMode(uint8_t _id, ViewMode::Enum _mode) + void setViewMode(ViewId _id, ViewMode::Enum _mode) { BX_CHECK(checkView(_id), "Invalid view id: %d", _id); s_ctx->setViewMode(_id, _mode); } - void setViewFrameBuffer(uint8_t _id, FrameBufferHandle _handle) + void setViewFrameBuffer(ViewId _id, FrameBufferHandle _handle) { BX_CHECK(checkView(_id), "Invalid view id: %d", _id); s_ctx->setViewFrameBuffer(_id, _handle); } - void setViewTransform(uint8_t _id, const void* _view, const void* _projL, uint8_t _flags, const void* _projR) + void setViewTransform(ViewId _id, const void* _view, const void* _projL, uint8_t _flags, const void* _projR) { BX_CHECK(checkView(_id), "Invalid view id: %d", _id); s_ctx->setViewTransform(_id, _view, _projL, _flags, _projR); } - void setViewOrder(uint8_t _id, uint8_t _num, const uint8_t* _order) + void setViewOrder(ViewId _id, uint8_t _num, const uint8_t* _order) { BX_CHECK(checkView(_id), "Invalid view id: %d", _id); s_ctx->setViewOrder(_id, _num, _order); } - void resetView(uint8_t _id) + void resetView(ViewId _id) { BX_CHECK(checkView(_id), "Invalid view id: %d", _id); s_ctx->resetView(_id); @@ -4205,25 +4205,25 @@ error: s_ctx->m_encoder0->setTexture(_stage, _sampler, _handle, _flags); } - void touch(uint8_t _id) + void touch(ViewId _id) { ProgramHandle handle = BGFX_INVALID_HANDLE; submit(_id, handle); } - void submit(uint8_t _id, ProgramHandle _program, int32_t _depth, bool _preserveState) + void submit(ViewId _id, ProgramHandle _program, int32_t _depth, bool _preserveState) { OcclusionQueryHandle handle = BGFX_INVALID_HANDLE; submit(_id, _program, handle, _depth, _preserveState); } - void submit(uint8_t _id, ProgramHandle _program, OcclusionQueryHandle _occlusionQuery, int32_t _depth, bool _preserveState) + void submit(ViewId _id, ProgramHandle _program, OcclusionQueryHandle _occlusionQuery, int32_t _depth, bool _preserveState) { BGFX_CHECK_API_THREAD(); s_ctx->m_encoder0->submit(_id, _program, _occlusionQuery, _depth, _preserveState); } - void submit(uint8_t _id, ProgramHandle _program, IndirectBufferHandle _indirectHandle, uint16_t _start, uint16_t _num, int32_t _depth, bool _preserveState) + void submit(ViewId _id, ProgramHandle _program, IndirectBufferHandle _indirectHandle, uint16_t _start, uint16_t _num, int32_t _depth, bool _preserveState) { BGFX_CHECK_API_THREAD(); s_ctx->m_encoder0->submit(_id, _program, _indirectHandle, _start, _num, _depth, _preserveState); @@ -4265,13 +4265,13 @@ error: s_ctx->m_encoder0->setImage(_stage, _sampler, _handle, _mip, _access, _format); } - void dispatch(uint8_t _id, ProgramHandle _handle, uint32_t _numX, uint32_t _numY, uint32_t _numZ, uint8_t _flags) + void dispatch(ViewId _id, ProgramHandle _handle, uint32_t _numX, uint32_t _numY, uint32_t _numZ, uint8_t _flags) { BGFX_CHECK_API_THREAD(); s_ctx->m_encoder0->dispatch(_id, _handle, _numX, _numY, _numZ, _flags); } - void dispatch(uint8_t _id, ProgramHandle _handle, IndirectBufferHandle _indirectHandle, uint16_t _start, uint16_t _num, uint8_t _flags) + void dispatch(ViewId _id, ProgramHandle _handle, IndirectBufferHandle _indirectHandle, uint16_t _start, uint16_t _num, uint8_t _flags) { BGFX_CHECK_API_THREAD(); s_ctx->m_encoder0->dispatch(_id, _handle, _indirectHandle, _start, _num, _flags); @@ -4283,12 +4283,12 @@ error: s_ctx->m_encoder0->discard(); } - void blit(uint8_t _id, TextureHandle _dst, uint16_t _dstX, uint16_t _dstY, TextureHandle _src, uint16_t _srcX, uint16_t _srcY, uint16_t _width, uint16_t _height) + void blit(ViewId _id, TextureHandle _dst, uint16_t _dstX, uint16_t _dstY, TextureHandle _src, uint16_t _srcX, uint16_t _srcY, uint16_t _width, uint16_t _height) { blit(_id, _dst, 0, _dstX, _dstY, 0, _src, 0, _srcX, _srcY, 0, _width, _height, 0); } - void blit(uint8_t _id, TextureHandle _dst, uint8_t _dstMip, uint16_t _dstX, uint16_t _dstY, uint16_t _dstZ, TextureHandle _src, uint8_t _srcMip, uint16_t _srcX, uint16_t _srcY, uint16_t _srcZ, uint16_t _width, uint16_t _height, uint16_t _depth) + void blit(ViewId _id, TextureHandle _dst, uint8_t _dstMip, uint16_t _dstX, uint16_t _dstY, uint16_t _dstZ, TextureHandle _src, uint8_t _srcMip, uint16_t _srcX, uint16_t _srcY, uint16_t _srcZ, uint16_t _width, uint16_t _height, uint16_t _depth) { BGFX_CHECK_API_THREAD(); s_ctx->m_encoder0->blit(_id, _dst, _dstMip, _dstX, _dstY, _dstZ, _src, _srcMip, _srcX, _srcY, _srcZ, _width, _height, _depth); @@ -5081,63 +5081,63 @@ BGFX_C_API void bgfx_set_palette_color(uint8_t _index, const float _rgba[4]) bgfx::setPaletteColor(_index, _rgba); } -BGFX_C_API void bgfx_set_view_name(uint8_t _id, const char* _name) +BGFX_C_API void bgfx_set_view_name(bgfx_view_id_t _id, const char* _name) { bgfx::setViewName(_id, _name); } -BGFX_C_API void bgfx_set_view_rect(uint8_t _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height) +BGFX_C_API void bgfx_set_view_rect(bgfx_view_id_t _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height) { bgfx::setViewRect(_id, _x, _y, _width, _height); } -BGFX_C_API void bgfx_set_view_rect_auto(uint8_t _id, uint16_t _x, uint16_t _y, bgfx_backbuffer_ratio_t _ratio) +BGFX_C_API void bgfx_set_view_rect_auto(bgfx_view_id_t _id, uint16_t _x, uint16_t _y, bgfx_backbuffer_ratio_t _ratio) { bgfx::setViewRect(_id, _x, _y, bgfx::BackbufferRatio::Enum(_ratio)); } -BGFX_C_API void bgfx_set_view_scissor(uint8_t _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height) +BGFX_C_API void bgfx_set_view_scissor(bgfx_view_id_t _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height) { bgfx::setViewScissor(_id, _x, _y, _width, _height); } -BGFX_C_API void bgfx_set_view_clear(uint8_t _id, uint16_t _flags, uint32_t _rgba, float _depth, uint8_t _stencil) +BGFX_C_API void bgfx_set_view_clear(bgfx_view_id_t _id, uint16_t _flags, uint32_t _rgba, float _depth, uint8_t _stencil) { bgfx::setViewClear(_id, _flags, _rgba, _depth, _stencil); } -BGFX_C_API void bgfx_set_view_clear_mrt(uint8_t _id, uint16_t _flags, float _depth, uint8_t _stencil, uint8_t _0, uint8_t _1, uint8_t _2, uint8_t _3, uint8_t _4, uint8_t _5, uint8_t _6, uint8_t _7) +BGFX_C_API void bgfx_set_view_clear_mrt(bgfx_view_id_t _id, uint16_t _flags, float _depth, uint8_t _stencil, uint8_t _0, uint8_t _1, uint8_t _2, uint8_t _3, uint8_t _4, uint8_t _5, uint8_t _6, uint8_t _7) { bgfx::setViewClear(_id, _flags, _depth, _stencil, _0, _1, _2, _3, _4, _5, _6, _7); } -BGFX_C_API void bgfx_set_view_mode(uint8_t _id, bgfx_view_mode_t _mode) +BGFX_C_API void bgfx_set_view_mode(bgfx_view_id_t _id, bgfx_view_mode_t _mode) { bgfx::setViewMode(_id, bgfx::ViewMode::Enum(_mode) ); } -BGFX_C_API void bgfx_set_view_frame_buffer(uint8_t _id, bgfx_frame_buffer_handle_t _handle) +BGFX_C_API void bgfx_set_view_frame_buffer(bgfx_view_id_t _id, bgfx_frame_buffer_handle_t _handle) { union { bgfx_frame_buffer_handle_t c; bgfx::FrameBufferHandle cpp; } handle = { _handle }; bgfx::setViewFrameBuffer(_id, handle.cpp); } -BGFX_C_API void bgfx_set_view_transform(uint8_t _id, const void* _view, const void* _proj) +BGFX_C_API void bgfx_set_view_transform(bgfx_view_id_t _id, const void* _view, const void* _proj) { bgfx::setViewTransform(_id, _view, _proj); } -BGFX_C_API void bgfx_set_view_transform_stereo(uint8_t _id, const void* _view, const void* _projL, uint8_t _flags, const void* _projR) +BGFX_C_API void bgfx_set_view_transform_stereo(bgfx_view_id_t _id, const void* _view, const void* _projL, uint8_t _flags, const void* _projR) { bgfx::setViewTransform(_id, _view, _projL, _flags, _projR); } -BGFX_C_API void bgfx_set_view_order(uint8_t _id, uint8_t _num, const uint8_t* _order) +BGFX_C_API void bgfx_set_view_order(bgfx_view_id_t _id, uint8_t _num, const uint8_t* _order) { bgfx::setViewOrder(_id, _num, _order); } -BGFX_C_API void bgfx_reset_view(uint8_t _id) +BGFX_C_API void bgfx_reset_view(bgfx_view_id_t _id) { bgfx::resetView(_id); } @@ -5252,25 +5252,25 @@ BGFX_C_API void bgfx_set_texture(uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx::setTexture(_stage, sampler.cpp, handle.cpp, _flags); } -BGFX_C_API void bgfx_touch(uint8_t _id) +BGFX_C_API void bgfx_touch(bgfx_view_id_t _id) { return bgfx::touch(_id); } -BGFX_C_API void bgfx_submit(uint8_t _id, bgfx_program_handle_t _handle, int32_t _depth, bool _preserveState) +BGFX_C_API void bgfx_submit(bgfx_view_id_t _id, bgfx_program_handle_t _handle, int32_t _depth, bool _preserveState) { union { bgfx_program_handle_t c; bgfx::ProgramHandle cpp; } handle = { _handle }; bgfx::submit(_id, handle.cpp, _depth, _preserveState); } -BGFX_C_API void bgfx_submit_occlusion_query(uint8_t _id, bgfx_program_handle_t _program, bgfx_occlusion_query_handle_t _occlusionQuery, int32_t _depth, bool _preserveState) +BGFX_C_API void bgfx_submit_occlusion_query(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_occlusion_query_handle_t _occlusionQuery, int32_t _depth, bool _preserveState) { union { bgfx_program_handle_t c; bgfx::ProgramHandle cpp; } program = { _program }; union { bgfx_occlusion_query_handle c; bgfx::OcclusionQueryHandle cpp; } occlusionQuery = { _occlusionQuery }; bgfx::submit(_id, program.cpp, occlusionQuery.cpp, _depth, _preserveState); } -BGFX_C_API void bgfx_submit_indirect(uint8_t _id, bgfx_program_handle_t _handle, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, int32_t _depth, bool _preserveState) +BGFX_C_API void bgfx_submit_indirect(bgfx_view_id_t _id, bgfx_program_handle_t _handle, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, int32_t _depth, bool _preserveState) { union { bgfx_program_handle_t c; bgfx::ProgramHandle cpp; } handle = { _handle }; union { bgfx_indirect_buffer_handle_t c; bgfx::IndirectBufferHandle cpp; } indirectHandle = { _indirectHandle }; @@ -5314,13 +5314,13 @@ BGFX_C_API void bgfx_set_compute_indirect_buffer(uint8_t _stage, bgfx_indirect_b bgfx::setBuffer(_stage, handle.cpp, bgfx::Access::Enum(_access) ); } -BGFX_C_API void bgfx_dispatch(uint8_t _id, bgfx_program_handle_t _handle, uint32_t _numX, uint32_t _numY, uint32_t _numZ, uint8_t _flags) +BGFX_C_API void bgfx_dispatch(bgfx_view_id_t _id, bgfx_program_handle_t _handle, uint32_t _numX, uint32_t _numY, uint32_t _numZ, uint8_t _flags) { union { bgfx_program_handle_t c; bgfx::ProgramHandle cpp; } handle = { _handle }; bgfx::dispatch(_id, handle.cpp, _numX, _numY, _numZ, _flags); } -BGFX_C_API void bgfx_dispatch_indirect(uint8_t _id, bgfx_program_handle_t _handle, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, uint8_t _flags) +BGFX_C_API void bgfx_dispatch_indirect(bgfx_view_id_t _id, bgfx_program_handle_t _handle, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, uint8_t _flags) { union { bgfx_program_handle_t c; bgfx::ProgramHandle cpp; } handle = { _handle }; union { bgfx_indirect_buffer_handle_t c; bgfx::IndirectBufferHandle cpp; } indirectHandle = { _indirectHandle }; @@ -5332,7 +5332,7 @@ BGFX_C_API void bgfx_discard() bgfx::discard(); } -BGFX_C_API void bgfx_blit(uint8_t _id, bgfx_texture_handle_t _dst, uint8_t _dstMip, uint16_t _dstX, uint16_t _dstY, uint16_t _dstZ, bgfx_texture_handle_t _src, uint8_t _srcMip, uint16_t _srcX, uint16_t _srcY, uint16_t _srcZ, uint16_t _width, uint16_t _height, uint16_t _depth) +BGFX_C_API void bgfx_blit(bgfx_view_id_t _id, bgfx_texture_handle_t _dst, uint8_t _dstMip, uint16_t _dstX, uint16_t _dstY, uint16_t _dstZ, bgfx_texture_handle_t _src, uint8_t _srcMip, uint16_t _srcX, uint16_t _srcY, uint16_t _srcZ, uint16_t _width, uint16_t _height, uint16_t _depth) { union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } dst = { _dst }; union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } src = { _src }; @@ -5451,25 +5451,25 @@ BGFX_C_API void bgfx_encoder_set_texture(bgfx_encoder* _encoder, uint8_t _stage, BGFX_ENCODER(setTexture(_stage, sampler.cpp, handle.cpp, _flags) ); } -BGFX_C_API void bgfx_encoder_touch(bgfx_encoder* _encoder, uint8_t _id) +BGFX_C_API void bgfx_encoder_touch(bgfx_encoder* _encoder, bgfx_view_id_t _id) { return BGFX_ENCODER(touch(_id) ); } -BGFX_C_API void bgfx_encoder_submit(bgfx_encoder* _encoder, uint8_t _id, bgfx_program_handle_t _handle, int32_t _depth, bool _preserveState) +BGFX_C_API void bgfx_encoder_submit(bgfx_encoder* _encoder, bgfx_view_id_t _id, bgfx_program_handle_t _handle, int32_t _depth, bool _preserveState) { union { bgfx_program_handle_t c; bgfx::ProgramHandle cpp; } handle = { _handle }; BGFX_ENCODER(submit(_id, handle.cpp, _depth, _preserveState) ); } -BGFX_C_API void bgfx_encoder_submit_occlusion_query(bgfx_encoder* _encoder, uint8_t _id, bgfx_program_handle_t _program, bgfx_occlusion_query_handle_t _occlusionQuery, int32_t _depth, bool _preserveState) +BGFX_C_API void bgfx_encoder_submit_occlusion_query(bgfx_encoder* _encoder, bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_occlusion_query_handle_t _occlusionQuery, int32_t _depth, bool _preserveState) { union { bgfx_program_handle_t c; bgfx::ProgramHandle cpp; } program = { _program }; union { bgfx_occlusion_query_handle c; bgfx::OcclusionQueryHandle cpp; } occlusionQuery = { _occlusionQuery }; BGFX_ENCODER(submit(_id, program.cpp, occlusionQuery.cpp, _depth, _preserveState) ); } -BGFX_C_API void bgfx_encoder_submit_indirect(bgfx_encoder* _encoder, uint8_t _id, bgfx_program_handle_t _handle, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, int32_t _depth, bool _preserveState) +BGFX_C_API void bgfx_encoder_submit_indirect(bgfx_encoder* _encoder, bgfx_view_id_t _id, bgfx_program_handle_t _handle, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, int32_t _depth, bool _preserveState) { union { bgfx_program_handle_t c; bgfx::ProgramHandle cpp; } handle = { _handle }; union { bgfx_indirect_buffer_handle_t c; bgfx::IndirectBufferHandle cpp; } indirectHandle = { _indirectHandle }; @@ -5513,13 +5513,13 @@ BGFX_C_API void bgfx_encoder_set_compute_indirect_buffer(bgfx_encoder* _encoder, BGFX_ENCODER(setBuffer(_stage, handle.cpp, bgfx::Access::Enum(_access) ) ); } -BGFX_C_API void bgfx_encoder_dispatch(bgfx_encoder* _encoder, uint8_t _id, bgfx_program_handle_t _handle, uint32_t _numX, uint32_t _numY, uint32_t _numZ, uint8_t _flags) +BGFX_C_API void bgfx_encoder_dispatch(bgfx_encoder* _encoder, bgfx_view_id_t _id, bgfx_program_handle_t _handle, uint32_t _numX, uint32_t _numY, uint32_t _numZ, uint8_t _flags) { union { bgfx_program_handle_t c; bgfx::ProgramHandle cpp; } handle = { _handle }; BGFX_ENCODER(dispatch(_id, handle.cpp, _numX, _numY, _numZ, _flags) ); } -BGFX_C_API void bgfx_encoder_dispatch_indirect(bgfx_encoder* _encoder, uint8_t _id, bgfx_program_handle_t _handle, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, uint8_t _flags) +BGFX_C_API void bgfx_encoder_dispatch_indirect(bgfx_encoder* _encoder, bgfx_view_id_t _id, bgfx_program_handle_t _handle, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, uint8_t _flags) { union { bgfx_program_handle_t c; bgfx::ProgramHandle cpp; } handle = { _handle }; union { bgfx_indirect_buffer_handle_t c; bgfx::IndirectBufferHandle cpp; } indirectHandle = { _indirectHandle }; @@ -5531,7 +5531,7 @@ BGFX_C_API void bgfx_encoder_discard(bgfx_encoder* _encoder) BGFX_ENCODER(discard() ); } -BGFX_C_API void bgfx_encoder_blit(bgfx_encoder* _encoder, uint8_t _id, bgfx_texture_handle_t _dst, uint8_t _dstMip, uint16_t _dstX, uint16_t _dstY, uint16_t _dstZ, bgfx_texture_handle_t _src, uint8_t _srcMip, uint16_t _srcX, uint16_t _srcY, uint16_t _srcZ, uint16_t _width, uint16_t _height, uint16_t _depth) +BGFX_C_API void bgfx_encoder_blit(bgfx_encoder* _encoder, bgfx_view_id_t _id, bgfx_texture_handle_t _dst, uint8_t _dstMip, uint16_t _dstX, uint16_t _dstY, uint16_t _dstZ, bgfx_texture_handle_t _src, uint8_t _srcMip, uint16_t _srcX, uint16_t _srcY, uint16_t _srcZ, uint16_t _width, uint16_t _height, uint16_t _depth) { union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } dst = { _dst }; union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } src = { _src }; diff --git a/src/bgfx_p.h b/src/bgfx_p.h index 3fd0a0546..21ce3cc9b 100644 --- a/src/bgfx_p.h +++ b/src/bgfx_p.h @@ -1982,7 +1982,7 @@ namespace bgfx discard(); } - void begin(Frame* _frame, uint8_t _idx) + void begin(Frame* _frame, ViewId _idx) { m_frame = _frame; @@ -2252,9 +2252,9 @@ namespace bgfx m_bind.clear(); } - void submit(uint8_t _id, ProgramHandle _program, OcclusionQueryHandle _occlusionQuery, int32_t _depth, bool _preserveState); + void submit(ViewId _id, ProgramHandle _program, OcclusionQueryHandle _occlusionQuery, int32_t _depth, bool _preserveState); - void submit(uint8_t _id, ProgramHandle _program, IndirectBufferHandle _indirectHandle, uint16_t _start, uint16_t _num, int32_t _depth, bool _preserveState) + void submit(ViewId _id, ProgramHandle _program, IndirectBufferHandle _indirectHandle, uint16_t _start, uint16_t _num, int32_t _depth, bool _preserveState) { m_draw.m_startIndirect = _start; m_draw.m_numIndirect = _num; @@ -2263,9 +2263,9 @@ namespace bgfx submit(_id, _program, handle, _depth, _preserveState); } - void dispatch(uint8_t _id, ProgramHandle _handle, uint32_t _ngx, uint32_t _ngy, uint32_t _ngz, uint8_t _flags); + void dispatch(ViewId _id, ProgramHandle _handle, uint32_t _ngx, uint32_t _ngy, uint32_t _ngz, uint8_t _flags); - void dispatch(uint8_t _id, ProgramHandle _handle, IndirectBufferHandle _indirectHandle, uint16_t _start, uint16_t _num, uint8_t _flags) + void dispatch(ViewId _id, ProgramHandle _handle, IndirectBufferHandle _indirectHandle, uint16_t _start, uint16_t _num, uint8_t _flags) { m_compute.m_indirectBuffer = _indirectHandle; m_compute.m_startIndirect = _start; @@ -2273,7 +2273,7 @@ namespace bgfx dispatch(_id, _handle, 0, 0, 0, _flags); } - void blit(uint8_t _id, TextureHandle _dst, uint8_t _dstMip, uint16_t _dstX, uint16_t _dstY, uint16_t _dstZ, TextureHandle _src, uint8_t _srcMip, uint16_t _srcX, uint16_t _srcY, uint16_t _srcZ, uint16_t _width, uint16_t _height, uint16_t _depth); + void blit(ViewId _id, TextureHandle _dst, uint8_t _dstMip, uint16_t _dstX, uint16_t _dstY, uint16_t _dstZ, TextureHandle _src, uint8_t _srcMip, uint16_t _srcX, uint16_t _srcY, uint16_t _srcZ, uint16_t _width, uint16_t _height, uint16_t _depth); Frame* m_frame; @@ -2559,7 +2559,7 @@ namespace bgfx virtual void createUniform(UniformHandle _handle, UniformType::Enum _type, uint16_t _num, const char* _name) = 0; virtual void destroyUniform(UniformHandle _handle) = 0; virtual void requestScreenShot(FrameBufferHandle _handle, const char* _filePath) = 0; - virtual void updateViewName(uint8_t _id, const char* _name) = 0; + virtual void updateViewName(ViewId _id, const char* _name) = 0; virtual void updateUniform(uint16_t _loc, const void* _data, uint32_t _size) = 0; virtual void setMarker(const char* _marker, uint32_t _size) = 0; virtual void invalidateOcclusionQuery(OcclusionQueryHandle _handle) = 0; @@ -4246,7 +4246,7 @@ namespace bgfx m_colorPaletteDirty = 2; } - BGFX_API_FUNC(void setViewName(uint8_t _id, const char* _name) ) + BGFX_API_FUNC(void setViewName(ViewId _id, const char* _name) ) { BGFX_MUTEX_SCOPE(m_resourceApiLock); @@ -4257,17 +4257,17 @@ namespace bgfx cmdbuf.write(_name, len); } - BGFX_API_FUNC(void setViewRect(uint8_t _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height) ) + BGFX_API_FUNC(void setViewRect(ViewId _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height) ) { m_view[_id].setRect(_x, _y, _width, _height); } - BGFX_API_FUNC(void setViewScissor(uint8_t _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height) ) + BGFX_API_FUNC(void setViewScissor(ViewId _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height) ) { m_view[_id].setScissor(_x, _y, _width, _height); } - BGFX_API_FUNC(void setViewClear(uint8_t _id, uint16_t _flags, uint32_t _rgba, float _depth, uint8_t _stencil) ) + BGFX_API_FUNC(void setViewClear(ViewId _id, uint16_t _flags, uint32_t _rgba, float _depth, uint8_t _stencil) ) { BX_CHECK(bx::fequal(_depth, bx::fclamp(_depth, 0.0f, 1.0f), 0.0001f) , "Clear depth value must be between 0.0 and 1.0 (_depth %f)." @@ -4277,7 +4277,7 @@ namespace bgfx m_view[_id].setClear(_flags, _rgba, _depth, _stencil); } - BGFX_API_FUNC(void setViewClear(uint8_t _id, uint16_t _flags, float _depth, uint8_t _stencil, uint8_t _0, uint8_t _1, uint8_t _2, uint8_t _3, uint8_t _4, uint8_t _5, uint8_t _6, uint8_t _7) ) + BGFX_API_FUNC(void setViewClear(ViewId _id, uint16_t _flags, float _depth, uint8_t _stencil, uint8_t _0, uint8_t _1, uint8_t _2, uint8_t _3, uint8_t _4, uint8_t _5, uint8_t _6, uint8_t _7) ) { BX_CHECK(bx::fequal(_depth, bx::fclamp(_depth, 0.0f, 1.0f), 0.0001f) , "Clear depth value must be between 0.0 and 1.0 (_depth %f)." @@ -4287,28 +4287,28 @@ namespace bgfx m_view[_id].setClear(_flags, _depth, _stencil, _0, _1, _2, _3, _4, _5, _6, _7); } - BGFX_API_FUNC(void setViewMode(uint8_t _id, ViewMode::Enum _mode) ) + BGFX_API_FUNC(void setViewMode(ViewId _id, ViewMode::Enum _mode) ) { m_view[_id].setMode(_mode); } - BGFX_API_FUNC(void setViewFrameBuffer(uint8_t _id, FrameBufferHandle _handle) ) + BGFX_API_FUNC(void setViewFrameBuffer(ViewId _id, FrameBufferHandle _handle) ) { BGFX_CHECK_HANDLE_INVALID_OK("setViewFrameBuffer", m_frameBufferHandle, _handle); m_view[_id].setFrameBuffer(_handle); } - BGFX_API_FUNC(void setViewTransform(uint8_t _id, const void* _view, const void* _proj, uint8_t _flags, const void* _proj1) ) + BGFX_API_FUNC(void setViewTransform(ViewId _id, const void* _view, const void* _proj, uint8_t _flags, const void* _proj1) ) { m_view[_id].setTransform(_view, _proj, _flags, _proj1); } - BGFX_API_FUNC(void resetView(uint8_t _id) ) + BGFX_API_FUNC(void resetView(ViewId _id) ) { m_view[_id].reset(); } - BGFX_API_FUNC(void setViewOrder(uint8_t _id, uint8_t _num, const uint8_t* _order) ) + BGFX_API_FUNC(void setViewOrder(ViewId _id, uint8_t _num, const uint8_t* _order) ) { const uint32_t num = bx::uint32_min(_id + _num, BGFX_CONFIG_MAX_VIEWS) - _id; if (NULL == _order) @@ -4331,7 +4331,7 @@ namespace bgfx BGFX_API_FUNC(uint32_t frame(bool _capture = false) ); - uint32_t getSeqIncr(uint8_t _id) + uint32_t getSeqIncr(ViewId _id) { return bx::atomicFetchAndAdd(&m_seq[_id], 1); } diff --git a/src/renderer_d3d11.cpp b/src/renderer_d3d11.cpp index 385af9f0b..0a22fa4b4 100644 --- a/src/renderer_d3d11.cpp +++ b/src/renderer_d3d11.cpp @@ -2131,7 +2131,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); DX_RELEASE(backBuffer, 0); } - void updateViewName(uint8_t _id, const char* _name) override + void updateViewName(ViewId _id, const char* _name) override { if (BX_ENABLED(BGFX_CONFIG_DEBUG_PIX) ) { diff --git a/src/renderer_d3d12.cpp b/src/renderer_d3d12.cpp index 960cddc44..c38ad43a7 100644 --- a/src/renderer_d3d12.cpp +++ b/src/renderer_d3d12.cpp @@ -1715,7 +1715,7 @@ namespace bgfx { namespace d3d12 DX_RELEASE(readback, 0); } - void updateViewName(uint8_t _id, const char* _name) override + void updateViewName(ViewId _id, const char* _name) override { if (BX_ENABLED(BGFX_CONFIG_DEBUG_PIX) ) { diff --git a/src/renderer_d3d9.cpp b/src/renderer_d3d9.cpp index b91a2933d..7dd76c2cc 100644 --- a/src/renderer_d3d9.cpp +++ b/src/renderer_d3d9.cpp @@ -1251,7 +1251,7 @@ namespace bgfx { namespace d3d9 DX_RELEASE(surface, 0); } - void updateViewName(uint8_t _id, const char* _name) override + void updateViewName(ViewId _id, const char* _name) override { if (BX_ENABLED(BGFX_CONFIG_DEBUG_PIX) ) { diff --git a/src/renderer_gl.cpp b/src/renderer_gl.cpp index 4aff1b7e8..9d7e0d3d7 100644 --- a/src/renderer_gl.cpp +++ b/src/renderer_gl.cpp @@ -2959,7 +2959,7 @@ namespace bgfx { namespace gl BX_FREE(g_allocator, data); } - void updateViewName(uint8_t _id, const char* _name) override + void updateViewName(ViewId _id, const char* _name) override { bx::strCopy(&s_viewName[_id][BGFX_CONFIG_MAX_VIEW_NAME_RESERVED] , BX_COUNTOF(s_viewName[0])-BGFX_CONFIG_MAX_VIEW_NAME_RESERVED diff --git a/src/renderer_noop.cpp b/src/renderer_noop.cpp index cfa763bc3..02debefed 100644 --- a/src/renderer_noop.cpp +++ b/src/renderer_noop.cpp @@ -188,7 +188,7 @@ namespace bgfx { namespace noop { } - void updateViewName(uint8_t /*_id*/, const char* /*_name*/) override + void updateViewName(ViewId /*_id*/, const char* /*_name*/) override { } diff --git a/src/renderer_vk.cpp b/src/renderer_vk.cpp index 18b1dd2db..5468aebc6 100644 --- a/src/renderer_vk.cpp +++ b/src/renderer_vk.cpp @@ -2100,7 +2100,7 @@ VK_IMPORT_DEVICE { } - void updateViewName(uint8_t _id, const char* _name) override + void updateViewName(ViewId _id, const char* _name) override { bx::strCopy(&s_viewName[_id][BGFX_CONFIG_MAX_VIEW_NAME_RESERVED] , BX_COUNTOF(s_viewName[0]) - BGFX_CONFIG_MAX_VIEW_NAME_RESERVED