Debian Codegraph @

Sources/nCine/Graphics/RHI/PVR/PvrRenderTarget.cpp

raw
1 #include "PvrRenderTarget.h"
2 #include "PvrDevice.h"
3 #include "PvrTexture.h"
4
5 namespace nCine::RHI::PVR
6 {
7 PvrRenderTarget::PvrRenderTarget()
8 : _numDrawBuffers(1)
9 {
10 for (std::uint32_t i = 0; i < MaxColorAttachments; i++) {
11 _colorTextures[i] = nullptr;
12 }
13 }
14
15 PvrRenderTarget::~PvrRenderTarget()
16 {
17 // Clear from the device so a destroyed target can't dangle as _currentRenderTarget
18 PvrDevice::UnbindRenderTarget(this);
19 }
20
21 void PvrRenderTarget::AttachColorTexture(PvrTexture& texture, std::uint32_t index)
22 {
23 if (index < MaxColorAttachments) {
24 _colorTextures[index] = &texture;
25 // Tag the texture so the rasterizer treats its store as bottom-up (GL framebuffer convention)
26 // both when drawing into it and when later sampling it as a source
27 texture.SetRenderTarget(true);
28 }
29 }
30
31 void PvrRenderTarget::DetachColorTexture(std::uint32_t index)
32 {
33 if (index < MaxColorAttachments) {
34 _colorTextures[index] = nullptr;
35 }
36 }
37
38 void PvrRenderTarget::AttachDepthStencil(DepthStencilFormat format, std::int32_t width, std::int32_t height)
39 {
40 static_cast<void>(format);
41 static_cast<void>(width);
42 static_cast<void>(height);
43 }
44
45 void PvrRenderTarget::DetachDepthStencil(DepthStencilFormat format)
46 {
47 static_cast<void>(format);
48 }
49
50 void PvrRenderTarget::BindDraw()
51 {
52 PvrDevice::SetRenderTarget(this);
53 }
54
55 void PvrRenderTarget::UnbindDraw()
56 {
57 PvrDevice::SetRenderTarget(nullptr);
58 }
59
60 bool PvrRenderTarget::SetDrawBuffers(std::uint32_t numColorAttachments)
61 {
62 _numDrawBuffers = numColorAttachments;
63 return true;
64 }
65
66 bool PvrRenderTarget::IsStatusComplete()
67 {
68 return (_colorTextures[0] != nullptr);
69 }
70
71 void PvrRenderTarget::InvalidateDepthStencil(DepthStencilFormat format)
72 {
73 static_cast<void>(format);
74 }
75
76 void PvrRenderTarget::SetObjectLabel(StringView label)
77 {
78 static_cast<void>(label);
79 }
80 }