Removed bgfx/platform.h (#3761)

This commit is contained in:
Branimir Karadžić
2026-06-15 21:10:12 -07:00
committed by GitHub
parent befae614da
commit f671eb83bf
13 changed files with 19 additions and 152 deletions

View File

@@ -27,7 +27,7 @@
#endif //
#include <GLFW/glfw3native.h>
#include <bgfx/platform.h>
#include <bgfx/bgfx.h>
#include <bx/handlealloc.h>
#include <bx/thread.h>

View File

@@ -7,7 +7,7 @@
#if BX_PLATFORM_EMSCRIPTEN
#include <bgfx/platform.h>
#include <bgfx/bgfx.h>
#include <emscripten.h>
#include <emscripten/html5.h>

View File

@@ -17,7 +17,7 @@
# define HAS_METAL_SDK
#endif
#include <bgfx/platform.h>
#include <bgfx/bgfx.h>
#include <bx/thread.h>

View File

@@ -9,7 +9,7 @@
#import <Cocoa/Cocoa.h>
#include <bgfx/platform.h>
#include <bgfx/bgfx.h>
#include <bx/thread.h>
#include <bx/os.h>

View File

@@ -21,7 +21,7 @@ BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG("-Wextern-c-compat")
#include <SDL2/SDL_syswm.h>
BX_PRAGMA_DIAGNOSTIC_POP()
#include <bgfx/platform.h>
#include <bgfx/bgfx.h>
#if defined(None) // X11 defines this...
# undef None
#endif // defined(None)

View File

@@ -7,7 +7,7 @@
#if ENTRY_CONFIG_USE_NATIVE && BX_PLATFORM_WINDOWS
#include <bgfx/platform.h>
#include <bgfx/bgfx.h>
#include <bx/mutex.h>
#include <bx/handlealloc.h>

View File

@@ -12,8 +12,6 @@
#ifndef BGFX_H_HEADER_GUARD
#define BGFX_H_HEADER_GUARD
#define BGFX_IDL_CPP 1
#include <stdarg.h> // va_list
#include <stdint.h> // uint32_t
#include <stdlib.h> // NULL

View File

@@ -1,141 +0,0 @@
/*
* Copyright 2011-2026 Branimir Karadzic. All rights reserved.
* License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE
*/
#ifndef BGFX_PLATFORM_H_HEADER_GUARD
#define BGFX_PLATFORM_H_HEADER_GUARD
// NOTICE:
// This header file contains platform specific interfaces. It is only
// necessary to use this header in conjunction with creating windows.
#include "bgfx.h"
#if !BGFX_IDL_CPP
namespace bgfx
{
/// Render frame enum.
///
/// @attention C99's equivalent binding is `bgfx_render_frame_t`.
///
struct RenderFrame
{
enum Enum
{
NoContext,
Render,
Timeout,
Exiting,
Count
};
};
/// Render frame.
///
/// @param _msecs Timeout in milliseconds.
///
/// @returns Current renderer state. See: `bgfx::RenderFrame`.
///
/// @attention `bgfx::renderFrame` is blocking call. It waits for
/// `bgfx::frame` to be called from API thread to process frame.
/// If timeout value is passed call will timeout and return even
/// if `bgfx::frame` is not called.
///
/// @warning This call should be only used on platforms that don't
/// allow creating separate rendering thread. If it is called before
/// to bgfx::init, render thread won't be created by bgfx::init call.
///
/// @attention C99's equivalent binding is `bgfx_render_frame`.
///
RenderFrame::Enum renderFrame(int32_t _msecs = -1);
/// Set platform data.
///
/// @warning Must be called before `bgfx::init`.
///
/// @attention C99's equivalent binding is `bgfx_set_platform_data`.
///
void setPlatformData(const PlatformData& _data);
/// Internal data.
///
/// @attention C99's equivalent binding is `bgfx_internal_data_t`.
///
struct InternalData
{
const struct Caps* caps; //!< Renderer capabilities.
void* context; //!< GL context, or D3D device.
};
/// Get internal data for interop.
///
/// @attention It's expected you understand some bgfx internals before you
/// use this call.
///
/// @warning Must be called only on render thread.
///
/// @attention C99's equivalent binding is `bgfx_get_internal_data`.
///
const InternalData* getInternalData();
/// Override internal texture with externally created texture. Previously
/// created internal texture will released.
///
/// @attention It's expected you understand some bgfx internals before you
/// use this call.
///
/// @param[in] _handle Texture handle.
/// @param[in] _ptr Native API pointer to texture.
/// @param[in] _layerIndex Layer index for texture arrays (only implemented for D3D11).
///
/// @returns Native API pointer to texture. If result is 0, texture is not created yet from the
/// main thread.
///
/// @warning Must be called only on render thread.
///
/// @attention C99's equivalent binding is `bgfx_override_internal_texture_ptr`.
///
uintptr_t overrideInternal(TextureHandle _handle, uintptr_t _ptr, uint16_t _layerIndex = 0);
/// Override internal texture by creating new texture. Previously created
/// internal texture will released.
///
/// @attention It's expected you understand some bgfx internals before you
/// use this call.
///
/// @param[in] _handle Texture handle.
/// @param[in] _width Width.
/// @param[in] _height Height.
/// @param[in] _numMips Number of mip-maps.
/// @param[in] _format Texture format. See: `TextureFormat::Enum`.
/// @param[in] _flags Default texture sampling mode is linear, and wrap mode
/// is repeat.
/// - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap
/// mode.
/// - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic
/// sampling.
///
/// @returns Native API pointer to texture. If result is 0, texture is not created yet from the
/// main thread.
///
/// @warning Must be called only on render thread.
///
/// @attention C99's equivalent binding is `bgfx_override_internal_texture`.
///
uintptr_t overrideInternal(
TextureHandle _handle
, uint16_t _width
, uint16_t _height
, uint8_t _numMips
, TextureFormat::Enum _format
, uint64_t _flags = BGFX_TEXTURE_NONE|BGFX_SAMPLER_NONE
);
} // namespace bgfx
#endif // BGFX_IDL_CPP
#endif // BGFX_PLATFORM_H_HEADER_GUARD

View File

@@ -12,8 +12,6 @@
#ifndef BGFX_H_HEADER_GUARD
#define BGFX_H_HEADER_GUARD
#define BGFX_IDL_CPP 1
#include <stdarg.h> // va_list
#include <stdint.h> // uint32_t
#include <stdlib.h> // NULL

View File

@@ -50,6 +50,8 @@ BGFX_C99_STRUCT_SIZE_CHECK(bgfx::InternalData, bgfx_internal_data_t);
#undef BGFX_C99_STRUCT_SIZE_CHECK
#if BGFX_CONFIG_C99_API
$c99
/* user define functions */
@@ -99,3 +101,5 @@ BGFX_C_API bgfx_interface_vtbl_t* bgfx_get_interface(uint32_t _version)
return NULL;
}
#endif // BGFX_CONFIG_C99_API

