sead
Loading...
Searching...
No Matches
aglRenderTarget.h
Go to the documentation of this file.
1#pragma once
2
3#include <common/aglTextureData.h>
4#include <gfx/cafe/seadFrameBufferCafe.h>
5#include <basis/seadAssert.h>
6
7namespace agl {
8
9template <typename T>
11{
12public:
13 static const u32 cMipLevelMax = 14;
14
15public:
17 : mTextureData()
18 , mUpdateRegs(true)
19 , mMipLevel(0)
20 , mSlice(0)
21 {
22 }
23
24 TextureData& getTextureData() { return mTextureData; }
25 const TextureData& getTextureData() const { return mTextureData; }
26
27 u32 getMipLevel() const { return mMipLevel; }
28 u32 getSlice() const { return mSlice; }
29
30 void setSlice(u32 slice)
31 {
32 if (mSlice != slice)
33 {
34 mSlice = slice;
35 mUpdateRegs = true;
36 }
37 }
38
39 void setMipLevel(u32 mip_level)
40 {
41 SEAD_ASSERT(mip_level < cMipLevelMax);
42 if (mMipLevel != mip_level)
43 {
44 mMipLevel = mip_level;
45 mUpdateRegs = true;
46 }
47 }
48
49 void applyTextureData(const TextureData& texture_data);
50 void applyTextureData(const TextureData& texture_data, u32 mip_level, u32 slice);
51
52protected:
53 void applyTextureData_(const TextureData& texture_data, u32 mip_level, u32 slice);
54
55protected:
57 mutable bool mUpdateRegs;
60};
61static_assert(sizeof(RenderTarget<void>) == 0xA8);
62
63class RenderBuffer;
64
66{
68 friend class RenderTarget<RenderTargetColor>;
69
70public:
72 RenderTargetColor(const TextureData& texture_data, u32 mip_level, u32 slice);
73
74 u32 getAuxBufferSize() const { return mAuxBufferSize; }
75 u32 getAuxBufferAlign() const { return mAuxBufferAlign; }
76
77 // TODO
78 //void setAuxBuffer(void* buffer) { mpAuxBuffer = buffer; }
79
80 void copyToDisplayBuffer(const sead::DisplayBufferCafe* display_buffer) const;
81 void copyToDisplayBuffer(GX2ScanTarget scan_target) const;
82
83 void expandAuxBuffer() const;
84
85 void invalidateGPUCache() const;
86
87 void bind(s32 target_index) const;
88
89private:
90 void initRegs_() const;
91
92protected:
98
99 friend class RenderBuffer;
100};
101static_assert(sizeof(RenderTargetColor) == 0x154, "agl::RenderTargetColor size mismatch");
102
104{
106 friend class RenderTarget<RenderTargetDepth>;
107
108public:
110 RenderTargetDepth(const TextureData& texture_data, u32 mip_level, u32 slice);
111
112 u32 getHiZBufferSize() const { return mHiZBufferSize; }
113 u32 getHiZBufferAlign() const { return mHiZBufferAlign; }
114
115 // TODO
116 //void setHiZBuffer(void* buffer) { mpHiZBuffer = buffer; }
117
118 void expandHiZBuffer() const;
119
120 void invalidateGPUCache() const;
121
122 void bind() const;
123
124private:
125 void initRegs_() const;
126
127protected:
132
133 friend class RenderBuffer;
134};
135static_assert(sizeof(RenderTargetDepth) == 0x160, "agl::RenderTargetDepth size mismatch");
136
137}
138
139#ifdef __cplusplus
140
141#include <common/aglRenderTarget.hpp>
142
143#endif // __cplusplus
Definition aglRenderBuffer.h:15
Definition aglRenderTarget.h:66
RenderTargetColor(const TextureData &texture_data, u32 mip_level, u32 slice)
bool mIsMSAA2D
Definition aglRenderTarget.h:93
void expandAuxBuffer() const
Definition aglRenderTarget.hpp:95
void copyToDisplayBuffer(const sead::DisplayBufferCafe *display_buffer) const
Definition aglRenderTarget.hpp:46
void * mpAuxBuffer
Definition aglRenderTarget.h:96
void invalidateGPUCache() const
Definition aglRenderTarget.cpp:28
void copyToDisplayBuffer(GX2ScanTarget scan_target) const
Definition aglRenderTarget.hpp:56
u32 getAuxBufferSize() const
Definition aglRenderTarget.h:74
void initRegs_() const
Definition aglRenderTarget.cpp:37
u32 getAuxBufferAlign() const
Definition aglRenderTarget.h:75
GX2ColorBuffer mInnerBuffer
Definition aglRenderTarget.h:97
RenderTargetColor()
Definition aglRenderTarget.cpp:17
void bind(s32 target_index) const
Definition aglRenderTarget.hpp:111
u32 mAuxBufferSize
Definition aglRenderTarget.h:94
void onApplyTextureData_()
Definition aglRenderTarget.cpp:6
u32 mAuxBufferAlign
Definition aglRenderTarget.h:95
Definition aglRenderTarget.h:104
u32 mHiZBufferSize
Definition aglRenderTarget.h:128
u32 mHiZBufferAlign
Definition aglRenderTarget.h:129
void * mpHiZBuffer
Definition aglRenderTarget.h:130
u32 getHiZBufferAlign() const
Definition aglRenderTarget.h:113
void bind() const
Definition aglRenderTarget.hpp:139
GX2DepthBuffer mInnerBuffer
Definition aglRenderTarget.h:131
RenderTargetDepth()
Definition aglRenderTarget.cpp:54
void onApplyTextureData_()
Definition aglRenderTarget.cpp:46
u32 getHiZBufferSize() const
Definition aglRenderTarget.h:112
RenderTargetDepth(const TextureData &texture_data, u32 mip_level, u32 slice)
void expandHiZBuffer() const
Definition aglRenderTarget.hpp:123
void invalidateGPUCache() const
void initRegs_() const
Definition aglRenderTarget.cpp:65
Definition aglRenderTarget.h:11
const TextureData & getTextureData() const
Definition aglRenderTarget.h:25
u32 mMipLevel
Definition aglRenderTarget.h:58
u32 getMipLevel() const
Definition aglRenderTarget.h:27
void applyTextureData_(const TextureData &texture_data, u32 mip_level, u32 slice)
Definition aglRenderTarget.hpp:36
TextureData & getTextureData()
Definition aglRenderTarget.h:24
void applyTextureData(const TextureData &texture_data, u32 mip_level, u32 slice)
Definition aglRenderTarget.hpp:14
u32 mSlice
Definition aglRenderTarget.h:59
u32 getSlice() const
Definition aglRenderTarget.h:28
TextureData mTextureData
Definition aglRenderTarget.h:56
void applyTextureData(const TextureData &texture_data)
Definition aglRenderTarget.hpp:8
static const u32 cMipLevelMax
Definition aglRenderTarget.h:13
void setMipLevel(u32 mip_level)
Definition aglRenderTarget.h:39
RenderTarget()
Definition aglRenderTarget.h:16
bool mUpdateRegs
Definition aglRenderTarget.h:57
void setSlice(u32 slice)
Definition aglRenderTarget.h:30
Definition aglTextureData.h:11
Definition seadFrameBufferCafe.h:52
Definition aglDisplayList.cpp:5
Definition seadAssert.h:44
#define SEAD_ASSERT(condition)
Definition seadAssert.h:24