aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/gallium/auxiliary/util
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/gallium/auxiliary/util')
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_blitter.c44
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_blitter.h6
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_clear.h118
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_surface.c4
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_surface.h180
5 files changed, 177 insertions, 175 deletions
diff --git a/mesalib/src/gallium/auxiliary/util/u_blitter.c b/mesalib/src/gallium/auxiliary/util/u_blitter.c
index d69fb1a11..58a52b3f2 100644
--- a/mesalib/src/gallium/auxiliary/util/u_blitter.c
+++ b/mesalib/src/gallium/auxiliary/util/u_blitter.c
@@ -111,7 +111,7 @@ static void blitter_draw_rectangle(struct blitter_context *blitter,
unsigned width, unsigned height,
float depth,
enum blitter_attrib_type type,
- const float attrib[4]);
+ const union pipe_color_union *attrib);
struct blitter_context *util_blitter_create(struct pipe_context *pipe)
@@ -398,16 +398,16 @@ static void blitter_set_rectangle(struct blitter_context_priv *ctx,
}
static void blitter_set_clear_color(struct blitter_context_priv *ctx,
- const float *rgba)
+ const union pipe_color_union *color)
{
int i;
- if (rgba) {
+ if (color) {
for (i = 0; i < 4; i++) {
- ctx->vertices[i][1][0] = rgba[0];
- ctx->vertices[i][1][1] = rgba[1];
- ctx->vertices[i][1][2] = rgba[2];
- ctx->vertices[i][1][3] = rgba[3];
+ ctx->vertices[i][1][0] = color->f[0];
+ ctx->vertices[i][1][1] = color->f[1];
+ ctx->vertices[i][1][2] = color->f[2];
+ ctx->vertices[i][1][3] = color->f[3];
}
} else {
for (i = 0; i < 4; i++) {
@@ -647,7 +647,7 @@ static void blitter_draw_rectangle(struct blitter_context *blitter,
unsigned x2, unsigned y2,
float depth,
enum blitter_attrib_type type,
- const float attrib[4])
+ const union pipe_color_union *attrib)
{
struct blitter_context_priv *ctx = (struct blitter_context_priv*)blitter;
@@ -657,7 +657,7 @@ static void blitter_draw_rectangle(struct blitter_context *blitter,
break;
case UTIL_BLITTER_ATTRIB_TEXCOORD:
- set_texcoords_in_vertices(attrib, &ctx->vertices[0][1][0], 8);
+ set_texcoords_in_vertices(attrib->f, &ctx->vertices[0][1][0], 8);
break;
default:;
@@ -674,7 +674,7 @@ static void util_blitter_clear_custom(struct blitter_context *blitter,
unsigned width, unsigned height,
unsigned num_cbufs,
unsigned clear_buffers,
- const float *rgba,
+ const union pipe_color_union *color,
double depth, unsigned stencil,
void *custom_blend, void *custom_dsa)
{
@@ -717,7 +717,7 @@ static void util_blitter_clear_custom(struct blitter_context *blitter,
blitter_set_dst_dimensions(ctx, width, height);
blitter->draw_rectangle(blitter, 0, 0, width, height, depth,
- UTIL_BLITTER_ATTRIB_COLOR, rgba);
+ UTIL_BLITTER_ATTRIB_COLOR, color);
blitter_restore_CSOs(ctx);
}
@@ -725,11 +725,11 @@ void util_blitter_clear(struct blitter_context *blitter,
unsigned width, unsigned height,
unsigned num_cbufs,
unsigned clear_buffers,
- const float *rgba,
+ const union pipe_color_union *color,
double depth, unsigned stencil)
{
util_blitter_clear_custom(blitter, width, height, num_cbufs,
- clear_buffers, rgba, depth, stencil,
+ clear_buffers, color, depth, stencil,
NULL, NULL);
}
@@ -737,9 +737,9 @@ void util_blitter_clear_depth_custom(struct blitter_context *blitter,
unsigned width, unsigned height,
double depth, void *custom_dsa)
{
- const float rgba[4] = {0, 0, 0, 0};
+ static const union pipe_color_union color;
util_blitter_clear_custom(blitter, width, height, 0,
- 0, rgba, depth, 0, NULL, custom_dsa);
+ 0, &color, depth, 0, NULL, custom_dsa);
}
static
@@ -869,14 +869,16 @@ void util_blitter_copy_texture(struct blitter_context *blitter,
case PIPE_TEXTURE_2D:
case PIPE_TEXTURE_RECT:
{
- /* Set texture coordinates. */
- float coord[4];
+ /* Set texture coordinates. - use a pipe color union
+ * for interface purposes
+ */
+ union pipe_color_union coord;
get_texcoords(src, srclevel, srcbox->x, srcbox->y,
- srcbox->x+width, srcbox->y+height, normalized, coord);
+ srcbox->x+width, srcbox->y+height, normalized, coord.f);
/* Draw. */
blitter->draw_rectangle(blitter, dstx, dsty, dstx+width, dsty+height, 0,
- UTIL_BLITTER_ATTRIB_TEXCOORD, coord);
+ UTIL_BLITTER_ATTRIB_TEXCOORD, &coord);
}
break;
@@ -925,7 +927,7 @@ void util_blitter_copy_texture(struct blitter_context *blitter,
/* Clear a region of a color surface to a constant value. */
void util_blitter_clear_render_target(struct blitter_context *blitter,
struct pipe_surface *dstsurf,
- const float *rgba,
+ const union pipe_color_union *color,
unsigned dstx, unsigned dsty,
unsigned width, unsigned height)
{
@@ -959,7 +961,7 @@ void util_blitter_clear_render_target(struct blitter_context *blitter,
blitter_set_dst_dimensions(ctx, dstsurf->width, dstsurf->height);
blitter->draw_rectangle(blitter, dstx, dsty, dstx+width, dsty+height, 0,
- UTIL_BLITTER_ATTRIB_COLOR, rgba);
+ UTIL_BLITTER_ATTRIB_COLOR, color);
blitter_restore_CSOs(ctx);
}
diff --git a/mesalib/src/gallium/auxiliary/util/u_blitter.h b/mesalib/src/gallium/auxiliary/util/u_blitter.h
index df6f023a6..a9ad02364 100644
--- a/mesalib/src/gallium/auxiliary/util/u_blitter.h
+++ b/mesalib/src/gallium/auxiliary/util/u_blitter.h
@@ -77,7 +77,7 @@ struct blitter_context
unsigned x1, unsigned y1, unsigned x2, unsigned y2,
float depth,
enum blitter_attrib_type type,
- const float attrib[4]);
+ const union pipe_color_union *color);
/* Whether the blitter is running. */
boolean running;
@@ -144,7 +144,7 @@ void util_blitter_clear(struct blitter_context *blitter,
unsigned width, unsigned height,
unsigned num_cbufs,
unsigned clear_buffers,
- const float *rgba,
+ const union pipe_color_union *color,
double depth, unsigned stencil);
void util_blitter_clear_depth_custom(struct blitter_context *blitter,
@@ -190,7 +190,7 @@ void util_blitter_copy_texture(struct blitter_context *blitter,
*/
void util_blitter_clear_render_target(struct blitter_context *blitter,
struct pipe_surface *dst,
- const float *rgba,
+ const union pipe_color_union *color,
unsigned dstx, unsigned dsty,
unsigned width, unsigned height);
diff --git a/mesalib/src/gallium/auxiliary/util/u_clear.h b/mesalib/src/gallium/auxiliary/util/u_clear.h
index c2f303261..e9fd874b1 100644
--- a/mesalib/src/gallium/auxiliary/util/u_clear.h
+++ b/mesalib/src/gallium/auxiliary/util/u_clear.h
@@ -1,59 +1,59 @@
-/**************************************************************************
- *
- * Copyright 2009 VMware, Inc. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-/* Authors:
- * Michel Dänzer
- */
-
-
-#include "pipe/p_context.h"
-#include "pipe/p_state.h"
-
-
-/**
- * Clear the given buffers to the specified values.
- * No masking, no scissor (clear entire buffer).
- */
-static INLINE void
-util_clear(struct pipe_context *pipe,
- struct pipe_framebuffer_state *framebuffer, unsigned buffers,
- const float *rgba, double depth, unsigned stencil)
-{
- if (buffers & PIPE_CLEAR_COLOR) {
- unsigned i;
- for (i = 0; i < framebuffer->nr_cbufs; i++) {
- struct pipe_surface *ps = framebuffer->cbufs[i];
- pipe->clear_render_target(pipe, ps, rgba, 0, 0, ps->width, ps->height);
- }
- }
-
- if (buffers & PIPE_CLEAR_DEPTHSTENCIL) {
- struct pipe_surface *ps = framebuffer->zsbuf;
- pipe->clear_depth_stencil(pipe, ps, buffers & PIPE_CLEAR_DEPTHSTENCIL,
- depth, stencil,
- 0, 0, ps->width, ps->height);
- }
-}
+/**************************************************************************
+ *
+ * Copyright 2009 VMware, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+/* Authors:
+ * Michel Dänzer
+ */
+
+
+#include "pipe/p_context.h"
+#include "pipe/p_state.h"
+
+
+/**
+ * Clear the given buffers to the specified values.
+ * No masking, no scissor (clear entire buffer).
+ */
+static INLINE void
+util_clear(struct pipe_context *pipe,
+ struct pipe_framebuffer_state *framebuffer, unsigned buffers,
+ const union pipe_color_union *color, double depth, unsigned stencil)
+{
+ if (buffers & PIPE_CLEAR_COLOR) {
+ unsigned i;
+ for (i = 0; i < framebuffer->nr_cbufs; i++) {
+ struct pipe_surface *ps = framebuffer->cbufs[i];
+ pipe->clear_render_target(pipe, ps, color, 0, 0, ps->width, ps->height);
+ }
+ }
+
+ if (buffers & PIPE_CLEAR_DEPTHSTENCIL) {
+ struct pipe_surface *ps = framebuffer->zsbuf;
+ pipe->clear_depth_stencil(pipe, ps, buffers & PIPE_CLEAR_DEPTHSTENCIL,
+ depth, stencil,
+ 0, 0, ps->width, ps->height);
+ }
+}
diff --git a/mesalib/src/gallium/auxiliary/util/u_surface.c b/mesalib/src/gallium/auxiliary/util/u_surface.c
index 8e123867d..308511b33 100644
--- a/mesalib/src/gallium/auxiliary/util/u_surface.c
+++ b/mesalib/src/gallium/auxiliary/util/u_surface.c
@@ -228,7 +228,7 @@ util_resource_copy_region(struct pipe_context *pipe,
void
util_clear_render_target(struct pipe_context *pipe,
struct pipe_surface *dst,
- const float *rgba,
+ const union pipe_color_union *color,
unsigned dstx, unsigned dsty,
unsigned width, unsigned height)
{
@@ -254,7 +254,7 @@ util_clear_render_target(struct pipe_context *pipe,
if (dst_map) {
assert(dst_trans->stride > 0);
- util_pack_color(rgba, dst->texture->format, &uc);
+ util_pack_color(color->f, dst->texture->format, &uc);
util_fill_rect(dst_map, dst->texture->format,
dst_trans->stride,
0, 0, width, height, &uc);
diff --git a/mesalib/src/gallium/auxiliary/util/u_surface.h b/mesalib/src/gallium/auxiliary/util/u_surface.h
index e02931bbe..1117b78da 100644
--- a/mesalib/src/gallium/auxiliary/util/u_surface.h
+++ b/mesalib/src/gallium/auxiliary/util/u_surface.h
@@ -1,90 +1,90 @@
-/**************************************************************************
- *
- * Copyright 2009 VMware, Inc. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-
-#ifndef U_SURFACE_H
-#define U_SURFACE_H
-
-
-#include "pipe/p_compiler.h"
-#include "pipe/p_state.h"
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-extern void
-u_surface_default_template(struct pipe_surface *view,
- const struct pipe_resource *texture,
- unsigned bind);
-
-extern boolean
-util_create_rgba_surface(struct pipe_context *ctx,
- uint width, uint height, uint bind,
- struct pipe_resource **textureOut,
- struct pipe_surface **surfaceOut);
-
-
-extern void
-util_destroy_rgba_surface(struct pipe_resource *texture,
- struct pipe_surface *surface);
-
-
-
-extern void
-util_resource_copy_region(struct pipe_context *pipe,
- struct pipe_resource *dst,
- unsigned dst_level,
- unsigned dst_x, unsigned dst_y, unsigned dst_z,
- struct pipe_resource *src,
- unsigned src_level,
- const struct pipe_box *src_box);
-
-extern void
-util_clear_render_target(struct pipe_context *pipe,
- struct pipe_surface *dst,
- const float *rgba,
- unsigned dstx, unsigned dsty,
- unsigned width, unsigned height);
-
-extern void
-util_clear_depth_stencil(struct pipe_context *pipe,
- struct pipe_surface *dst,
- unsigned clear_flags,
- double depth,
- unsigned stencil,
- unsigned dstx, unsigned dsty,
- unsigned width, unsigned height);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif /* U_SURFACE_H */
+/**************************************************************************
+ *
+ * Copyright 2009 VMware, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+
+#ifndef U_SURFACE_H
+#define U_SURFACE_H
+
+
+#include "pipe/p_compiler.h"
+#include "pipe/p_state.h"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+extern void
+u_surface_default_template(struct pipe_surface *view,
+ const struct pipe_resource *texture,
+ unsigned bind);
+
+extern boolean
+util_create_rgba_surface(struct pipe_context *ctx,
+ uint width, uint height, uint bind,
+ struct pipe_resource **textureOut,
+ struct pipe_surface **surfaceOut);
+
+
+extern void
+util_destroy_rgba_surface(struct pipe_resource *texture,
+ struct pipe_surface *surface);
+
+
+
+extern void
+util_resource_copy_region(struct pipe_context *pipe,
+ struct pipe_resource *dst,
+ unsigned dst_level,
+ unsigned dst_x, unsigned dst_y, unsigned dst_z,
+ struct pipe_resource *src,
+ unsigned src_level,
+ const struct pipe_box *src_box);
+
+extern void
+util_clear_render_target(struct pipe_context *pipe,
+ struct pipe_surface *dst,
+ const union pipe_color_union *color,
+ unsigned dstx, unsigned dsty,
+ unsigned width, unsigned height);
+
+extern void
+util_clear_depth_stencil(struct pipe_context *pipe,
+ struct pipe_surface *dst,
+ unsigned clear_flags,
+ double depth,
+ unsigned stencil,
+ unsigned dstx, unsigned dsty,
+ unsigned width, unsigned height);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* U_SURFACE_H */