aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/context.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2015-02-22 14:31:16 +0100
committermarha <marha@users.sourceforge.net>2015-02-22 14:31:16 +0100
commitf1c2db43dcf35d2cf4715390bd2391c28e42a8c2 (patch)
tree46b537271afe0f6534231b1bd4cc4f91ae1fb446 /mesalib/src/mesa/main/context.c
parent5e5a48ff8cd08f123601cd0625ca62a86675aac9 (diff)
downloadvcxsrv-f1c2db43dcf35d2cf4715390bd2391c28e42a8c2.tar.gz
vcxsrv-f1c2db43dcf35d2cf4715390bd2391c28e42a8c2.tar.bz2
vcxsrv-f1c2db43dcf35d2cf4715390bd2391c28e42a8c2.zip
xwininfo fontconfig libX11 libXdmcp libfontenc libxcb libxcb/xcb-proto mesalib xserver xkeyboard-config mkfontscale git update 22 Feb 2015
xserver commit 3a06faf3fcdb7451125a46181f9152e8e59e9770 libxcb commit e3ec1f74637237ce500dfd0ca59f2e422da4e019 libxcb/xcb-proto commit 4c550465934164aab2449a125f75f4ca07816233 xkeyboard-config commit 26f344c93f8c6141e9233eb68088ba4fd56bc9ef libX11 commit c8e19b393defd53f046ddc2da3a16881221b3c34 libXdmcp commit 9f4cac7656b221ce2a8f97e7bd31e5e23126d001 libfontenc commit de1843aaf76015c9d99416f3122d169fe331b849 mkfontscale commit 87d628f8eec170ec13bb9feefb1ce05aed07d1d6 xwininfo commit 0c49f8f2bd56b1e77721e81030ea948386dcdf4e fontconfig commit d6d5adeb7940c0d0beb86489c2a1c2ce59e5c044 mesa commit 4359954d842caa2a9f8d4b50d70ecc789884b68b
Diffstat (limited to 'mesalib/src/mesa/main/context.c')
-rw-r--r--mesalib/src/mesa/main/context.c90
1 files changed, 59 insertions, 31 deletions
diff --git a/mesalib/src/mesa/main/context.c b/mesalib/src/mesa/main/context.c
index 400c158a7..b186a1fad 100644
--- a/mesalib/src/mesa/main/context.c
+++ b/mesalib/src/mesa/main/context.c
@@ -118,7 +118,7 @@
#include "scissor.h"
#include "shared.h"
#include "shaderobj.h"
-#include "simple_list.h"
+#include "util/simple_list.h"
#include "state.h"
#include "stencil.h"
#include "texcompress_s3tc.h"
@@ -908,6 +908,9 @@ nop_glFlush(void)
#endif
+extern void (*__glapi_noop_table[])(void);
+
+
/**
* Allocate and initialize a new dispatch table. All the dispatch
* function pointers will point at the _mesa_generic_nop() function
@@ -929,7 +932,13 @@ _mesa_alloc_dispatch_table(void)
_glapi_proc *entry = (_glapi_proc *) table;
GLint i;
for (i = 0; i < numEntries; i++) {
+#if defined(_WIN32)
+ /* FIXME: This will not generate an error, but at least it won't
+ * corrupt the stack like _mesa_generic_nop does. */
+ entry[i] = __glapi_noop_table[i];
+#else
entry[i] = (_glapi_proc) _mesa_generic_nop;
+#endif
}
#if defined(_WIN32)
@@ -1271,7 +1280,6 @@ _mesa_free_context_data( struct gl_context *ctx )
_mesa_free_attrib_data(ctx);
_mesa_free_buffer_objects(ctx);
- _mesa_free_lighting_data( ctx );
_mesa_free_eval_data( ctx );
_mesa_free_texture_data( ctx );
_mesa_free_matrix_data( ctx );
@@ -1903,49 +1911,69 @@ shader_linked_or_absent(struct gl_context *ctx,
GLboolean
_mesa_valid_to_render(struct gl_context *ctx, const char *where)
{
- bool from_glsl_shader[MESA_SHADER_COMPUTE] = { false };
unsigned i;
/* This depends on having up to date derived state (shaders) */
if (ctx->NewState)
_mesa_update_state(ctx);
- for (i = 0; i < MESA_SHADER_COMPUTE; i++) {
- if (!shader_linked_or_absent(ctx, ctx->_Shader->CurrentProgram[i],
- &from_glsl_shader[i], where))
- return GL_FALSE;
- }
+ if (ctx->API == API_OPENGL_CORE || ctx->API == API_OPENGLES2) {
+ bool from_glsl_shader[MESA_SHADER_COMPUTE] = { false };
- /* Any shader stages that are not supplied by the GLSL shader and have
- * assembly shaders enabled must now be validated.
- */
- if (!from_glsl_shader[MESA_SHADER_VERTEX]
- && ctx->VertexProgram.Enabled && !ctx->VertexProgram._Enabled) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "%s(vertex program not valid)", where);
- return GL_FALSE;
- }
+ for (i = 0; i < MESA_SHADER_COMPUTE; i++) {
+ if (!shader_linked_or_absent(ctx, ctx->_Shader->CurrentProgram[i],
+ &from_glsl_shader[i], where))
+ return GL_FALSE;
+ }
- /* FINISHME: If GL_NV_geometry_program4 is ever supported, the current
- * FINISHME: geometry program should validated here.
- */
- (void) from_glsl_shader[MESA_SHADER_GEOMETRY];
+ /* In OpenGL Core Profile and OpenGL ES 2.0 / 3.0, there are no assembly
+ * shaders. Don't check state related to those.
+ */
+ } else {
+ bool has_vertex_shader = false;
+ bool has_fragment_shader = false;
+
+ /* In OpenGL Compatibility Profile, there is only vertex shader and
+ * fragment shader. We take this path also for API_OPENGLES because
+ * optimizing that path would make the other (more common) paths
+ * slightly slower.
+ */
+ if (!shader_linked_or_absent(ctx,
+ ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX],
+ &has_vertex_shader, where))
+ return GL_FALSE;
- if (!from_glsl_shader[MESA_SHADER_FRAGMENT]) {
- if (ctx->FragmentProgram.Enabled && !ctx->FragmentProgram._Enabled) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "%s(fragment program not valid)", where);
- return GL_FALSE;
- }
+ if (!shader_linked_or_absent(ctx,
+ ctx->_Shader->CurrentProgram[MESA_SHADER_FRAGMENT],
+ &has_fragment_shader, where))
+ return GL_FALSE;
- /* If drawing to integer-valued color buffers, there must be an
- * active fragment shader (GL_EXT_texture_integer).
+ /* Any shader stages that are not supplied by the GLSL shader and have
+ * assembly shaders enabled must now be validated.
*/
- if (ctx->DrawBuffer && ctx->DrawBuffer->_IntegerColor) {
+ if (!has_vertex_shader
+ && ctx->VertexProgram.Enabled && !ctx->VertexProgram._Enabled) {
_mesa_error(ctx, GL_INVALID_OPERATION,
- "%s(integer format but no fragment shader)", where);
+ "%s(vertex program not valid)", where);
return GL_FALSE;
}
+
+ if (!has_fragment_shader) {
+ if (ctx->FragmentProgram.Enabled && !ctx->FragmentProgram._Enabled) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "%s(fragment program not valid)", where);
+ return GL_FALSE;
+ }
+
+ /* If drawing to integer-valued color buffers, there must be an
+ * active fragment shader (GL_EXT_texture_integer).
+ */
+ if (ctx->DrawBuffer && ctx->DrawBuffer->_IntegerColor) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "%s(integer format but no fragment shader)", where);
+ return GL_FALSE;
+ }
+ }
}
/* A pipeline object is bound */