diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/glx/x11/glxhash.c | 10 | ||||
-rw-r--r-- | src/mesa/drivers/common/meta.c | 4 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_clear.c | 6 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/compiler/r300_fragprog_emit.c | 2 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_cb_fbo.c | 1 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_cb_texture.c | 18 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_framebuffer.c | 18 |
7 files changed, 41 insertions, 18 deletions
diff --git a/src/glx/x11/glxhash.c b/src/glx/x11/glxhash.c index 74cd4f344df..7d28ada49ca 100644 --- a/src/glx/x11/glxhash.c +++ b/src/glx/x11/glxhash.c @@ -87,9 +87,13 @@ #define HASH_ALLOC malloc #define HASH_FREE free -#define HASH_RANDOM_DECL -#define HASH_RANDOM_INIT(seed) srandom(seed) -#define HASH_RANDOM random() +#define HASH_RANDOM_DECL struct random_data rd; int32_t rv; char rs[256] +#define HASH_RANDOM_INIT(seed) \ + do { \ + (void) memset(&rd, 0, sizeof(rd)); \ + (void) initstate_r(seed, rs, sizeof(rs), &rd); \ + } while(0) +#define HASH_RANDOM ((void) random_r(&rd, &rv), rv) #define HASH_RANDOM_DESTROY typedef struct __glxHashBucket diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index e9b892e33f0..532b2c92635 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -772,7 +772,6 @@ _mesa_meta_end(GLcontext *ctx) _mesa_MatrixMode(save->MatrixMode); - save->ClipPlanesEnabled = ctx->Transform.ClipPlanesEnabled; if (save->ClipPlanesEnabled) { GLuint i; for (i = 0; i < ctx->Const.MaxClipPlanes; i++) { @@ -808,9 +807,6 @@ _mesa_meta_end(GLcontext *ctx) if (save->Lighting) { _mesa_set_enable(ctx, GL_LIGHTING, GL_TRUE); } - if (save->Fog) { - _mesa_set_enable(ctx, GL_FOG, GL_TRUE); - } } diff --git a/src/mesa/drivers/dri/intel/intel_clear.c b/src/mesa/drivers/dri/intel/intel_clear.c index 4ce783f4503..9010b910c7d 100644 --- a/src/mesa/drivers/dri/intel/intel_clear.c +++ b/src/mesa/drivers/dri/intel/intel_clear.c @@ -38,6 +38,7 @@ #include "intel_fbo.h" #include "intel_pixel.h" #include "intel_regions.h" +#include "intel_batchbuffer.h" #define FILE_DEBUG_FLAG DEBUG_BLIT @@ -170,8 +171,9 @@ intelClear(GLcontext *ctx, GLbitfield mask) } DBG("\n"); } - intelFlush(&intel->ctx); - _mesa_meta_Clear(&intel->ctx, tri_mask); + + _mesa_meta_clear(&intel->ctx, tri_mask); + intel_batchbuffer_flush(intel->batch); } if (swrast_mask) { diff --git a/src/mesa/drivers/dri/r300/compiler/r300_fragprog_emit.c b/src/mesa/drivers/dri/r300/compiler/r300_fragprog_emit.c index 305dc074ee8..c7227bbd15b 100644 --- a/src/mesa/drivers/dri/r300/compiler/r300_fragprog_emit.c +++ b/src/mesa/drivers/dri/r300/compiler/r300_fragprog_emit.c @@ -352,7 +352,7 @@ void r300BuildFragmentProgramHwCode(struct r300_fragment_program_compiler *compi if (emit.current_node < 3) { int shift = 3 - emit.current_node; int i; - for(i = 0; i <= emit.current_node; ++i) + for(i = emit.current_node; i >= 0; --i) code->code_addr[shift + i] = code->code_addr[i]; for(i = 0; i < shift; ++i) code->code_addr[i] = 0; diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c index a96602878e4..fe0a1214933 100644 --- a/src/mesa/state_tracker/st_cb_fbo.c +++ b/src/mesa/state_tracker/st_cb_fbo.c @@ -258,6 +258,7 @@ st_new_renderbuffer_fb(enum pipe_format format, int samples, boolean sw) strb->Base.ClassID = 0x4242; /* just a unique value */ strb->Base.NumSamples = samples; strb->format = format; + init_renderbuffer_bits(strb, format); strb->software = sw; switch (format) { diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index c0ace3b9eac..3520c986b47 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -658,8 +658,10 @@ st_TexImage(GLcontext * ctx, format, type, pixels, unpack, "glTexImage"); } - if (!pixels) - return; + + /* Note: we can't check for pixels==NULL until after we've allocated + * memory for the texture. + */ /* See if we can do texture compression with a blit/render. */ @@ -670,6 +672,9 @@ st_TexImage(GLcontext * ctx, stImage->pt->format, stImage->pt->target, PIPE_TEXTURE_USAGE_RENDER_TARGET, 0)) { + if (!pixels) + goto done; + if (compress_with_blit(ctx, target, level, 0, 0, 0, width, height, depth, format, type, pixels, unpack, texImage)) { goto done; @@ -711,6 +716,9 @@ st_TexImage(GLcontext * ctx, return; } + if (!pixels) + goto done; + DBG("Upload image %dx%dx%d row_len %x pitch %x\n", width, height, depth, width * texelBytes, dstRowStride); @@ -753,9 +761,9 @@ st_TexImage(GLcontext * ctx, } } +done: _mesa_unmap_teximage_pbo(ctx, unpack); -done: if (stImage->pt && texImage->Data) { st_texture_image_unmap(ctx->st, stImage); texImage->Data = NULL; @@ -1092,7 +1100,7 @@ st_TexSubimage(GLcontext *ctx, GLint dims, GLenum target, GLint level, if (!texImage->Data) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage"); - return; + goto done; } src = (const GLubyte *) pixels; @@ -1123,9 +1131,9 @@ st_TexSubimage(GLcontext *ctx, GLint dims, GLenum target, GLint level, } } +done: _mesa_unmap_teximage_pbo(ctx, packing); -done: if (stImage->pt) { st_texture_image_unmap(ctx->st, stImage); texImage->Data = NULL; diff --git a/src/mesa/state_tracker/st_framebuffer.c b/src/mesa/state_tracker/st_framebuffer.c index ca32b2e573c..5c0d335d62d 100644 --- a/src/mesa/state_tracker/st_framebuffer.c +++ b/src/mesa/state_tracker/st_framebuffer.c @@ -66,7 +66,7 @@ st_create_framebuffer( const __GLcontextModes *visual, else { /* Only allocate front buffer right now if we're single buffered. * If double-buffered, allocate front buffer on demand later. - * See check_create_front_buffers(). + * See check_create_front_buffers() and st_set_framebuffer_surface(). */ struct gl_renderbuffer *rb = st_new_renderbuffer_fb(colorFormat, samples, FALSE); @@ -170,8 +170,20 @@ st_set_framebuffer_surface(struct st_framebuffer *stfb, strb = st_renderbuffer(stfb->Base.Attachment[surfIndex].Renderbuffer); - /* fail */ - if (!strb) return; + if (!strb) { + if (surfIndex == ST_SURFACE_FRONT_LEFT) { + /* Delayed creation when the window system supplies a fake front buffer */ + struct st_renderbuffer *strb_back + = st_renderbuffer(stfb->Base.Attachment[ST_SURFACE_BACK_LEFT].Renderbuffer); + struct gl_renderbuffer *rb + = st_new_renderbuffer_fb(surf->format, strb_back->Base.NumSamples, FALSE); + _mesa_add_renderbuffer(&stfb->Base, BUFFER_FRONT_LEFT, rb); + strb = st_renderbuffer(rb); + } else { + /* fail */ + return; + } + } /* replace the renderbuffer's surface/texture pointers */ pipe_surface_reference( &strb->surface, surf ); |