summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichal Krol <[email protected]>2009-12-03 09:56:03 +0100
committerMichal Krol <[email protected]>2009-12-03 09:56:03 +0100
commit3400b668e35469d5dbba515e3a8b9d775fd2eff5 (patch)
treeae330b437c9c79876d11b2a7129615b60f660905 /src
parent3ffe25c91706fe5ab2735f07c3c8b4114b9f9514 (diff)
Move pf_is_compressed() to u_format auxiliary module.
Diffstat (limited to 'src')
-rw-r--r--src/gallium/auxiliary/util/u_format.h22
-rw-r--r--src/gallium/drivers/svga/svga_screen_texture.c5
-rw-r--r--src/gallium/include/pipe/p_format.h6
-rw-r--r--src/mesa/state_tracker/st_cb_texture.c3
4 files changed, 27 insertions, 9 deletions
diff --git a/src/gallium/auxiliary/util/u_format.h b/src/gallium/auxiliary/util/u_format.h
index 7b5b7fcda5b..2931d2a8bbf 100644
--- a/src/gallium/auxiliary/util/u_format.h
+++ b/src/gallium/auxiliary/util/u_format.h
@@ -111,6 +111,28 @@ const struct util_format_description *
util_format_description(enum pipe_format format);
+/*
+ * Format query functions.
+ */
+
+static INLINE boolean
+util_format_is_compressed(enum pipe_format format)
+{
+ const struct util_format_description *desc = util_format_description(format);
+
+ assert(format);
+ if (!format) {
+ return FALSE;
+ }
+
+ return desc->layout == UTIL_FORMAT_LAYOUT_DXT ? TRUE : FALSE;
+}
+
+
+/*
+ * Format access functions.
+ */
+
void
util_format_read_4f(enum pipe_format format,
float *dst, unsigned dst_stride,
diff --git a/src/gallium/drivers/svga/svga_screen_texture.c b/src/gallium/drivers/svga/svga_screen_texture.c
index 6e10d65a205..b8997961016 100644
--- a/src/gallium/drivers/svga/svga_screen_texture.c
+++ b/src/gallium/drivers/svga/svga_screen_texture.c
@@ -29,6 +29,7 @@
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
#include "pipe/p_thread.h"
+#include "util/u_format.h"
#include "util/u_math.h"
#include "util/u_memory.h"
@@ -319,7 +320,7 @@ svga_texture_create(struct pipe_screen *screen,
*/
#if 0
if((templat->tex_usage & PIPE_TEXTURE_USAGE_RENDER_TARGET) &&
- !pf_is_compressed(templat->format))
+ !util_format_is_compressed(templat->format))
tex->key.flags |= SVGA3D_SURFACE_HINT_RENDERTARGET;
#endif
@@ -933,7 +934,7 @@ svga_get_tex_sampler_view(struct pipe_context *pipe, struct pipe_texture *pt,
if (min_lod == 0 && max_lod >= pt->last_level)
view = FALSE;
- if (pf_is_compressed(pt->format) && view) {
+ if (util_format_is_compressed(pt->format) && view) {
format = svga_translate_format_render(pt->format);
}
diff --git a/src/gallium/include/pipe/p_format.h b/src/gallium/include/pipe/p_format.h
index 8c61858e7b5..3eb22ff077d 100644
--- a/src/gallium/include/pipe/p_format.h
+++ b/src/gallium/include/pipe/p_format.h
@@ -569,12 +569,6 @@ pf_is_depth_stencil( enum pipe_format format )
return pf_is_depth_or_stencil( format );
}
-static INLINE boolean
-pf_is_compressed( enum pipe_format format )
-{
- return pf_layout(format) == PIPE_FORMAT_LAYOUT_DXT ? TRUE : FALSE;
-}
-
enum pipe_video_chroma_format
{
PIPE_VIDEO_CHROMA_FORMAT_420,
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index 3a2337802fa..2c5601c22b7 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -62,6 +62,7 @@
#include "pipe/p_shader_tokens.h"
#include "util/u_tile.h"
#include "util/u_blit.h"
+#include "util/u_format.h"
#include "util/u_surface.h"
#include "util/u_math.h"
@@ -890,7 +891,7 @@ st_get_tex_image(GLcontext * ctx, GLenum target, GLint level,
GLubyte *dest;
if (stImage->pt &&
- pf_is_compressed(stImage->pt->format) &&
+ util_format_is_compressed(stImage->pt->format) &&
!compressed_dst) {
/* Need to decompress the texture.
* We'll do this by rendering a textured quad.