intel: Handle arbitrary compressed formats in intel_compressed_num_bytes.
Note that we don't support arbitrary block size for compressed quite yet -- block height of 4 is hard-coded all over the place. Bug #27098 (srgb dxt1 producing a bytes per pixel of 0).
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
#include "intel_context.h"
|
#include "intel_context.h"
|
||||||
#include "intel_tex.h"
|
#include "intel_tex.h"
|
||||||
#include "main/enums.h"
|
#include "main/enums.h"
|
||||||
|
#include "main/formats.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Choose hardware texture format given the user's glTexImage parameters.
|
* Choose hardware texture format given the user's glTexImage parameters.
|
||||||
@@ -208,22 +208,11 @@ intelChooseTextureFormat(GLcontext * ctx, GLint internalFormat,
|
|||||||
|
|
||||||
int intel_compressed_num_bytes(GLuint mesaFormat)
|
int intel_compressed_num_bytes(GLuint mesaFormat)
|
||||||
{
|
{
|
||||||
int bytes = 0;
|
GLuint bw, bh;
|
||||||
switch(mesaFormat) {
|
GLuint block_size;
|
||||||
|
|
||||||
case MESA_FORMAT_RGB_FXT1:
|
block_size = _mesa_get_format_bytes(mesaFormat);
|
||||||
case MESA_FORMAT_RGBA_FXT1:
|
_mesa_get_format_block_size(mesaFormat, &bw, &bh);
|
||||||
case MESA_FORMAT_RGB_DXT1:
|
|
||||||
case MESA_FORMAT_RGBA_DXT1:
|
return block_size / bh;
|
||||||
bytes = 2;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MESA_FORMAT_RGBA_DXT3:
|
|
||||||
case MESA_FORMAT_RGBA_DXT5:
|
|
||||||
bytes = 4;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return bytes;
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user