Debian Codegraph @

Sources/nCine/Graphics/RHI/RSX/RsxRhiCapabilities.h

raw
1 #pragma once
2
3 #include "../RhiCapabilitiesBase.h"
4 #include "RsxDevice.h"
5 #include "RsxRenderTarget.h"
6 #include "RsxTexture.h"
7
8 namespace nCine::RHI::RSX
9 {
10 /**
11 @brief Runtime capabilities of the RSX backend
12
13 libgcm has no queryable API context, so the limits come from the device the window backend has
14 already created (see @ref RhiCapabilitiesBase::SetDeviceCapabilities()).
15 */
16 class RsxRhiCapabilities : public RhiCapabilitiesBase
17 {
18 public:
19 RsxRhiCapabilities()
20 {
21 // Real RSX limits: 4096 is the NV47's largest 2D texture dimension, and it has 16 fragment
22 // texture units (the backend exposes the 8 the pipeline uses, see RsxTexture::MaxTextureUnits).
23 // The uniform block budget is NOT the 64 KB the other backends publish: a block reaches the
24 // vertex program through its constant registers, of which the vp40 profile allows a program 544
25 // in total, so this is a deliberately conservative byte figure rather than a derivation. The
26 // offset alignment is one std140 vec4, as elsewhere.
27 // The block size alone cannot bound the batch here, though - it is only a byte budget, and
28 // dividing it by an instance stride yields more instances than the microcode can address (65 at
29 // a stride of 112 against the 32 every batched variant is compiled for). MaxBatchSize is what
30 // actually caps it, and the batcher has to be told rather than left to derive it.
31 // The RSX can bind four colour surfaces at once, but this backend uses one
32 // (RsxRenderTarget::MaxColorAttachments) - the pipeline never asks for MRT.
33 SetDeviceCapabilities("RSX", RsxDevice::GetMaxTextureDimension(), std::int32_t(RsxTexture::MaxTextureUnits),
34 RsxDevice::GetMaxUniformBlockSize(), RsxDevice::GetUniformBufferOffsetAlignment(),
35 std::int32_t(RsxRenderTarget::MaxColorAttachments), std::int32_t(RsxDevice::MaxBatchSize));
36
37 LogCapabilities();
38 }
39 };
40 }