summaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker
diff options
context:
space:
mode:
authorBrian <[email protected]>2008-02-27 13:58:06 -0700
committerBrian <[email protected]>2008-02-27 13:58:06 -0700
commit364f8cad0f8f02fd39d9c51ea0774d349121b58d (patch)
tree1e1d2e81a3093b1b59a7b9ecc9567d547015a019 /src/mesa/state_tracker
parent8383f798b41df9a305e0a33afe8afa028d5d5dfb (diff)
gallium: move is_format_supported() to pipe_screen struct
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r--src/mesa/state_tracker/st_cb_drawpixels.c5
-rw-r--r--src/mesa/state_tracker/st_format.c45
-rw-r--r--src/mesa/state_tracker/st_gen_mipmap.c3
3 files changed, 30 insertions, 23 deletions
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
index 6245ce057f9..0f2c6307dd4 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -993,6 +993,7 @@ make_bitmap_texture(GLcontext *ctx, GLsizei width, GLsizei height,
const GLubyte *bitmap)
{
struct pipe_context *pipe = ctx->st->pipe;
+ struct pipe_screen *screen = pipe->screen;
struct pipe_surface *surface;
uint format = 0, cpp, comp;
ubyte *dest;
@@ -1000,12 +1001,12 @@ make_bitmap_texture(GLcontext *ctx, GLsizei width, GLsizei height,
int row, col;
/* find a texture format we know */
- if (pipe->is_format_supported( pipe, PIPE_FORMAT_U_I8, PIPE_TEXTURE )) {
+ if (screen->is_format_supported( screen, PIPE_FORMAT_U_I8, PIPE_TEXTURE )) {
format = PIPE_FORMAT_U_I8;
cpp = 1;
comp = 0;
}
- else if (pipe->is_format_supported( pipe, PIPE_FORMAT_A8R8G8B8_UNORM, PIPE_TEXTURE )) {
+ else if (screen->is_format_supported( screen, PIPE_FORMAT_A8R8G8B8_UNORM, PIPE_TEXTURE )) {
format = PIPE_FORMAT_A8R8G8B8_UNORM;
cpp = 4;
comp = 3; /* alpha channel */ /*XXX little-endian dependency */
diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c
index 2a23445ca2b..9aeda65a5c8 100644
--- a/src/mesa/state_tracker/st_format.c
+++ b/src/mesa/state_tracker/st_format.c
@@ -40,6 +40,7 @@
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
+#include "pipe/p_screen.h"
#include "st_context.h"
#include "st_format.h"
@@ -288,9 +289,10 @@ default_rgba_format(struct pipe_context *pipe, uint type)
PIPE_FORMAT_R8G8B8A8_UNORM,
PIPE_FORMAT_R5G6B5_UNORM
};
+ struct pipe_screen *screen = pipe->screen;
uint i;
for (i = 0; i < Elements(colorFormats); i++) {
- if (pipe->is_format_supported( pipe, colorFormats[i], type )) {
+ if (screen->is_format_supported( screen, colorFormats[i], type )) {
return colorFormats[i];
}
}
@@ -304,7 +306,8 @@ default_rgba_format(struct pipe_context *pipe, uint type)
static GLuint
default_deep_rgba_format(struct pipe_context *pipe, uint type)
{
- if (pipe->is_format_supported(pipe, PIPE_FORMAT_R16G16B16A16_SNORM, type)) {
+ struct pipe_screen *screen = pipe->screen;
+ if (screen->is_format_supported(screen, PIPE_FORMAT_R16G16B16A16_SNORM, type)) {
return PIPE_FORMAT_R16G16B16A16_SNORM;
}
return PIPE_FORMAT_NONE;
@@ -323,9 +326,10 @@ default_depth_format(struct pipe_context *pipe, uint type)
PIPE_FORMAT_S8Z24_UNORM,
PIPE_FORMAT_Z24S8_UNORM
};
+ struct pipe_screen *screen = pipe->screen;
uint i;
for (i = 0; i < Elements(zFormats); i++) {
- if (pipe->is_format_supported( pipe, zFormats[i], type )) {
+ if (screen->is_format_supported( screen, zFormats[i], type )) {
return zFormats[i];
}
}
@@ -341,6 +345,7 @@ default_depth_format(struct pipe_context *pipe, uint type)
enum pipe_format
st_choose_renderbuffer_format(struct pipe_context *pipe, GLint internalFormat)
{
+ struct pipe_screen *screen = pipe->screen;
uint surfType = PIPE_SURFACE;
switch (internalFormat) {
@@ -359,12 +364,12 @@ st_choose_renderbuffer_format(struct pipe_context *pipe, GLint internalFormat)
case GL_RGBA4:
case GL_RGBA2:
- if (pipe->is_format_supported( pipe, PIPE_FORMAT_A4R4G4B4_UNORM, surfType ))
+ if (screen->is_format_supported( screen, PIPE_FORMAT_A4R4G4B4_UNORM, surfType ))
return PIPE_FORMAT_A4R4G4B4_UNORM;
return default_rgba_format( pipe, surfType );
case GL_RGB5_A1:
- if (pipe->is_format_supported( pipe, PIPE_FORMAT_A1R5G5B5_UNORM, surfType ))
+ if (screen->is_format_supported( screen, PIPE_FORMAT_A1R5G5B5_UNORM, surfType ))
return PIPE_FORMAT_A1R5G5B5_UNORM;
return default_rgba_format( pipe, surfType );
@@ -377,9 +382,9 @@ st_choose_renderbuffer_format(struct pipe_context *pipe, GLint internalFormat)
case GL_RGB5:
case GL_RGB4:
case GL_R3_G3_B2:
- if (pipe->is_format_supported( pipe, PIPE_FORMAT_A1R5G5B5_UNORM, surfType ))
+ if (screen->is_format_supported( screen, PIPE_FORMAT_A1R5G5B5_UNORM, surfType ))
return PIPE_FORMAT_A1R5G5B5_UNORM;
- if (pipe->is_format_supported( pipe, PIPE_FORMAT_R5G6B5_UNORM, surfType ))
+ if (screen->is_format_supported( screen, PIPE_FORMAT_R5G6B5_UNORM, surfType ))
return PIPE_FORMAT_R5G6B5_UNORM;
return default_rgba_format( pipe, surfType );
@@ -389,7 +394,7 @@ st_choose_renderbuffer_format(struct pipe_context *pipe, GLint internalFormat)
case GL_ALPHA12:
case GL_ALPHA16:
case GL_COMPRESSED_ALPHA:
- if (pipe->is_format_supported( pipe, PIPE_FORMAT_U_A8, surfType ))
+ if (screen->is_format_supported( screen, PIPE_FORMAT_U_A8, surfType ))
return PIPE_FORMAT_U_A8;
return default_rgba_format( pipe, surfType );
@@ -400,7 +405,7 @@ st_choose_renderbuffer_format(struct pipe_context *pipe, GLint internalFormat)
case GL_LUMINANCE12:
case GL_LUMINANCE16:
case GL_COMPRESSED_LUMINANCE:
- if (pipe->is_format_supported( pipe, PIPE_FORMAT_U_L8, surfType ))
+ if (screen->is_format_supported( screen, PIPE_FORMAT_U_L8, surfType ))
return PIPE_FORMAT_U_A8;
return default_rgba_format( pipe, surfType );
@@ -413,7 +418,7 @@ st_choose_renderbuffer_format(struct pipe_context *pipe, GLint internalFormat)
case GL_LUMINANCE12_ALPHA12:
case GL_LUMINANCE16_ALPHA16:
case GL_COMPRESSED_LUMINANCE_ALPHA:
- if (pipe->is_format_supported( pipe, PIPE_FORMAT_U_A8_L8, surfType ))
+ if (screen->is_format_supported( screen, PIPE_FORMAT_U_A8_L8, surfType ))
return PIPE_FORMAT_U_A8_L8;
return default_rgba_format( pipe, surfType );
@@ -423,7 +428,7 @@ st_choose_renderbuffer_format(struct pipe_context *pipe, GLint internalFormat)
case GL_INTENSITY12:
case GL_INTENSITY16:
case GL_COMPRESSED_INTENSITY:
- if (pipe->is_format_supported( pipe, PIPE_FORMAT_U_I8, surfType ))
+ if (screen->is_format_supported( screen, PIPE_FORMAT_U_I8, surfType ))
return PIPE_FORMAT_U_I8;
return default_rgba_format( pipe, surfType );
@@ -454,17 +459,17 @@ st_choose_renderbuffer_format(struct pipe_context *pipe, GLint internalFormat)
#endif
case GL_DEPTH_COMPONENT16:
- if (pipe->is_format_supported( pipe, PIPE_FORMAT_Z16_UNORM, surfType ))
+ if (screen->is_format_supported( screen, PIPE_FORMAT_Z16_UNORM, surfType ))
return PIPE_FORMAT_Z16_UNORM;
/* fall-through */
case GL_DEPTH_COMPONENT24:
- if (pipe->is_format_supported( pipe, PIPE_FORMAT_S8Z24_UNORM, surfType ))
+ if (screen->is_format_supported( screen, PIPE_FORMAT_S8Z24_UNORM, surfType ))
return PIPE_FORMAT_S8Z24_UNORM;
- if (pipe->is_format_supported( pipe, PIPE_FORMAT_Z24S8_UNORM, surfType ))
+ if (screen->is_format_supported( screen, PIPE_FORMAT_Z24S8_UNORM, surfType ))
return PIPE_FORMAT_Z24S8_UNORM;
/* fall-through */
case GL_DEPTH_COMPONENT32:
- if (pipe->is_format_supported( pipe, PIPE_FORMAT_Z32_UNORM, surfType ))
+ if (screen->is_format_supported( screen, PIPE_FORMAT_Z32_UNORM, surfType ))
return PIPE_FORMAT_Z32_UNORM;
/* fall-through */
case GL_DEPTH_COMPONENT:
@@ -475,19 +480,19 @@ st_choose_renderbuffer_format(struct pipe_context *pipe, GLint internalFormat)
case GL_STENCIL_INDEX4_EXT:
case GL_STENCIL_INDEX8_EXT:
case GL_STENCIL_INDEX16_EXT:
- if (pipe->is_format_supported( pipe, PIPE_FORMAT_U_S8, surfType ))
+ if (screen->is_format_supported( screen, PIPE_FORMAT_U_S8, surfType ))
return PIPE_FORMAT_U_S8;
- if (pipe->is_format_supported( pipe, PIPE_FORMAT_S8Z24_UNORM, surfType ))
+ if (screen->is_format_supported( screen, PIPE_FORMAT_S8Z24_UNORM, surfType ))
return PIPE_FORMAT_S8Z24_UNORM;
- if (pipe->is_format_supported( pipe, PIPE_FORMAT_Z24S8_UNORM, surfType ))
+ if (screen->is_format_supported( screen, PIPE_FORMAT_Z24S8_UNORM, surfType ))
return PIPE_FORMAT_Z24S8_UNORM;
return PIPE_FORMAT_NONE;
case GL_DEPTH_STENCIL_EXT:
case GL_DEPTH24_STENCIL8_EXT:
- if (pipe->is_format_supported( pipe, PIPE_FORMAT_S8Z24_UNORM, surfType ))
+ if (screen->is_format_supported( screen, PIPE_FORMAT_S8Z24_UNORM, surfType ))
return PIPE_FORMAT_S8Z24_UNORM;
- if (pipe->is_format_supported( pipe, PIPE_FORMAT_Z24S8_UNORM, surfType ))
+ if (screen->is_format_supported( screen, PIPE_FORMAT_Z24S8_UNORM, surfType ))
return PIPE_FORMAT_Z24S8_UNORM;
return PIPE_FORMAT_NONE;
diff --git a/src/mesa/state_tracker/st_gen_mipmap.c b/src/mesa/state_tracker/st_gen_mipmap.c
index c9765b20036..2b163106028 100644
--- a/src/mesa/state_tracker/st_gen_mipmap.c
+++ b/src/mesa/state_tracker/st_gen_mipmap.c
@@ -227,6 +227,7 @@ st_render_mipmap(struct st_context *st,
uint baseLevel, uint lastLevel)
{
struct pipe_context *pipe = st->pipe;
+ struct pipe_screen *screen = pipe->screen;
struct pipe_framebuffer_state fb;
struct pipe_sampler_state sampler;
void *sampler_cso;
@@ -237,7 +238,7 @@ st_render_mipmap(struct st_context *st,
assert(target != GL_TEXTURE_3D); /* not done yet */
/* check if we can render in the texture's format */
- if (!pipe->is_format_supported(pipe, pt->format, PIPE_SURFACE)) {
+ if (!screen->is_format_supported(screen, pt->format, PIPE_SURFACE)) {
return FALSE;
}