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.
This commit is contained in:
Brian Paul 2009-10-07 09:58:03 -06:00
parent de81b2cf0a
commit 2ef1aae163
5 changed files with 15 additions and 12 deletions

View File

@ -122,7 +122,8 @@ create_color_map_texture(GLcontext *ctx)
const uint texSize = 256; /* simple, and usually perfect */ const uint texSize = 256; /* simple, and usually perfect */
/* find an RGBA texture format */ /* 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 */ /* create texture for color map/table */
pt = st_texture_create(ctx->st, PIPE_TEXTURE_2D, format, 0, pt = st_texture_create(ctx->st, PIPE_TEXTURE_2D, format, 0,

View File

@ -1015,13 +1015,14 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy,
else { else {
/* srcFormat can't be used as a texture format */ /* srcFormat can't be used as a texture format */
if (type == GL_DEPTH) { 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); PIPE_TEXTURE_USAGE_DEPTH_STENCIL);
assert(texFormat != PIPE_FORMAT_NONE); /* XXX no depth texture formats??? */ assert(texFormat != PIPE_FORMAT_NONE); /* XXX no depth texture formats??? */
} }
else { else {
/* default color format */ /* 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); PIPE_TEXTURE_USAGE_SAMPLER);
assert(texFormat != PIPE_FORMAT_NONE); assert(texFormat != PIPE_FORMAT_NONE);
} }

View File

@ -93,7 +93,7 @@ st_renderbuffer_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
if (strb->format != PIPE_FORMAT_NONE) if (strb->format != PIPE_FORMAT_NONE)
format = strb->format; format = strb->format;
else else
format = st_choose_renderbuffer_format(pipe, internalFormat); format = st_choose_renderbuffer_format(pipe->screen, internalFormat);
/* init renderbuffer fields */ /* init renderbuffer fields */
strb->Base.Width = width; strb->Base.Width = width;

View File

@ -392,10 +392,9 @@ default_depth_format(struct pipe_screen *screen,
* or PIPE_TEXTURE_USAGE_SAMPLER * or PIPE_TEXTURE_USAGE_SAMPLER
*/ */
enum pipe_format 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) enum pipe_texture_target target, unsigned tex_usage)
{ {
struct pipe_screen *screen = pipe->screen;
unsigned geom_flags = 0; unsigned geom_flags = 0;
switch (internalFormat) { 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. * Called by FBO code to choose a PIPE_FORMAT_ for drawing surfaces.
*/ */
enum pipe_format 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; uint usage;
if (is_depth_or_stencil_format(internalFormat)) if (is_depth_or_stencil_format(internalFormat))
usage = PIPE_TEXTURE_USAGE_DEPTH_STENCIL; usage = PIPE_TEXTURE_USAGE_DEPTH_STENCIL;
else else
usage = PIPE_TEXTURE_USAGE_RENDER_TARGET; 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) format;
(void) type; (void) type;
pFormat = st_choose_format(ctx->st->pipe, internalFormat, PIPE_TEXTURE_2D, pFormat = st_choose_format(ctx->st->pipe->screen, internalFormat,
PIPE_TEXTURE_USAGE_SAMPLER); PIPE_TEXTURE_2D, PIPE_TEXTURE_USAGE_SAMPLER);
if (pFormat == PIPE_FORMAT_NONE) if (pFormat == PIPE_FORMAT_NONE)
return NULL; return NULL;

View File

@ -64,11 +64,12 @@ st_mesa_format_to_pipe_format(GLuint mesaFormat);
extern enum pipe_format 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); enum pipe_texture_target target, unsigned tex_usage);
extern enum pipe_format 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 * extern const struct gl_texture_format *