Mesa (master): mesa: Only check for a current vertex shader in core profile

Kenneth Graunke kwg at kemper.freedesktop.org
Thu Jan 15 02:16:04 UTC 2015


Module: Mesa
Branch: master
Commit: a4aeb534ea8a21770b28cdf1f66cff4afe123009
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a4aeb534ea8a21770b28cdf1f66cff4afe123009

Author: Ian Romanick <ian.d.romanick at intel.com>
Date:   Tue Nov 11 11:28:28 2014 +0000

mesa: Only check for a current vertex shader in core profile

This doesn't affect performance, but it feels more correct.

On Bay Trail-D using Fedora 20 compile flags (-m64 -O2 -mtune=generic
for 64-bit and -m32 -march=i686 -mtune=atom for 32-bit), affects
Gl32Batch7:

32-bit: No difference proven at 95.0% confidence (n=120)
64-bit: No difference proven at 95.0% confidence (n=120)

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

---

 src/mesa/main/api_validate.c |   14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c
index 7d98933..a93a67d 100644
--- a/src/mesa/main/api_validate.c
+++ b/src/mesa/main/api_validate.c
@@ -89,7 +89,19 @@ check_valid_to_render(struct gl_context *ctx, const char *function)
          _mesa_error(ctx, GL_INVALID_OPERATION, "%s(no VAO bound)", function);
          return false;
       }
-      /* fallthrough */
+
+      /* Section 7.3 (Program Objects) of the OpenGL 4.5 Core Profile spec
+       * says:
+       *
+       *     "If there is no active program for the vertex or fragment shader
+       *     stages, the results of vertex and/or fragment processing will be
+       *     undefined. However, this is not an error."
+       *
+       * The fragment shader is not tested here because other state (e.g.,
+       * GL_RASTERIZER_DISCARD) affects whether or not we actually care.
+       */
+      return ctx->VertexProgram._Current != NULL;
+
    case API_OPENGL_COMPAT: {
       const struct gl_shader_program *const vsProg =
          ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX];




More information about the mesa-commit mailing list