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:
parent
de81b2cf0a
commit
2ef1aae163
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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 *
|
||||
|
|
Loading…
Reference in New Issue