broadcom/vc5: Set up MSAA texture type according to the internal format.

It gets most of EXT_framebuffer_multisample-formats passing, but doesn't
really work for texture views.
This commit is contained in:
Eric Anholt 2017-10-25 13:00:44 -07:00
parent fe6fc579cb
commit a797f0eb63
2 changed files with 39 additions and 2 deletions

View File

@ -371,7 +371,7 @@ vc5_setup_slices(struct vc5_resource *rsc, const char *caller)
/* MSAA textures/renderbuffers are always laid out as single-level
* UIF.
*/
bool uif_top = prsc->nr_samples > 1;
bool uif_top = msaa;
for (int i = prsc->last_level; i >= 0; i--) {
struct vc5_resource_slice *slice = &rsc->slices[i];

View File

@ -571,13 +571,50 @@ vc5_create_sampler_view(struct pipe_context *pctx, struct pipe_resource *prsc,
.image_height = prsc->height0 * msaa_scale,
.image_depth = prsc->depth0,
.texture_type = vc5_get_tex_format(cso->format),
.srgb = util_format_is_srgb(cso->format),
.base_level = cso->u.tex.first_level,
.array_stride_64_byte_aligned = rsc->cube_map_stride / 64,
};
if (prsc->nr_samples > 1) {
/* Using texture views to reinterpret formats on our MSAA
* textures won't work, because we don't lay out the bits in
* memory as it's expected -- for example, RGBA8 and RGB10_A2
* are compatible in the ARB_texture_view spec, but in HW we
* lay them out as 32bpp RGBA8 and 64bpp RGBA16F. Just assert
* for now to catch failures.
*/
assert(util_format_linear(cso->format) ==
util_format_linear(prsc->format));
uint32_t output_image_format = vc5_get_rt_format(cso->format);
uint32_t internal_type;
uint32_t internal_bpp;
vc5_get_internal_type_bpp_for_output_format(output_image_format,
&internal_type,
&internal_bpp);
switch (internal_type) {
case INTERNAL_TYPE_8:
state_unpacked.texture_type = TEXTURE_DATA_FORMAT_RGBA8;
break;
case INTERNAL_TYPE_16F:
state_unpacked.texture_type = TEXTURE_DATA_FORMAT_RGBA16F;
break;
default:
unreachable("Bad MSAA texture type");
}
/* sRGB was stored in the tile buffer as linear and would have
* been encoded to sRGB on resolved tile buffer store. Note
* that this means we would need shader code if we wanted to
* read an MSAA sRGB texture without sRGB decode.
*/
state_unpacked.srgb = false;
} else {
state_unpacked.texture_type = vc5_get_tex_format(cso->format);
}
/* Note: Contrary to the docs, the swizzle still applies even
* if the return size is 32. It's just that you probably want
* to swizzle in the shader, because you need the Y/Z/W