diff options
author | Eric Anholt <[email protected]> | 2017-10-25 13:00:44 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2017-10-30 13:31:28 -0700 |
commit | a797f0eb6371efb78bee5f5aea73c5cdcfbcd030 (patch) | |
tree | 6e6b7332c5f2111ef6d8e06745cd6b2592a8627d /src | |
parent | fe6fc579cbdc040a9bd62170c3713546dd112ae5 (diff) |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/vc5/vc5_resource.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/vc5/vc5_state.c | 39 |
2 files changed, 39 insertions, 2 deletions
diff --git a/src/gallium/drivers/vc5/vc5_resource.c b/src/gallium/drivers/vc5/vc5_resource.c index 29623d9ba2c..9b951d9341e 100644 --- a/src/gallium/drivers/vc5/vc5_resource.c +++ b/src/gallium/drivers/vc5/vc5_resource.c @@ -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]; diff --git a/src/gallium/drivers/vc5/vc5_state.c b/src/gallium/drivers/vc5/vc5_state.c index 1f05576c18b..fc0e2874273 100644 --- a/src/gallium/drivers/vc5/vc5_state.c +++ b/src/gallium/drivers/vc5/vc5_state.c @@ -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 |