Guest User

Untitled

a guest
Sep 13th, 2021
322
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.33 KB | None | 0 0
  1.     //int blockWidth = width / blockSizeX;          // width of image in blocks
  2.     //int blockHeight = height / blockSizeY;            // height of image in blocks
  3.  
  4.     int blockWidth = (width + (blockSizeX - 1)) / blockSizeX;           // width of image in blocks
  5.     int blockHeight = (height + (blockSizeY - 1)) / (blockSizeY - 1);   // height of image in blocks
  6.  
  7.     // Term "GOB" means "group of bytes". bytes_per_gob_y affects only gobOffset value.
  8.     int gobs_per_block_x = (blockWidth * bytesPerBlock + 63) / 64;
  9.     int bytes_per_gob_x = 64;
  10.  
  11.     int multi = height / width;
  12.     int bytes_per_gob_y = 8 * multi;
  13.  
  14.     /*if (blockSizeX == 1 && blockSizeY == 1)
  15.     {
  16.         // Uncompressed tiled texture
  17.         bytes_per_gob_y = 16;
  18.         if (blockHeight < 128) bytes_per_gob_y = 8;
  19.         //?? didn't find when to switch to value 8 (but it seems code works well anyway)
  20.     }*/
  21.  
  22.     int gob_bytes = bytes_per_gob_x * bytes_per_gob_y; // usually has value 512
  23.  
  24.     // Smaller textures has different memory layout
  25.     /*if (blockHeight < 64) bytes_per_gob_y = 4;
  26.     if (blockHeight < 32) bytes_per_gob_y = 2;
  27.     if (blockHeight < 16) bytes_per_gob_y = 1;*/
  28.  
  29.     // Smaller textures has different memory layout
  30.     if (blockHeight < 48) bytes_per_gob_y = 4;
  31.     if (blockHeight < 24) bytes_per_gob_y = 2;
  32.     if (blockHeight < 16) bytes_per_gob_y = 1;
  33.  
  34.     ////////......////////
  35.     if (swzAddr >= dataSize)
  36.         return true;
  37.    
Advertisement
Add Comment
Please, Sign In to add comment