initial support for GL_MIRRORED_REPEAT

This commit is contained in:
jnmartin84 2025-07-12 12:07:04 -04:00
parent f09760dda3
commit 708566af72
4 changed files with 17 additions and 2 deletions

View File

@ -153,7 +153,9 @@ typedef struct {
//50
GLenum internalFormat;
//54
GLubyte padding[10]; // Pad to 64-bytes
GLubyte uv_flip;
// 55
GLubyte padding[9]; // Pad to 64-bytes
} __attribute__((aligned(32))) TextureObject;
typedef struct {

View File

@ -390,7 +390,7 @@ void _glUpdatePVRTextureContext(PolyContext *context, GLshort textureUnit) {
}
context->txr.env = tx1->env;
context->txr.uv_flip = GPU_UVFLIP_NONE;
context->txr.uv_flip = tx1->uv_flip;
context->txr.uv_clamp = tx1->uv_clamp;
}
}

View File

@ -17,6 +17,9 @@
#define CLAMP_U (1<<1)
#define CLAMP_V (1<<0)
#define MIRROR_U (1<<1)
#define MIRROR_V (1<<0)
static TextureObject* TEXTURE_UNITS[MAX_GLDC_TEXTURE_UNITS] = {NULL, NULL};
static NamedArray TEXTURE_OBJECTS;
GLubyte ACTIVE_TEXTURE = 0;
@ -505,6 +508,7 @@ static void _glInitializeTextureObject(TextureObject* txr, unsigned int id) {
txr->width = txr->height = 0;
txr->mipmap = 0;
txr->uv_clamp = 0;
txr->uv_flip = 0;
txr->env = GPU_TXRENV_MODULATEALPHA;
txr->data = NULL;
txr->mipmapCount = 0;
@ -1899,6 +1903,10 @@ void APIENTRY glTexParameteri(GLenum target, GLenum pname, GLint param) {
case GL_REPEAT:
active->uv_clamp &= ~CLAMP_U;
break;
case GL_MIRRORED_REPEAT:
active->uv_flip |= MIRROR_U;
break;
}
break;
@ -1913,6 +1921,10 @@ void APIENTRY glTexParameteri(GLenum target, GLenum pname, GLint param) {
case GL_REPEAT:
active->uv_clamp &= ~CLAMP_V;
break;
case GL_MIRRORED_REPEAT:
active->uv_flip |= MIRROR_V;
break;
}
break;

View File

@ -116,6 +116,7 @@ __BEGIN_DECLS
#define GL_TEXTURE_WRAP_T 0x2803
#define GL_TEXTURE_MAG_FILTER 0x2800
#define GL_TEXTURE_MIN_FILTER 0x2801
#define GL_MIRRORED_REPEAT 0x2902
#define GL_REPEAT 0x2901
#define GL_CLAMP 0x2900