Implement more pvr constants

This commit is contained in:
Luke Benstead 2021-04-04 22:17:24 +01:00
parent 6361cd415e
commit 7e879b2c61
6 changed files with 182 additions and 86 deletions

View File

@ -160,7 +160,7 @@ static GL_NO_INSTRUMENT GLboolean _glCalculateAverageTexel(GLuint pvrFormat, con
const GLubyte ARGB4444 = 1;
const GLubyte RGB565 = 2;
if((pvrFormat & PVR_TXRFMT_PAL8BPP) == PVR_TXRFMT_PAL8BPP) {
if((pvrFormat & GPU_TXRFMT_PAL8BPP) == GPU_TXRFMT_PAL8BPP) {
/* Paletted... all we can do really is just pick one of the
* 4 texels.. unless we want to change the palette (bad) or
* pick the closest available colour (slow, and probably bad)
@ -232,7 +232,7 @@ GLboolean _glGenerateMipmapTwiddled(const GLuint pvrFormat, const GLubyte* prevD
uint32_t i, j;
uint32_t stride = 0;
if((pvrFormat & PVR_TXRFMT_PAL8BPP) == PVR_TXRFMT_PAL8BPP) {
if((pvrFormat & GPU_TXRFMT_PAL8BPP) == GPU_TXRFMT_PAL8BPP) {
stride = 1;
} else {
stride = 2;
@ -281,7 +281,7 @@ void APIENTRY glGenerateMipmapEXT(GLenum target) {
return;
}
if((tex->color & PVR_TXRFMT_NONTWIDDLED) == PVR_TXRFMT_NONTWIDDLED) {
if((tex->color & GPU_TXRFMT_NONTWIDDLED) == GPU_TXRFMT_NONTWIDDLED) {
/* glTexImage2D should twiddle internally textures in nearly all cases
* so this error is unlikely */

View File

@ -6,7 +6,7 @@ void APIENTRY gluPerspective(GLfloat angle, GLfloat aspect,
GLfloat znear, GLfloat zfar) {
GLfloat fW, fH;
fH = tanf(angle * (F_PI / 360.0f)) * znear;
fH = tanf(angle * (M_PI / 360.0f)) * znear;
fW = fH * aspect;
glFrustum(-fW, fW, -fH, fH, znear, zfar);

View File

@ -8,6 +8,11 @@ typedef enum GPUAlpha {
GPU_ALPHA_ENABLE = 1
} GPUAlpha;
typedef enum GPUTexture {
GPU_TEXTURE_DISABLE = 0,
GPU_TEXTURE_ENABLE = 1
} GPUTexture;
typedef enum GPUTextureAlpha {
GPU_TXRALPHA_DISABLE = 1,
GPU_TXRALPHA_ENABLE = 0
@ -32,7 +37,6 @@ typedef enum GPUBlend {
GPU_BLEND_INVDESTALPHA = 7
} GPUBlend;
typedef enum GPUDepthCompare {
GPU_DEPTHCMP_NEVER = 0,
GPU_DEPTHCMP_LESS = 1,
@ -44,6 +48,105 @@ typedef enum GPUDepthCompare {
GPU_DEPTHCMP_ALWAYS = 7
} GPUDepthCompare;
typedef enum GPUTextureFormat {
GPU_TXRFMT_NONE,
GPU_TXRFMT_VQ_DISABLE = (0 << 30),
GPU_TXRFMT_VQ_ENABLE = (1 << 30),
GPU_TXRFMT_ARGB1555 = (0 << 27),
GPU_TXRFMT_RGB565 = (1 << 27),
GPU_TXRFMT_ARGB4444 = (2 << 27),
GPU_TXRFMT_YUV422 = (3 << 27),
GPU_TXRFMT_BUMP = (4 << 27),
GPU_TXRFMT_PAL4BPP = (5 << 27),
GPU_TXRFMT_PAL8BPP = (6 << 27),
GPU_TXRFMT_TWIDDLED = (0 << 26),
GPU_TXRFMT_NONTWIDDLED = (1 << 26),
GPU_TXRFMT_NOSTRIDE = (0 << 21),
GPU_TXRFMT_STRIDE = (1 << 21)
} GPUTextureFormat;
typedef enum GPUCulling {
GPU_CULLING_NONE = 0,
GPU_CULLING_SMALL = 1,
GPU_CULLING_CCW = 2,
GPU_CULLING_CW = 3
} GPUCulling;
typedef enum GPUUVFlip {
GPU_UVFLIP_NONE = 0,
GPU_UVFLIP_V = 1,
GPU_UVFLIP_U = 2,
GPU_UVFLIP_UV = 3
} GPUUVFlip;
typedef enum GPUUVClamp {
GPU_UVCLAMP_NONE = 0,
GPU_UVCLAMP_V = 1,
GPU_UVCLAMP_U = 2,
GPU_UVCLAMP_UV = 3
} GPUUVClamp;
typedef enum GPUColorClamp {
GPU_CLRCLAMP_DISABLE = 0,
GPU_CLRCLAMP_ENABLE = 1
} GPUColorClamp;
typedef enum GPUFilter {
GPU_FILTER_NEAREST = 0,
GPU_FILTER_BILINEAR = 2,
GPU_FILTER_TRILINEAR1 = 4,
GPU_FILTER_TRILINEAR2 = 6
} GPUFilter;
typedef enum GPUDepthWrite {
GPU_DEPTHWRITE_ENABLE = 0,
GPU_DEPTHWRITE_DISABLE = 1
} GPUDepthWrite;
typedef enum GPUUserClip {
GPU_USERCLIP_DISABLE = 0,
GPU_USERCLIP_INSIDE = 2,
GPU_USERCLIP_OUTSIDE = 3
} GPUUserClip;
typedef enum GPUColorFormat {
GPU_CLRFMT_ARGBPACKED = 0,
GPU_CLRFMT_4FLOATS = 1,
GPU_CLRFMT_INTENSITY = 2,
GPU_CLRFMT_INTENSITY_PREV = 3
} GPUColorFormat;
typedef enum GPUUVFormat {
GPU_UVFMT_32BIT = 0,
GPU_UVFMT_16BIT = 1
} GPUUVFormat;
typedef enum GPUPaletteFormat {
GPU_PAL_ARGB1555 = 0,
GPU_PAL_RGB565 = 1,
GPU_PAL_ARGB4444 = 2,
GPU_PAL_ARGB8888 = 3
} GPUPaletteFormat;
typedef enum GPUFog {
GPU_FOG_TABLE = 0,
GPU_FOG_VERTEX = 1,
GPU_FOG_DISABLE = 2,
GPU_FOG_TABLE2 = 3
} GPUFog;
typedef enum GPUShade {
GPU_SHADE_FLAT = 0,
GPU_SHADE_GOURAUD = 1
} GPUShade;
typedef enum GPUTextureEnv {
GPU_TXRENV_REPLACE = 0,
GPU_TXRENV_MODULATE = 1,
GPU_TXRENV_DECAL = 2,
GPU_TXRENV_MODULATEALPHA = 3
} GPUTextureEnv;
/* Duplication of pvr_poly_cxt_t from KOS so that we can
* compile on non-KOS platforms for testing */

View File

@ -1,4 +1,3 @@
#include <kos.h>
#include <stdint.h>
#include <string.h>
#include <stdio.h>

View File

@ -2,10 +2,6 @@
#include <string.h>
#include <stdio.h>
#include <dc/pvr.h>
#include <dc/vec3f.h>
#include <dc/video.h>
#include "../include/gl.h"
#include "../include/glext.h"
#include "../include/glkos.h"
@ -43,12 +39,12 @@ GLboolean _glIsSharedTexturePaletteEnabled() {
static int _calc_pvr_face_culling() {
if(!CULLING_ENABLED) {
return PVR_CULLING_NONE;
return GPU_CULLING_NONE;
} else {
if(CULL_FACE == GL_BACK) {
return (FRONT_FACE == GL_CW) ? PVR_CULLING_CCW : PVR_CULLING_CW;
return (FRONT_FACE == GL_CW) ? GPU_CULLING_CCW : GPU_CULLING_CW;
} else {
return (FRONT_FACE == GL_CCW) ? PVR_CULLING_CCW : PVR_CULLING_CW;
return (FRONT_FACE == GL_CCW) ? GPU_CULLING_CCW : GPU_CULLING_CW;
}
}
}
@ -58,28 +54,28 @@ static GLboolean DEPTH_TEST_ENABLED = GL_FALSE;
static int _calc_pvr_depth_test() {
if(!DEPTH_TEST_ENABLED) {
return PVR_DEPTHCMP_ALWAYS;
return GPU_DEPTHCMP_ALWAYS;
}
switch(DEPTH_FUNC) {
case GL_NEVER:
return PVR_DEPTHCMP_NEVER;
return GPU_DEPTHCMP_NEVER;
case GL_LESS:
return PVR_DEPTHCMP_GREATER;
return GPU_DEPTHCMP_GREATER;
case GL_EQUAL:
return PVR_DEPTHCMP_EQUAL;
return GPU_DEPTHCMP_EQUAL;
case GL_LEQUAL:
return PVR_DEPTHCMP_GEQUAL;
return GPU_DEPTHCMP_GEQUAL;
case GL_GREATER:
return PVR_DEPTHCMP_LESS;
return GPU_DEPTHCMP_LESS;
case GL_NOTEQUAL:
return PVR_DEPTHCMP_NOTEQUAL;
return GPU_DEPTHCMP_NOTEQUAL;
case GL_GEQUAL:
return PVR_DEPTHCMP_LEQUAL;
return GPU_DEPTHCMP_LEQUAL;
break;
case GL_ALWAYS:
default:
return PVR_DEPTHCMP_ALWAYS;
return GPU_DEPTHCMP_ALWAYS;
}
}
@ -105,32 +101,32 @@ GLboolean _glIsAlphaTestEnabled() {
static int _calcPVRBlendFactor(GLenum factor) {
switch(factor) {
case GL_ZERO:
return PVR_BLEND_ZERO;
return GPU_BLEND_ZERO;
case GL_SRC_ALPHA:
return PVR_BLEND_SRCALPHA;
return GPU_BLEND_SRCALPHA;
case GL_DST_COLOR:
return PVR_BLEND_DESTCOLOR;
return GPU_BLEND_DESTCOLOR;
case GL_DST_ALPHA:
return PVR_BLEND_DESTALPHA;
return GPU_BLEND_DESTALPHA;
case GL_ONE_MINUS_DST_COLOR:
return PVR_BLEND_INVDESTCOLOR;
return GPU_BLEND_INVDESTCOLOR;
case GL_ONE_MINUS_SRC_ALPHA:
return PVR_BLEND_INVSRCALPHA;
return GPU_BLEND_INVSRCALPHA;
case GL_ONE_MINUS_DST_ALPHA:
return PVR_BLEND_INVDESTALPHA;
return GPU_BLEND_INVDESTALPHA;
case GL_ONE:
return PVR_BLEND_ONE;
return GPU_BLEND_ONE;
default:
fprintf(stderr, "Invalid blend mode: %u\n", (unsigned int) factor);
return PVR_BLEND_ONE;
return GPU_BLEND_ONE;
}
}
static void _updatePVRBlend(pvr_poly_cxt_t* context) {
static void _updatePVRBlend(PolyContext* context) {
if(BLEND_ENABLED || ALPHA_TEST_ENABLED) {
context->gen.alpha = PVR_ALPHA_ENABLE;
context->gen.alpha = GPU_ALPHA_ENABLE;
} else {
context->gen.alpha = PVR_ALPHA_DISABLE;
context->gen.alpha = GPU_ALPHA_DISABLE;
}
context->blend.src = _calcPVRBlendFactor(BLEND_SFACTOR);
@ -162,17 +158,17 @@ void _glUpdatePVRTextureContext(PolyContext *context, GLshort textureUnit) {
const TextureObject *tx1 = (textureUnit == 0) ? _glGetTexture0() : _glGetTexture1();
/* Disable all texturing to start with */
context->txr.enable = PVR_TEXTURE_DISABLE;
context->txr2.enable = PVR_TEXTURE_DISABLE;
context->txr2.alpha = PVR_TXRALPHA_DISABLE;
context->txr.enable = GPU_TEXTURE_DISABLE;
context->txr2.enable = GPU_TEXTURE_DISABLE;
context->txr2.alpha = GPU_TXRALPHA_DISABLE;
if(!TEXTURES_ENABLED[textureUnit] || !tx1) {
return;
}
context->txr.alpha = (BLEND_ENABLED || ALPHA_TEST_ENABLED) ? PVR_TXRALPHA_ENABLE : PVR_TXRALPHA_DISABLE;
context->txr.alpha = (BLEND_ENABLED || ALPHA_TEST_ENABLED) ? GPU_TXRALPHA_ENABLE : GPU_TXRALPHA_DISABLE;
GLuint filter = PVR_FILTER_NEAREST;
GLuint filter = GPU_FILTER_NEAREST;
GLboolean enableMipmaps = GL_FALSE;
switch(tx1->minFilter) {
@ -199,17 +195,17 @@ void _glUpdatePVRTextureContext(PolyContext *context, GLshort textureUnit) {
if(enableMipmaps) {
if(tx1->minFilter == GL_LINEAR_MIPMAP_NEAREST) {
filter = PVR_FILTER_TRILINEAR1;
filter = GPU_FILTER_TRILINEAR1;
} else if(tx1->minFilter == GL_LINEAR_MIPMAP_LINEAR) {
filter = PVR_FILTER_TRILINEAR2;
filter = GPU_FILTER_TRILINEAR2;
} else if(tx1->minFilter == GL_NEAREST_MIPMAP_LINEAR) {
filter = PVR_FILTER_BILINEAR;
filter = GPU_FILTER_BILINEAR;
} else {
filter = PVR_FILTER_NEAREST;
filter = GPU_FILTER_NEAREST;
}
} else {
if(tx1->minFilter == GL_LINEAR && tx1->magFilter == GL_LINEAR) {
filter = PVR_FILTER_BILINEAR;
filter = GPU_FILTER_BILINEAR;
}
}
@ -221,7 +217,7 @@ void _glUpdatePVRTextureContext(PolyContext *context, GLshort textureUnit) {
}
if(tx1->data) {
context->txr.enable = PVR_TEXTURE_ENABLE;
context->txr.enable = GPU_TEXTURE_ENABLE;
context->txr.filter = filter;
context->txr.width = tx1->width;
context->txr.height = tx1->height;
@ -246,7 +242,7 @@ void _glUpdatePVRTextureContext(PolyContext *context, GLshort textureUnit) {
}
context->txr.env = tx1->env;
context->txr.uv_flip = PVR_UVFLIP_NONE;
context->txr.uv_flip = GPU_UVFLIP_NONE;
context->txr.uv_clamp = tx1->uv_clamp;
}
}
@ -262,12 +258,12 @@ GLboolean _glIsColorMaterialEnabled() {
static GLfloat CLEAR_COLOUR[3];
void _glInitContext() {
memset(&GL_CONTEXT, 0, sizeof(pvr_poly_cxt_t));
memset(&GL_CONTEXT, 0, sizeof(PolyContext));
GL_CONTEXT.list_type = PVR_LIST_OP_POLY;
GL_CONTEXT.fmt.color = PVR_CLRFMT_ARGBPACKED;
GL_CONTEXT.fmt.uv = PVR_UVFMT_32BIT;
GL_CONTEXT.gen.color_clamp = PVR_CLRCLAMP_DISABLE;
GL_CONTEXT.list_type = GPU_LIST_OP_POLY;
GL_CONTEXT.fmt.color = GPU_CLRFMT_ARGBPACKED;
GL_CONTEXT.fmt.uv = GPU_UVFMT_32BIT;
GL_CONTEXT.gen.color_clamp = GPU_CLRCLAMP_DISABLE;
glClearDepth(1.0f);
glDepthFunc(GL_LESS);
@ -309,13 +305,13 @@ GLAPI void APIENTRY glEnable(GLenum cap) {
_updatePVRBlend(&GL_CONTEXT);
} break;
case GL_SCISSOR_TEST: {
GL_CONTEXT.gen.clip_mode = PVR_USERCLIP_INSIDE;
GL_CONTEXT.gen.clip_mode = GPU_USERCLIP_INSIDE;
} break;
case GL_LIGHTING: {
LIGHTING_ENABLED = GL_TRUE;
} break;
case GL_FOG:
GL_CONTEXT.gen.fog_type = PVR_FOG_TABLE;
GL_CONTEXT.gen.fog_type = GPU_FOG_TABLE;
break;
case GL_COLOR_MATERIAL:
COLOR_MATERIAL_ENABLED = GL_TRUE;
@ -372,13 +368,13 @@ GLAPI void APIENTRY glDisable(GLenum cap) {
_updatePVRBlend(&GL_CONTEXT);
break;
case GL_SCISSOR_TEST: {
GL_CONTEXT.gen.clip_mode = PVR_USERCLIP_DISABLE;
GL_CONTEXT.gen.clip_mode = GPU_USERCLIP_DISABLE;
} break;
case GL_LIGHTING: {
LIGHTING_ENABLED = GL_FALSE;
} break;
case GL_FOG:
GL_CONTEXT.gen.fog_type = PVR_FOG_DISABLE;
GL_CONTEXT.gen.fog_type = GPU_FOG_DISABLE;
break;
case GL_COLOR_MATERIAL:
COLOR_MATERIAL_ENABLED = GL_FALSE;
@ -455,7 +451,7 @@ GLAPI void APIENTRY glReadBuffer(GLenum mode) {
}
GLAPI void APIENTRY glDepthMask(GLboolean flag) {
GL_CONTEXT.depth.write = (flag == GL_TRUE) ? PVR_DEPTHWRITE_ENABLE : PVR_DEPTHWRITE_DISABLE;
GL_CONTEXT.depth.write = (flag == GL_TRUE) ? GPU_DEPTHWRITE_ENABLE : GPU_DEPTHWRITE_DISABLE;
}
GLAPI void APIENTRY glDepthFunc(GLenum func) {
@ -484,12 +480,12 @@ GLAPI void APIENTRY glCullFace(GLenum mode) {
}
GLenum _glGetShadeModel() {
return (GL_CONTEXT.gen.shading == PVR_SHADE_FLAT) ? GL_FLAT : GL_SMOOTH;
return (GL_CONTEXT.gen.shading == GPU_SHADE_FLAT) ? GL_FLAT : GL_SMOOTH;
}
/* Shading - Flat or Goraud */
GLAPI void APIENTRY glShadeModel(GLenum mode) {
GL_CONTEXT.gen.shading = (mode == GL_SMOOTH) ? PVR_SHADE_GOURAUD : PVR_SHADE_FLAT;
GL_CONTEXT.gen.shading = (mode == GL_SMOOTH) ? GPU_SHADE_GOURAUD : GPU_SHADE_FLAT;
}
/* Blending */
@ -570,7 +566,7 @@ void APIENTRY glScissor(GLint x, GLint y, GLsizei width, GLsizei height) {
maxy = (gl_scissor_height + miny);
/* load command structure while mapping screen coords to TA tiles */
c->flags = PVR_CMD_USERCLIP;
c->flags = GPU_CMD_USERCLIP;
c->d1 = c->d2 = c->d3 = 0;
c->sx = CLAMP(x / 32, 0, vid_mode->width / 32);
c->sy = CLAMP(miny / 32, 0, vid_mode->height / 32);
@ -583,7 +579,7 @@ GLboolean APIENTRY glIsEnabled(GLenum cap) {
case GL_DEPTH_TEST:
return DEPTH_TEST_ENABLED;
case GL_SCISSOR_TEST:
return GL_CONTEXT.gen.clip_mode == PVR_USERCLIP_INSIDE;
return GL_CONTEXT.gen.clip_mode == GPU_USERCLIP_INSIDE;
case GL_CULL_FACE:
return CULLING_ENABLED;
case GL_LIGHTING:

View File

@ -12,8 +12,6 @@
#include "yalloc/yalloc.h"
#include <kos/string.h>
/* We always leave this amount of vram unallocated to prevent
* issues with the allocator */
#define PVR_MEM_BUFFER_SIZE (64 * 1024)
@ -124,10 +122,10 @@ void _glSetInternalPaletteFormat(GLenum val) {
INTERNAL_PALETTE_FORMAT = val;
if(INTERNAL_PALETTE_FORMAT == GL_RGBA4) {
pvr_set_pal_format(PVR_PAL_ARGB4444);
pvr_set_pal_format(GPU_PAL_ARGB4444);
} else {
assert(INTERNAL_PALETTE_FORMAT == GL_RGBA8);
pvr_set_pal_format(PVR_PAL_ARGB8888);
pvr_set_pal_format(GPU_PAL_ARGB8888);
}
}
@ -375,7 +373,7 @@ static void _glInitializeTextureObject(TextureObject* txr, unsigned int id) {
txr->width = txr->height = 0;
txr->mipmap = 0;
txr->uv_clamp = 0;
txr->env = PVR_TXRENV_MODULATEALPHA;
txr->env = GPU_TXRENV_MODULATEALPHA;
txr->data = NULL;
txr->mipmapCount = 0;
txr->minFilter = GL_NEAREST;
@ -497,13 +495,13 @@ void APIENTRY glTexEnvi(GLenum target, GLenum pname, GLint param) {
switch(param) {
case GL_MODULATE:
active->env = PVR_TXRENV_MODULATEALPHA;
active->env = GPU_TXRENV_MODULATEALPHA;
break;
case GL_DECAL:
active->env = PVR_TXRENV_DECAL;
active->env = GPU_TXRENV_DECAL;
break;
case GL_REPLACE:
active->env = PVR_TXRENV_REPLACE;
active->env = GPU_TXRENV_REPLACE;
break;
default:
break;
@ -722,47 +720,47 @@ static GLint _cleanInternalFormat(GLint internalFormat) {
* the type was already 1555 (1-bit alpha) in which case we return that
*/
if(type == GL_UNSIGNED_SHORT_1_5_5_5_REV) {
return PVR_TXRFMT_ARGB1555 | PVR_TXRFMT_NONTWIDDLED;
return GPU_TXRFMT_ARGB1555 | GPU_TXRFMT_NONTWIDDLED;
} else if(type == GL_UNSIGNED_SHORT_1_5_5_5_REV_TWID_KOS) {
return PVR_TXRFMT_ARGB1555 | PVR_TXRFMT_TWIDDLED;
return GPU_TXRFMT_ARGB1555 | GPU_TXRFMT_TWIDDLED;
} else if(type == GL_UNSIGNED_SHORT_4_4_4_4_REV_TWID_KOS) {
return PVR_TXRFMT_ARGB4444 | PVR_TXRFMT_TWIDDLED;
return GPU_TXRFMT_ARGB4444 | GPU_TXRFMT_TWIDDLED;
} else {
return PVR_TXRFMT_ARGB4444 | PVR_TXRFMT_NONTWIDDLED;
return GPU_TXRFMT_ARGB4444 | GPU_TXRFMT_NONTWIDDLED;
}
case GL_RED:
case GL_RGB:
/* No alpha? Return RGB565 which is the best we can do without using palettes */
return PVR_TXRFMT_RGB565 | PVR_TXRFMT_NONTWIDDLED;
return GPU_TXRFMT_RGB565 | GPU_TXRFMT_NONTWIDDLED;
/* Compressed and twiddled versions */
case GL_UNSIGNED_SHORT_5_6_5_TWID_KOS:
return PVR_TXRFMT_RGB565 | PVR_TXRFMT_TWIDDLED;
return GPU_TXRFMT_RGB565 | GPU_TXRFMT_TWIDDLED;
case GL_UNSIGNED_SHORT_4_4_4_4_REV_TWID_KOS:
return PVR_TXRFMT_ARGB4444 | PVR_TXRFMT_TWIDDLED;
return GPU_TXRFMT_ARGB4444 | GPU_TXRFMT_TWIDDLED;
case GL_UNSIGNED_SHORT_1_5_5_5_REV_TWID_KOS:
return PVR_TXRFMT_ARGB1555 | PVR_TXRFMT_TWIDDLED;
return GPU_TXRFMT_ARGB1555 | GPU_TXRFMT_TWIDDLED;
case GL_COMPRESSED_RGB_565_VQ_KOS:
case GL_COMPRESSED_RGB_565_VQ_MIPMAP_KOS:
return PVR_TXRFMT_RGB565 | PVR_TXRFMT_NONTWIDDLED | PVR_TXRFMT_VQ_ENABLE;
return GPU_TXRFMT_RGB565 | GPU_TXRFMT_NONTWIDDLED | GPU_TXRFMT_VQ_ENABLE;
case GL_COMPRESSED_RGB_565_VQ_TWID_KOS:
case GL_COMPRESSED_RGB_565_VQ_MIPMAP_TWID_KOS:
return PVR_TXRFMT_RGB565 | PVR_TXRFMT_TWIDDLED | PVR_TXRFMT_VQ_ENABLE;
return GPU_TXRFMT_RGB565 | GPU_TXRFMT_TWIDDLED | GPU_TXRFMT_VQ_ENABLE;
case GL_COMPRESSED_ARGB_4444_VQ_TWID_KOS:
case GL_COMPRESSED_ARGB_4444_VQ_MIPMAP_TWID_KOS:
return PVR_TXRFMT_ARGB4444 | PVR_TXRFMT_TWIDDLED | PVR_TXRFMT_VQ_ENABLE;
return GPU_TXRFMT_ARGB4444 | GPU_TXRFMT_TWIDDLED | GPU_TXRFMT_VQ_ENABLE;
case GL_COMPRESSED_ARGB_4444_VQ_KOS:
case GL_COMPRESSED_ARGB_4444_VQ_MIPMAP_KOS:
return PVR_TXRFMT_ARGB4444 | PVR_TXRFMT_NONTWIDDLED | PVR_TXRFMT_VQ_ENABLE;
return GPU_TXRFMT_ARGB4444 | GPU_TXRFMT_NONTWIDDLED | GPU_TXRFMT_VQ_ENABLE;
case GL_COMPRESSED_ARGB_1555_VQ_KOS:
case GL_COMPRESSED_ARGB_1555_VQ_MIPMAP_KOS:
return PVR_TXRFMT_ARGB1555 | PVR_TXRFMT_NONTWIDDLED | PVR_TXRFMT_VQ_ENABLE;
return GPU_TXRFMT_ARGB1555 | GPU_TXRFMT_NONTWIDDLED | GPU_TXRFMT_VQ_ENABLE;
case GL_COMPRESSED_ARGB_1555_VQ_TWID_KOS:
case GL_COMPRESSED_ARGB_1555_VQ_MIPMAP_TWID_KOS:
return PVR_TXRFMT_ARGB1555 | PVR_TXRFMT_TWIDDLED | PVR_TXRFMT_VQ_ENABLE;
return GPU_TXRFMT_ARGB1555 | GPU_TXRFMT_TWIDDLED | GPU_TXRFMT_VQ_ENABLE;
case GL_COLOR_INDEX8_EXT:
return PVR_TXRFMT_PAL8BPP | PVR_TXRFMT_TWIDDLED;
return GPU_TXRFMT_PAL8BPP | GPU_TXRFMT_TWIDDLED;
case GL_COLOR_INDEX4_EXT:
return PVR_TXRFMT_PAL4BPP | PVR_TXRFMT_TWIDDLED;
return GPU_TXRFMT_PAL4BPP | GPU_TXRFMT_TWIDDLED;
default:
return 0;
}
@ -1228,9 +1226,9 @@ void APIENTRY glTexImage2D(GLenum target, GLint level, GLint internalFormat,
const GLubyte *pixels = (GLubyte*) (conversionBuffer) ? conversionBuffer : data;
if(internalFormat == GL_COLOR_INDEX8_EXT) {
pvr_txr_load_ex((void*) pixels, targetData, width, height, PVR_TXRLOAD_8BPP);
pvr_txr_load_ex((void*) pixels, targetData, width, height, GPU_TXRLOAD_8BPP);
} else {
pvr_txr_load_ex((void*) pixels, targetData, width, height, PVR_TXRLOAD_16BPP);
pvr_txr_load_ex((void*) pixels, targetData, width, height, GPU_TXRLOAD_16BPP);
}
/* We make sure we remove nontwiddled and add twiddled. We could always