LeviLamina
Loading...
Searching...
No Matches
RenderDragonRenderingBackend.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/client/gui/oreui/interface/IRenderingBackend.h"
7#include "mc/deps/core/checked_resource_service/ClientResourcePointer.h"
8#include "mc/deps/core/utility/NonOwnerPointer.h"
9#include "mc/deps/minecraft_renderer/framebuilder/GamefaceBatchDraw.h"
10#include "mc/deps/minecraft_renderer/framebuilder/GamefacePipelineState.h"
11#include "mc/deps/minecraft_renderer/resources/ClientTexture.h"
12#include "mc/external/gameface/renoir/CBType.h"
13#include "mc/external/gameface/renoir/ConstantBufferObject.h"
14#include "mc/external/gameface/renoir/DepthStencilTextureObject.h"
15#include "mc/external/gameface/renoir/IndexBufferObject.h"
16#include "mc/external/gameface/renoir/IndexBufferType.h"
17#include "mc/external/gameface/renoir/PipelineStateObject.h"
18#include "mc/external/gameface/renoir/PixelFormat.h"
19#include "mc/external/gameface/renoir/RendererBackend.h"
20#include "mc/external/gameface/renoir/ResourcesCommandsStage.h"
21#include "mc/external/gameface/renoir/Sampler2DObject.h"
22#include "mc/external/gameface/renoir/Texture2DObject.h"
23#include "mc/external/gameface/renoir/VertexBufferObject.h"
24#include "mc/external/gameface/renoir/VertexType.h"
25#include "mc/external/render_dragon/mesh/VertexFormat.h"
26#include "mc/external/render_dragon/resources/ServerResourcePointer.h"
27#include "mc/external/render_dragon/resources/TextureDescription.h"
28#include "mc/platform/brstd/function_ref.h"
29
30// auto generated forward declare list
31// clang-format off
32namespace OreUI { class TemporaryTextureHolder; }
33namespace OreUI { struct FrameDebugData; }
34namespace OreUI::RenderUtils { struct TextureData; }
35namespace cg { class ImageBuffer; }
36namespace dragon { class ResolvedTextureResource; }
37namespace dragon { struct ResolvedIndexBufferResource; }
38namespace dragon { struct ResolvedVertexBufferResource; }
39namespace mce { class ShaderGroup; }
40namespace mce { struct SamplerStateDescription; }
41namespace renoir { struct DepthStencilTexture; }
42namespace renoir { struct PipelineState; }
43namespace renoir { struct RendererCaps; }
44namespace renoir { struct Sampler2D; }
45namespace renoir { struct SetMultipleVertexBuffersCmd; }
46namespace renoir { struct SetPSConstantBuffersCmd; }
47namespace renoir { struct SetPSSamplersCmd; }
48namespace renoir { struct SetPSTexturesCmd; }
49namespace renoir { struct SetPipelineStateCmd; }
50namespace renoir { struct SetRenderTargetCmd; }
51namespace renoir { struct SetScissorRectCmd; }
52namespace renoir { struct SetVSConstantBuffersCmd; }
53namespace renoir { struct SetViewportCmd; }
54namespace renoir { struct Texture2D; }
55namespace renoir { struct TextureObject; }
56namespace renoir { struct UpdateBox; }
57namespace renoir { struct float2; }
58// clang-format on
59
60namespace OreUI {
61
62class RenderDragonRenderingBackend : public ::OreUI::IRenderingBackend {
63public:
64 // RenderDragonRenderingBackend inner types declare
65 // clang-format off
66 struct TextureData;
67 struct VertexBuffer;
68 struct GetGamefaceStride;
69 struct IndexBuffer;
70 struct ConstantBuffer;
71 // clang-format on
72
73 // RenderDragonRenderingBackend inner types define
74 struct TextureData {
75 public:
76 // member variables
77 // NOLINTBEGIN
78 ::ll::TypedStorage<
79 8,
80 32,
81 ::std::variant<
82 ::std::monostate,
83 ::mce::ClientResourcePointer<::dragon::ResolvedTextureResource>,
84 ::mce::ClientTexture>>
85 mTexture;
86 ::ll::TypedStorage<8, 64, ::dragon::TextureDescription> mDesc;
87 // NOLINTEND
88
89 public:
90 // member functions
91 // NOLINTBEGIN
92 MCAPI ~TextureData();
93 // NOLINTEND
94
95 public:
96 // destructor thunk
97 // NOLINTBEGIN
98 MCAPI void $dtor();
99 // NOLINTEND
100 };
101
102 struct VertexBuffer {
103 public:
104 // VertexBuffer inner types declare
105 // clang-format off
106 struct DragonVertexBuffer;
107 struct DragonInstanceData;
108 // clang-format on
109
110 // VertexBuffer inner types define
111 struct DragonVertexBuffer {
112 public:
113 // member variables
114 // NOLINTBEGIN
115 ::ll::TypedStorage<8, 184, ::dragon::mesh::VertexFormat> dragonFormat;
116 ::ll::TypedStorage<8, 24, ::mce::ServerResourcePointer<::dragon::ResolvedVertexBufferResource>>
117 dragonVertexBuffer;
118 // NOLINTEND
119 };
120
121 struct DragonInstanceData {
122 public:
123 // DragonInstanceData inner types define
124 using BufferConvert = void (*)(::std::vector<uchar> const&, ::std::vector<uchar>&, uint64);
125
126 public:
127 // member variables
128 // NOLINTBEGIN
129 ::ll::TypedStorage<
130 8,
131 8,
132 ::gsl::not_null<void (*)(::std::vector<uchar> const&, ::std::vector<uchar>&, uint64)>>
133 mGamefaceToDragon;
134 ::ll::TypedStorage<8, 24, ::std::vector<uchar>> mDragonInstanceBuffer;
135 ::ll::TypedStorage<1, 1, uchar> mGamefaceStride;
136 // NOLINTEND
137 };
138
139 using DragonStorage = ::std::variant<
140 ::OreUI::RenderDragonRenderingBackend::VertexBuffer::DragonVertexBuffer,
141 ::OreUI::RenderDragonRenderingBackend::VertexBuffer::DragonInstanceData>;
142
143 public:
144 // member variables
145 // NOLINTBEGIN
146 ::ll::TypedStorage<4, 4, uint> count;
147 ::ll::TypedStorage<8, 24, ::std::vector<uchar>> data;
148 ::ll::TypedStorage<
149 8,
150 216,
151 ::std::variant<
152 ::OreUI::RenderDragonRenderingBackend::VertexBuffer::DragonVertexBuffer,
153 ::OreUI::RenderDragonRenderingBackend::VertexBuffer::DragonInstanceData>>
154 mDragonStorage;
155 // NOLINTEND
156
157 public:
158 // member functions
159 // NOLINTBEGIN
160 MCAPI ~VertexBuffer();
161 // NOLINTEND
162
163 public:
164 // destructor thunk
165 // NOLINTBEGIN
166 MCAPI void $dtor();
167 // NOLINTEND
168 };
169
170 struct GetGamefaceStride {};
171
172 struct IndexBuffer {
173 public:
174 // member variables
175 // NOLINTBEGIN
176 ::ll::TypedStorage<4, 4, uint> count;
177 ::ll::TypedStorage<1, 1, uchar> mStride;
178 ::ll::TypedStorage<8, 24, ::std::vector<uchar>> data;
179 ::ll::TypedStorage<8, 24, ::mce::ServerResourcePointer<::dragon::ResolvedIndexBufferResource>>
180 dragonIndexBuffer;
181 // NOLINTEND
182
183 public:
184 // member functions
185 // NOLINTBEGIN
186 MCAPI ~IndexBuffer();
187 // NOLINTEND
188
189 public:
190 // destructor thunk
191 // NOLINTBEGIN
192 MCAPI void $dtor();
193 // NOLINTEND
194 };
195
196 struct ConstantBuffer {
197 public:
198 // member variables
199 // NOLINTBEGIN
200 ::ll::TypedStorage<4, 4, ::renoir::CBType> type;
201 ::ll::TypedStorage<4, 2048, ::glm::vec4[128]> data;
202 ::ll::TypedStorage<8, 8, uint64> size;
203 // NOLINTEND
204 };
205
206 using PipelineStateData = ::mce::framebuilder::GamefacePipelineState;
207
208 using BatchDraw = ::mce::framebuilder::GamefaceBatchDraw;
209
210public:
211 // member variables
212 // NOLINTBEGIN
213 ::ll::TypedStorage<8, 8, ::OreUI::FrameDebugData&> mFrameDebugData;
214 ::ll::TypedStorage<8, 8, ::OreUI::TemporaryTextureHolder&> mTemporaryTextureHolder;
215 ::ll::TypedStorage<
216 8,
217 64,
218 ::std::unordered_map<::renoir::PipelineStateObject, ::mce::framebuilder::GamefacePipelineState>>
219 mPipelineStates;
220 ::ll::TypedStorage<
221 8,
222 64,
223 ::std::unordered_map<::renoir::VertexBufferObject, ::OreUI::RenderDragonRenderingBackend::VertexBuffer>>
224 mVertexBuffers;
225 ::ll::TypedStorage<4, 8, ::std::array<::renoir::VertexBufferObject, 2>> mCurrentVertexBuffers;
226 ::ll::TypedStorage<4, 4, int> mNumVertexBuffersActive;
227 ::ll::TypedStorage<
228 8,
229 64,
230 ::std::unordered_map<::renoir::IndexBufferObject, ::OreUI::RenderDragonRenderingBackend::IndexBuffer>>
231 mIndexBuffers;
232 ::ll::TypedStorage<4, 4, ::renoir::IndexBufferObject> mCurrentIndexBuffer;
233 ::ll::TypedStorage<
234 8,
235 64,
236 ::std::unordered_map<::renoir::ConstantBufferObject, ::OreUI::RenderDragonRenderingBackend::ConstantBuffer>>
237 mConstantBuffers;
238 ::ll::TypedStorage<
239 8,
240 64,
241 ::std::unordered_map<::renoir::Texture2DObject, ::OreUI::RenderDragonRenderingBackend::TextureData>>
242 mTextures;
243 ::ll::TypedStorage<
244 8,
245 64,
246 ::std::unordered_map<::renoir::DepthStencilTextureObject, ::OreUI::RenderDragonRenderingBackend::TextureData>>
247 mDepthTextures;
248 ::ll::TypedStorage<8, 64, ::std::unordered_map<::renoir::Sampler2DObject, ::mce::SamplerStateDescription>>
249 mSamplers;
250 ::ll::TypedStorage<4, 20, ::std::array<::renoir::Texture2DObject, 5>> mRequestedTextures;
251 ::ll::TypedStorage<4, 20, ::std::array<::renoir::Sampler2DObject, 5>> mRequestedSamplers;
252 ::ll::TypedStorage<8, 144, ::mce::framebuilder::GamefacePipelineState> mCurrentPipelineState;
253 ::ll::TypedStorage<8, 464, ::mce::framebuilder::GamefaceBatchDraw::GamefaceMesh> mMesh;
254 ::ll::TypedStorage<8, 24, ::mce::framebuilder::GamefaceBatchDraw> mBatch;
255 // NOLINTEND
256
257public:
258 // prevent constructor by default
259 RenderDragonRenderingBackend& operator=(RenderDragonRenderingBackend const&);
260 RenderDragonRenderingBackend(RenderDragonRenderingBackend const&);
261 RenderDragonRenderingBackend();
262
263public:
264 // virtual functions
265 // NOLINTBEGIN
266 virtual void initializeStaticResources(::Bedrock::NonOwnerPointer<::mce::ShaderGroup> const&) /*override*/;
267
268 virtual void onAppPreSuspended() /*override*/;
269
270 virtual void BeginCommands() /*override*/;
271
272 virtual void FillCaps(::renoir::RendererCaps& outCaps) /*override*/;
273
274 virtual void WrapUserRenderTarget(
275 void* userObject,
276 ::renoir::Texture2D const& description,
277 ::renoir::Texture2DObject object,
278 void* depthStencil,
279 ::renoir::DepthStencilTexture const& dsDescription,
280 ::renoir::DepthStencilTextureObject dsObject
281 ) /*override*/;
282
283 virtual void WrapUserTexture(
284 void* userObject,
285 ::renoir::Texture2D const& description,
286 ::renoir::Texture2DObject object
287 ) /*override*/;
288
289 virtual bool
290 CreatePipelineState(::renoir::PipelineState const& state, ::renoir::PipelineStateObject object) /*override*/;
291
292 virtual void DestroyPipelineState(::renoir::PipelineStateObject object) /*override*/;
293
294 virtual bool
295 CreateVertexBuffer(::renoir::VertexType type, uint count, ::renoir::VertexBufferObject object, bool) /*override*/;
296
297 virtual void DestroyVertexBuffer(::renoir::VertexBufferObject object) /*override*/;
298
299 virtual void* MapVertexBuffer(::renoir::VertexBufferObject object) /*override*/;
300
301 virtual void UnmapVertexBuffer(::renoir::VertexBufferObject object, uint count) /*override*/;
302
303 virtual bool CreateIndexBuffer(
304 ::renoir::IndexBufferType format,
305 uint count,
306 ::renoir::IndexBufferObject object,
307 bool
308 ) /*override*/;
309
310 virtual void DestroyIndexBuffer(::renoir::IndexBufferObject object) /*override*/;
311
312 virtual void* MapIndexBuffer(::renoir::IndexBufferObject object) /*override*/;
313
314 virtual void UnmapIndexBuffer(::renoir::IndexBufferObject object, uint elemCount) /*override*/;
315
316 virtual bool
317 CreateConstantBuffer(::renoir::CBType type, ::renoir::ConstantBufferObject object, uint size) /*override*/;
318
319 virtual void DestroyConstantBuffer(::renoir::ConstantBufferObject object) /*override*/;
320
321 virtual bool CreateTexture(
322 ::renoir::Texture2DObject object,
323 ::renoir::Texture2D const& description,
324 void const* data,
325 uint dataLen
326 ) /*override*/;
327
328 virtual void DestroyTexture(::renoir::Texture2DObject object) /*override*/;
329
330 virtual void UpdateTexture(
331 ::renoir::Texture2DObject object,
332 ::renoir::Texture2D const& description,
333 ::renoir::UpdateBox* boxes,
334 void const** newBytes,
335 uint count,
336 bool
337 ) /*override*/;
338
339 virtual bool CreateDepthStencilTexture(
340 ::renoir::DepthStencilTextureObject object,
341 ::renoir::DepthStencilTexture const& description
342 ) /*override*/;
343
344 virtual void DestroyDepthStencilTexture(::renoir::DepthStencilTextureObject object) /*override*/;
345
346 virtual void CopyTextureToTexture(
347 ::renoir::Texture2DObject,
348 ::renoir::Texture2DObject,
349 ::renoir::UpdateBox,
350 ::renoir::float2
351 ) /*override*/;
352
353 virtual bool CreateSampler2D(::renoir::Sampler2DObject object, ::renoir::Sampler2D const& description) /*override*/;
354
355 virtual void DestroySampler2D(::renoir::Sampler2DObject object) /*override*/;
356
357 virtual bool ReadTexture(::renoir::TextureObject, ::renoir::UpdateBox const&, void*) /*override*/;
358
359 virtual void ExecuteRendering(
360 ::renoir::RendererBackend::BackendCommandsBuffer const* buffers,
361 uint buffersCount,
362 ::renoir::RendererBackend::ConstantBufferUpdateData const* cboUpdates,
363 uint numCboUpdates
364 ) /*override*/;
365
366 virtual void ExecuteResourceCommands(
367 ::renoir::RendererBackend::BackendResourceCommandsBuffer const* buffers,
368 uint buffersCount,
369 ::renoir::ResourcesCommandsStage
370 ) /*override*/;
371
372 virtual void EndCommands() /*override*/;
373
374 virtual ~RenderDragonRenderingBackend() /*override*/;
375 // NOLINTEND
376
377public:
378 // member functions
379 // NOLINTBEGIN
380 MCAPI RenderDragonRenderingBackend(
381 ::OreUI::FrameDebugData& frameDebugData,
382 ::OreUI::TemporaryTextureHolder& temporaryTextureHolder
383 );
384
385 MCAPI void _drawIndexedInstanced(uint indexCount, uint indexOffset, uint instanceCount, uint instanceOffset);
386
387 MCAPI void _flush();
388
389 MCAPI void _setMultipleVertexBuffer(
390 ::renoir::SetMultipleVertexBuffersCmd const& cmd,
391 ::renoir::VertexBufferObject const* objs
392 );
393
394 MCAPI void
395 _setPSConstantBuffers(::renoir::SetPSConstantBuffersCmd const* cmd, ::renoir::ConstantBufferObject const* data);
396
397 MCAPI void _setPSSamplers(::renoir::SetPSSamplersCmd const& cmd, ::renoir::Sampler2DObject const* samplers);
398
399 MCAPI void _setPSTextures(::renoir::SetPSTexturesCmd const& cmd, ::renoir::Texture2DObject const* textures);
400
401 MCAPI void _setPerFrameConstantBuffers(
402 ::renoir::RendererBackend::ConstantBufferUpdateData const* cboUpdates,
403 uint cboUpdatesCount
404 );
405
406 MCAPI void _setPipelineState(::renoir::SetPipelineStateCmd const& cmd);
407
408 MCAPI void _setRenderTarget(::renoir::SetRenderTargetCmd const& cmd);
409
410 MCAPI void _setScissorRect(::renoir::SetScissorRectCmd const& cmd);
411
412 MCAPI void
413 _setVSConstantBuffers(::renoir::SetVSConstantBuffersCmd const* cmd, ::renoir::ConstantBufferObject const* data);
414
415 MCAPI void _setViewport(::renoir::SetViewportCmd const& cmd);
416 // NOLINTEND
417
418public:
419 // static functions
420 // NOLINTBEGIN
421 MCAPI static void _updateTextureRegions(
422 ::renoir::Texture2D const& description,
423 ::renoir::UpdateBox const* boxes,
424 void const** newBytes,
425 uint count,
426 ::brstd::function_ref<
427 ::OreUI::RenderUtils::TextureData(::renoir::PixelFormat, ::gsl::span<uchar const>) const,
428 ::OreUI::RenderUtils::TextureData(::renoir::PixelFormat, ::gsl::span<uchar const>)> convertTextureData,
429 ::brstd::function_ref<void(uint, uint, ::cg::ImageBuffer&&)> update
430 );
431 // NOLINTEND
432
433public:
434 // constructor thunks
435 // NOLINTBEGIN
436 MCAPI void* $ctor(::OreUI::FrameDebugData& frameDebugData, ::OreUI::TemporaryTextureHolder& temporaryTextureHolder);
437 // NOLINTEND
438
439public:
440 // destructor thunk
441 // NOLINTBEGIN
442 MCAPI void $dtor();
443 // NOLINTEND
444
445public:
446 // virtual function thunks
447 // NOLINTBEGIN
448 MCFOLD void $initializeStaticResources(::Bedrock::NonOwnerPointer<::mce::ShaderGroup> const&);
449
450 MCFOLD void $onAppPreSuspended();
451
452 MCFOLD void $BeginCommands();
453
454 MCAPI void $FillCaps(::renoir::RendererCaps& outCaps);
455
456 MCAPI void $WrapUserRenderTarget(
457 void* userObject,
458 ::renoir::Texture2D const& description,
459 ::renoir::Texture2DObject object,
460 void* depthStencil,
461 ::renoir::DepthStencilTexture const& dsDescription,
462 ::renoir::DepthStencilTextureObject dsObject
463 );
464
465 MCAPI void
466 $WrapUserTexture(void* userObject, ::renoir::Texture2D const& description, ::renoir::Texture2DObject object);
467
468 MCAPI bool $CreatePipelineState(::renoir::PipelineState const& state, ::renoir::PipelineStateObject object);
469
470 MCAPI void $DestroyPipelineState(::renoir::PipelineStateObject object);
471
472 MCAPI bool $CreateVertexBuffer(::renoir::VertexType type, uint count, ::renoir::VertexBufferObject object, bool);
473
474 MCAPI void $DestroyVertexBuffer(::renoir::VertexBufferObject object);
475
476 MCAPI void* $MapVertexBuffer(::renoir::VertexBufferObject object);
477
478 MCAPI void $UnmapVertexBuffer(::renoir::VertexBufferObject object, uint count);
479
480 MCAPI bool
481 $CreateIndexBuffer(::renoir::IndexBufferType format, uint count, ::renoir::IndexBufferObject object, bool);
482
483 MCAPI void $DestroyIndexBuffer(::renoir::IndexBufferObject object);
484
485 MCAPI void* $MapIndexBuffer(::renoir::IndexBufferObject object);
486
487 MCAPI void $UnmapIndexBuffer(::renoir::IndexBufferObject object, uint elemCount);
488
489 MCAPI bool $CreateConstantBuffer(::renoir::CBType type, ::renoir::ConstantBufferObject object, uint size);
490
491 MCAPI void $DestroyConstantBuffer(::renoir::ConstantBufferObject object);
492
493 MCAPI bool $CreateTexture(
494 ::renoir::Texture2DObject object,
495 ::renoir::Texture2D const& description,
496 void const* data,
497 uint dataLen
498 );
499
500 MCAPI void $DestroyTexture(::renoir::Texture2DObject object);
501
502 MCAPI void $UpdateTexture(
503 ::renoir::Texture2DObject object,
504 ::renoir::Texture2D const& description,
505 ::renoir::UpdateBox* boxes,
506 void const** newBytes,
507 uint count,
508 bool
509 );
510
511 MCAPI bool $CreateDepthStencilTexture(
512 ::renoir::DepthStencilTextureObject object,
513 ::renoir::DepthStencilTexture const& description
514 );
515
516 MCAPI void $DestroyDepthStencilTexture(::renoir::DepthStencilTextureObject object);
517
518 MCFOLD void $CopyTextureToTexture(
519 ::renoir::Texture2DObject,
520 ::renoir::Texture2DObject,
521 ::renoir::UpdateBox,
522 ::renoir::float2
523 );
524
525 MCAPI bool $CreateSampler2D(::renoir::Sampler2DObject object, ::renoir::Sampler2D const& description);
526
527 MCAPI void $DestroySampler2D(::renoir::Sampler2DObject object);
528
529 MCFOLD bool $ReadTexture(::renoir::TextureObject, ::renoir::UpdateBox const&, void*);
530
531 MCAPI void $ExecuteRendering(
532 ::renoir::RendererBackend::BackendCommandsBuffer const* buffers,
533 uint buffersCount,
534 ::renoir::RendererBackend::ConstantBufferUpdateData const* cboUpdates,
535 uint numCboUpdates
536 );
537
538 MCAPI void $ExecuteResourceCommands(
539 ::renoir::RendererBackend::BackendResourceCommandsBuffer const* buffers,
540 uint buffersCount,
541 ::renoir::ResourcesCommandsStage
542 );
543
544 MCAPI void $EndCommands();
545 // NOLINTEND
546
547public:
548 // vftables
549 // NOLINTBEGIN
550 MCNAPI static void** $vftable();
551 // NOLINTEND
552};
553
554} // namespace OreUI
Definition RenderDragonRenderingBackend.h:7
static MCAPI void ** $vftable()
Definition TemporaryTextureHolder.h:7
Definition ImageBuffer.h:16
Definition ResolvedTextureResource.h:7
Definition ShaderGroup.h:7
Definition FrameDebugData.h:7
Definition RenderDragonRenderingBackend.h:39
Definition RenderDragonRenderingBackend.h:35
Definition RenderDragonRenderingBackend.h:37
Definition RenderDragonRenderingBackend.h:19
Definition RenderDragonRenderingBackend.h:21
Definition TextureData.h:7
Definition ResolvedIndexBufferResource.h:7
Definition ResolvedVertexBufferResource.h:7
Definition SamplerStateDescription.h:7
Definition DepthStencilTexture.h:7
Definition PipelineState.h:7
Definition RendererCaps.h:7
Definition Sampler2D.h:7
Definition SetMultipleVertexBuffersCmd.h:7
Definition SetPSConstantBuffersCmd.h:7
Definition SetPSSamplersCmd.h:7
Definition SetPSTexturesCmd.h:7
Definition SetPipelineStateCmd.h:7
Definition SetRenderTargetCmd.h:7
Definition SetScissorRectCmd.h:7
Definition SetVSConstantBuffersCmd.h:7
Definition SetViewportCmd.h:7
Definition Texture2D.h:7
Definition TextureObject.h:7
Definition UpdateBox.h:7
Definition float2.h:7