mirror of
https://github.com/bkaradzic/bgfx.git
synced 2026-02-17 20:52:36 +01:00
Cleanup.
This commit is contained in:
@@ -440,7 +440,7 @@ int _main_(int _argc, char** _argv)
|
||||
if (150 == frame)
|
||||
{
|
||||
bgfx::FrameBufferHandle fbh = BGFX_INVALID_HANDLE;
|
||||
bgfx::saveScreenShot(fbh, "temp/frame150");
|
||||
bgfx::requestScreenShot(fbh, "temp/frame150");
|
||||
}
|
||||
|
||||
// Advance to next frame. Rendering thread will be kicked to
|
||||
|
||||
@@ -316,7 +316,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
|
||||
|
||||
if (_argc > 2)
|
||||
{
|
||||
bgfx::saveScreenShot(fbh, _argv[2]);
|
||||
bgfx::requestScreenShot(fbh, _argv[2]);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -325,7 +325,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
|
||||
|
||||
char filePath[256];
|
||||
bx::snprintf(filePath, sizeof(filePath), "temp/screenshot-%d", tt);
|
||||
bgfx::saveScreenShot(fbh, filePath);
|
||||
bgfx::requestScreenShot(fbh, filePath);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -1215,6 +1215,8 @@ namespace bgfx
|
||||
|
||||
/// Destroy static index buffer.
|
||||
///
|
||||
/// @param[in] _handle Static index buffer handle.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_destroy_index_buffer`.
|
||||
///
|
||||
void destroyIndexBuffer(IndexBufferHandle _handle);
|
||||
@@ -1268,6 +1270,7 @@ namespace bgfx
|
||||
/// buffers.
|
||||
/// - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on
|
||||
/// index buffers.
|
||||
/// @returns Dynamic index buffer handle.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_create_dynamic_index_buffer`.
|
||||
///
|
||||
@@ -1291,6 +1294,7 @@ namespace bgfx
|
||||
/// buffers.
|
||||
/// - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on
|
||||
/// index buffers.
|
||||
/// @returns Dynamic index buffer handle.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_create_dynamic_index_buffer_mem`.
|
||||
///
|
||||
@@ -1337,6 +1341,7 @@ namespace bgfx
|
||||
/// buffers.
|
||||
/// - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on
|
||||
/// index buffers.
|
||||
/// @returns Dynamic vertex buffer handle.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_create_dynamic_vertex_buffer`.
|
||||
///
|
||||
@@ -1362,6 +1367,7 @@ namespace bgfx
|
||||
/// buffers.
|
||||
/// - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on
|
||||
/// index buffers.
|
||||
/// @returns Dynamic vertex buffer handle.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_create_dynamic_vertex_buffer_mem`.
|
||||
///
|
||||
@@ -1387,6 +1393,8 @@ namespace bgfx
|
||||
|
||||
/// Destroy dynamic vertex buffer.
|
||||
///
|
||||
/// @param[in] _handle Dynamic vertex buffer handle.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_destroy_dynamic_vertex_buffer`.
|
||||
///
|
||||
void destroyDynamicVertexBuffer(DynamicVertexBufferHandle _handle);
|
||||
@@ -1480,12 +1488,17 @@ namespace bgfx
|
||||
|
||||
/// Create draw indirect buffer.
|
||||
///
|
||||
/// @param[in] _num Number of indirect calls.
|
||||
/// @returns Indirect buffer handle.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_create_indirect_buffer`.
|
||||
///
|
||||
IndirectBufferHandle createIndirectBuffer(uint32_t _num);
|
||||
|
||||
/// Destroy draw indirect buffer.
|
||||
///
|
||||
/// @param[in] _handle Indirect buffer handle.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_destroy_indirect_buffer`.
|
||||
///
|
||||
void destroyIndirectBuffer(IndirectBufferHandle _handle);
|
||||
@@ -2818,9 +2831,9 @@ namespace bgfx
|
||||
/// @remarks
|
||||
/// `bgfx::CallbackI::screenShot` must be implemented.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_save_screen_shot`.
|
||||
/// @attention C99 equivalent is `bgfx_request_screen_shot`.
|
||||
///
|
||||
void saveScreenShot(FrameBufferHandle _handle, const char* _filePath);
|
||||
void requestScreenShot(FrameBufferHandle _handle, const char* _filePath);
|
||||
|
||||
} // namespace bgfx
|
||||
|
||||
|
||||
@@ -909,6 +909,6 @@ 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_save_screen_shot(bgfx_frame_buffer_handle_t _handle, const char* _filePath);
|
||||
BGFX_C_API void bgfx_request_screen_shot(bgfx_frame_buffer_handle_t _handle, const char* _filePath);
|
||||
|
||||
#endif // BGFX_C99_H_HEADER_GUARD
|
||||
|
||||
@@ -198,7 +198,7 @@ typedef struct bgfx_interface_vtbl
|
||||
uint32_t (*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);
|
||||
void (*discard)();
|
||||
void (*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);
|
||||
void (*save_screen_shot)(bgfx_frame_buffer_handle_t _handle, const char* _filePath);
|
||||
void (*request_screen_shot)(bgfx_frame_buffer_handle_t _handle, const char* _filePath);
|
||||
|
||||
} bgfx_interface_vtbl_t;
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#ifndef BGFX_DEFINES_H_HEADER_GUARD
|
||||
#define BGFX_DEFINES_H_HEADER_GUARD
|
||||
|
||||
#define BGFX_API_VERSION UINT32_C(37)
|
||||
#define BGFX_API_VERSION UINT32_C(38)
|
||||
|
||||
///
|
||||
#define BGFX_STATE_RGB_WRITE UINT64_C(0x0000000000000001) //!< Enable RGB write.
|
||||
|
||||
14
src/bgfx.cpp
14
src/bgfx.cpp
@@ -2447,7 +2447,7 @@ namespace bgfx
|
||||
}
|
||||
break;
|
||||
|
||||
case CommandBuffer::SaveScreenShot:
|
||||
case CommandBuffer::RequestScreenShot:
|
||||
{
|
||||
FrameBufferHandle handle;
|
||||
_cmdbuf.read(handle);
|
||||
@@ -2457,7 +2457,7 @@ namespace bgfx
|
||||
|
||||
const char* filePath = (const char*)_cmdbuf.skip(len);
|
||||
|
||||
m_renderCtx->saveScreenShot(handle, filePath);
|
||||
m_renderCtx->requestScreenShot(handle, filePath);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -3847,10 +3847,10 @@ error:
|
||||
s_ctx->blit(_id, _dst, _dstMip, _dstX, _dstY, _dstZ, _src, _srcMip, _srcX, _srcY, _srcZ, _width, _height, _depth);
|
||||
}
|
||||
|
||||
void saveScreenShot(FrameBufferHandle _handle, const char* _filePath)
|
||||
void requestScreenShot(FrameBufferHandle _handle, const char* _filePath)
|
||||
{
|
||||
BGFX_CHECK_MAIN_THREAD();
|
||||
s_ctx->saveScreenShot(_handle, _filePath);
|
||||
s_ctx->requestScreenShot(_handle, _filePath);
|
||||
}
|
||||
} // namespace bgfx
|
||||
|
||||
@@ -4778,10 +4778,10 @@ BGFX_C_API void bgfx_blit(uint8_t _id, bgfx_texture_handle_t _dst, uint8_t _dstM
|
||||
bgfx::blit(_id, dst.cpp, _dstMip, _dstX, _dstY, _dstZ, src.cpp, _srcMip, _srcX, _srcY, _srcZ, _width, _height, _depth);
|
||||
}
|
||||
|
||||
BGFX_C_API void bgfx_save_screen_shot(bgfx_frame_buffer_handle _handle, const char* _filePath)
|
||||
BGFX_C_API void bgfx_request_screen_shot(bgfx_frame_buffer_handle _handle, const char* _filePath)
|
||||
{
|
||||
union { bgfx_frame_buffer_handle_t c; bgfx::FrameBufferHandle cpp; } handle = { _handle };
|
||||
bgfx::saveScreenShot(handle.cpp, _filePath);
|
||||
bgfx::requestScreenShot(handle.cpp, _filePath);
|
||||
}
|
||||
|
||||
BGFX_C_API bgfx_render_frame_t bgfx_render_frame()
|
||||
@@ -4948,7 +4948,7 @@ BGFX_C_API bgfx_interface_vtbl_t* bgfx_get_interface(uint32_t _version)
|
||||
BGFX_IMPORT_FUNC(dispatch_indirect) \
|
||||
BGFX_IMPORT_FUNC(discard) \
|
||||
BGFX_IMPORT_FUNC(blit) \
|
||||
BGFX_IMPORT_FUNC(save_screen_shot)
|
||||
BGFX_IMPORT_FUNC(request_screen_shot)
|
||||
|
||||
static bgfx_interface_vtbl_t s_bgfx_interface =
|
||||
{
|
||||
|
||||
12
src/bgfx_p.h
12
src/bgfx_p.h
@@ -646,7 +646,7 @@ namespace bgfx
|
||||
DestroyFrameBuffer,
|
||||
DestroyUniform,
|
||||
ReadTexture,
|
||||
SaveScreenShot,
|
||||
RequestScreenShot,
|
||||
};
|
||||
|
||||
void write(const void* _data, uint32_t _size)
|
||||
@@ -2166,7 +2166,7 @@ namespace bgfx
|
||||
virtual void destroyFrameBuffer(FrameBufferHandle _handle) = 0;
|
||||
virtual void createUniform(UniformHandle _handle, UniformType::Enum _type, uint16_t _num, const char* _name) = 0;
|
||||
virtual void destroyUniform(UniformHandle _handle) = 0;
|
||||
virtual void saveScreenShot(FrameBufferHandle _handle, const char* _filePath) = 0;
|
||||
virtual void requestScreenShot(FrameBufferHandle _handle, const char* _filePath) = 0;
|
||||
virtual void updateViewName(uint8_t _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;
|
||||
@@ -3625,18 +3625,18 @@ namespace bgfx
|
||||
m_freeOcclusionQueryHandle[m_numFreeOcclusionQueryHandles++] = _handle;
|
||||
}
|
||||
|
||||
BGFX_API_FUNC(void saveScreenShot(FrameBufferHandle _handle, const char* _filePath) )
|
||||
BGFX_API_FUNC(void requestScreenShot(FrameBufferHandle _handle, const char* _filePath) )
|
||||
{
|
||||
BGFX_CHECK_HANDLE_INVALID_OK("saveScreenShot", m_frameBufferHandle, _handle);
|
||||
BGFX_CHECK_HANDLE_INVALID_OK("requestScreenShot", m_frameBufferHandle, _handle);
|
||||
|
||||
if (isValid(_handle) )
|
||||
{
|
||||
FrameBufferRef& ref = m_frameBufferRef[_handle.idx];
|
||||
BX_CHECK(ref.m_window, "saveScreenShot can be done only for window frame buffer handles (handle: %d).", _handle.idx); BX_UNUSED(ref);
|
||||
BX_CHECK(ref.m_window, "requestScreenShot can be done only for window frame buffer handles (handle: %d).", _handle.idx); BX_UNUSED(ref);
|
||||
return;
|
||||
}
|
||||
|
||||
CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::SaveScreenShot);
|
||||
CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::RequestScreenShot);
|
||||
uint16_t len = (uint16_t)bx::strnlen(_filePath)+1;
|
||||
cmdbuf.write(_handle);
|
||||
cmdbuf.write(len);
|
||||
|
||||
@@ -1975,7 +1975,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
|
||||
m_uniformReg.remove(_handle);
|
||||
}
|
||||
|
||||
void saveScreenShot(FrameBufferHandle _handle, const char* _filePath) BX_OVERRIDE
|
||||
void requestScreenShot(FrameBufferHandle _handle, const char* _filePath) BX_OVERRIDE
|
||||
{
|
||||
IDXGISwapChain* swapChain = isValid(_handle)
|
||||
? m_frameBuffers[_handle.idx].m_swapChain
|
||||
|
||||
@@ -1559,7 +1559,7 @@ namespace bgfx { namespace d3d12
|
||||
m_uniformReg.remove(_handle);
|
||||
}
|
||||
|
||||
void saveScreenShot(FrameBufferHandle _handle, const char* _filePath) BX_OVERRIDE
|
||||
void requestScreenShot(FrameBufferHandle _handle, const char* _filePath) BX_OVERRIDE
|
||||
{
|
||||
BX_UNUSED(_handle);
|
||||
|
||||
|
||||
@@ -1129,7 +1129,7 @@ namespace bgfx { namespace d3d9
|
||||
m_uniformReg.remove(_handle);
|
||||
}
|
||||
|
||||
void saveScreenShot(FrameBufferHandle _handle, const char* _filePath) BX_OVERRIDE
|
||||
void requestScreenShot(FrameBufferHandle _handle, const char* _filePath) BX_OVERRIDE
|
||||
{
|
||||
#if BX_PLATFORM_WINDOWS
|
||||
BX_UNUSED(_handle);
|
||||
|
||||
@@ -2523,7 +2523,7 @@ namespace bgfx { namespace gl
|
||||
m_uniformReg.remove(_handle);
|
||||
}
|
||||
|
||||
void saveScreenShot(FrameBufferHandle _handle, const char* _filePath) BX_OVERRIDE
|
||||
void requestScreenShot(FrameBufferHandle _handle, const char* _filePath) BX_OVERRIDE
|
||||
{
|
||||
SwapChainGL* swapChain = NULL;
|
||||
uint32_t width = m_resolution.m_width;
|
||||
|
||||
@@ -904,14 +904,14 @@ namespace bgfx { namespace mtl
|
||||
}
|
||||
|
||||
//cmdPre
|
||||
void saveScreenShotPre(const char* _filePath) BX_OVERRIDE
|
||||
void requestScreenShotPre(const char* _filePath) BX_OVERRIDE
|
||||
{
|
||||
BX_UNUSED(_filePath);
|
||||
m_saveScreenshot = true;
|
||||
}
|
||||
|
||||
//cmdPost
|
||||
void saveScreenShot(FrameBufferHandle _handle, const char* _filePath) BX_OVERRIDE
|
||||
void requestScreenShot(FrameBufferHandle _handle, const char* _filePath) BX_OVERRIDE
|
||||
{
|
||||
BX_UNUSED(_handle);
|
||||
|
||||
|
||||
@@ -177,7 +177,7 @@ namespace bgfx { namespace noop
|
||||
{
|
||||
}
|
||||
|
||||
void saveScreenShot(FrameBufferHandle /*_handle*/, const char* /*_filePath*/) BX_OVERRIDE
|
||||
void requestScreenShot(FrameBufferHandle /*_handle*/, const char* /*_filePath*/) BX_OVERRIDE
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -2097,7 +2097,7 @@ VK_IMPORT_DEVICE
|
||||
m_uniforms[_handle.idx] = NULL;
|
||||
}
|
||||
|
||||
void saveScreenShot(FrameBufferHandle /*_handle*/, const char* /*_filePath*/) BX_OVERRIDE
|
||||
void requestScreenShot(FrameBufferHandle /*_handle*/, const char* /*_filePath*/) BX_OVERRIDE
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user