summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2016-01-12 17:09:50 -0800
committerIan Romanick <[email protected]>2017-06-28 16:38:05 -0700
commite0acd625364528f80b35e80dbb4678a202566f6c (patch)
tree47098bf86b0ae47b20ceea33d73e3e74b5bb4ca7
parentd2c4f714d1a7752ad773a2662bf9800e0ea0b0c1 (diff)
mesa: Refactor error checking for GL_TEXTURE_BASE_LEVEL vs texture targets
Add a big spec quotation justifying the error generated, which has changed over the GL versions. v2: Compact the spec quote based on a Khronos bug and discussion with Jason. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
-rw-r--r--src/mesa/main/texparam.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
index 1059a4cb5ee..d8bbabf8f26 100644
--- a/src/mesa/main/texparam.c
+++ b/src/mesa/main/texparam.c
@@ -376,8 +376,26 @@ set_tex_parameteri(struct gl_context *ctx,
if (texObj->BaseLevel == params[0])
return GL_FALSE;
+ /* Section 8.10 (Texture Parameters) of the OpenGL 4.5 Core Profile spec
+ * says:
+ *
+ * An INVALID_OPERATION error is generated if the effective target is
+ * TEXTURE_2D_MULTISAMPLE, TEXTURE_2D_MULTISAMPLE_ARRAY, or
+ * TEXTURE_RECTANGLE, and pname TEXTURE_BASE_LEVEL is set to a value
+ * other than zero.
+ *
+ * Note that section 3.8.8 (Texture Parameters) of the OpenGL 3.3 Core
+ * Profile spec said:
+ *
+ * The error INVALID_VALUE is generated if TEXTURE_BASE_LEVEL is set
+ * to any value other than zero.
+ *
+ * We take the 4.5 language as a correction to 3.3, and we implement
+ * that on all GL versions.
+ */
if ((texObj->Target == GL_TEXTURE_2D_MULTISAMPLE ||
- texObj->Target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY) && params[0] != 0)
+ texObj->Target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY ||
+ texObj->Target == GL_TEXTURE_RECTANGLE) && params[0] != 0)
goto invalid_operation;
if (params[0] < 0) {
@@ -385,12 +403,6 @@ set_tex_parameteri(struct gl_context *ctx,
"glTex%sParameter(param=%d)", suffix, params[0]);
return GL_FALSE;
}
- if (texObj->Target == GL_TEXTURE_RECTANGLE_ARB && params[0] != 0) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glTex%sParameter(target=%s, param=%d)", suffix,
- _mesa_enum_to_string(texObj->Target), params[0]);
- return GL_FALSE;
- }
incomplete(ctx, texObj);
/** See note about ARB_texture_storage below */