diff options
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r-- | src/mesa/state_tracker/st_cb_drawpixels.c | 13 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_cb_fbo.c | 13 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_cb_fbo.h | 1 |
3 files changed, 10 insertions, 17 deletions
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index 386eed2909f..88e57b8c5d7 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -842,12 +842,14 @@ draw_stencil_pixels(struct gl_context *ctx, GLint x, GLint y, y = ctx->DrawBuffer->Height - y - height; } - if(format != GL_DEPTH_STENCIL && - util_format_get_component_bits(strb->format, - UTIL_FORMAT_COLORSPACE_ZS, 0) != 0) + if (format == GL_STENCIL_INDEX && + _mesa_is_format_packed_depth_stencil(strb->Base.Format)) { + /* writing stencil to a combined depth+stencil buffer */ usage = PIPE_TRANSFER_READ_WRITE; - else + } + else { usage = PIPE_TRANSFER_WRITE; + } pt = pipe_get_transfer(pipe, strb->texture, strb->rtt_level, strb->rtt_face + strb->rtt_slice, @@ -1209,8 +1211,7 @@ copy_stencil_pixels(struct gl_context *ctx, GLint srcx, GLint srcy, } } - if (util_format_get_component_bits(rbDraw->format, - UTIL_FORMAT_COLORSPACE_ZS, 0) != 0) + if (_mesa_is_format_packed_depth_stencil(rbDraw->Base.Format)) usage = PIPE_TRANSFER_READ_WRITE; else usage = PIPE_TRANSFER_WRITE; diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c index 1cbc0d606bf..85086bbd2a9 100644 --- a/src/mesa/state_tracker/st_cb_fbo.c +++ b/src/mesa/state_tracker/st_cb_fbo.c @@ -97,7 +97,6 @@ st_renderbuffer_alloc_storage(struct gl_context * ctx, strb->Base.Height = height; strb->Base.Format = st_pipe_format_to_mesa_format(format); strb->Base._BaseFormat = _mesa_base_fbo_format(ctx, internalFormat); - strb->format = format; strb->defined = GL_FALSE; /* undefined contents now */ @@ -106,10 +105,8 @@ st_renderbuffer_alloc_storage(struct gl_context * ctx, free(strb->data); - assert(strb->format != PIPE_FORMAT_NONE); - - strb->stride = util_format_get_stride(strb->format, width); - size = util_format_get_2d_size(strb->format, strb->stride, height); + strb->stride = util_format_get_stride(format, width); + size = util_format_get_2d_size(format, strb->stride, height); strb->data = malloc(size); @@ -206,7 +203,6 @@ st_new_renderbuffer(struct gl_context *ctx, GLuint name) _mesa_init_renderbuffer(&strb->Base, name); strb->Base.Delete = st_renderbuffer_delete; strb->Base.AllocStorage = st_renderbuffer_alloc_storage; - strb->format = PIPE_FORMAT_NONE; return &strb->Base; } return NULL; @@ -233,7 +229,6 @@ st_new_renderbuffer_fb(enum pipe_format format, int samples, boolean sw) strb->Base.NumSamples = samples; strb->Base.Format = st_pipe_format_to_mesa_format(format); strb->Base._BaseFormat = _mesa_get_format_base_format(strb->Base.Format); - strb->format = format; strb->software = sw; switch (format) { @@ -401,8 +396,6 @@ st_render_texture(struct gl_context *ctx, strb->texture, &surf_tmpl); - strb->format = pt->format; - strb->Base.Format = st_pipe_format_to_mesa_format(pt->format); /* @@ -650,7 +643,7 @@ st_MapRenderbuffer(struct gl_context *ctx, GLubyte *map = (GLubyte *) strb->data; if (strb->data) { map += strb->stride * y; - map += util_format_get_blocksize(strb->format) * x; + map += _mesa_get_format_bytes(strb->Base.Format) * x; *mapOut = map; *rowStrideOut = strb->stride; } diff --git a/src/mesa/state_tracker/st_cb_fbo.h b/src/mesa/state_tracker/st_cb_fbo.h index 1be017314ef..7a2d4d8b157 100644 --- a/src/mesa/state_tracker/st_cb_fbo.h +++ b/src/mesa/state_tracker/st_cb_fbo.h @@ -48,7 +48,6 @@ struct st_renderbuffer struct gl_renderbuffer Base; struct pipe_resource *texture; struct pipe_surface *surface; /* temporary view into texture */ - enum pipe_format format; /** preferred format, or PIPE_FORMAT_NONE */ GLboolean defined; /**< defined contents? */ struct pipe_transfer *transfer; /**< only used when mapping the resource */ |