From aac2cccccfd701ae8d7ce0813c28c64498d4a076 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Mon, 26 Apr 2010 19:50:57 +0200 Subject: gallium: interface changes for multisampling add function to set sample mask, and state for alpha-to-coverage and alpha-to-one. Also make it possible to query for supported sample count with is_msaa_supported(). Use explicit resource_resolve() to resolve a resource. Note that it is illegal to bind a unresolved resource as a sampler view, must be resolved first (as per d3d10 and OGL APIs, binding unresolved resource would mean that special texture fetch functions need to be used which give explicit control over what samples to fetch, which isn't supported yet). Also change surface_fill() and surface_copy() to operate directly on resources. Blits should operate directly on resources, most often state trackers just used get_tex_surface() then did a blit. Note this also means the blit bind flags are gone, if a driver implements this functionality it is expected to handle it for all resources having depth_stencil/render_target/sampler_view bind flags (might even require it for all bind flags?). Might want to introduce quality levels for MSAA later. Might need to revisit this for hw which does instant resolve. --- src/gallium/auxiliary/cso_cache/cso_context.c | 11 +++++++++++ src/gallium/auxiliary/cso_cache/cso_context.h | 2 ++ 2 files changed, 13 insertions(+) (limited to 'src/gallium/auxiliary/cso_cache') diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c index 6d0b4207986..50736f06b32 100644 --- a/src/gallium/auxiliary/cso_cache/cso_context.c +++ b/src/gallium/auxiliary/cso_cache/cso_context.c @@ -98,6 +98,7 @@ struct cso_context { struct pipe_framebuffer_state fb, fb_saved; struct pipe_viewport_state vp, vp_saved; struct pipe_blend_color blend_color; + unsigned sample_mask sample_mask; struct pipe_stencil_ref stencil_ref, stencil_ref_saved; }; @@ -984,6 +985,16 @@ enum pipe_error cso_set_blend_color(struct cso_context *ctx, return PIPE_OK; } +enum pipe_error cso_set_sample_mask(struct cso_context *ctx, + unsigned sample_mask) +{ + if (ctx->sample_mask != sample_mask) { + ctx->sample_mask = sample_mask; + ctx->pipe->set_sample_mask(ctx->pipe, sample_mask); + } + return PIPE_OK; +} + enum pipe_error cso_set_stencil_ref(struct cso_context *ctx, const struct pipe_stencil_ref *sr) { diff --git a/src/gallium/auxiliary/cso_cache/cso_context.h b/src/gallium/auxiliary/cso_cache/cso_context.h index d6bcb1fe8f7..f0b07f73765 100644 --- a/src/gallium/auxiliary/cso_cache/cso_context.h +++ b/src/gallium/auxiliary/cso_cache/cso_context.h @@ -159,6 +159,8 @@ void cso_restore_viewport(struct cso_context *cso); enum pipe_error cso_set_blend_color(struct cso_context *cso, const struct pipe_blend_color *bc); +enum pipe_error cso_set_sample_mask(struct cso_context *cso, + unsigned stencil_mask); enum pipe_error cso_set_stencil_ref(struct cso_context *cso, const struct pipe_stencil_ref *sr); -- cgit v1.2.3