MCPcopy Create free account
hub / github.com/DaedalusX64/daedalus / Initialise

Method Initialise

Source/HLEGraphics/CachedTexture.cpp:229–256  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

227}
228
229bool CachedTexture::Initialise()
230{
231 #ifdef DAEDALUS_ENABLE_ASSERTS
232 DAEDALUS_ASSERT_Q(mpTexture == nullptr);
233 #endif
234 u32 width {mTextureInfo.GetWidth()};
235 u32 height {mTextureInfo.GetHeight()};
236
237 if (mTextureInfo.GetEmulateMirrorS()) width *= 2;
238 if (mTextureInfo.GetEmulateMirrorT()) height *= 2;
239
240 mpTexture = CNativeTexture::Create( width, height, SelectNativeFormat(mTextureInfo) );
241 if( mpTexture != nullptr )
242 {
243 // If this we're performing Texture updated checks, randomly offset the
244 // 'FrameLastUpToDate' time. This ensures when lots of textures are
245 // created on the same frame we update them over a nice distribution of frames.
246
247 if(gCheckTextureHashFrequency > 0)
248 {
249 mFrameLastUpToDate = gRDPFrame + (FastRand() & (gCheckTextureHashFrequency - 1));
250 }
251 UpdateTextureHash();
252 UpdateTexture( mTextureInfo, mpTexture );
253 }
254
255 return mpTexture != nullptr;
256}
257
258// Update the hash of the texture. Returns true if the texture should be updated.
259bool CachedTexture::UpdateTextureHash()

Callers 1

CreateMethod · 0.45

Calls 8

SelectNativeFormatFunction · 0.85
FastRandFunction · 0.85
UpdateTextureFunction · 0.85
GetEmulateMirrorSMethod · 0.80
GetEmulateMirrorTMethod · 0.80
CreateFunction · 0.50
GetWidthMethod · 0.45
GetHeightMethod · 0.45

Tested by

no test coverage detected