[Scummvm-git-logs] scummvm master -> 44b4b2f7402e48131780f9989872e9f09ebb6130

aquadran noreply at scummvm.org
Sat Dec 4 13:29:31 UTC 2021


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
44b4b2f740 TINYGL: Fixed multi texture generation calls


Commit: 44b4b2f7402e48131780f9989872e9f09ebb6130
    https://github.com/scummvm/scummvm/commit/44b4b2f7402e48131780f9989872e9f09ebb6130
Author: Paweł Kołodziejski (aquadran at gmail.com)
Date: 2021-12-04T14:29:25+01:00

Commit Message:
TINYGL: Fixed multi texture generation calls

Changed paths:
    graphics/tinygl/texture.cpp
    graphics/tinygl/zgl.h


diff --git a/graphics/tinygl/texture.cpp b/graphics/tinygl/texture.cpp
index 91052c271b..d3829fef45 100644
--- a/graphics/tinygl/texture.cpp
+++ b/graphics/tinygl/texture.cpp
@@ -97,6 +97,7 @@ GLTexture *alloc_texture(GLContext *c, uint h) {
 void glInitTextures(GLContext *c) {
 	c->texture_2d_enabled = 0;
 	c->current_texture = find_texture(c, 0);
+	c->maxTextureName = 0;
 	c->texture_mag_filter = TGL_LINEAR;
 	c->texture_min_filter = TGL_NEAREST_MIPMAP_LINEAR;
 #if defined(SCUMM_LITTLE_ENDIAN)
@@ -277,21 +278,11 @@ void glopPixelStore(GLContext *, GLParam *p) {
 
 void tglGenTextures(int n, unsigned int *textures) {
 	TinyGL::GLContext *c = TinyGL::gl_get_context();
-	unsigned int max;
-	TinyGL::GLTexture *t;
 
-	max = 0;
-	for (int i = 0; i < TEXTURE_HASH_TABLE_SIZE; i++) {
-		t = c->shared_state.texture_hash_table[i];
-		while (t) {
-			if (t->handle > max)
-				max = t->handle;
-			t = t->next;
-		}
-	}
 	for (int i = 0; i < n; i++) {
-		textures[i] = max + i + 1;
+		textures[i] = c->maxTextureName + i + 1;
 	}
+	c->maxTextureName += n;
 }
 
 void tglDeleteTextures(int n, const unsigned int *textures) {
diff --git a/graphics/tinygl/zgl.h b/graphics/tinygl/zgl.h
index a3c8fac1f4..2bd7a4401f 100644
--- a/graphics/tinygl/zgl.h
+++ b/graphics/tinygl/zgl.h
@@ -284,6 +284,7 @@ struct GLContext {
 
 	// textures
 	GLTexture *current_texture;
+	uint maxTextureName;
 	int texture_2d_enabled;
 	int texture_mag_filter;
 	int texture_min_filter;




More information about the Scummvm-git-logs mailing list