MCPcopy Create free account
hub / github.com/WilliamLCobb/iNDS / ClearFramebuffer

Method ClearFramebuffer

desmume/src/render3D.cpp:132–175  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

130}
131
132Render3DError Render3D::ClearFramebuffer(const GFX3D_State *renderState)
133{
134 Render3DError error = RENDER3DERROR_NOERR;
135
136 struct GFX3D_ClearColor
137 {
138 u8 r;
139 u8 g;
140 u8 b;
141 u8 a;
142 } clearColor;
143
144 clearColor.r = renderState->clearColor & 0x1F;
145 clearColor.g = (renderState->clearColor >> 5) & 0x1F;
146 clearColor.b = (renderState->clearColor >> 10) & 0x1F;
147 clearColor.a = (renderState->clearColor >> 16) & 0x1F;
148
149 const u8 clearStencil = (renderState->clearColor >> 24) & 0x3F;
150
151 if (renderState->enableClearImage)
152 {
153 const u16 *__restrict clearColorBuffer = (u16 *__restrict)MMU.texInfo.textureSlotAddr[2];
154 const u16 *__restrict clearDepthBuffer = (u16 *__restrict)MMU.texInfo.textureSlotAddr[3];
155 const u16 scrollBits = T1ReadWord(MMU.ARM9_REG, 0x356); //CLRIMAGE_OFFSET
156 const u8 xScroll = scrollBits & 0xFF;
157 const u8 yScroll = (scrollBits >> 8) & 0xFF;
158
159 error = this->UpdateClearImage(clearColorBuffer, clearDepthBuffer, clearStencil, xScroll, yScroll);
160 if (error == RENDER3DERROR_NOERR)
161 {
162 error = this->ClearUsingImage();
163 }
164 else
165 {
166 error = this->ClearUsingValues(clearColor.r, clearColor.g, clearColor.b, clearColor.a, renderState->clearDepth, clearStencil);
167 }
168 }
169 else
170 {
171 error = this->ClearUsingValues(clearColor.r, clearColor.g, clearColor.b, clearColor.a, renderState->clearDepth, clearStencil);
172 }
173
174 return error;
175}
176
177Render3DError Render3D::ClearUsingImage() const
178{

Callers 1

RenderMethod · 0.95

Calls 4

UpdateClearImageMethod · 0.95
ClearUsingImageMethod · 0.95
ClearUsingValuesMethod · 0.95
T1ReadWordFunction · 0.85

Tested by

no test coverage detected