From c136bde0e46ed01491786cd837d343602e16e418 Mon Sep 17 00:00:00 2001 From: Ethan Lee Date: Sun, 26 Apr 2020 22:35:13 -0400 Subject: [PATCH] Put the vertex sampler offset firmly at TEXTURE16 --- mojoshader_opengl.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mojoshader_opengl.c b/mojoshader_opengl.c index f57de3ef..4ad73580 100644 --- a/mojoshader_opengl.c +++ b/mojoshader_opengl.c @@ -1721,7 +1721,12 @@ MOJOSHADER_glContext *MOJOSHADER_glCreateContext(const char *profile, GLint maxTextures; GLint maxVertexTextures; ctx->glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &maxTextures); - maxVertexTextures = ((maxTextures - 16) < 4) ? (maxTextures - 16) : 4; + if (maxTextures > 20) + maxTextures = 20; + if (maxTextures > 16) + maxVertexTextures = maxTextures - 16; + else + maxVertexTextures = 0; ctx->vertex_sampler_offset = maxTextures - maxVertexTextures; #endif