diff options
author | Eric Anholt <[email protected]> | 2014-02-13 10:45:35 -0800 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2014-02-18 10:01:45 -0800 |
commit | 4e0924c5de5f3964e4ca81f923d877dbb59fad0a (patch) | |
tree | e9af3ff446a6e9c3b87f82db7c2b075d895ca826 /src/mesa/drivers/dri/i965/intel_fbo.h | |
parent | 019560c127778dc3b08bdc7c3acdc68dbbb80ea0 (diff) |
i965: Move singlesample_mt to the renderbuffer.
Since only window system renderbuffers can have a singlesample_mt, this
lets us drop a bunch of sanity checking to make sure that we're just a
renderbuffer-like thing.
v2: Fix a badly-written comment (thanks Kenneth!), drop the now trivial
helper function for set_needs_downsample.
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/i965/intel_fbo.h')
-rw-r--r-- | src/mesa/drivers/dri/i965/intel_fbo.h | 50 |
1 files changed, 46 insertions, 4 deletions
diff --git a/src/mesa/drivers/dri/i965/intel_fbo.h b/src/mesa/drivers/dri/i965/intel_fbo.h index 45e2cd89d9e..b8db7e2d73f 100644 --- a/src/mesa/drivers/dri/i965/intel_fbo.h +++ b/src/mesa/drivers/dri/i965/intel_fbo.h @@ -49,7 +49,26 @@ struct intel_texture_image; struct intel_renderbuffer { struct swrast_renderbuffer Base; - struct intel_mipmap_tree *mt; /**< The renderbuffer storage. */ + /** + * The real renderbuffer storage. + * + * This is multisampled if NumSamples is > 1. + */ + struct intel_mipmap_tree *mt; + + /** + * Downsampled contents for window-system MSAA renderbuffers. + * + * For window system MSAA color buffers, the singlesample_mt is shared with + * other processes in DRI2 (and in DRI3, it's the image buffer managed by + * glx_dri3.c), while mt is private to our process. To do a swapbuffers, + * we have to downsample out of mt into singlesample_mt. For depth and + * stencil buffers, the singlesample_mt is also private, and since we don't + * expect to need to do resolves (except if someone does a glReadPixels() + * or glCopyTexImage()), we just temporarily allocate singlesample_mt when + * asked to map the renderbuffer. + */ + struct intel_mipmap_tree *singlesample_mt; /** * \name Miptree view @@ -74,6 +93,24 @@ struct intel_renderbuffer /** \} */ GLuint draw_x, draw_y; /**< Offset of drawing within the region */ + + /** + * Set to true at every draw call, to indicate if a window-system + * renderbuffer needs to be downsampled before using singlesample_mt. + */ + bool need_downsample; + + /** + * Set to true when doing an intel_renderbuffer_map()/unmap() that requires + * an upsample at the end. + */ + bool need_map_upsample; + + /** + * Set to true if singlesample_mt is temporary storage that persists only + * for the duration of a mapping. + */ + bool singlesample_mt_is_tmp; }; @@ -157,9 +194,6 @@ intel_renderbuffer_get_tile_offsets(struct intel_renderbuffer *irb, tile_x, tile_y); } -void -intel_renderbuffer_set_needs_downsample(struct intel_renderbuffer *irb); - bool intel_renderbuffer_has_hiz(struct intel_renderbuffer *irb); @@ -195,6 +229,14 @@ void intel_renderbuffer_move_to_temp(struct brw_context *brw, struct intel_renderbuffer *irb, bool invalidate); +void +intel_renderbuffer_downsample(struct brw_context *brw, + struct intel_renderbuffer *irb); + +void +intel_renderbuffer_upsample(struct brw_context *brw, + struct intel_renderbuffer *irb); + unsigned intel_quantize_num_samples(struct intel_screen *intel, unsigned num_samples); |