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 eff3666ca88a691cbed1cd107d2f1ae6a3c5d27c..babfcc87b4ab8e2081df7166e683faa290890b36 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 4a64472fa144d1bab035e60391d3a8cdc2b83e4e..5c3413f9056d7fd64edd280aeb911633bdff18a6 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 57a2a3db5bb084175dda1d4fcefe01ac8707d4fe..864f5d3ca3f2617092d3489da2d4c1ff3ef4f671 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 dcb90a3107602d32788d4e7c05e5c7caf0039ac5..3e0db374144454f1f9923b3997b35f8056ad680a 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 9d9e02fe9b62bb32b69ef247d628ce8c593111a2..e4a788c89bb2343a712bd36147f9caec6b046ea5 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 *