Debian Codegraph @

Sources/nCine/Graphics/RHI/GXM/GxmRhiCapabilities.h

raw
1 #pragma once
2
3 #include "../RhiCapabilitiesBase.h"
4 #include "GxmDevice.h"
5 #include "GxmRenderTarget.h"
6 #include "GxmTexture.h"
7
8 namespace nCine::RHI::GXM
9 {
10 /**
11 @brief Runtime capabilities of the GXM backend
12
13 sceGxm has no queryable API context, so the limits come from the device the window backend has already
14 created (see @ref RhiCapabilitiesBase::SetDeviceCapabilities()).
15 */
16 class GxmRhiCapabilities : public RhiCapabilitiesBase
17 {
18 public:
19 GxmRhiCapabilities()
20 {
21 // Real sceGxm limits: 4096 is the SGX543's largest 2D texture dimension. A uniform block is copied into
22 // the draw's default uniform buffer rather than bound as a buffer object (see GxmDevice::DrawCommon), so
23 // the 64 KB block budget is the engine-side one every other backend publishes - which also keeps the
24 // batch size at the value the generated Cg sources bake in - and the offset alignment is only the
25 // engine's own suballocation granularity of one std140 vec4. sceGxm binds one colour surface per scene,
26 // so MAX_COLOR_ATTACHMENTS is 1 (GxmRenderTarget::MaxColorAttachments).
27 // The batch size is stated rather than derived. A batched draw's instance array lives in the
28 // draw's *default uniform buffer*, which is uploaded per draw and indexed dynamically by the
29 // shader; sized from the 64 KB block budget above that array is 585 instances, i.e. 64 KB of
30 // per-draw uniform data for a PowerVR SGX543, which is not a shape this hardware is meant to be
31 // fed. The engine already forces a fixed batch on the PowerVR Rogue parts for the same reason
32 // (see Application::InitCommon()), one generation *newer* than the Vita's, so the same 10 is used.
33 SetDeviceCapabilities("GXM", GxmDevice::GetMaxTextureDimension(), std::int32_t(GxmTexture::MaxTextureUnits),
34 64 * 1024, GxmDevice::GetUniformBufferOffsetAlignment(), std::int32_t(GxmRenderTarget::MaxColorAttachments), 10);
35
36 LogCapabilities();
37 }
38 };
39 }