From 2ef1aae1633db98fc52f440ca33b8f2a6f153d45 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 7 Oct 2009 09:58:03 -0600 Subject: st/mesa: pass pipe_screen, not pipe_context to st_choose_format() functions These don't depend on context state, but use a screen pointer. --- src/mesa/state_tracker/st_atom_pixeltransfer.c | 3 ++- src/mesa/state_tracker/st_cb_drawpixels.c | 5 +++-- src/mesa/state_tracker/st_cb_fbo.c | 2 +- src/mesa/state_tracker/st_format.c | 12 ++++++------ src/mesa/state_tracker/st_format.h | 5 +++-- 5 files changed, 15 insertions(+), 12 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/state_tracker/st_atom_pixeltransfer.c b/src/mesa/state_tracker/st_atom_pixeltransfer.c index eff3666ca8..babfcc87b4 100644 --- a/src/mesa/state_tracker/st_atom_pixeltransfer.c +++ b/src/mesa/state_tracker/st_atom_pixeltransfer.c @@ -122,7 +122,8 @@ create_color_map_texture(GLcontext *ctx) const uint texSize = 256; /* simple, and usually perfect */ /* find an RGBA texture format */ - format = st_choose_format(pipe, GL_RGBA, PIPE_TEXTURE_2D, PIPE_TEXTURE_USAGE_SAMPLER); + format = st_choose_format(pipe->screen, GL_RGBA, + PIPE_TEXTURE_2D, PIPE_TEXTURE_USAGE_SAMPLER); /* create texture for color map/table */ pt = st_texture_create(ctx->st, PIPE_TEXTURE_2D, format, 0, diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index 4a64472fa1..5c3413f905 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -1015,13 +1015,14 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy, else { /* srcFormat can't be used as a texture format */ if (type == GL_DEPTH) { - texFormat = st_choose_format(pipe, GL_DEPTH_COMPONENT, PIPE_TEXTURE_2D, + texFormat = st_choose_format(screen, GL_DEPTH_COMPONENT, + PIPE_TEXTURE_2D, PIPE_TEXTURE_USAGE_DEPTH_STENCIL); assert(texFormat != PIPE_FORMAT_NONE); /* XXX no depth texture formats??? */ } else { /* default color format */ - texFormat = st_choose_format(pipe, GL_RGBA, PIPE_TEXTURE_2D, + texFormat = st_choose_format(screen, GL_RGBA, PIPE_TEXTURE_2D, PIPE_TEXTURE_USAGE_SAMPLER); assert(texFormat != PIPE_FORMAT_NONE); } diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c index 57a2a3db5b..864f5d3ca3 100644 --- a/src/mesa/state_tracker/st_cb_fbo.c +++ b/src/mesa/state_tracker/st_cb_fbo.c @@ -93,7 +93,7 @@ st_renderbuffer_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb, if (strb->format != PIPE_FORMAT_NONE) format = strb->format; else - format = st_choose_renderbuffer_format(pipe, internalFormat); + format = st_choose_renderbuffer_format(pipe->screen, internalFormat); /* init renderbuffer fields */ strb->Base.Width = width; diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c index dcb90a3107..3e0db37414 100644 --- a/src/mesa/state_tracker/st_format.c +++ b/src/mesa/state_tracker/st_format.c @@ -392,10 +392,9 @@ default_depth_format(struct pipe_screen *screen, * or PIPE_TEXTURE_USAGE_SAMPLER */ enum pipe_format -st_choose_format(struct pipe_context *pipe, GLenum internalFormat, +st_choose_format(struct pipe_screen *screen, GLenum internalFormat, enum pipe_texture_target target, unsigned tex_usage) { - struct pipe_screen *screen = pipe->screen; unsigned geom_flags = 0; switch (internalFormat) { @@ -618,14 +617,15 @@ is_depth_or_stencil_format(GLenum internalFormat) * Called by FBO code to choose a PIPE_FORMAT_ for drawing surfaces. */ enum pipe_format -st_choose_renderbuffer_format(struct pipe_context *pipe, GLenum internalFormat) +st_choose_renderbuffer_format(struct pipe_screen *screen, + GLenum internalFormat) { uint usage; if (is_depth_or_stencil_format(internalFormat)) usage = PIPE_TEXTURE_USAGE_DEPTH_STENCIL; else usage = PIPE_TEXTURE_USAGE_RENDER_TARGET; - return st_choose_format(pipe, internalFormat, PIPE_TEXTURE_2D, usage); + return st_choose_format(screen, internalFormat, PIPE_TEXTURE_2D, usage); } @@ -713,8 +713,8 @@ st_ChooseTextureFormat(GLcontext *ctx, GLint internalFormat, (void) format; (void) type; - pFormat = st_choose_format(ctx->st->pipe, internalFormat, PIPE_TEXTURE_2D, - PIPE_TEXTURE_USAGE_SAMPLER); + pFormat = st_choose_format(ctx->st->pipe->screen, internalFormat, + PIPE_TEXTURE_2D, PIPE_TEXTURE_USAGE_SAMPLER); if (pFormat == PIPE_FORMAT_NONE) return NULL; diff --git a/src/mesa/state_tracker/st_format.h b/src/mesa/state_tracker/st_format.h index 9d9e02fe9b..e4a788c89b 100644 --- a/src/mesa/state_tracker/st_format.h +++ b/src/mesa/state_tracker/st_format.h @@ -64,11 +64,12 @@ st_mesa_format_to_pipe_format(GLuint mesaFormat); extern enum pipe_format -st_choose_format(struct pipe_context *pipe, GLenum internalFormat, +st_choose_format(struct pipe_screen *screen, GLenum internalFormat, enum pipe_texture_target target, unsigned tex_usage); extern enum pipe_format -st_choose_renderbuffer_format(struct pipe_context *pipe, GLenum internalFormat); +st_choose_renderbuffer_format(struct pipe_screen *screen, + GLenum internalFormat); extern const struct gl_texture_format * -- cgit v1.2.3