From 39a7ee9c02f976d3868c9a5b5b10d314479b818d Mon Sep 17 00:00:00 2001 From: Hayden Kowalchuk Date: Wed, 7 Aug 2019 20:55:37 -0400 Subject: [PATCH] fix: update correct Modulate behavior --- GL/draw.c | 22 +++++++++++----------- GL/texture.c | 6 ++++-- Makefile | 9 +++++---- 3 files changed, 20 insertions(+), 17 deletions(-) diff --git a/GL/draw.c b/GL/draw.c index cbe6338..1517b48 100644 --- a/GL/draw.c +++ b/GL/draw.c @@ -628,10 +628,10 @@ static inline void _readUVData(const GLuint first, const GLuint count, Vertex* o } static inline void _readSTData(const GLuint first, const GLuint count, VertexExtra* extra) { - if((ENABLED_VERTEX_ATTRIBUTES & ST_ENABLED_FLAG) != ST_ENABLED_FLAG) { + /*if((ENABLED_VERTEX_ATTRIBUTES & ST_ENABLED_FLAG) != ST_ENABLED_FLAG) { _fillZero2fVE(count, extra->st); return; - } + }*/ const GLubyte ststride = (ST_POINTER.stride) ? ST_POINTER.stride : ST_POINTER.size * byte_size(ST_POINTER.type); const void* stptr = ((GLubyte*) ST_POINTER.ptr + (first * ststride)); @@ -1057,9 +1057,9 @@ static void submitVertices(GLenum mode, GLsizei first, GLuint count, GLenum type //glActiveTextureARB(GL_TEXTURE0); //glGetBooleanv(GL_TEXTURE_2D, &doTexture); - doMultitexture = _GetBooleanTextureEnabled(GL_TEXTURE1); - //glActiveTextureARB(GL_TEXTURE1); - //glGetBooleanv(GL_TEXTURE_2D, &doMultitexture); + //doMultitexture = _GetBooleanTextureEnabled(GL_TEXTURE1); + glActiveTextureARB(GL_TEXTURE1); + glGetBooleanv(GL_TEXTURE_2D, &doMultitexture); doLighting = _glIsLightingEnabled(); @@ -1177,7 +1177,7 @@ static void submitVertices(GLenum mode, GLsizei first, GLuint count, GLenum type } TextureObject* texture1 = _glGetTexture1(); - + /* Multitexture implicitly disabled */ if(!texture1 || ((ENABLED_VERTEX_ATTRIBUTES & ST_ENABLED_FLAG) != ST_ENABLED_FLAG)) { /* Multitexture actively disabled */ @@ -1215,12 +1215,12 @@ static void submitVertices(GLenum mode, GLsizei first, GLuint count, GLenum type GLboolean blendEnabled = glIsEnabled(GL_BLEND); GLboolean depthEnabled = glIsEnabled(GL_DEPTH_TEST); - glDepthFunc(GL_EQUAL); - glEnable(GL_BLEND); + //glDepthFunc(GL_EQUAL); + //glEnable(GL_BLEND); + + /* This is modulation, we need to switch depending on the texture env mode! */ + //glBlendFunc(GL_DST_COLOR, GL_ZERO); - /* This is modulation, we need to switch depending on the texture env mode! */ - glBlendFunc(GL_DST_COLOR, GL_ZERO); - /* Send the buffer again to the transparent list */ push(mtHeader, mtStart, target->count, _glTransparentPolyList(), 1); diff --git a/GL/texture.c b/GL/texture.c index cf8971e..be24185 100644 --- a/GL/texture.c +++ b/GL/texture.c @@ -314,7 +314,8 @@ 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 = PVR_TXRENV_MODULATEALPHA; + txr->env = PVR_TXRENV_MODULATE; txr->data = NULL; txr->mipmapCount = 0; txr->minFilter = GL_NEAREST; @@ -430,7 +431,8 @@ void APIENTRY glTexEnvi(GLenum target, GLenum pname, GLint param) { switch(param) { case GL_MODULATE: - active->env = PVR_TXRENV_MODULATEALPHA; + active->env = PVR_TXRENV_MODULATE; + //active->env = PVR_TXRENV_MODULATEALPHA; break; case GL_DECAL: active->env = PVR_TXRENV_DECAL; diff --git a/Makefile b/Makefile index cc4ae95..41b2776 100644 --- a/Makefile +++ b/Makefile @@ -6,14 +6,15 @@ # Copyright (C) 2018 Luke Benstead TARGET = libGLdc.a -OBJS = GL/gldc.o -#OBJS = GL/draw.o GL/flush.o GL/framebuffer.o GL/immediate.o GL/lighting.o GL/state.o GL/texture.o GL/glu.o -#OBJS += GL/matrix.o GL/fog.o GL/error.o GL/clip.o containers/stack.o containers/named_array.o containers/aligned_vector.o GL/profiler.o +#OBJS = GL/gldc.o +OBJS = GL/draw.o GL/flush.o GL/framebuffer.o GL/immediate.o GL/lighting.o GL/state.o GL/texture.o GL/glu.o +OBJS += GL/matrix.o GL/fog.o GL/error.o GL/clip.o containers/stack.o containers/named_array.o containers/aligned_vector.o GL/profiler.o OBJS += containers/stack.o containers/named_array.o containers/aligned_vector.o GL/profiler.o SUBDIRS = -KOS_CFLAGS += -ffast-math -O3 -funroll-loops -Iinclude +KOS_CFLAGS += -ffast-math -O3 -Iinclude -funsafe-math-optimizations -fno-expensive-optimizations +GCC_FLAGS = -mlra link: $(KOS_AR) rcs $(TARGET) $(OBJS)