sead
Loading...
Searching...
No Matches
aglRenderTarget.hpp
Go to the documentation of this file.
1
#
pragma
once
2
3
#
include
<
detail
/
aglGX2
.
h
>
4
5
namespace
agl
{
6
7
template
<
typename
T
>
8
void
RenderTarget
<
T
>::
applyTextureData
(
const
TextureData
&
texture_data
)
9
{
10
applyTextureData
(
texture_data
,
mMipLevel
,
mSlice
);
11
}
12
13
template
<
typename
T
>
14
void
RenderTarget
<
T
>::
applyTextureData
(
const
TextureData
&
texture_data
,
u32
mip_level
,
u32
slice
)
15
{
16
if
(
mTextureData
!=
texture_data
)
17
applyTextureData_
(
texture_data
,
mip_level
,
slice
);
18
19
else
20
{
21
void
*
image_ptr
=
texture_data
.
getImagePtr
();
22
void
*
mip_ptr
=
texture_data
.
getMipPtr
();
23
24
mTextureData
.
setImagePtr
(
image_ptr
);
25
mTextureData
.
setMipPtr
(
mip_ptr
);
26
27
static_cast
<
T
*>(
this
)->
mInnerBuffer
.
surface
.
imagePtr
=
image_ptr
;
28
static_cast
<
T
*>(
this
)->
mInnerBuffer
.
surface
.
mipPtr
=
mip_ptr
;
29
30
setSlice
(
slice
);
31
setMipLevel
(
mip_level
);
32
}
33
}
34
35
template
<
typename
T
>
36
void
RenderTarget
<
T
>::
applyTextureData_
(
const
TextureData
&
texture_data
,
u32
mip_level
,
u32
slice
)
37
{
38
mTextureData
=
texture_data
;
39
mMipLevel
=
mip_level
;
40
mSlice
=
slice
;
41
static_cast
<
T
*>(
this
)->
onApplyTextureData_
();
42
mUpdateRegs
=
true
;
43
}
44
45
inline
void
46
RenderTargetColor
::
copyToDisplayBuffer
(
const
sead
::
DisplayBufferCafe
*
display_buffer
)
const
47
{
48
copyToDisplayBuffer
(
49
display_buffer
->
getScanOutTarget
() ==
sead
::
DisplayBufferCafe
::
cTarget_TV
50
?
GX2_SCAN_TARGET_TV
51
:
GX2_SCAN_TARGET_DRC_FIRST
52
);
53
}
54
55
inline
void
56
RenderTargetColor
::
copyToDisplayBuffer
(
GX2ScanTarget
scan_target
)
const
57
{
58
GX2ColorBuffer
color_buffer
;
59
color_buffer
.
surface
.
width
=
mInnerBuffer
.
surface
.
width
;
60
color_buffer
.
surface
.
height
=
mInnerBuffer
.
surface
.
height
;
61
62
GX2SetViewport
(
63
0.0f, 0.0f,
64
f32
(
s32
(
color_buffer
.
surface
.
width
)),
f32
(
s32
(
color_buffer
.
surface
.
height
)),
65
0.0f, 1.0f
66
);
67
68
GX2SetScissor
(
69
0, 0,
70
color_buffer
.
surface
.
width
,
color_buffer
.
surface
.
height
71
);
72
73
if
(
scan_target
==
GX2_SCAN_TARGET_TV
)
74
{
75
GX2InitColorBufferFTV
(
76
&
color_buffer
,
77
color_buffer
.
surface
.
width
,
color_buffer
.
surface
.
height
,
78
mInnerBuffer
.
surface
.
format
,
79
mInnerBuffer
.
surface
.
aa
80
);
81
GX2InitColorBufferPtr
(&
color_buffer
,
mInnerBuffer
.
surface
.
imagePtr
);
82
GX2InitColorBufferAuxPtr
(&
color_buffer
,
mInnerBuffer
.
auxPtr
);
83
84
GX2CopyColorBufferToScanBuffer
(&
color_buffer
,
scan_target
);
85
driver
::
GX2Resource
::
instance
()->
restoreContextState
();
86
}
87
else
88
{
89
GX2CopyColorBufferToScanBuffer
(&
mInnerBuffer
,
scan_target
);
90
driver
::
GX2Resource
::
instance
()->
restoreContextState
();
91
}
92
}
93
94
inline
void
95
RenderTargetColor
::
expandAuxBuffer
()
const
96
{
97
if
(!
mpAuxBuffer
)
98
return
;
99
100
if
(
mUpdateRegs
)
101
{
102
initRegs_
();
103
mUpdateRegs
=
false
;
104
}
105
106
GX2ExpandAAColorBuffer
(&
mInnerBuffer
);
107
driver
::
GX2Resource
::
instance
()->
restoreContextState
();
108
}
109
110
inline
void
111
RenderTargetColor
::
bind
(
s32
target_index
)
const
112
{
113
if
(
mUpdateRegs
)
114
{
115
initRegs_
();
116
mUpdateRegs
=
false
;
117
}
118
119
GX2SetColorBuffer
(&
mInnerBuffer
,
GX2RenderTarget
(
target_index
));
120
}
121
122
inline
void
123
RenderTargetDepth
::
expandHiZBuffer
()
const
124
{
125
if
(!
mpHiZBuffer
)
126
return
;
127
128
if
(
mUpdateRegs
)
129
{
130
initRegs_
();
131
mUpdateRegs
=
false
;
132
}
133
134
GX2ExpandDepthBuffer
(&
mInnerBuffer
);
135
driver
::
GX2Resource
::
instance
()->
restoreContextState
();
136
}
137
138
inline
void
139
RenderTargetDepth
::
bind
()
const
140
{
141
if
(
mUpdateRegs
)
142
{
143
initRegs_
();
144
mUpdateRegs
=
false
;
145
}
146
147
GX2SetDepthBuffer
(&
mInnerBuffer
);
148
}
149
150
}
agl
Definition
aglDisplayList.cpp:5
packages
agl
include
common
aglRenderTarget.hpp
Generated by
1.14.0