diff options
author | Marek Olšák <[email protected]> | 2018-04-30 22:29:14 -0400 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2018-05-10 18:34:31 -0400 |
commit | 912b0163dc5d6929d8a9ae4c6d475807e764832a (patch) | |
tree | 115fb6be4b3eaa68306e94a442d4bcc6baeb3f17 /src/amd | |
parent | ee31762ef56a5af6caf9c056e2b7d88ae6d7664d (diff) |
ac/surface: add EQAA support
Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/amd')
-rw-r--r-- | src/amd/common/ac_surface.c | 29 | ||||
-rw-r--r-- | src/amd/common/ac_surface.h | 3 | ||||
-rw-r--r-- | src/amd/vulkan/radv_image.c | 1 |
3 files changed, 30 insertions, 3 deletions
diff --git a/src/amd/common/ac_surface.c b/src/amd/common/ac_surface.c index 22608c84351..12240c93d6b 100644 --- a/src/amd/common/ac_surface.c +++ b/src/amd/common/ac_surface.c @@ -249,10 +249,27 @@ static int surf_config_sanity(const struct ac_surf_config *config, case 4: case 8: break; + case 16: + if (flags & RADEON_SURF_Z_OR_SBUFFER) + return -EINVAL; + break; default: return -EINVAL; } + if (!(flags & RADEON_SURF_Z_OR_SBUFFER)) { + switch (config->info.color_samples) { + case 0: + case 1: + case 2: + case 4: + case 8: + break; + default: + return -EINVAL; + } + } + if (config->is_3d && config->info.array_size > 1) return -EINVAL; if (config->is_cube && config->info.depth > 1) @@ -607,9 +624,14 @@ static int gfx6_compute_surface(ADDR_HANDLE addrlib, } AddrDccIn.numSamples = AddrSurfInfoIn.numSamples = - config->info.samples ? config->info.samples : 1; + MAX2(1, config->info.samples); AddrSurfInfoIn.tileIndex = -1; + if (!(surf->flags & RADEON_SURF_Z_OR_SBUFFER)) { + AddrDccIn.numSamples = AddrSurfInfoIn.numFrags = + MAX2(1, config->info.color_samples); + } + /* Set the micro tile type. */ if (surf->flags & RADEON_SURF_SCANOUT) AddrSurfInfoIn.tileType = ADDR_DISPLAYABLE; @@ -1317,9 +1339,12 @@ static int gfx9_compute_surface(ADDR_HANDLE addrlib, AddrSurfInfoIn.flags.opt4space = 1; AddrSurfInfoIn.numMipLevels = config->info.levels; - AddrSurfInfoIn.numSamples = config->info.samples ? config->info.samples : 1; + AddrSurfInfoIn.numSamples = MAX2(1, config->info.samples); AddrSurfInfoIn.numFrags = AddrSurfInfoIn.numSamples; + if (!(surf->flags & RADEON_SURF_Z_OR_SBUFFER)) + AddrSurfInfoIn.numFrags = MAX2(1, config->info.color_samples); + /* GFX9 doesn't support 1D depth textures, so allocate all 1D textures * as 2D to avoid having shader variants for 1D vs 2D, so all shaders * must sample 1D textures as 2D. */ diff --git a/src/amd/common/ac_surface.h b/src/amd/common/ac_surface.h index 45fb8045e53..864b5bad529 100644 --- a/src/amd/common/ac_surface.h +++ b/src/amd/common/ac_surface.h @@ -224,7 +224,8 @@ struct ac_surf_info { uint32_t width; uint32_t height; uint32_t depth; - uint8_t samples; + uint8_t samples; /* For Z/S: samples; For color: FMASK coverage samples */ + uint8_t color_samples; /* For color: color samples */ uint8_t levels; uint8_t num_channels; /* heuristic for displayability */ uint16_t array_size; diff --git a/src/amd/vulkan/radv_image.c b/src/amd/vulkan/radv_image.c index 5b13cf952b7..076b9ebf27a 100644 --- a/src/amd/vulkan/radv_image.c +++ b/src/amd/vulkan/radv_image.c @@ -937,6 +937,7 @@ radv_image_create(VkDevice _device, image->info.height = pCreateInfo->extent.height; image->info.depth = pCreateInfo->extent.depth; image->info.samples = pCreateInfo->samples; + image->info.color_samples = pCreateInfo->samples; image->info.array_size = pCreateInfo->arrayLayers; image->info.levels = pCreateInfo->mipLevels; image->info.num_channels = vk_format_get_nr_components(pCreateInfo->format); |