MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / getSurfaceSize

Method getSurfaceSize

Engine/source/gfx/bitmap/ddsLoader.cpp:160–195  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

158}
159
160U32 DDSFile::getSurfaceSize( U32 height, U32 width, U32 mipLevel ) const
161{
162 // Bump by the mip level.
163 height = getMax(U32(1), height >> mipLevel);
164 width = getMax(U32(1), width >> mipLevel);
165
166 if(mFlags.test(CompressedData))
167 {
168 // From the directX docs:
169 // max(1, width � 4) x max(1, height � 4) x 8(DXT1) or 16(DXT2-5)
170
171 U32 sizeMultiple = 0;
172
173 switch(mFormat)
174 {
175 case GFXFormatDXT1:
176 sizeMultiple = 8;
177 break;
178 case GFXFormatDXT2:
179 case GFXFormatDXT3:
180 case GFXFormatDXT4:
181 case GFXFormatDXT5:
182 sizeMultiple = 16;
183 break;
184 default:
185 AssertISV(false, "DDSFile::getSurfaceSize - invalid compressed texture format, we only support DXT1-5 right now.");
186 break;
187 }
188
189 return getMax(U32(1), width/4) * getMax(U32(1), height/4) * sizeMultiple;
190 }
191 else
192 {
193 return height * width* mBytesPerPixel;
194 }
195}
196
197U32 DDSFile::getSizeInBytes() const
198{

Callers 12

_loadTextureMethod · 0.45
initStaticMethod · 0.45
initStaticMethod · 0.45
_loadTextureMethod · 0.45
initStaticMethod · 0.45
DDSFileMethod · 0.45
dumpImageMethod · 0.45
readNextMipMethod · 0.45
writeNextMipMethod · 0.45
squishDDSMethod · 0.45
swizzleDDSMethod · 0.45

Calls 3

getMaxFunction · 0.85
U32Enum · 0.50
testMethod · 0.45

Tested by

no test coverage detected