3#include "mc/_HeaderOutputPredefine.h"
6#include "mc/external/bgfx/ClearQuad.h"
7#include "mc/external/bgfx/CommandBuffer.h"
8#include "mc/external/bgfx/DynamicIndexBuffer.h"
9#include "mc/external/bgfx/DynamicIndexBufferHandle.h"
10#include "mc/external/bgfx/DynamicVertexBuffer.h"
11#include "mc/external/bgfx/DynamicVertexBufferHandle.h"
12#include "mc/external/bgfx/Frame.h"
13#include "mc/external/bgfx/GuardedHandleAllocPagedT.h"
14#include "mc/external/bgfx/GuardedPagedHeapBackedArray.h"
15#include "mc/external/bgfx/IndexBuffer.h"
16#include "mc/external/bgfx/Init.h"
17#include "mc/external/bgfx/InitResult.h"
18#include "mc/external/bgfx/InitState.h"
19#include "mc/external/bgfx/NonLocalAllocator.h"
20#include "mc/external/bgfx/OcclusionQueryHandle.h"
21#include "mc/external/bgfx/ShaderHandle.h"
22#include "mc/external/bgfx/Stats.h"
23#include "mc/external/bgfx/TextVideoMemBlitter.h"
24#include "mc/external/bgfx/TextureHandle.h"
25#include "mc/external/bgfx/UpdateBatchT.h"
26#include "mc/external/bgfx/VertexBuffer.h"
27#include "mc/external/bgfx/VertexDeclRef.h"
28#include "mc/external/bgfx/View.h"
29#include "mc/external/bgfx/ViewStats.h"
30#include "mc/external/bgfx/acceleration_structure_build_flags/Enum.h"
31#include "mc/external/bgfx/backbuffer_ratio/Enum.h"
32#include "mc/external/bgfx/render_frame/Enum.h"
33#include "mc/external/bgfx/renderer_type/Enum.h"
34#include "mc/external/bgfx/texture_format/Enum.h"
35#include "mc/external/bgfx/uniform_type/Enum.h"
36#include "mc/external/bx/HandleAllocT.h"
37#include "mc/external/bx/HandleHashMapT.h"
38#include "mc/external/bx/Mutex.h"
39#include "mc/external/bx/Semaphore.h"
40#include "mc/external/bx/Thread.h"
48namespace bgfx {
struct Encoder; }
52namespace bgfx {
struct Handle; }
54namespace bgfx {
struct Memory; }
91 ::ll::TypedStorage<8, 8, uint64> m_ptr;
92 ::ll::TypedStorage<4, 4, uint> m_offset;
93 ::ll::TypedStorage<8, 8, uint64> m_totalSize;
101 ::ll::TypedStorage<8, 8, ::bgfx::UniformHandle*> m_uniforms;
102 ::ll::UntypedStorage<8, 16> m_name;
103 ::ll::TypedStorage<4, 4, uint> m_hash;
104 ::ll::TypedStorage<2, 2, short> m_refCount;
105 ::ll::TypedStorage<2, 2, ushort> m_num;
133 ::ll::TypedStorage<2, 2, ::bgfx::ShaderHandle> m_vsh;
134 ::ll::TypedStorage<2, 2, ::bgfx::ShaderHandle> m_fsh;
135 ::ll::TypedStorage<2, 2, short> m_refCount;
143 ::ll::UntypedStorage<8, 16> m_name;
144 ::ll::TypedStorage<4, 4, ::bgfx::UniformType::Enum> m_type;
145 ::ll::TypedStorage<2, 2, ushort> m_num;
146 ::ll::TypedStorage<2, 2, short> m_refCount;
160 MCFOLD
void* $ctor();
174 ::ll::UntypedStorage<8, 16> m_name;
175 ::ll::TypedStorage<8, 8, void*> m_ptr;
176 ::ll::TypedStorage<4, 4, uint> m_storageSize;
177 ::ll::TypedStorage<2, 2, short> m_refCount;
178 ::ll::TypedStorage<1, 1, uchar> m_bbRatio;
179 ::ll::TypedStorage<1, 1, uchar> m_format;
180 ::ll::TypedStorage<1, 1, uchar> m_numMips;
181 ::ll::TypedStorage<2, 2, ushort> m_numLayers;
182 ::ll::TypedStorage<1, 1, bool> m_owned;
183 ::ll::TypedStorage<1, 1, bool> m_immutable;
184 ::ll::TypedStorage<1, 1, bool> m_rt;
192 ::ll::UntypedStorage<8, 16> m_name;
193 ::ll::TypedStorage<8, 8, void*> m_ptr;
194 ::ll::TypedStorage<4, 4, uint> m_stride;
195 ::ll::TypedStorage<4, 4, uint> m_count;
196 ::ll::TypedStorage<2, 2, short> m_refCount;
202 MCAPI ShaderBufferRef();
204 MCAPI ~ShaderBufferRef();
210 MCFOLD
void* $ctor();
227 ::ll::TypedStorage<2, 16, ::bgfx::TextureHandle[8]> m_th;
228 ::ll::TypedStorage<8, 16, void*> m_nwh;
235 ::ll::TypedStorage<8, 16, ::bgfx::Context::FrameBufferRef::un>
un;
236 ::ll::TypedStorage<1, 1, bool> m_window;
240 using UniformHashMap = ::bx::HandleHashMapT<1024, uint>;
242 using ShaderHashMap = ::bx::HandleHashMapT<8192, uint>;
244 using ProgramHashMap = ::bx::HandleHashMapT<4096, uint>;
246 using TextureUpdateBatch = ::bgfx::UpdateBatchT<256>;
251 ::ll::TypedStorage<1, 128, ::bx::Semaphore> m_renderSem;
252 ::ll::TypedStorage<1, 128, ::bx::Semaphore> m_apiSem;
253 ::ll::TypedStorage<1, 128, ::bx::Semaphore> m_encoderEndSem;
254 ::ll::TypedStorage<1, 64, ::bx::Mutex> m_encoderApiLock;
255 ::ll::TypedStorage<1, 64, ::bx::Mutex> m_resourceApiLock;
256 ::ll::TypedStorage<8, 464, ::bx::Thread> m_thread;
257 ::ll::TypedStorage<1, 64, ::bx::Mutex> m_perfStatsApiLock;
258 ::ll::TypedStorage<8, 208, ::bgfx::Stats> m_lastPerfStats;
259 ::ll::TypedStorage<2, 2, ushort> m_lastNumViewStats;
260 ::ll::TypedStorage<8, 79872, ::bgfx::ViewStats[256]> m_lastViewStats;
261 ::ll::TypedStorage<2, 2, ushort> m_lastNumEncoderStats;
262 ::ll::TypedStorage<8, 8, ::bgfx::EncoderStats*> m_lastEncoderStats;
263 ::ll::TypedStorage<2, 2, ushort> m_numEncoderStats;
264 ::ll::TypedStorage<8, 8, ::bgfx::EncoderStats*> m_encoderStats;
265 ::ll::TypedStorage<8, 8, ::bgfx::Encoder*> m_encoder0;
266 ::ll::TypedStorage<8, 8, ::bgfx::EncoderImpl*> m_encoder;
267 ::ll::TypedStorage<8, 8, ::bx::HandleAlloc*> m_encoderHandle;
268 ::ll::TypedStorage<8, 206541568, ::bgfx::Frame[2]> m_frame;
269 ::ll::TypedStorage<8, 8, ::bgfx::Frame*> m_render;
270 ::ll::TypedStorage<8, 8, ::bgfx::Frame*> m_submit;
271 ::ll::TypedStorage<8, 524280, uint64[65535]> m_tempKeys;
272 ::ll::TypedStorage<2, 131070, ushort[65535]> m_tempValues;
273 ::ll::TypedStorage<4, 16384, ::bgfx::IndexBuffer[4096]> m_indexBuffers;
274 ::ll::TypedStorage<4, 32768, ::bgfx::VertexBuffer[4096]> m_vertexBuffers;
275 ::ll::TypedStorage<4, 81920, ::bgfx::DynamicIndexBuffer[4096]> m_dynamicIndexBuffers;
276 ::ll::TypedStorage<4, 114688, ::bgfx::DynamicVertexBuffer[4096]> m_dynamicVertexBuffers;
277 ::ll::TypedStorage<2, 2, ushort> m_numFreeDynamicIndexBufferHandles;
278 ::ll::TypedStorage<2, 2, ushort> m_numFreeDynamicVertexBufferHandles;
279 ::ll::TypedStorage<2, 2, ushort> m_numFreeOcclusionQueryHandles;
280 ::ll::TypedStorage<2, 8192, ::bgfx::DynamicIndexBufferHandle[4096]> m_freeDynamicIndexBufferHandle;
281 ::ll::TypedStorage<2, 8192, ::bgfx::DynamicVertexBufferHandle[4096]> m_freeDynamicVertexBufferHandle;
282 ::ll::TypedStorage<2, 512, ::bgfx::OcclusionQueryHandle[256]> m_freeOcclusionQueryHandle;
283 ::ll::TypedStorage<8, 56, ::bgfx::NonLocalAllocator> m_dynIndexBufferAllocator;
284 ::ll::TypedStorage<2, 16388, ::bx::HandleAllocT<4096>> m_dynamicIndexBufferHandle;
285 ::ll::TypedStorage<8, 56, ::bgfx::NonLocalAllocator> m_dynVertexBufferAllocator;
286 ::ll::TypedStorage<2, 16388, ::bx::HandleAllocT<4096>> m_dynamicVertexBufferHandle;
287 ::ll::TypedStorage<2, 16388, ::bx::HandleAllocT<4096>> m_indexBufferHandle;
288 ::ll::TypedStorage<2, 260, ::bx::HandleAllocT<64>> m_vertexDeclHandle;
289 ::ll::TypedStorage<2, 16388, ::bx::HandleAllocT<4096>> m_vertexBufferHandle;
290 ::ll::TypedStorage<2, 16388, ::bx::HandleAllocT<4096>> m_shaderHandle;
291 ::ll::TypedStorage<2, 8196, ::bx::HandleAllocT<2048>> m_programHandle;
292 ::ll::TypedStorage<8, 16424, ::bgfx::GuardedHandleAllocPagedT<4096, 4096, ushort, ::bgfx::AllocationContext>>
294 ::ll::TypedStorage<2, 16388, ::bx::HandleAllocT<4096>> m_shaderBufferHandle;
295 ::ll::TypedStorage<2, 516, ::bx::HandleAllocT<128>> m_frameBufferHandle;
296 ::ll::TypedStorage<2, 2052, ::bx::HandleAllocT<512>> m_uniformHandle;
297 ::ll::TypedStorage<2, 1028, ::bx::HandleAllocT<256>> m_occlusionQueryHandle;
298 ::ll::TypedStorage<2, 131076, ::bx::HandleAllocT<32768>> m_accelerationStructureBufferHandle;
299 ::ll::TypedStorage<4, 6152, ::bx::HandleHashMapT<1024, uint>> m_uniformHashMap;
300 ::ll::TypedStorage<8, 12288, ::bgfx::Context::UniformRef[512]> m_uniformRef;
301 ::ll::TypedStorage<4, 49160, ::bx::HandleHashMapT<8192, uint>> m_shaderHashMap;
302 ::ll::TypedStorage<8, 131072, ::bgfx::Context::ShaderRef[4096]> m_shaderRef;
303 ::ll::TypedStorage<4, 24584, ::bx::HandleHashMapT<4096, uint>> m_programHashMap;
304 ::ll::TypedStorage<2, 12288, ::bgfx::Context::ProgramRef[2048]> m_programRef;
305 ::ll::TypedStorage<8, 163872, ::bgfx::GuardedPagedHeapBackedArray<::bgfx::Context::TextureRef, 4096>> m_textureRef;
306 ::ll::TypedStorage<8, 163840, ::bgfx::Context::ShaderBufferRef[4096]> m_shaderBufferRef;
307 ::ll::TypedStorage<8, 3072, ::bgfx::Context::FrameBufferRef[128]> m_frameBufferRef;
308 ::ll::TypedStorage<4, 17288, ::bgfx::VertexDeclRef> m_declRef;
309 ::ll::TypedStorage<2, 512, ushort[256]> m_viewRemap;
310 ::ll::TypedStorage<4, 1024, uint[256]> m_seq;
311 ::ll::TypedStorage<8, 114688, ::bgfx::View[256]> m_view;
312 ::ll::TypedStorage<4, 256, float[16][4]> m_clearColor;
313 ::ll::TypedStorage<1, 1, uchar> m_colorPaletteDirty;
314 ::ll::TypedStorage<8, 64, ::bgfx::Init> m_init;
315 ::ll::TypedStorage<8, 8, int64> m_frameTimeLast;
316 ::ll::TypedStorage<4, 4, uint> m_debug;
317 ::ll::TypedStorage<8, 8, int64> m_rtMemoryUsed;
318 ::ll::TypedStorage<8, 8, int64> m_textureMemoryUsed;
319 ::ll::TypedStorage<8, 8, int64> m_shaderBufferMemoryUsed;
320 ::ll::TypedStorage<8, 112, ::bgfx::TextVideoMemBlitter> m_textVideoMemBlitter;
321 ::ll::TypedStorage<8, 112, ::bgfx::ClearQuad> m_clearQuad;
322 ::ll::TypedStorage<8, 8, ::bgfx::RendererContextI*> m_renderCtx;
323 ::ll::TypedStorage<8, 8, ::bgfx::RendererContextI*> m_renderMain;
324 ::ll::TypedStorage<8, 8, ::bgfx::RendererContextI*> m_renderNoop;
325 ::ll::TypedStorage<4, 4, ::bgfx::InitState> m_initState;
326 ::ll::TypedStorage<1, 1, bool> m_rendererInitialized;
327 ::ll::TypedStorage<1, 1, bool> m_skipFlip;
328 ::ll::TypedStorage<1, 1, bool> m_suspended;
329 ::ll::TypedStorage<1, 1, bool> m_exit;
330 ::ll::TypedStorage<1, 1, bool> m_flipAfterRender;
331 ::ll::TypedStorage<1, 1, bool> m_singleThreaded;
332 ::ll::TypedStorage<1, 1, bool> m_initSyncOptional;
333 ::ll::TypedStorage<1, 1, bool> m_texturesGuarded;
334 ::ll::TypedStorage<4, 2052, ::bgfx::UpdateBatchT<256>> m_textureUpdateBatch;
342 MCAPI
void _initBegin();
344 MCAPI
bool _initFinalize();
346 MCAPI
void _initPending(
bool async);
348 MCAPI
void _shutdownBegin();
350 MCAPI uint64 allocDynamicIndexBuffer(uint _size, ushort _flags);
352 MCAPI ::bgfx::Context::DynamicVertexAllocation
353 allocDynamicVertexBuffer(uint _size, ushort _flags, ushort _aligment);
355 MCAPI
bool apiSemWait(
int _msecs);
357 MCAPI ::bgfx::InitResult continueInit(
bool async);
359 MCAPI ::bgfx::AccelerationStructureHandle createBottomLevelAccelerationStructure(
360 ::bgfx::AccelerationStructureHandle _handle,
361 ::bgfx::DynamicVertexBufferHandle _vertexBufferHandle,
362 ::bgfx::VertexDeclHandle _vertexDeclHandle,
365 ::bgfx::IndexBufferHandle _indexBufferHandle,
368 ::bgfx::AccelerationStructureBuildFlags::Enum _flags
371 MCAPI ::bgfx::AccelerationStructureHandle createBottomLevelAccelerationStructure(
372 ::bgfx::AccelerationStructureHandle _handle,
373 ::bgfx::VertexBufferHandle _vertexBufferHandle,
374 ::bgfx::VertexDeclHandle _vertexDeclHandle,
377 ::bgfx::IndexBufferHandle _indexBufferHandle,
380 ::bgfx::AccelerationStructureBuildFlags::Enum _flags
383 MCAPI ::bgfx::DynamicIndexBufferHandle createDynamicIndexBuffer(uint _num, ushort _flags);
385 MCAPI ::bgfx::DynamicVertexBufferHandle
386 createDynamicVertexBuffer(uint _num, ::bgfx::VertexDecl
const& _decl, ushort _flags);
388 MCAPI ::bgfx::FrameBufferHandle
389 createFrameBuffer(uchar _num, ::bgfx::Attachment
const* _attachment,
bool _destroyTextures);
391 MCAPI ::bgfx::FrameBufferHandle
392 createFrameBuffer(
void* _nwh, ushort _width, ushort _height, ::bgfx::TextureFormat::Enum _depthFormat);
394 MCAPI ::bgfx::IndexBufferHandle createIndexBuffer(::bgfx::Memory
const* _mem, ushort _flags);
396 MCAPI ::bgfx::ProgramHandle createProgram(::bgfx::ShaderHandle _vsh,
bool _destroyShader);
398 MCAPI ::bgfx::ProgramHandle
399 createProgram(::bgfx::ShaderHandle _vsh, ::bgfx::ShaderHandle _fsh,
bool _destroyShaders);
401 MCAPI ::bgfx::ShaderHandle createShader(::bgfx::Memory
const* _mem);
403 MCAPI ::bgfx::ShaderBufferHandle createShaderBuffer(uint _num, uint _stride, ushort _flags);
405 MCAPI ::bgfx::TextureHandle createTexture(
406 ::bgfx::Memory
const* _mem,
409 ::bgfx::TextureInfo* _info,
410 ::bgfx::BackbufferRatio::Enum _ratio,
414 MCAPI ::bgfx::AccelerationStructureHandle createTopLevelAccelerationStructure(
415 ::bgfx::AccelerationStructureHandle _handle,
417 ::bgfx::TopLevelInstanceDesc* instanceDescs
420 MCAPI ::bgfx::TransientIndexBuffer* createTransientIndexBuffer(uint _size);
422 MCAPI ::bgfx::TransientVertexBuffer* createTransientVertexBuffer(uint _size, ::bgfx::VertexDecl
const* _decl);
424 MCAPI ::bgfx::UniformHandle createUniform(
char const* _name, ::bgfx::UniformType::Enum _type, ushort _num);
426 MCAPI ::bgfx::VertexBufferHandle
427 createVertexBuffer(::bgfx::Memory
const* _mem, ::bgfx::VertexDecl
const& _decl, ushort _flags);
429 MCAPI
void destroyFrameBuffer(::bgfx::FrameBufferHandle _handle);
431 MCAPI
void destroyIndexBuffer(::bgfx::IndexBufferHandle _handle);
433 MCAPI
void destroyProgram(::bgfx::ProgramHandle _handle);
435 MCAPI
void destroyTransientIndexBuffer(::bgfx::TransientIndexBuffer* _tib);
437 MCAPI
void destroyTransientVertexBuffer(::bgfx::TransientVertexBuffer* _tvb);
439 MCAPI
void destroyUniform(::bgfx::UniformHandle _handle);
441 MCAPI
void destroyVertexBuffer(::bgfx::VertexBufferHandle _handle);
443 MCAPI ::bgfx::VertexDeclHandle findVertexDecl(::bgfx::VertexDecl
const& _decl);
445 MCAPI
void flushTextureUpdateBatch(::bgfx::CommandBuffer& _cmdbuf);
447 MCAPI uint frame(uint _flags);
449 MCAPI
void freeAllHandles(::bgfx::Frame* _frame);
451 MCAPI
void freeDynamicBuffers();
453 MCAPI ::bgfx::CommandBuffer& getCommandBuffer(::bgfx::CommandBuffer::Enum _cmd);
455 MCAPI ::bgfx::RenderFrame::Enum renderFrame(
int _msecs);
457 MCAPI
void rendererExecCommands(::bgfx::CommandBuffer& _cmdbuf);
459 MCAPI
void resetView(ushort _id);
462 resizeTexture(::bgfx::TextureHandle _handle, ushort _width, ushort _height, uchar _numMips, ushort _numLayers);
464 MCAPI
void setName(::bgfx::Handle _handle, ::bx::StringView
const& _name);
466 MCAPI
void shaderDecRef(::bgfx::ShaderHandle _handle);
470 MCAPI
void textureDecRef(::bgfx::TextureHandle _handle);
472 MCAPI
void update(::bgfx::ShaderBufferHandle _handle, ::bgfx::Memory
const* _mem);
474 MCAPI
void update(::bgfx::DynamicIndexBufferHandle _handle, uint _startIndex, ::bgfx::Memory
const* _mem);
476 MCAPI
void update(::bgfx::DynamicVertexBufferHandle _handle, uint _startVertex, ::bgfx::Memory
const* _mem);
479 updateOffset(::bgfx::DynamicIndexBufferHandle _handle, uint _offset, uint _declStride, ::bgfx::Memory
const* _mem);
482 updateOffset(::bgfx::DynamicVertexBufferHandle _handle, uint _offset, uint _declStride, ::bgfx::Memory
const* _mem);
484 MCAPI
void updateTexture(
485 ::bgfx::TextureHandle _handle,
495 ::bgfx::Memory
const* _mem
498 MCAPI ::bgfx::TextureHandle wrapExternalTexture(::bgfx::RendererType::Enum _type,
void* _texturePtr);
504 MCAPI
static int renderThread(::bx::Thread*,
void*);
Definition AccelerationStructureHandle.h:7
Definition AllocationContext.h:7
Definition Attachment.h:7
Definition CommandBuffer.h:7
Definition EncoderImpl.h:7
Definition EncoderStats.h:7
Definition FrameBufferHandle.h:7
Definition IndexBufferHandle.h:7
Definition ProgramHandle.h:7
Definition RendererContextI.h:7
Definition ShaderBufferHandle.h:7
Definition TextureInfo.h:7
Definition TopLevelInstanceDesc.h:7
Definition TransientIndexBuffer.h:7
Definition TransientVertexBuffer.h:7
Definition VertexBufferHandle.h:7
Definition VertexDeclHandle.h:7
Definition VertexDecl.h:7
Definition HandleAlloc.h:7
Definition StringView.h:7