diff options
Diffstat (limited to 'mesalib/src/mesa/main')
-rw-r--r-- | mesalib/src/mesa/main/context.c | 45 | ||||
-rw-r--r-- | mesalib/src/mesa/main/dd.h | 9 | ||||
-rw-r--r-- | mesalib/src/mesa/main/ff_fragment_shader.cpp | 1 | ||||
-rw-r--r-- | mesalib/src/mesa/main/framebuffer.c | 69 | ||||
-rw-r--r-- | mesalib/src/mesa/main/mtypes.h | 2 | ||||
-rw-r--r-- | mesalib/src/mesa/main/shaderapi.c | 60 | ||||
-rw-r--r-- | mesalib/src/mesa/main/uniform_query.cpp | 9 | ||||
-rw-r--r-- | mesalib/src/mesa/main/uniforms.h | 2 |
8 files changed, 44 insertions, 153 deletions
diff --git a/mesalib/src/mesa/main/context.c b/mesalib/src/mesa/main/context.c index c59f755c6..5ad04cc99 100644 --- a/mesalib/src/mesa/main/context.c +++ b/mesalib/src/mesa/main/context.c @@ -1388,25 +1388,6 @@ check_compatible(const struct gl_context *ctx, /** - * Do one-time initialization for the given framebuffer. Specifically, - * ask the driver for the window's current size and update the framebuffer - * object to match. - * Really, the device driver should totally take care of this. - */ -static void -initialize_framebuffer_size(struct gl_context *ctx, struct gl_framebuffer *fb) -{ - GLuint width, height; - if (ctx->Driver.GetBufferSize) { - ctx->Driver.GetBufferSize(fb, &width, &height); - if (ctx->Driver.ResizeBuffers) - ctx->Driver.ResizeBuffers(ctx, fb, width, height); - fb->Initialized = GL_TRUE; - } -} - - -/** * Check if the viewport/scissor size has not yet been initialized. * Initialize the size if the given width and height are non-zero. */ @@ -1508,32 +1489,6 @@ _mesa_make_current( struct gl_context *newCtx, */ newCtx->NewState |= _NEW_BUFFERS; -#if 1 - /* We want to get rid of these lines: */ - if (!drawBuffer->Initialized) { - initialize_framebuffer_size(newCtx, drawBuffer); - } - if (readBuffer != drawBuffer && !readBuffer->Initialized) { - initialize_framebuffer_size(newCtx, readBuffer); - } - - _mesa_resizebuffers(newCtx); -#else - /* We want the drawBuffer and readBuffer to be initialized by - * the driver. - * This generally means the Width and Height match the actual - * window size and the renderbuffers (both hardware and software - * based) are allocated to match. The later can generally be - * done with a call to _mesa_resize_framebuffer(). - * - * It's theoretically possible for a buffer to have zero width - * or height, but for now, assert check that the driver did what's - * expected of it. - */ - ASSERT(drawBuffer->Width > 0); - ASSERT(drawBuffer->Height > 0); -#endif - if (drawBuffer) { _mesa_check_init_viewport(newCtx, drawBuffer->Width, drawBuffer->Height); diff --git a/mesalib/src/mesa/main/dd.h b/mesalib/src/mesa/main/dd.h index e2519780a..c1d9b2c95 100644 --- a/mesalib/src/mesa/main/dd.h +++ b/mesalib/src/mesa/main/dd.h @@ -93,15 +93,6 @@ struct dd_function_table { void (*UpdateState)( struct gl_context *ctx, GLbitfield new_state ); /** - * Get the width and height of the named buffer/window. - * - * Mesa uses this to determine when the driver's window size has changed. - * XXX OBSOLETE: this function will be removed in the future. - */ - void (*GetBufferSize)( struct gl_framebuffer *buffer, - GLuint *width, GLuint *height ); - - /** * Resize the given framebuffer to the given size. * XXX OBSOLETE: this function will be removed in the future. */ diff --git a/mesalib/src/mesa/main/ff_fragment_shader.cpp b/mesalib/src/mesa/main/ff_fragment_shader.cpp index d162da8db..86317efcd 100644 --- a/mesalib/src/mesa/main/ff_fragment_shader.cpp +++ b/mesalib/src/mesa/main/ff_fragment_shader.cpp @@ -51,7 +51,6 @@ extern "C" { #include "../glsl/glsl_symbol_table.h" #include "../glsl/glsl_parser_extras.h" #include "../glsl/ir_optimization.h" -#include "../glsl/ir_print_visitor.h" #include "../program/ir_to_mesa.h" using namespace ir_builder; diff --git a/mesalib/src/mesa/main/framebuffer.c b/mesalib/src/mesa/main/framebuffer.c index 1906a8a55..d28882ac4 100644 --- a/mesalib/src/mesa/main/framebuffer.c +++ b/mesalib/src/mesa/main/framebuffer.c @@ -319,81 +319,12 @@ _mesa_resize_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb, } } - - -/** - * XXX THIS IS OBSOLETE - drivers should take care of detecting window - * size changes and act accordingly, likely calling _mesa_resize_framebuffer(). - * - * GL_MESA_resize_buffers extension. - * - * When this function is called, we'll ask the window system how large - * the current window is. If it's a new size, we'll call the driver's - * ResizeBuffers function. The driver will then resize its color buffers - * as needed, and maybe call the swrast's routine for reallocating - * swrast-managed depth/stencil/accum/etc buffers. - * \note This function should only be called through the GL API, not - * from device drivers (as was done in the past). - */ -void -_mesa_resizebuffers( struct gl_context *ctx ) -{ - FLUSH_VERTICES(ctx, 0); - - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glResizeBuffersMESA\n"); - - if (!ctx->Driver.GetBufferSize) { - return; - } - - if (ctx->WinSysDrawBuffer) { - GLuint newWidth, newHeight; - struct gl_framebuffer *buffer = ctx->WinSysDrawBuffer; - - assert(_mesa_is_winsys_fbo(buffer)); - - /* ask device driver for size of output buffer */ - ctx->Driver.GetBufferSize( buffer, &newWidth, &newHeight ); - - /* see if size of device driver's color buffer (window) has changed */ - if (buffer->Width != newWidth || buffer->Height != newHeight) { - if (ctx->Driver.ResizeBuffers) - ctx->Driver.ResizeBuffers(ctx, buffer, newWidth, newHeight ); - } - } - - if (ctx->WinSysReadBuffer - && ctx->WinSysReadBuffer != ctx->WinSysDrawBuffer) { - GLuint newWidth, newHeight; - struct gl_framebuffer *buffer = ctx->WinSysReadBuffer; - - assert(_mesa_is_winsys_fbo(buffer)); - - /* ask device driver for size of read buffer */ - ctx->Driver.GetBufferSize( buffer, &newWidth, &newHeight ); - - /* see if size of device driver's color buffer (window) has changed */ - if (buffer->Width != newWidth || buffer->Height != newHeight) { - if (ctx->Driver.ResizeBuffers) - ctx->Driver.ResizeBuffers(ctx, buffer, newWidth, newHeight ); - } - } - - ctx->NewState |= _NEW_BUFFERS; /* to update scissor / window bounds */ -} - - /* * XXX THIS IS OBSOLETE */ void GLAPIENTRY _mesa_ResizeBuffersMESA( void ) { - GET_CURRENT_CONTEXT(ctx); - - if (ctx->Extensions.MESA_resize_buffers) - _mesa_resizebuffers( ctx ); } diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h index 0002da5c0..5d5b53492 100644 --- a/mesalib/src/mesa/main/mtypes.h +++ b/mesalib/src/mesa/main/mtypes.h @@ -2680,8 +2680,6 @@ struct gl_framebuffer */ struct gl_config Visual; - GLboolean Initialized; - GLuint Width, Height; /**< size of frame buffer in pixels */ /** \name Drawing bounds (Intersection of buffer size and scissor box) */ diff --git a/mesalib/src/mesa/main/shaderapi.c b/mesalib/src/mesa/main/shaderapi.c index 8cb02760b..4cc0357b1 100644 --- a/mesalib/src/mesa/main/shaderapi.c +++ b/mesalib/src/mesa/main/shaderapi.c @@ -48,11 +48,14 @@ #include "main/transformfeedback.h" #include "main/uniforms.h" #include "program/program.h" +#include "program/prog_print.h" #include "program/prog_parameter.h" #include "ralloc.h" #include <stdbool.h> #include "../glsl/glsl_parser_extras.h" +#include "../glsl/ir.h" #include "../glsl/ir_uniform.h" +#include "../glsl/program.h" /** Define this to enable shader substitution (see below) */ #define SHADER_SUBST 0 @@ -743,10 +746,42 @@ compile_shader(struct gl_context *ctx, GLuint shaderObj) /* set default pragma state for shader */ sh->Pragmas = options->DefaultPragmas; - /* this call will set the sh->CompileStatus field to indicate if - * compilation was successful. - */ - _mesa_glsl_compile_shader(ctx, sh); + if (!sh->Source) { + /* If the user called glCompileShader without first calling + * glShaderSource, we should fail to compile, but not raise a GL_ERROR. + */ + sh->CompileStatus = GL_FALSE; + } else { + if (ctx->Shader.Flags & GLSL_DUMP) { + printf("GLSL source for %s shader %d:\n", + _mesa_glsl_shader_target_name(sh->Type), sh->Name); + printf("%s\n", sh->Source); + } + + /* this call will set the shader->CompileStatus field to indicate if + * compilation was successful. + */ + _mesa_glsl_compile_shader(ctx, sh, false, false); + + if (ctx->Shader.Flags & GLSL_LOG) { + _mesa_write_shader_to_file(sh); + } + + if (ctx->Shader.Flags & GLSL_DUMP) { + if (sh->CompileStatus) { + printf("GLSL IR for shader %d:\n", sh->Name); + _mesa_print_ir(sh->ir, NULL); + printf("\n\n"); + } else { + printf("GLSL shader %d failed to compile.\n", sh->Name); + } + if (sh->InfoLog && sh->InfoLog[0] != 0) { + printf("GLSL shader %d info log:\n", sh->Name); + printf("%s\n", sh->InfoLog); + } + } + + } if (sh->CompileStatus == GL_FALSE && (ctx->Shader.Flags & GLSL_REPORT_ERRORS)) { @@ -816,21 +851,8 @@ print_shader_info(const struct gl_shader_program *shProg) printf("Mesa: glUseProgram(%u)\n", shProg->Name); for (i = 0; i < shProg->NumShaders; i++) { - const char *s; - switch (shProg->Shaders[i]->Type) { - case GL_VERTEX_SHADER: - s = "vertex"; - break; - case GL_FRAGMENT_SHADER: - s = "fragment"; - break; - case GL_GEOMETRY_SHADER: - s = "geometry"; - break; - default: - s = ""; - } - printf(" %s shader %u, checksum %u\n", s, + printf(" %s shader %u, checksum %u\n", + _mesa_glsl_shader_target_name(shProg->Shaders[i]->Type), shProg->Shaders[i]->Name, shProg->Shaders[i]->SourceChecksum); } diff --git a/mesalib/src/mesa/main/uniform_query.cpp b/mesalib/src/mesa/main/uniform_query.cpp index 296f80f17..3c460042e 100644 --- a/mesalib/src/mesa/main/uniform_query.cpp +++ b/mesalib/src/mesa/main/uniform_query.cpp @@ -33,6 +33,7 @@ #include "program/hash_table.h" #include "../glsl/program.h" #include "../glsl/ir_uniform.h" +#include "../glsl/glsl_parser_extras.h" #include "main/shaderapi.h" #include "main/shaderobj.h" #include "uniforms.h" @@ -434,12 +435,6 @@ log_uniform(const void *values, enum glsl_base_type basicType, static void log_program_parameters(const struct gl_shader_program *shProg) { - static const char *stages[] = { - "vertex", "fragment", "geometry" - }; - - assert(Elements(stages) == MESA_SHADER_TYPES); - for (unsigned i = 0; i < MESA_SHADER_TYPES; i++) { if (shProg->_LinkedShaders[i] == NULL) continue; @@ -447,7 +442,7 @@ log_program_parameters(const struct gl_shader_program *shProg) const struct gl_program *const prog = shProg->_LinkedShaders[i]->Program; printf("Program %d %s shader parameters:\n", - shProg->Name, stages[i]); + shProg->Name, _mesa_glsl_shader_target_name(prog->Target)); for (unsigned j = 0; j < prog->Parameters->NumParameters; j++) { printf("%s: %p %f %f %f %f\n", prog->Parameters->Parameters[j].Name, diff --git a/mesalib/src/mesa/main/uniforms.h b/mesalib/src/mesa/main/uniforms.h index 14fe26d5f..92239176e 100644 --- a/mesalib/src/mesa/main/uniforms.h +++ b/mesalib/src/mesa/main/uniforms.h @@ -272,7 +272,7 @@ static inline GLint _mesa_uniform_merge_location_offset(const struct gl_shader_program *prog, unsigned base_location, unsigned offset) { - assert(prog->UniformLocationBaseScale >= 0); + assert(prog->UniformLocationBaseScale >= 1); assert(offset < prog->UniformLocationBaseScale); return (base_location * prog->UniformLocationBaseScale) + offset; } |