aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/gallium/auxiliary
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/gallium/auxiliary')
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_blit.c8
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_blitter.c9
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_blitter.h8
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_dump_state.c7
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_gen_mipmap.c5
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_sampler.c212
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_surface.c17
7 files changed, 127 insertions, 139 deletions
diff --git a/mesalib/src/gallium/auxiliary/util/u_blit.c b/mesalib/src/gallium/auxiliary/util/u_blit.c
index bba0031d7..a10fd17cb 100644
--- a/mesalib/src/gallium/auxiliary/util/u_blit.c
+++ b/mesalib/src/gallium/auxiliary/util/u_blit.c
@@ -62,7 +62,6 @@ struct blit_state
struct pipe_rasterizer_state rasterizer;
struct pipe_sampler_state sampler;
struct pipe_viewport_state viewport;
- struct pipe_clip_state clip;
struct pipe_vertex_element velem[2];
enum pipe_texture_target internal_target;
@@ -109,6 +108,7 @@ util_create_blit(struct pipe_context *pipe, struct cso_context *cso)
memset(&ctx->rasterizer, 0, sizeof(ctx->rasterizer));
ctx->rasterizer.cull_face = PIPE_FACE_NONE;
ctx->rasterizer.gl_rasterization_rules = 1;
+ ctx->rasterizer.depth_clip = 1;
/* samplers */
memset(&ctx->sampler, 0, sizeof(ctx->sampler));
@@ -535,7 +535,6 @@ util_blit_pixels_writemask(struct blit_state *ctx,
cso_save_fragment_shader(ctx->cso);
cso_save_vertex_shader(ctx->cso);
cso_save_geometry_shader(ctx->cso);
- cso_save_clip(ctx->cso);
cso_save_vertex_elements(ctx->cso);
cso_save_vertex_buffers(ctx->cso);
@@ -545,7 +544,6 @@ util_blit_pixels_writemask(struct blit_state *ctx,
dst_is_depth ? &ctx->depthstencil_write :
&ctx->depthstencil_keep);
cso_set_rasterizer(ctx->cso, &ctx->rasterizer);
- cso_set_clip(ctx->cso, &ctx->clip);
cso_set_vertex_elements(ctx->cso, 2, ctx->velem);
cso_set_stream_outputs(ctx->cso, 0, NULL, 0);
@@ -621,7 +619,6 @@ util_blit_pixels_writemask(struct blit_state *ctx,
cso_restore_fragment_shader(ctx->cso);
cso_restore_vertex_shader(ctx->cso);
cso_restore_geometry_shader(ctx->cso);
- cso_restore_clip(ctx->cso);
cso_restore_vertex_elements(ctx->cso);
cso_restore_vertex_buffers(ctx->cso);
cso_restore_stream_outputs(ctx->cso);
@@ -731,7 +728,6 @@ util_blit_pixels_tex(struct blit_state *ctx,
cso_save_fragment_shader(ctx->cso);
cso_save_vertex_shader(ctx->cso);
cso_save_geometry_shader(ctx->cso);
- cso_save_clip(ctx->cso);
cso_save_vertex_elements(ctx->cso);
cso_save_vertex_buffers(ctx->cso);
@@ -739,7 +735,6 @@ util_blit_pixels_tex(struct blit_state *ctx,
cso_set_blend(ctx->cso, &ctx->blend);
cso_set_depth_stencil_alpha(ctx->cso, &ctx->depthstencil_keep);
cso_set_rasterizer(ctx->cso, &ctx->rasterizer);
- cso_set_clip(ctx->cso, &ctx->clip);
cso_set_vertex_elements(ctx->cso, 2, ctx->velem);
cso_set_stream_outputs(ctx->cso, 0, NULL, 0);
@@ -803,7 +798,6 @@ util_blit_pixels_tex(struct blit_state *ctx,
cso_restore_fragment_shader(ctx->cso);
cso_restore_vertex_shader(ctx->cso);
cso_restore_geometry_shader(ctx->cso);
- cso_restore_clip(ctx->cso);
cso_restore_vertex_elements(ctx->cso);
cso_restore_vertex_buffers(ctx->cso);
cso_restore_stream_outputs(ctx->cso);
diff --git a/mesalib/src/gallium/auxiliary/util/u_blitter.c b/mesalib/src/gallium/auxiliary/util/u_blitter.c
index 80fdfe0a9..59940d9cb 100644
--- a/mesalib/src/gallium/auxiliary/util/u_blitter.c
+++ b/mesalib/src/gallium/auxiliary/util/u_blitter.c
@@ -104,9 +104,6 @@ struct blitter_context_priv
/* Viewport state. */
struct pipe_viewport_state viewport;
- /* Clip state. */
- struct pipe_clip_state clip;
-
/* Destination surface dimensions. */
unsigned dst_width;
unsigned dst_height;
@@ -193,7 +190,6 @@ struct blitter_context *util_blitter_create(struct pipe_context *pipe)
ctx->dsa_write_depth_stencil =
pipe->create_depth_stencil_alpha_state(pipe, &dsa);
-
dsa.depth.enabled = 0;
dsa.depth.writemask = 0;
ctx->dsa_keep_depth_write_stencil =
@@ -212,6 +208,7 @@ struct blitter_context *util_blitter_create(struct pipe_context *pipe)
rs_state.cull_face = PIPE_FACE_NONE;
rs_state.gl_rasterization_rules = 1;
rs_state.flatshade = 1;
+ rs_state.depth_clip = 1;
ctx->rs_state = pipe->create_rasterizer_state(pipe, &rs_state);
if (ctx->has_stream_out) {
@@ -439,7 +436,6 @@ static void blitter_restore_fragment_states(struct blitter_context_priv *ctx)
* (depending on the operation) */
pipe->set_stencil_ref(pipe, &ctx->base.saved_stencil_ref);
pipe->set_viewport_state(pipe, &ctx->base.saved_viewport);
- pipe->set_clip_state(pipe, &ctx->base.saved_clip);
}
static void blitter_check_saved_fb_state(struct blitter_context_priv *ctx)
@@ -516,9 +512,6 @@ static void blitter_set_rectangle(struct blitter_context_priv *ctx,
ctx->viewport.translate[2] = 0.0f;
ctx->viewport.translate[3] = 0.0f;
ctx->base.pipe->set_viewport_state(ctx->base.pipe, &ctx->viewport);
-
- /* clip */
- ctx->base.pipe->set_clip_state(ctx->base.pipe, &ctx->clip);
}
static void blitter_set_clear_color(struct blitter_context_priv *ctx,
diff --git a/mesalib/src/gallium/auxiliary/util/u_blitter.h b/mesalib/src/gallium/auxiliary/util/u_blitter.h
index 4dd64c516..d4d30852b 100644
--- a/mesalib/src/gallium/auxiliary/util/u_blitter.h
+++ b/mesalib/src/gallium/auxiliary/util/u_blitter.h
@@ -94,7 +94,6 @@ struct blitter_context
struct pipe_framebuffer_state saved_fb_state; /**< framebuffer state */
struct pipe_stencil_ref saved_stencil_ref; /**< stencil ref */
struct pipe_viewport_state saved_viewport;
- struct pipe_clip_state saved_clip;
int saved_num_sampler_states;
void *saved_sampler_states[PIPE_MAX_SAMPLERS];
@@ -365,13 +364,6 @@ void util_blitter_save_viewport(struct blitter_context *blitter,
}
static INLINE
-void util_blitter_save_clip(struct blitter_context *blitter,
- struct pipe_clip_state *state)
-{
- blitter->saved_clip = *state;
-}
-
-static INLINE
void util_blitter_save_fragment_sampler_states(
struct blitter_context *blitter,
int num_sampler_states,
diff --git a/mesalib/src/gallium/auxiliary/util/u_dump_state.c b/mesalib/src/gallium/auxiliary/util/u_dump_state.c
index e44c6194c..c728bc402 100644
--- a/mesalib/src/gallium/auxiliary/util/u_dump_state.c
+++ b/mesalib/src/gallium/auxiliary/util/u_dump_state.c
@@ -303,6 +303,8 @@ util_dump_rasterizer_state(FILE *stream, const struct pipe_rasterizer_state *sta
util_dump_member(stream, bool, state, flatshade);
util_dump_member(stream, bool, state, light_twoside);
+ util_dump_member(stream, bool, state, clamp_vertex_color);
+ util_dump_member(stream, bool, state, clamp_fragment_color);
util_dump_member(stream, uint, state, front_ccw);
util_dump_member(stream, uint, state, cull_face);
util_dump_member(stream, uint, state, fill_front);
@@ -326,6 +328,9 @@ util_dump_rasterizer_state(FILE *stream, const struct pipe_rasterizer_state *sta
util_dump_member(stream, bool, state, line_last_pixel);
util_dump_member(stream, bool, state, flatshade_first);
util_dump_member(stream, bool, state, gl_rasterization_rules);
+ util_dump_member(stream, bool, state, rasterizer_discard);
+ util_dump_member(stream, bool, state, depth_clip);
+ util_dump_member(stream, uint, state, clip_plane_enable);
util_dump_member(stream, float, state, line_width);
util_dump_member(stream, float, state, point_size);
@@ -413,8 +418,6 @@ util_dump_clip_state(FILE *stream, const struct pipe_clip_state *state)
util_dump_array_end(stream);
util_dump_member_end(stream);
- util_dump_member(stream, uint, state, nr);
-
util_dump_struct_end(stream);
}
diff --git a/mesalib/src/gallium/auxiliary/util/u_gen_mipmap.c b/mesalib/src/gallium/auxiliary/util/u_gen_mipmap.c
index 7cce815be..a28d41825 100644
--- a/mesalib/src/gallium/auxiliary/util/u_gen_mipmap.c
+++ b/mesalib/src/gallium/auxiliary/util/u_gen_mipmap.c
@@ -63,7 +63,6 @@ struct gen_mipmap_state
struct pipe_depth_stencil_alpha_state depthstencil;
struct pipe_rasterizer_state rasterizer;
struct pipe_sampler_state sampler;
- struct pipe_clip_state clip;
struct pipe_vertex_element velem[2];
void *vs;
@@ -1283,6 +1282,7 @@ util_create_gen_mipmap(struct pipe_context *pipe,
memset(&ctx->rasterizer, 0, sizeof(ctx->rasterizer));
ctx->rasterizer.cull_face = PIPE_FACE_NONE;
ctx->rasterizer.gl_rasterization_rules = 1;
+ ctx->rasterizer.depth_clip = 1;
/* sampler state */
memset(&ctx->sampler, 0, sizeof(ctx->sampler));
@@ -1564,14 +1564,12 @@ util_gen_mipmap(struct gen_mipmap_state *ctx,
cso_save_vertex_shader(ctx->cso);
cso_save_geometry_shader(ctx->cso);
cso_save_viewport(ctx->cso);
- cso_save_clip(ctx->cso);
cso_save_vertex_elements(ctx->cso);
/* bind our state */
cso_set_blend(ctx->cso, &ctx->blend);
cso_set_depth_stencil_alpha(ctx->cso, &ctx->depthstencil);
cso_set_rasterizer(ctx->cso, &ctx->rasterizer);
- cso_set_clip(ctx->cso, &ctx->clip);
cso_set_vertex_elements(ctx->cso, 2, ctx->velem);
cso_set_stream_outputs(ctx->cso, 0, NULL, 0);
@@ -1688,7 +1686,6 @@ util_gen_mipmap(struct gen_mipmap_state *ctx,
cso_restore_vertex_shader(ctx->cso);
cso_restore_geometry_shader(ctx->cso);
cso_restore_viewport(ctx->cso);
- cso_restore_clip(ctx->cso);
cso_restore_vertex_elements(ctx->cso);
cso_restore_stream_outputs(ctx->cso);
}
diff --git a/mesalib/src/gallium/auxiliary/util/u_sampler.c b/mesalib/src/gallium/auxiliary/util/u_sampler.c
index 3dcf4fcd0..227641bda 100644
--- a/mesalib/src/gallium/auxiliary/util/u_sampler.c
+++ b/mesalib/src/gallium/auxiliary/util/u_sampler.c
@@ -1,103 +1,109 @@
-/**************************************************************************
- *
- * Copyright 2010 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.
- *
- **************************************************************************/
-
-
-#include "u_format.h"
-#include "u_sampler.h"
-
-
-static void
-default_template(struct pipe_sampler_view *view,
- const struct pipe_resource *texture,
- enum pipe_format format,
- unsigned expand_green_blue)
-{
- /* XXX: Check if format is compatible with texture->format.
- */
-
- view->format = format;
- view->u.tex.first_level = 0;
- view->u.tex.last_level = texture->last_level;
- view->u.tex.first_layer = 0;
- view->u.tex.last_layer = texture->target == PIPE_TEXTURE_3D ?
- texture->depth0 - 1 : texture->array_size - 1;
- view->swizzle_r = PIPE_SWIZZLE_RED;
- view->swizzle_g = PIPE_SWIZZLE_GREEN;
- view->swizzle_b = PIPE_SWIZZLE_BLUE;
- view->swizzle_a = PIPE_SWIZZLE_ALPHA;
-
- /* Override default green and blue component expansion to the requested
- * one.
- *
- * Gallium expands nonexistent components to (0,0,0,1), DX9 expands
- * to (1,1,1,1). Since alpha is always expanded to 1, and red is
- * always present, we only really care about green and blue
- * components.
- *
- * To make it look less hackish, one would have to add
- * UTIL_FORMAT_SWIZZLE_EXPAND to indicate components for expansion
- * and then override without exceptions or favoring one component
- * over another.
- */
- if (format != PIPE_FORMAT_A8_UNORM) {
- const struct util_format_description *desc = util_format_description(format);
-
- assert(desc);
- if (desc) {
- if (desc->swizzle[1] == UTIL_FORMAT_SWIZZLE_0) {
- view->swizzle_g = expand_green_blue;
- }
- if (desc->swizzle[2] == UTIL_FORMAT_SWIZZLE_0) {
- view->swizzle_b = expand_green_blue;
- }
- }
- }
-}
-
-void
-u_sampler_view_default_template(struct pipe_sampler_view *view,
- const struct pipe_resource *texture,
- enum pipe_format format)
-{
- /* Expand to (0, 0, 0, 1) */
- default_template(view,
- texture,
- format,
- PIPE_SWIZZLE_ZERO);
-}
-
-void
-u_sampler_view_default_dx9_template(struct pipe_sampler_view *view,
- const struct pipe_resource *texture,
- enum pipe_format format)
-{
- /* Expand to (1, 1, 1, 1) */
- default_template(view,
- texture,
- format,
- PIPE_SWIZZLE_ONE);
-}
+/**************************************************************************
+ *
+ * Copyright 2010 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.
+ *
+ **************************************************************************/
+
+
+#include "u_format.h"
+#include "u_sampler.h"
+
+
+/**
+ * Initialize a pipe_sampler_view. 'view' is considered to have
+ * uninitialized contents.
+ */
+static void
+default_template(struct pipe_sampler_view *view,
+ const struct pipe_resource *texture,
+ enum pipe_format format,
+ unsigned expand_green_blue)
+{
+ memset(view, 0, sizeof(*view));
+
+ /* XXX: Check if format is compatible with texture->format.
+ */
+
+ view->format = format;
+ view->u.tex.first_level = 0;
+ view->u.tex.last_level = texture->last_level;
+ view->u.tex.first_layer = 0;
+ view->u.tex.last_layer = texture->target == PIPE_TEXTURE_3D ?
+ texture->depth0 - 1 : texture->array_size - 1;
+ view->swizzle_r = PIPE_SWIZZLE_RED;
+ view->swizzle_g = PIPE_SWIZZLE_GREEN;
+ view->swizzle_b = PIPE_SWIZZLE_BLUE;
+ view->swizzle_a = PIPE_SWIZZLE_ALPHA;
+
+ /* Override default green and blue component expansion to the requested
+ * one.
+ *
+ * Gallium expands nonexistent components to (0,0,0,1), DX9 expands
+ * to (1,1,1,1). Since alpha is always expanded to 1, and red is
+ * always present, we only really care about green and blue
+ * components.
+ *
+ * To make it look less hackish, one would have to add
+ * UTIL_FORMAT_SWIZZLE_EXPAND to indicate components for expansion
+ * and then override without exceptions or favoring one component
+ * over another.
+ */
+ if (format != PIPE_FORMAT_A8_UNORM) {
+ const struct util_format_description *desc = util_format_description(format);
+
+ assert(desc);
+ if (desc) {
+ if (desc->swizzle[1] == UTIL_FORMAT_SWIZZLE_0) {
+ view->swizzle_g = expand_green_blue;
+ }
+ if (desc->swizzle[2] == UTIL_FORMAT_SWIZZLE_0) {
+ view->swizzle_b = expand_green_blue;
+ }
+ }
+ }
+}
+
+void
+u_sampler_view_default_template(struct pipe_sampler_view *view,
+ const struct pipe_resource *texture,
+ enum pipe_format format)
+{
+ /* Expand to (0, 0, 0, 1) */
+ default_template(view,
+ texture,
+ format,
+ PIPE_SWIZZLE_ZERO);
+}
+
+void
+u_sampler_view_default_dx9_template(struct pipe_sampler_view *view,
+ const struct pipe_resource *texture,
+ enum pipe_format format)
+{
+ /* Expand to (1, 1, 1, 1) */
+ default_template(view,
+ texture,
+ format,
+ PIPE_SWIZZLE_ONE);
+}
diff --git a/mesalib/src/gallium/auxiliary/util/u_surface.c b/mesalib/src/gallium/auxiliary/util/u_surface.c
index c7fbd3657..a541a38ff 100644
--- a/mesalib/src/gallium/auxiliary/util/u_surface.c
+++ b/mesalib/src/gallium/auxiliary/util/u_surface.c
@@ -42,17 +42,21 @@
#include "util/u_surface.h"
#include "util/u_pack_color.h"
+
+/**
+ * Initialize a pipe_surface object. 'view' is considered to have
+ * uninitialized contents.
+ */
void
-u_surface_default_template(struct pipe_surface *view,
+u_surface_default_template(struct pipe_surface *surf,
const struct pipe_resource *texture,
unsigned bind)
{
- view->format = texture->format;
- view->u.tex.level = 0;
- view->u.tex.first_layer = 0;
- view->u.tex.last_layer = 0;
+ memset(surf, 0, sizeof(*surf));
+
+ surf->format = texture->format;
/* XXX should filter out all non-rt/ds bind flags ? */
- view->usage = bind;
+ surf->usage = bind;
}
/**
@@ -108,7 +112,6 @@ util_create_rgba_surface(struct pipe_context *pipe,
return FALSE;
/* create surface */
- memset(&surf_templ, 0, sizeof(surf_templ));
u_surface_default_template(&surf_templ, *textureOut, bind);
/* create surface / view into texture */
*surfaceOut = pipe->create_surface(pipe,