diff options
-rw-r--r-- | src/gallium/include/pipe/p_format.h | 12 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_atom_shader.c | 4 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_cb_clear.c | 18 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_cb_drawpixels.c | 3 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_format.c | 14 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_format.h | 4 | ||||
-rw-r--r-- | src/mesa/vbo/vbo_exec_api.c | 9 |
7 files changed, 33 insertions, 31 deletions
diff --git a/src/gallium/include/pipe/p_format.h b/src/gallium/include/pipe/p_format.h index 187377f92ae..e31538c95fc 100644 --- a/src/gallium/include/pipe/p_format.h +++ b/src/gallium/include/pipe/p_format.h @@ -549,13 +549,23 @@ pf_get_2d_size(const struct pipe_format_block *block, size_t stride, unsigned he } static INLINE boolean -pf_is_depth_stencil( enum pipe_format format ) +pf_is_depth_or_stencil( enum pipe_format format ) { return (pf_get_component_bits( format, PIPE_FORMAT_COMP_Z ) + pf_get_component_bits( format, PIPE_FORMAT_COMP_S )) != 0; } static INLINE boolean +pf_is_depth_and_stencil( enum pipe_format format ) +{ + return (pf_get_component_bits( format, PIPE_FORMAT_COMP_Z ) != 0 && + pf_get_component_bits( format, PIPE_FORMAT_COMP_S ) != 0); +} + +/** DEPRECATED: For backwards compatibility */ +#define pf_is_depth_stencil pf_is_depth_or_stencil + +static INLINE boolean pf_is_compressed( enum pipe_format format ) { return pf_layout(format) == PIPE_FORMAT_LAYOUT_DXT ? TRUE : FALSE; diff --git a/src/mesa/state_tracker/st_atom_shader.c b/src/mesa/state_tracker/st_atom_shader.c index fc1ff5be04a..cb869c98a3d 100644 --- a/src/mesa/state_tracker/st_atom_shader.c +++ b/src/mesa/state_tracker/st_atom_shader.c @@ -237,8 +237,8 @@ find_translated_vp(struct st_context *st, } if (emitBFC1) { xvp->output_to_slot[VERT_RESULT_BFC1] = numVpOuts++; - xvp->output_to_semantic_name[VERT_RESULT_BFC0] = TGSI_SEMANTIC_COLOR; - xvp->output_to_semantic_index[VERT_RESULT_BFC0] = 1; + xvp->output_to_semantic_name[VERT_RESULT_BFC1] = TGSI_SEMANTIC_COLOR; + xvp->output_to_semantic_index[VERT_RESULT_BFC1] = 1; } /* Unneeded vertex program outputs will go to this slot. diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c index 880e83108c1..668acbccb88 100644 --- a/src/mesa/state_tracker/st_cb_clear.c +++ b/src/mesa/state_tracker/st_cb_clear.c @@ -103,20 +103,6 @@ st_destroy_clear(struct st_context *st) } -static GLboolean -is_depth_stencil_format(enum pipe_format pipeFormat) -{ - switch (pipeFormat) { - case PIPE_FORMAT_S8Z24_UNORM: - case PIPE_FORMAT_Z24S8_UNORM: - return GL_TRUE; - default: - return GL_FALSE; - } -} - - - /** * Draw a screen-aligned quadrilateral. * Coords are window coords with y=0=bottom. These will be passed @@ -331,7 +317,7 @@ static INLINE GLboolean check_clear_depth_with_quad(GLcontext *ctx, struct gl_renderbuffer *rb) { const struct st_renderbuffer *strb = st_renderbuffer(rb); - const GLboolean isDS = is_depth_stencil_format(strb->surface->format); + const GLboolean isDS = pf_is_depth_and_stencil(strb->surface->format); if (ctx->Scissor.Enabled) return TRUE; @@ -351,7 +337,7 @@ static INLINE GLboolean check_clear_stencil_with_quad(GLcontext *ctx, struct gl_renderbuffer *rb) { const struct st_renderbuffer *strb = st_renderbuffer(rb); - const GLboolean isDS = is_depth_stencil_format(strb->surface->format); + const GLboolean isDS = pf_is_depth_and_stencil(strb->surface->format); const GLuint stencilMax = (1 << rb->StencilBits) - 1; const GLboolean maskStencil = (ctx->Stencil.WriteMask[0] & stencilMax) != stencilMax; diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index 04cf673f637..2027b713ce0 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -769,7 +769,6 @@ st_DrawPixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, struct st_vertex_program *stvp; struct st_context *st = ctx->st; struct pipe_surface *ps; - GLuint bufferFormat; const GLfloat *color; if (format == GL_STENCIL_INDEX || @@ -797,8 +796,6 @@ st_DrawPixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, color = NULL; } - bufferFormat = ps->format; - /* draw with textured quad */ { struct pipe_texture *pt diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c index d507e3e58dd..b243c249e37 100644 --- a/src/mesa/state_tracker/st_format.c +++ b/src/mesa/state_tracker/st_format.c @@ -392,7 +392,7 @@ default_depth_format(struct pipe_screen *screen, * or PIPE_TEXTURE_USAGE_SAMPLER */ enum pipe_format -st_choose_format(struct pipe_context *pipe, GLint internalFormat, +st_choose_format(struct pipe_context *pipe, GLenum internalFormat, enum pipe_texture_target target, unsigned tex_usage) { struct pipe_screen *screen = pipe->screen; @@ -594,9 +594,13 @@ st_choose_format(struct pipe_context *pipe, GLint internalFormat, static GLboolean -is_stencil_format(GLenum format) +is_depth_or_stencil_format(GLenum internalFormat) { - switch (format) { + switch (internalFormat) { + case GL_DEPTH_COMPONENT: + case GL_DEPTH_COMPONENT16: + case GL_DEPTH_COMPONENT24: + case GL_DEPTH_COMPONENT32: case GL_STENCIL_INDEX: case GL_STENCIL_INDEX1_EXT: case GL_STENCIL_INDEX4_EXT: @@ -614,10 +618,10 @@ is_stencil_format(GLenum format) * Called by FBO code to choose a PIPE_FORMAT_ for drawing surfaces. */ enum pipe_format -st_choose_renderbuffer_format(struct pipe_context *pipe, GLint internalFormat) +st_choose_renderbuffer_format(struct pipe_context *pipe, GLenum internalFormat) { uint usage; - if (is_stencil_format(internalFormat)) + if (is_depth_or_stencil_format(internalFormat)) usage = PIPE_TEXTURE_USAGE_DEPTH_STENCIL; else usage = PIPE_TEXTURE_USAGE_RENDER_TARGET; diff --git a/src/mesa/state_tracker/st_format.h b/src/mesa/state_tracker/st_format.h index 7bbbe2d5704..9d9e02fe9b6 100644 --- a/src/mesa/state_tracker/st_format.h +++ b/src/mesa/state_tracker/st_format.h @@ -64,11 +64,11 @@ st_mesa_format_to_pipe_format(GLuint mesaFormat); extern enum pipe_format -st_choose_format(struct pipe_context *pipe, GLint internalFormat, +st_choose_format(struct pipe_context *pipe, GLenum internalFormat, enum pipe_texture_target target, unsigned tex_usage); extern enum pipe_format -st_choose_renderbuffer_format(struct pipe_context *pipe, GLint internalFormat); +st_choose_renderbuffer_format(struct pipe_context *pipe, GLenum internalFormat); extern const struct gl_texture_format * diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c index 372d6819c1f..b746a77bc19 100644 --- a/src/mesa/vbo/vbo_exec_api.c +++ b/src/mesa/vbo/vbo_exec_api.c @@ -51,6 +51,10 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #endif +/** ID/name for immediate-mode VBO */ +#define IMM_BUFFER_NAME 0xaabbccdd + + static void reset_attrfv( struct vbo_exec_context *exec ); @@ -665,7 +669,7 @@ void vbo_use_buffer_objects(GLcontext *ctx) /* Any buffer name but 0 can be used here since this bufferobj won't * go into the bufferobj hashtable. */ - GLuint bufName = 0xaabbccdd; + GLuint bufName = IMM_BUFFER_NAME; GLenum target = GL_ARRAY_BUFFER_ARB; GLenum usage = GL_STREAM_DRAW_ARB; GLsizei size = VBO_VERT_BUFFER_SIZE; @@ -734,7 +738,8 @@ void vbo_exec_vtx_destroy( struct vbo_exec_context *exec ) /* True VBOs should already be unmapped */ if (exec->vtx.buffer_map) { - assert (exec->vtx.bufferobj->Name == 0); + ASSERT(exec->vtx.bufferobj->Name == 0 || + exec->vtx.bufferobj->Name == IMM_BUFFER_NAME); if (exec->vtx.bufferobj->Name == 0) { ALIGN_FREE(exec->vtx.buffer_map); exec->vtx.buffer_map = NULL; |