Cleanup.
This commit is contained in:
parent
cc8d0c5fff
commit
f7060b66ee
@ -312,6 +312,28 @@ namespace bgfx
|
||||
};
|
||||
};
|
||||
|
||||
///
|
||||
struct TopologySort
|
||||
{
|
||||
enum Enum
|
||||
{
|
||||
DirectionFrontToBackMin,
|
||||
DirectionFrontToBackAvg,
|
||||
DirectionFrontToBackMax,
|
||||
DirectionBackToFrontMin,
|
||||
DirectionBackToFrontAvg,
|
||||
DirectionBackToFrontMax,
|
||||
DistanceFrontToBackMin,
|
||||
DistanceFrontToBackAvg,
|
||||
DistanceFrontToBackMax,
|
||||
DistanceBackToFrontMin,
|
||||
DistanceBackToFrontAvg,
|
||||
DistanceBackToFrontMax,
|
||||
|
||||
Count
|
||||
};
|
||||
};
|
||||
|
||||
static const uint16_t invalidHandle = UINT16_MAX;
|
||||
|
||||
BGFX_HANDLE(DynamicIndexBufferHandle);
|
||||
@ -830,6 +852,23 @@ namespace bgfx
|
||||
, bool _index32
|
||||
);
|
||||
|
||||
/// Sort indices.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_topology_sort_tri_list`.
|
||||
///
|
||||
void topologySortTriList(
|
||||
TopologySort::Enum _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
|
||||
);
|
||||
|
||||
/// Swizzle RGBA8 image to BGRA8.
|
||||
///
|
||||
/// @param[in] _width Width of input image (pixels).
|
||||
|
@ -6,7 +6,7 @@
|
||||
#ifndef BGFX_DEFINES_H_HEADER_GUARD
|
||||
#define BGFX_DEFINES_H_HEADER_GUARD
|
||||
|
||||
#define BGFX_API_VERSION UINT32_C(16)
|
||||
#define BGFX_API_VERSION UINT32_C(17)
|
||||
|
||||
///
|
||||
#define BGFX_STATE_RGB_WRITE UINT64_C(0x0000000000000001) //!< Enable RGB write.
|
||||
|
@ -235,6 +235,25 @@ typedef enum bgfx_topology_convert
|
||||
|
||||
} bgfx_topology_convert_t;
|
||||
|
||||
typedef enum bgfx_topology_sort
|
||||
{
|
||||
BGFX_TOPOLOGY_SORT_DIRECTION_FRONT_TO_BACK_MIN,
|
||||
BGFX_TOPOLOGY_SORT_DIRECTION_FRONT_TO_BACK_AVG,
|
||||
BGFX_TOPOLOGY_SORT_DIRECTION_FRONT_TO_BACK_MAX,
|
||||
BGFX_TOPOLOGY_SORT_DIRECTION_BACK_TO_FRONT_MIN,
|
||||
BGFX_TOPOLOGY_SORT_DIRECTION_BACK_TO_FRONT_AVG,
|
||||
BGFX_TOPOLOGY_SORT_DIRECTION_BACK_TO_FRONT_MAX,
|
||||
BGFX_TOPOLOGY_SORT_DISTANCE_FRONT_TO_BACK_MIN,
|
||||
BGFX_TOPOLOGY_SORT_DISTANCE_FRONT_TO_BACK_AVG,
|
||||
BGFX_TOPOLOGY_SORT_DISTANCE_FRONT_TO_BACK_MAX,
|
||||
BGFX_TOPOLOGY_SORT_DISTANCE_BACK_TO_FRONT_MIN,
|
||||
BGFX_TOPOLOGY_SORT_DISTANCE_BACK_TO_FRONT_AVG,
|
||||
BGFX_TOPOLOGY_SORT_DISTANCE_BACK_TO_FRONT_MAX,
|
||||
|
||||
BGFX_TOPOLOGY_SORT_COUNT
|
||||
|
||||
} bgfx_topology_sort_t;
|
||||
|
||||
#define BGFX_HANDLE_T(_name) \
|
||||
typedef struct _name { uint16_t idx; } _name##_t
|
||||
|
||||
@ -483,6 +502,12 @@ BGFX_C_API void bgfx_vertex_convert(const bgfx_vertex_decl_t* _destDecl, void* _
|
||||
/**/
|
||||
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 uint32_t bgfx_topology_convert(bgfx_topology_convert_t _conversion, void* _dst, uint32_t _dstSize, const void* _indices, uint32_t _numIndices, bool _index32);
|
||||
|
||||
/**/
|
||||
BGFX_C_API void bgfx_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);
|
||||
|
||||
/**/
|
||||
BGFX_C_API void bgfx_image_swizzle_bgra8(uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src, void* _dst);
|
||||
|
||||
|
@ -78,6 +78,7 @@ typedef struct bgfx_interface_vtbl
|
||||
void (*vertex_convert)(const bgfx_vertex_decl_t* _destDecl, void* _destData, 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);
|
||||
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);
|
||||
void (*image_swizzle_bgra8)(uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src, void* _dst);
|
||||
void (*image_rgba8_downsample_2x2)(uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src, void* _dst);
|
||||
uint8_t (*get_supported_renderers)(bgfx_renderer_type_t _enum[BGFX_RENDERER_TYPE_COUNT]);
|
||||
|
11
src/bgfx.cpp
11
src/bgfx.cpp
@ -2379,6 +2379,11 @@ namespace bgfx
|
||||
return topologyConvert(_conversion, _dst, _dstSize, _indices, _numIndices, _index32, g_allocator);
|
||||
}
|
||||
|
||||
void topologySortTriList(TopologySort::Enum _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)
|
||||
{
|
||||
topologySortTriList(_sort, _dst, _dstSize, _dir, _pos, _vertices, _stride, _indices, _numIndices, _index32, g_allocator);
|
||||
}
|
||||
|
||||
uint8_t getSupportedRenderers(RendererType::Enum _enum[RendererType::Count])
|
||||
{
|
||||
uint8_t num = 0;
|
||||
@ -3852,6 +3857,11 @@ uint32_t bgfx_topology_convert(bgfx_topology_convert_t _conversion, void* _dst,
|
||||
return bgfx::topologyConvert(bgfx::TopologyConvert::Enum(_conversion), _dst, _dstSize, _indices, _numIndices, _index32);
|
||||
}
|
||||
|
||||
void bgfx_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)
|
||||
{
|
||||
bgfx::topologySortTriList(bgfx::TopologySort::Enum(_sort), _dst, _dstSize, _dir, _pos, _vertices, _stride, _indices, _numIndices, _index32);
|
||||
}
|
||||
|
||||
BGFX_C_API void bgfx_image_swizzle_bgra8(uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src, void* _dst)
|
||||
{
|
||||
bgfx::imageSwizzleBgra8(_width, _height, _pitch, _src, _dst);
|
||||
@ -4625,6 +4635,7 @@ BGFX_C_API bgfx_interface_vtbl_t* bgfx_get_interface(uint32_t _version)
|
||||
BGFX_IMPORT_FUNC(vertex_convert) \
|
||||
BGFX_IMPORT_FUNC(weld_vertices) \
|
||||
BGFX_IMPORT_FUNC(topology_convert) \
|
||||
BGFX_IMPORT_FUNC(topology_sort_tri_list) \
|
||||
BGFX_IMPORT_FUNC(image_swizzle_bgra8) \
|
||||
BGFX_IMPORT_FUNC(image_rgba8_downsample_2x2) \
|
||||
BGFX_IMPORT_FUNC(get_supported_renderers) \
|
||||
|
@ -291,7 +291,7 @@ namespace bgfx
|
||||
|
||||
template<typename IndexT>
|
||||
void topologySortTriList(
|
||||
Sort::Enum _sort
|
||||
TopologySort::Enum _sort
|
||||
, IndexT* _dst
|
||||
, uint32_t* _keys
|
||||
, uint32_t* _values
|
||||
@ -310,18 +310,18 @@ namespace bgfx
|
||||
switch (_sort)
|
||||
{
|
||||
default:
|
||||
case Sort::DirectionFrontToBackMin: calcSortKeys<IndexT, distanceDir, fmin3, 0 >(_keys, _values, _dir, _vertices, _stride, _indices, _num); break;
|
||||
case Sort::DirectionFrontToBackAvg: calcSortKeys<IndexT, distanceDir, favg3, 0 >(_keys, _values, _dir, _vertices, _stride, _indices, _num); break;
|
||||
case Sort::DirectionFrontToBackMax: calcSortKeys<IndexT, distanceDir, fmax3, 0 >(_keys, _values, _dir, _vertices, _stride, _indices, _num); break;
|
||||
case Sort::DirectionBackToFrontMin: calcSortKeys<IndexT, distanceDir, fmin3, UINT32_MAX>(_keys, _values, _dir, _vertices, _stride, _indices, _num); break;
|
||||
case Sort::DirectionBackToFrontAvg: calcSortKeys<IndexT, distanceDir, favg3, UINT32_MAX>(_keys, _values, _dir, _vertices, _stride, _indices, _num); break;
|
||||
case Sort::DirectionBackToFrontMax: calcSortKeys<IndexT, distanceDir, fmax3, UINT32_MAX>(_keys, _values, _dir, _vertices, _stride, _indices, _num); break;
|
||||
case Sort::DistanceFrontToBackMin: calcSortKeys<IndexT, distancePos, fmin3, 0 >(_keys, _values, _pos, _vertices, _stride, _indices, _num); break;
|
||||
case Sort::DistanceFrontToBackAvg: calcSortKeys<IndexT, distancePos, favg3, 0 >(_keys, _values, _pos, _vertices, _stride, _indices, _num); break;
|
||||
case Sort::DistanceFrontToBackMax: calcSortKeys<IndexT, distancePos, fmax3, 0 >(_keys, _values, _pos, _vertices, _stride, _indices, _num); break;
|
||||
case Sort::DistanceBackToFrontMin: calcSortKeys<IndexT, distancePos, fmin3, UINT32_MAX>(_keys, _values, _pos, _vertices, _stride, _indices, _num); break;
|
||||
case Sort::DistanceBackToFrontAvg: calcSortKeys<IndexT, distancePos, favg3, UINT32_MAX>(_keys, _values, _pos, _vertices, _stride, _indices, _num); break;
|
||||
case Sort::DistanceBackToFrontMax: calcSortKeys<IndexT, distancePos, fmax3, UINT32_MAX>(_keys, _values, _pos, _vertices, _stride, _indices, _num); break;
|
||||
case TopologySort::DirectionFrontToBackMin: calcSortKeys<IndexT, distanceDir, fmin3, 0 >(_keys, _values, _dir, _vertices, _stride, _indices, _num); break;
|
||||
case TopologySort::DirectionFrontToBackAvg: calcSortKeys<IndexT, distanceDir, favg3, 0 >(_keys, _values, _dir, _vertices, _stride, _indices, _num); break;
|
||||
case TopologySort::DirectionFrontToBackMax: calcSortKeys<IndexT, distanceDir, fmax3, 0 >(_keys, _values, _dir, _vertices, _stride, _indices, _num); break;
|
||||
case TopologySort::DirectionBackToFrontMin: calcSortKeys<IndexT, distanceDir, fmin3, UINT32_MAX>(_keys, _values, _dir, _vertices, _stride, _indices, _num); break;
|
||||
case TopologySort::DirectionBackToFrontAvg: calcSortKeys<IndexT, distanceDir, favg3, UINT32_MAX>(_keys, _values, _dir, _vertices, _stride, _indices, _num); break;
|
||||
case TopologySort::DirectionBackToFrontMax: calcSortKeys<IndexT, distanceDir, fmax3, UINT32_MAX>(_keys, _values, _dir, _vertices, _stride, _indices, _num); break;
|
||||
case TopologySort::DistanceFrontToBackMin: calcSortKeys<IndexT, distancePos, fmin3, 0 >(_keys, _values, _pos, _vertices, _stride, _indices, _num); break;
|
||||
case TopologySort::DistanceFrontToBackAvg: calcSortKeys<IndexT, distancePos, favg3, 0 >(_keys, _values, _pos, _vertices, _stride, _indices, _num); break;
|
||||
case TopologySort::DistanceFrontToBackMax: calcSortKeys<IndexT, distancePos, fmax3, 0 >(_keys, _values, _pos, _vertices, _stride, _indices, _num); break;
|
||||
case TopologySort::DistanceBackToFrontMin: calcSortKeys<IndexT, distancePos, fmin3, UINT32_MAX>(_keys, _values, _pos, _vertices, _stride, _indices, _num); break;
|
||||
case TopologySort::DistanceBackToFrontAvg: calcSortKeys<IndexT, distancePos, favg3, UINT32_MAX>(_keys, _values, _pos, _vertices, _stride, _indices, _num); break;
|
||||
case TopologySort::DistanceBackToFrontMax: calcSortKeys<IndexT, distancePos, fmax3, UINT32_MAX>(_keys, _values, _pos, _vertices, _stride, _indices, _num); break;
|
||||
}
|
||||
|
||||
radixSort(_keys, _tempKeys, _values, _tempValues, _num);
|
||||
@ -343,7 +343,7 @@ namespace bgfx
|
||||
}
|
||||
|
||||
void topologySortTriList(
|
||||
Sort::Enum _sort
|
||||
TopologySort::Enum _sort
|
||||
, void* _dst
|
||||
, uint32_t _dstSize
|
||||
, const float _dir[3]
|
||||
|
@ -36,40 +36,18 @@ namespace bgfx
|
||||
, bx::AllocatorI* _allocator
|
||||
);
|
||||
|
||||
///
|
||||
struct Sort
|
||||
{
|
||||
enum Enum
|
||||
{
|
||||
DirectionFrontToBackMin,
|
||||
DirectionFrontToBackAvg,
|
||||
DirectionFrontToBackMax,
|
||||
DirectionBackToFrontMin,
|
||||
DirectionBackToFrontAvg,
|
||||
DirectionBackToFrontMax,
|
||||
DistanceFrontToBackMin,
|
||||
DistanceFrontToBackAvg,
|
||||
DistanceFrontToBackMax,
|
||||
DistanceBackToFrontMin,
|
||||
DistanceBackToFrontAvg,
|
||||
DistanceBackToFrontMax,
|
||||
|
||||
Count
|
||||
};
|
||||
};
|
||||
|
||||
///
|
||||
void topologySortTriList(
|
||||
Sort::Enum _sort
|
||||
, void* _dst
|
||||
, uint32_t _dstSize
|
||||
TopologySort::Enum _sort
|
||||
, void* _dst
|
||||
, uint32_t _dstSize
|
||||
, const float _dir[3]
|
||||
, const float _pos[3]
|
||||
, const void* _vertices
|
||||
, uint32_t _stride
|
||||
, uint32_t _stride
|
||||
, const void* _indices
|
||||
, uint32_t _numIndices
|
||||
, bool _index32
|
||||
, uint32_t _numIndices
|
||||
, bool _index32
|
||||
, bx::AllocatorI* _allocator
|
||||
);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user