diff options
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r-- | src/mesa/state_tracker/st_cb_bufferobjects.c | 5 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_cb_drawpixels.c | 9 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_cb_fbo.c | 9 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_mipmap_tree.c | 9 |
4 files changed, 17 insertions, 15 deletions
diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.c b/src/mesa/state_tracker/st_cb_bufferobjects.c index d020eb2007b..78fc18a49ad 100644 --- a/src/mesa/state_tracker/st_cb_bufferobjects.c +++ b/src/mesa/state_tracker/st_cb_bufferobjects.c @@ -34,6 +34,9 @@ #include "st_cb_bufferobjects.h" #include "pipe/p_context.h" +#include "pipe/p_defines.h" + + /* Pixel buffers and Vertex/index buffers are handled through these * mesa callbacks. Framebuffer/Renderbuffer objects are @@ -160,7 +163,7 @@ st_bufferobj_map(GLcontext *ctx, flags = PIPE_BUFFER_FLAG_WRITE; break; - + case GL_READ_ONLY: flags = PIPE_BUFFER_FLAG_READ; break; diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index f0c7a2bfc5a..6981097ef4a 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -101,20 +101,19 @@ make_mipmap_tree(struct st_context *st, const GLvoid *pixels) { GLuint pipeFormat = st_choose_pipe_format(st->pipe, GL_RGBA, format, type); - int cpp = 4, pitch; + int cpp = 4; struct pipe_mipmap_tree *mt = CALLOC_STRUCT(pipe_mipmap_tree); + GLbitfield flags = PIPE_SURFACE_FLAG_TEXTURE; assert(pipeFormat); - pitch = width; /* XXX pad */ - if (unpack->BufferObj) { /* mt->region = buffer_object_region(unpack->BufferObj); */ } else { - mt->region = st->pipe->region_alloc(st->pipe, cpp, pitch, height); + mt->region = st->pipe->region_alloc(st->pipe, cpp, width, height, flags); /* XXX do texstore() here */ } @@ -128,7 +127,7 @@ make_mipmap_tree(struct st_context *st, mt->depth0 = 1; mt->cpp = cpp; mt->compressed = 0; - mt->pitch = pitch; + mt->pitch = mt->region->pitch; mt->depth_pitch = 0; mt->total_height = height; mt->level[0].level_offset = 0; diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c index 64ec8022164..bb588d10ea2 100644 --- a/src/mesa/state_tracker/st_cb_fbo.c +++ b/src/mesa/state_tracker/st_cb_fbo.c @@ -62,7 +62,8 @@ st_renderbuffer_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb, const GLuint pipeFormat = st_choose_pipe_format(pipe, internalFormat, GL_NONE, GL_NONE); const struct pipe_format_info *info = st_get_format_info(pipeFormat); - GLuint cpp, pitch; + GLuint cpp; + GLbitfield flags = PIPE_SURFACE_FLAG_RENDER; /* want to render to surface */ assert(info); if (!info) @@ -98,11 +99,7 @@ st_renderbuffer_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb, pipe->region_release(pipe, &strb->surface->region); } - /* Choose a pitch to match hardware requirements: - */ - pitch = ((cpp * width + 63) & ~63) / cpp; /* XXX fix: device-specific */ - - strb->surface->region = pipe->region_alloc(pipe, cpp, pitch, height); + strb->surface->region = pipe->region_alloc(pipe, cpp, width, height, flags); if (!strb->surface->region) return GL_FALSE; /* out of memory, try s/w buffer? */ diff --git a/src/mesa/state_tracker/st_mipmap_tree.c b/src/mesa/state_tracker/st_mipmap_tree.c index ac74335ba13..3cbe697ab3f 100644 --- a/src/mesa/state_tracker/st_mipmap_tree.c +++ b/src/mesa/state_tracker/st_mipmap_tree.c @@ -62,6 +62,7 @@ st_miptree_create(struct pipe_context *pipe, { GLboolean ok; struct pipe_mipmap_tree *mt = calloc(sizeof(*mt), 1); + GLbitfield flags = 0x0; DBG("%s target %s format %s level %d..%d\n", __FUNCTION__, _mesa_lookup_enum_by_nr(target), @@ -79,9 +80,11 @@ st_miptree_create(struct pipe_context *pipe, mt->refcount = 1; ok = pipe->mipmap_tree_layout(pipe, mt); - if (ok) - mt->region = pipe->region_alloc(pipe, - mt->cpp, mt->pitch, mt->total_height); + if (ok) { + /* note: it's OK to pass 'pitch' as 'width' here: */ + mt->region = pipe->region_alloc(pipe, mt->cpp, mt->pitch, + mt->total_height, flags); + } if (!mt->region) { free(mt); |