i965/Gen7: Include bitfield in the sampler key for CMS layout

We need to emit extra shader code in this case to sample the
MCS surface first; we can't just blindly do this all the time
since IVB will sometimes try to access the MCS surface even if
disabled.

V3: Use actual MSAA layout from the texture's mt, rather
then computing what would have been used based on the format.
This is simpler and less fragile - there's at least one case where
we might want to have a texture's MSAA layout change based on what
the app does (CMS SINT falling back to UMS if the app ever attempts
to render to it with a channel disabled.)

This also obsoletes V2's 1/10 -- compute_msaa_layout can now remain
an implementation detail of the miptree code.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
This commit is contained in:
Chris Forbes 2013-11-30 10:01:12 +13:00
parent b1604841c2
commit 27359b8079
2 changed files with 18 additions and 0 deletions

View File

@ -45,6 +45,11 @@ struct brw_sampler_prog_key_data {
* For RG32F, gather4's channel select is broken.
*/
uint16_t gather_channel_quirk_mask;
/**
* Whether this sampler uses the compressed multisample surface layout.
*/
uint16_t compressed_multisample_layout_mask;
};
#ifdef __cplusplus

View File

@ -38,6 +38,7 @@
#include "main/samplerobj.h"
#include "program/prog_parameter.h"
#include "program/program.h"
#include "intel_mipmap_tree.h"
#include "glsl/ralloc.h"
@ -356,6 +357,18 @@ brw_populate_sampler_prog_key_data(struct gl_context *ctx,
if (img->InternalFormat == GL_RG32F)
key->gather_channel_quirk_mask |= 1 << s;
}
/* If this is a multisample sampler, and uses the CMS MSAA layout,
* then we need to emit slightly different code to first sample the
* MCS surface.
*/
struct intel_texture_object *intel_tex =
intel_texture_object((struct gl_texture_object *)t);
if (brw->gen >= 7 &&
intel_tex->mt->msaa_layout == INTEL_MSAA_LAYOUT_CMS) {
key->compressed_multisample_layout_mask |= 1 << s;
}
}
}
}