diff options
author | Chad Versace <[email protected]> | 2012-07-20 14:56:16 -0700 |
---|---|---|
committer | Chad Versace <[email protected]> | 2012-08-07 09:30:33 -0700 |
commit | 4eba67285fb6b5d2dd4927e8dc4b3e2945435309 (patch) | |
tree | 50666c2f7400469a21fee1bc9179432e09ba0ec1 /src | |
parent | e2f2376e884225705e2369caee4a8c4e90e938f3 (diff) |
intel: Refactor creation of hiz and mcs miptrees
Move the logic for creating the ancillary hiz and mcs miptress for winsys
and non-texture renderbuffers from intel_alloc_renderbuffer_storage to
intel_miptree_create_for_renderbuffer. Let's try to isolate complex
miptree logic to intel_mipmap_tree.c.
Without this refactor, code duplication would be required along the
intel_process_dri2_buffer codepath in order to create the mcs miptree.
Reviewed-by: Eric Anholt <[email protected]>
Reviewed-by: Paul Berry <[email protected]>
Signed-off-by: Chad Versace <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_fbo.c | 16 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_mipmap_tree.c | 19 |
2 files changed, 19 insertions, 16 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c index cea57e6d31d..e6e64080bf2 100644 --- a/src/mesa/drivers/dri/intel/intel_fbo.c +++ b/src/mesa/drivers/dri/intel/intel_fbo.c @@ -274,22 +274,6 @@ intel_alloc_renderbuffer_storage(struct gl_context * ctx, struct gl_renderbuffer if (!irb->mt) return false; - if (intel->vtbl.is_hiz_depth_format(intel, rb->Format)) { - bool ok = intel_miptree_alloc_hiz(intel, irb->mt, rb->NumSamples); - if (!ok) { - intel_miptree_release(&irb->mt); - return false; - } - } - - if (irb->mt->msaa_layout == INTEL_MSAA_LAYOUT_CMS) { - bool ok = intel_miptree_alloc_mcs(intel, irb->mt, rb->NumSamples); - if (!ok) { - intel_miptree_release(&irb->mt); - return false; - } - } - return true; } diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c index 9f349d00a5f..b6ecbca9162 100644 --- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c +++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c @@ -334,6 +334,7 @@ intel_miptree_create_for_renderbuffer(struct intel_context *intel, struct intel_mipmap_tree *mt; uint32_t depth = 1; enum intel_msaa_layout msaa_layout = INTEL_MSAA_LAYOUT_NONE; + bool ok; if (num_samples > 1) { /* Adjust width/height/depth for MSAA */ @@ -397,8 +398,26 @@ intel_miptree_create_for_renderbuffer(struct intel_context *intel, mt = intel_miptree_create(intel, GL_TEXTURE_2D, format, 0, 0, width, height, depth, true, num_samples, msaa_layout); + if (!mt) + goto fail; + + if (intel->vtbl.is_hiz_depth_format(intel, format)) { + ok = intel_miptree_alloc_hiz(intel, mt, num_samples); + if (!ok) + goto fail; + } + + if (mt->msaa_layout == INTEL_MSAA_LAYOUT_CMS) { + ok = intel_miptree_alloc_mcs(intel, mt, num_samples); + if (!ok) + goto fail; + } return mt; + +fail: + intel_miptree_release(&mt); + return NULL; } void |