summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorChris Forbes <[email protected]>2012-12-16 19:50:26 +1300
committerChris Forbes <[email protected]>2013-03-02 11:35:24 +1300
commite62b6a10bcebae9fe6cb8fe81e95941ac06f13cd (patch)
tree70b7a4533dffbd03d9d6a43f27d03ee4bbde45c9 /src/mesa
parent575d3870bb669f00edaf341900aa72dc6cd997bf (diff)
i965: add support for multisample textures
V2: - Fix for state moving from texobj to image - Rebased onto Paul's logical/physical cleanup - Fixed missing quantization of sample count - Fold in IMS renderbuffer wrapper fixes from later in the series - Use correct physical slice offset for UMS/CMS surfaces on Gen7 Signed-off-by: Chris Forbes <[email protected]> Reviewed-by: Paul Berry <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/i965/brw_tex_layout.c1
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_surface_state.c2
-rw-r--r--src/mesa/drivers/dri/intel/intel_fbo.c24
-rw-r--r--src/mesa/drivers/dri/intel/intel_mipmap_tree.c24
-rw-r--r--src/mesa/drivers/dri/intel/intel_tex.c9
-rw-r--r--src/mesa/drivers/dri/intel/intel_tex_image.c2
6 files changed, 55 insertions, 7 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_tex_layout.c b/src/mesa/drivers/dri/i965/brw_tex_layout.c
index 1428396c907..d28e5aff009 100644
--- a/src/mesa/drivers/dri/i965/brw_tex_layout.c
+++ b/src/mesa/drivers/dri/i965/brw_tex_layout.c
@@ -168,6 +168,7 @@ brw_miptree_layout(struct intel_context *intel, struct intel_mipmap_tree *mt)
case GL_TEXTURE_2D_ARRAY:
case GL_TEXTURE_1D_ARRAY:
+ case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
brw_miptree_layout_texture_array(intel, mt);
break;
diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
index 587ad053081..267d00b60ee 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -60,6 +60,8 @@ translate_tex_target(GLenum target)
case GL_TEXTURE_2D:
case GL_TEXTURE_2D_ARRAY_EXT:
case GL_TEXTURE_EXTERNAL_OES:
+ case GL_TEXTURE_2D_MULTISAMPLE:
+ case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
return BRW_SURFACE_2D;
case GL_TEXTURE_3D:
diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c
index 9a9bb9f3abc..7186978b4a0 100644
--- a/src/mesa/drivers/dri/intel/intel_fbo.c
+++ b/src/mesa/drivers/dri/intel/intel_fbo.c
@@ -499,15 +499,33 @@ intel_renderbuffer_update_wrapper(struct intel_context *intel,
rb->Format = image->TexFormat;
rb->InternalFormat = image->InternalFormat;
rb->_BaseFormat = image->_BaseFormat;
- rb->Width = mt->level[level].width;
- rb->Height = mt->level[level].height;
+ rb->NumSamples = mt->num_samples;
+
+ if (mt->msaa_layout != INTEL_MSAA_LAYOUT_NONE) {
+ assert(level == 0);
+ rb->Width = mt->logical_width0;
+ rb->Height = mt->logical_height0;
+ }
+ else {
+ rb->Width = mt->level[level].width;
+ rb->Height = mt->level[level].height;
+ }
rb->Delete = intel_delete_renderbuffer;
rb->AllocStorage = intel_nop_alloc_storage;
intel_miptree_check_level_layer(mt, level, layer);
irb->mt_level = level;
- irb->mt_layer = layer;
+
+ switch (mt->msaa_layout) {
+ case INTEL_MSAA_LAYOUT_UMS:
+ case INTEL_MSAA_LAYOUT_CMS:
+ irb->mt_layer = layer * mt->num_samples;
+ break;
+
+ default:
+ irb->mt_layer = layer;
+ }
intel_miptree_reference(&irb->mt, mt);
diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
index ee058a1029e..749508f8ae8 100644
--- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
@@ -624,9 +624,27 @@ intel_miptree_match_image(struct intel_mipmap_tree *mt,
* minification. This will also catch images not present in the
* tree, changed targets, etc.
*/
- if (width != mt->level[level].width ||
- height != mt->level[level].height ||
- depth != mt->level[level].depth)
+ if (mt->target == GL_TEXTURE_2D_MULTISAMPLE ||
+ mt->target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY) {
+ /* nonzero level here is always bogus */
+ assert(level == 0);
+
+ if (width != mt->logical_width0 ||
+ height != mt->logical_height0 ||
+ depth != mt->logical_depth0) {
+ return false;
+ }
+ }
+ else {
+ /* all normal textures, renderbuffers, etc */
+ if (width != mt->level[level].width ||
+ height != mt->level[level].height ||
+ depth != mt->level[level].depth) {
+ return false;
+ }
+ }
+
+ if (image->NumSamples != mt->num_samples)
return false;
return true;
diff --git a/src/mesa/drivers/dri/intel/intel_tex.c b/src/mesa/drivers/dri/intel/intel_tex.c
index a2a36937490..1564f6cd97e 100644
--- a/src/mesa/drivers/dri/intel/intel_tex.c
+++ b/src/mesa/drivers/dri/intel/intel_tex.c
@@ -7,6 +7,7 @@
#include "intel_context.h"
#include "intel_mipmap_tree.h"
#include "intel_tex.h"
+#include "intel_fbo.h"
#define FILE_DEBUG_FLAG DEBUG_TEXTURE
@@ -63,6 +64,13 @@ intel_alloc_texture_image_buffer(struct gl_context *ctx,
assert(image->Border == 0);
+ /* Quantize sample count */
+ if (image->NumSamples) {
+ image->NumSamples = intel_quantize_num_samples(intel->intelScreen, image->NumSamples);
+ if (!image->NumSamples)
+ return false;
+ }
+
/* Because the driver uses AllocTextureImageBuffer() internally, it may end
* up mismatched with FreeTextureImageBuffer(), but that is safe to call
* multiple times.
@@ -73,6 +81,7 @@ intel_alloc_texture_image_buffer(struct gl_context *ctx,
switch (texobj->Target) {
case GL_TEXTURE_3D:
case GL_TEXTURE_2D_ARRAY:
+ case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
slices = image->Depth;
break;
case GL_TEXTURE_1D_ARRAY:
diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c
index d227ee5a8c6..63a1be03775 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_image.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_image.c
@@ -104,7 +104,7 @@ intel_miptree_create_for_teximage(struct intel_context *intel,
height,
depth,
expect_accelerated_upload,
- 0 /* num_samples */,
+ intelImage->base.Base.NumSamples,
false /* force_y_tiling */);
}