Fix an off-by-one error

This commit is contained in:
Luke Benstead 2023-05-17 20:39:27 +01:00
parent 9037d157d5
commit c4c0bf4239

View File

@ -523,12 +523,15 @@ TextureObject* _glGetBoundTexture() {
void APIENTRY glActiveTextureARB(GLenum texture) {
TRACE();
if(texture < GL_TEXTURE0_ARB || texture > GL_TEXTURE0_ARB + MAX_GLDC_TEXTURE_UNITS) {
if(texture < GL_TEXTURE0_ARB || texture >= GL_TEXTURE0_ARB + MAX_GLDC_TEXTURE_UNITS) {
_glKosThrowError(GL_INVALID_ENUM, "glActiveTextureARB");
return;
}
ACTIVE_TEXTURE = texture & 0xF;
gl_assert(ACTIVE_TEXTURE < MAX_GLDC_TEXTURE_UNITS);
gl_assert(TEXTURE_OBJECTS.element_size > 0);
}
GLboolean APIENTRY glIsTexture(GLuint texture) {