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

Method getSurfaceSize

Engine/source/gfx/bitmap/ddsFile.cpp:117–152  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

115}
116
117U32 DDSFile::getSurfaceSize( U32 height, U32 width, U32 mipLevel ) const
118{
119 // Bump by the mip level.
120 height = getMax(U32(1), height >> mipLevel);
121 width = getMax(U32(1), width >> mipLevel);
122
123 if(mFlags.test(CompressedData))
124 {
125 // From the directX docs:
126 // max(1, width � 4) x max(1, height � 4) x 8(DXT1) or 16(DXT2-5)
127
128 U32 sizeMultiple = 0;
129
130 switch(mFormat)
131 {
132 case GFXFormatBC1:
133 case GFXFormatBC4:
134 sizeMultiple = 8;
135 break;
136 case GFXFormatBC2:
137 case GFXFormatBC3:
138 case GFXFormatBC5:
139 sizeMultiple = 16;
140 break;
141 default:
142 AssertISV(false, "DDSFile::getSurfaceSize - invalid compressed texture format, we only support DXT1-5 right now.");
143 break;
144 }
145
146 return getMax(U32(1), width/4) * getMax(U32(1), height/4) * sizeMultiple;
147 }
148 else
149 {
150 return height * width* mBytesPerPixel;
151 }
152}
153
154U32 DDSFile::getSizeInBytes() const
155{

Callers 11

copyToBmpMethod · 0.45
initStaticMethod · 0.45
_loadTextureMethod · 0.45
ddsCompressFunction · 0.45
swizzleDDSFunction · 0.45
DDSFileMethod · 0.45
dumpImageMethod · 0.45
readNextMipMethod · 0.45
writeNextMipMethod · 0.45

Calls 3

getMaxFunction · 0.85
U32Enum · 0.50
testMethod · 0.45

Tested by

no test coverage detected