summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_aaline.c13
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_aapoint.c13
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_pstipple.c5
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_exec.h2
-rw-r--r--src/gallium/auxiliary/util/u_tile.c17
-rw-r--r--src/gallium/state_trackers/wgl/shared/stw_framebuffer.c72
-rw-r--r--src/mesa/main/context.c10
-rw-r--r--src/mesa/main/mfeatures.h1
-rw-r--r--src/mesa/state_tracker/st_cb_texture.c17
-rw-r--r--src/mesa/state_tracker/st_program.c2
10 files changed, 114 insertions, 38 deletions
diff --git a/src/gallium/auxiliary/draw/draw_pipe_aaline.c b/src/gallium/auxiliary/draw/draw_pipe_aaline.c
index 9fedeef2d34..9f956715a22 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_aaline.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_aaline.c
@@ -60,8 +60,6 @@ struct aaline_fragment_shader
struct pipe_shader_state state;
void *driver_fs;
void *aaline_fs;
- void *aapoint_fs; /* not yet */
- void *sprite_fs; /* not yet */
uint sampler_unit;
int generic_attrib; /**< texcoord/generic used for texture */
};
@@ -373,10 +371,15 @@ generate_aaline_fs(struct aaline_stage *aaline)
aaline->fs->aaline_fs
= aaline->driver_create_fs_state(aaline->pipe, &aaline_fs);
if (aaline->fs->aaline_fs == NULL)
- return FALSE;
+ goto fail;
aaline->fs->generic_attrib = transform.maxGeneric + 1;
+ FREE((void *)aaline_fs.tokens);
return TRUE;
+
+fail:
+ FREE((void *)aaline_fs.tokens);
+ return FALSE;
}
@@ -816,6 +819,10 @@ aaline_delete_fs_state(struct pipe_context *pipe, void *fs)
struct aaline_fragment_shader *aafs = (struct aaline_fragment_shader *) fs;
/* pass-through */
aaline->driver_delete_fs_state(aaline->pipe, aafs->driver_fs);
+
+ if (aafs->aaline_fs)
+ aaline->driver_delete_fs_state(aaline->pipe, aafs->aaline_fs);
+
FREE(aafs);
}
diff --git a/src/gallium/auxiliary/draw/draw_pipe_aapoint.c b/src/gallium/auxiliary/draw/draw_pipe_aapoint.c
index 66839f7873c..ae1712fe122 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_aapoint.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_aapoint.c
@@ -523,11 +523,15 @@ generate_aapoint_fs(struct aapoint_stage *aapoint)
aapoint->fs->aapoint_fs
= aapoint->driver_create_fs_state(aapoint->pipe, &aapoint_fs);
if (aapoint->fs->aapoint_fs == NULL)
- return FALSE;
+ goto fail;
aapoint->fs->generic_attrib = transform.maxGeneric + 1;
-
+ FREE((void *)aapoint_fs.tokens);
return TRUE;
+
+fail:
+ FREE((void *)aapoint_fs.tokens);
+ return FALSE;
}
@@ -825,8 +829,13 @@ aapoint_delete_fs_state(struct pipe_context *pipe, void *fs)
{
struct aapoint_stage *aapoint = aapoint_stage_from_pipe(pipe);
struct aapoint_fragment_shader *aafs = (struct aapoint_fragment_shader *) fs;
+
/* pass-through */
aapoint->driver_delete_fs_state(aapoint->pipe, aafs->driver_fs);
+
+ if (aafs->aapoint_fs)
+ aapoint->driver_delete_fs_state(aapoint->pipe, aafs->aapoint_fs);
+
FREE(aafs);
}
diff --git a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c
index 9287fc130ee..30a6d2919d9 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c
@@ -358,6 +358,7 @@ generate_pstip_fs(struct pstip_stage *pstip)
pstip->fs->pstip_fs = pstip->driver_create_fs_state(pstip->pipe, &pstip_fs);
+ FREE((void *)pstip_fs.tokens);
return TRUE;
}
@@ -649,6 +650,10 @@ pstip_delete_fs_state(struct pipe_context *pipe, void *fs)
struct pstip_fragment_shader *aafs = (struct pstip_fragment_shader *) fs;
/* pass-through */
pstip->driver_delete_fs_state(pstip->pipe, aafs->driver_fs);
+
+ if (aafs->pstip_fs)
+ pstip->driver_delete_fs_state(pstip->pipe, aafs->pstip_fs);
+
FREE(aafs);
}
diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.h b/src/gallium/auxiliary/tgsi/tgsi_exec.h
index 0b4b2a6fb6e..da22baad3ef 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.h
@@ -34,7 +34,7 @@
extern "C" {
#endif
-#define MAX_LABELS 1024
+#define MAX_LABELS (4 * 1024) /**< basically, max instructions */
#define NUM_CHANNELS 4 /* R,G,B,A */
#define QUAD_SIZE 4 /* 4 pixel/quad */
diff --git a/src/gallium/auxiliary/util/u_tile.c b/src/gallium/auxiliary/util/u_tile.c
index f0a5a339eb3..9747a55cbfa 100644
--- a/src/gallium/auxiliary/util/u_tile.c
+++ b/src/gallium/auxiliary/util/u_tile.c
@@ -1126,7 +1126,22 @@ pipe_get_tile_z(struct pipe_transfer *pt,
for (i = 0; i < h; i++) {
for (j = 0; j < w; j++) {
/* convert 24-bit Z to 32-bit Z */
- pDest[j] = (ptrc[j] << 8) | (ptrc[j] & 0xff);
+ pDest[j] = (ptrc[j] << 8) | ((ptrc[j] >> 16) & 0xff);
+ }
+ pDest += dstStride;
+ ptrc += pt->stride/4;
+ }
+ }
+ break;
+ case PIPE_FORMAT_Z24S8_UNORM:
+ case PIPE_FORMAT_Z24X8_UNORM:
+ {
+ const uint *ptrc
+ = (const uint *)(map + y * pt->stride + x*4);
+ for (i = 0; i < h; i++) {
+ for (j = 0; j < w; j++) {
+ /* convert 24-bit Z to 32-bit Z */
+ pDest[j] = (ptrc[j] & 0xffffff00) | ((ptrc[j] >> 24) & 0xff);
}
pDest += dstStride;
ptrc += pt->stride/4;
diff --git a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c
index 768cef3db6c..de37d135dfe 100644
--- a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c
+++ b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c
@@ -45,6 +45,41 @@
#include "stw_tls.h"
+struct stw_framebuffer *
+stw_framebuffer_from_hwnd_locked(
+ HWND hwnd )
+{
+ struct stw_framebuffer *fb;
+
+ for (fb = stw_dev->fb_head; fb != NULL; fb = fb->next)
+ if (fb->hWnd == hwnd)
+ break;
+
+ return fb;
+}
+
+
+static INLINE void
+stw_framebuffer_destroy_locked(
+ struct stw_framebuffer *fb )
+{
+ struct stw_framebuffer **link;
+
+ link = &stw_dev->fb_head;
+ while (*link != fb)
+ link = &(*link)->next;
+ assert(*link);
+ *link = fb->next;
+ fb->next = NULL;
+
+ st_unreference_framebuffer(fb->stfb);
+
+ pipe_mutex_destroy( fb->mutex );
+
+ FREE( fb );
+}
+
+
/**
* @sa http://msdn.microsoft.com/en-us/library/ms644975(VS.85).aspx
* @sa http://msdn.microsoft.com/en-us/library/ms644960(VS.85).aspx
@@ -69,9 +104,7 @@ stw_call_window_proc(
struct stw_framebuffer *fb;
pipe_mutex_lock( stw_dev->mutex );
- for (fb = stw_dev->fb_head; fb != NULL; fb = fb->next)
- if (fb->hWnd == pParams->hwnd)
- break;
+ fb = stw_framebuffer_from_hwnd_locked( pParams->hwnd );
pipe_mutex_unlock( stw_dev->mutex );
if(fb) {
@@ -90,6 +123,18 @@ stw_call_window_proc(
}
}
+ if (pParams->message == WM_DESTROY) {
+ struct stw_framebuffer *fb;
+
+ pipe_mutex_lock( stw_dev->mutex );
+
+ fb = stw_framebuffer_from_hwnd_locked( pParams->hwnd );
+ if(fb)
+ stw_framebuffer_destroy_locked(fb);
+
+ pipe_mutex_unlock( stw_dev->mutex );
+ }
+
return CallNextHookEx(tls_data->hCallWndProcHook, nCode, wParam, lParam);
}
@@ -212,27 +257,6 @@ stw_framebuffer_resize(
}
-static INLINE void
-stw_framebuffer_destroy_locked(
- struct stw_framebuffer *fb )
-{
- struct stw_framebuffer **link;
-
- link = &stw_dev->fb_head;
- while (*link != fb)
- link = &(*link)->next;
- assert(*link);
- *link = fb->next;
- fb->next = NULL;
-
- st_unreference_framebuffer(fb->stfb);
-
- pipe_mutex_destroy( fb->mutex );
-
- FREE( fb );
-}
-
-
void
stw_framebuffer_cleanup( void )
{
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index ad47e22580b..bf53bd34678 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1011,6 +1011,16 @@ _mesa_free_context_data( GLcontext *ctx )
_mesa_delete_array_object(ctx, ctx->Array.DefaultArrayObj);
+#if FEATURE_ARB_pixel_buffer_object
+ _mesa_reference_buffer_object(ctx, &ctx->Pack.BufferObj, NULL);
+ _mesa_reference_buffer_object(ctx, &ctx->Unpack.BufferObj, NULL);
+#endif
+
+#if FEATURE_ARB_vertex_buffer_object
+ _mesa_reference_buffer_object(ctx, &ctx->Array.ArrayBufferObj, NULL);
+ _mesa_reference_buffer_object(ctx, &ctx->Array.ElementArrayBufferObj, NULL);
+#endif
+
/* free dispatch tables */
_mesa_free(ctx->Exec);
_mesa_free(ctx->Save);
diff --git a/src/mesa/main/mfeatures.h b/src/mesa/main/mfeatures.h
index f5706479423..62c3ead3e1b 100644
--- a/src/mesa/main/mfeatures.h
+++ b/src/mesa/main/mfeatures.h
@@ -61,6 +61,7 @@
#define FEATURE_ARB_occlusion_query _HAVE_FULL_GL
#define FEATURE_ARB_fragment_program _HAVE_FULL_GL
#define FEATURE_ARB_framebuffer_object _HAVE_FULL_GL
+#define FEATURE_ARB_pixel_buffer_object _HAVE_FULL_GL
#define FEATURE_ARB_vertex_buffer_object _HAVE_FULL_GL
#define FEATURE_ARB_vertex_program _HAVE_FULL_GL
#define FEATURE_ARB_vertex_shader _HAVE_FULL_GL
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index b182106fd56..14b78d12539 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -673,7 +673,7 @@ st_TexImage(GLcontext * ctx,
PIPE_TEXTURE_USAGE_RENDER_TARGET, 0)) {
if (compress_with_blit(ctx, target, level, 0, 0, 0, width, height, depth,
format, type, pixels, unpack, texImage)) {
- return;
+ goto done;
}
}
@@ -750,6 +750,7 @@ st_TexImage(GLcontext * ctx,
_mesa_unmap_teximage_pbo(ctx, unpack);
+done:
if (stImage->pt && texImage->Data) {
st_texture_image_unmap(ctx->st, stImage);
texImage->Data = NULL;
@@ -1061,7 +1062,7 @@ st_TexSubimage(GLcontext *ctx, GLint dims, GLenum target, GLint level,
xoffset, yoffset, zoffset,
width, height, depth,
format, type, pixels, packing, texImage)) {
- return;
+ goto done;
}
}
@@ -1110,16 +1111,17 @@ st_TexSubimage(GLcontext *ctx, GLint dims, GLenum target, GLint level,
}
}
- if (level == texObj->BaseLevel && texObj->GenerateMipmap) {
- ctx->Driver.GenerateMipmap(ctx, target, texObj);
- }
-
_mesa_unmap_teximage_pbo(ctx, packing);
+done:
if (stImage->pt) {
st_texture_image_unmap(ctx->st, stImage);
texImage->Data = NULL;
}
+
+ if (level == texObj->BaseLevel && texObj->GenerateMipmap) {
+ ctx->Driver.GenerateMipmap(ctx, target, texObj);
+ }
}
@@ -1315,6 +1317,9 @@ st_copy_texsubimage(GLcontext *ctx,
GLboolean use_fallback = GL_TRUE;
GLboolean matching_base_formats;
+ /* any rendering in progress must flushed before we grab the fb image */
+ st_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL);
+
/* make sure finalize_textures has been called?
*/
if (0) st_validate_state(ctx->st);
diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
index 6ec633c0b46..34926101ed0 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -49,7 +49,7 @@
#include "cso_cache/cso_context.h"
-#define ST_MAX_SHADER_TOKENS 4096
+#define ST_MAX_SHADER_TOKENS (8 * 1024)
#define TGSI_DEBUG 0