View File

@@ -50,6 +50,8 @@ BGFX_C99_STRUCT_SIZE_CHECK(bgfx::InternalData, bgfx_internal_data_t);
#undef BGFX_C99_STRUCT_SIZE_CHECK
#if BGFX_CONFIG_C99_API
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 _numLayers, uint16_t _mip, uint8_t _resolve)
{
bgfx::Attachment* This = (bgfx::Attachment*)_this;
@@ -1545,3 +1547,5 @@ BGFX_C_API bgfx_interface_vtbl_t* bgfx_get_interface(uint32_t _version)
return NULL;
}
#endif // BGFX_CONFIG_C99_API

View File

@@ -141,7 +141,6 @@ namespace bgfx
#include <bx/thread.h>
#include <bx/timer.h>
#include <bgfx/platform.h>
#include <bimg/bimg.h>
#include "shader.h"
#include "vertexlayout.h"

View File

@@ -546,4 +546,9 @@ static_assert(BGFX_CONFIG_MAX_VERTEX_STREAMS < 32, "Must be less than 32!");
# define BGFX_CONFIG_ENCODER_API_ONLY 0
#endif // BGFX_CONFIG_ENCODER_API_ONLY
/// C99 API is used for shared library and language bindings.
#ifndef BGFX_CONFIG_C99_API
# define BGFX_CONFIG_C99_API 1
#endif // BGFX_CONFIG_C99_API
#endif // BGFX_CONFIG_H_HEADER_GUARD