summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Bumiller <[email protected]>2011-08-03 15:43:16 +0200
committerChristoph Bumiller <[email protected]>2011-08-04 15:38:49 +0200
commit94822c6d83b7811db2a02bb4416df02ae225ba47 (patch)
tree2fce95f2b46da2bb273d45c95adb634f22a414fb
parent57590e173b6f421b1015190aa3c0011ea55f31d8 (diff)
gallium: extend resource_resolve to accommodate BlitFramebuffer
Resolve via glBlitFramebuffer allows resolving a sub-region of a renderbuffer to a different location in any mipmap level of some other texture, and, with a new extension, even scaling. Therefore, location and size parameters are needed. The mask parameter was added because resolving only depth or only stencil of a combined buffer is possible as well. Full information about the blit operation allows the drivers to take the most efficient path they possibly can.
-rw-r--r--src/gallium/docs/source/context.rst9
-rw-r--r--src/gallium/include/pipe/p_context.h8
-rw-r--r--src/gallium/include/pipe/p_defines.h4
-rw-r--r--src/gallium/include/pipe/p_state.h28
4 files changed, 43 insertions, 6 deletions
diff --git a/src/gallium/docs/source/context.rst b/src/gallium/docs/source/context.rst
index 25a3245066c..3faf801b4b1 100644
--- a/src/gallium/docs/source/context.rst
+++ b/src/gallium/docs/source/context.rst
@@ -329,8 +329,15 @@ textured quad blitter.. The source and destination may be the same resource,
but overlapping blits are not permitted.
``resource_resolve`` resolves a multisampled resource into a non-multisampled
-one. Formats and dimensions must match. This function must be present if a driver
+one. Their formats must match. This function must be present if a driver
supports multisampling.
+The region that is to be resolved is described by ``pipe_resolve_info``, which
+provides a source and a destination rectangle.
+The source rectangle may be vertically flipped, but otherwise the dimensions
+of the rectangles must match, unless PIPE_CAP_SCALED_RESOLVE is supported,
+in which case scaling and horizontal flipping are allowed as well.
+The result of resolving depth/stencil values may be any function of the values at
+the sample points, but returning the value of the centermost sample is preferred.
The interfaces to these calls are likely to change to make it easier
for a driver to batch multiple blits with the same source and
diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h
index 3f6d90d1bf4..da3ee87515f 100644
--- a/src/gallium/include/pipe/p_context.h
+++ b/src/gallium/include/pipe/p_context.h
@@ -49,6 +49,7 @@ struct pipe_index_buffer;
struct pipe_query;
struct pipe_poly_stipple;
struct pipe_rasterizer_state;
+struct pipe_resolve_info;
struct pipe_resource;
struct pipe_sampler_state;
struct pipe_sampler_view;
@@ -268,13 +269,10 @@ struct pipe_context {
/**
* Resolve a multisampled resource into a non-multisampled one.
- * Source and destination must have the same size and same format.
+ * Source and destination must be of the same format.
*/
void (*resource_resolve)(struct pipe_context *pipe,
- struct pipe_resource *dst,
- unsigned dst_layer,
- struct pipe_resource *src,
- unsigned src_layer);
+ const struct pipe_resolve_info *info);
/*@}*/
diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
index 79b89699566..7ffdf97fdfb 100644
--- a/src/gallium/include/pipe/p_defines.h
+++ b/src/gallium/include/pipe/p_defines.h
@@ -99,6 +99,9 @@ enum pipe_error {
#define PIPE_MASK_B 0x4
#define PIPE_MASK_A 0x8
#define PIPE_MASK_RGBA 0xf
+#define PIPE_MASK_Z 0x10
+#define PIPE_MASK_S 0x20
+#define PIPE_MASK_ZS 0x30
/**
@@ -468,6 +471,7 @@ enum pipe_cap {
PIPE_CAP_MIXED_COLORBUFFER_FORMATS = 46,
PIPE_CAP_SEAMLESS_CUBE_MAP = 47,
PIPE_CAP_SEAMLESS_CUBE_MAP_PER_TEXTURE = 48,
+ PIPE_CAP_SCALED_RESOLVE = 49
};
/* Shader caps not specific to any single stage */
diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h
index d442c15c02a..840b3ee0e37 100644
--- a/src/gallium/include/pipe/p_state.h
+++ b/src/gallium/include/pipe/p_state.h
@@ -483,6 +483,34 @@ struct pipe_draw_info
};
+/**
+ * Information to describe a resource_resolve call.
+ */
+struct pipe_resolve_info
+{
+ struct {
+ struct pipe_resource *res;
+ unsigned level;
+ unsigned layer;
+ int x0; /**< always left */
+ int y0; /**< always top */
+ int x1; /**< determines scale if PIPE_CAP_SCALED_RESOLVE is supported */
+ int y1; /**< determines scale if PIPE_CAP_SCALED_RESOLVE is supported */
+ } dst;
+
+ struct {
+ struct pipe_resource *res;
+ unsigned layer;
+ int x0;
+ int y0;
+ int x1; /**< may be < x0 only if PIPE_CAP_SCALED_RESOLVE is supported */
+ int y1; /**< may be < y1 even if PIPE_CAP_SCALED_RESOLVE not supported */
+ } src;
+
+ unsigned mask; /**< PIPE_MASK_RGBA, Z, S or ZS */
+};
+
+
#ifdef __cplusplus
}
#endif