st/mesa: pass pipe_screen, not pipe_context to st_choose_format() functions
authorBrian Paul <brianp@vmware.com>
Wed, 7 Oct 2009 15:58:03 +0000 (09:58 -0600)
committerBrian Paul <brianp@vmware.com>
Wed, 7 Oct 2009 15:58:34 +0000 (09:58 -0600)
These don't depend on context state, but use a screen pointer.

src/mesa/state_tracker/st_atom_pixeltransfer.c
src/mesa/state_tracker/st_cb_drawpixels.c
src/mesa/state_tracker/st_cb_fbo.c
src/mesa/state_tracker/st_format.c
src/mesa/state_tracker/st_format.h

index eff3666..babfcc8 100644 (file)
@@ -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,
index 4a64472..5c3413f 100644 (file)
@@ -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);
       }
index 57a2a3d..864f5d3 100644 (file)
@@ -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;
index dcb90a3..3e0db37 100644 (file)
@@ -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;
 
index 9d9e02f..e4a788c 100644 (file)
@@ -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 *