diff options
author | Marek Olšák <[email protected]> | 2016-10-01 01:53:05 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2017-03-30 14:44:33 +0200 |
commit | 00e777b61c8c6cc9c216e15b848a705b6c14dcdb (patch) | |
tree | 4d274e841bd9f055155ff24846a07e3d9e765a94 /src | |
parent | e6c520362d56dc51efc6700dc18828bd150bc5b5 (diff) |
amd: add texture format definitions for GFX9
the DATA_FORMAT and NUM_FORMAT fields are the same, but some of the enums
differ, thus add GFX6 and GFX9 suffixes, so that the IB parser can show
enums for both.
Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/amd/common/ac_nir_to_llvm.c | 2 | ||||
-rw-r--r-- | src/amd/common/gfx9d.h | 137 | ||||
-rw-r--r-- | src/amd/common/sid.h | 24 | ||||
-rw-r--r-- | src/amd/vulkan/radv_image.c | 8 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_state.c | 8 |
5 files changed, 152 insertions, 27 deletions
diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c index 8e770495f01..d0cb411f7cd 100644 --- a/src/amd/common/ac_nir_to_llvm.c +++ b/src/amd/common/ac_nir_to_llvm.c @@ -1710,7 +1710,7 @@ static LLVMValueRef radv_lower_gather4_integer(struct nir_to_llvm_context *ctx, LLVMConstInt(ctx->i32, 0x14000000, false), ""); /* replace the NUM FORMAT in the descriptor */ - tmp2 = LLVMBuildAnd(ctx->builder, tmp2, LLVMConstInt(ctx->i32, C_008F14_NUM_FORMAT, false), ""); + tmp2 = LLVMBuildAnd(ctx->builder, tmp2, LLVMConstInt(ctx->i32, C_008F14_NUM_FORMAT_GFX6, false), ""); tmp2 = LLVMBuildOr(ctx->builder, tmp2, tmp, ""); args->resource = LLVMBuildInsertElement(ctx->builder, args->resource, tmp2, ctx->i32one, ""); diff --git a/src/amd/common/gfx9d.h b/src/amd/common/gfx9d.h index 702508bfb39..b8ff825054c 100644 --- a/src/amd/common/gfx9d.h +++ b/src/amd/common/gfx9d.h @@ -1283,12 +1283,133 @@ #define S_008F14_MIN_LOD(x) (((unsigned)(x) & 0xFFF) << 8) #define G_008F14_MIN_LOD(x) (((x) >> 8) & 0xFFF) #define C_008F14_MIN_LOD 0xFFF000FF -#define S_008F14_DATA_FORMAT(x) (((unsigned)(x) & 0x3F) << 20) -#define G_008F14_DATA_FORMAT(x) (((x) >> 20) & 0x3F) -#define C_008F14_DATA_FORMAT 0xFC0FFFFF -#define S_008F14_NUM_FORMAT(x) (((unsigned)(x) & 0x0F) << 26) -#define G_008F14_NUM_FORMAT(x) (((x) >> 26) & 0x0F) -#define C_008F14_NUM_FORMAT 0xC3FFFFFF +#define S_008F14_DATA_FORMAT_GFX9(x) (((unsigned)(x) & 0x3F) << 20) +#define G_008F14_DATA_FORMAT_GFX9(x) (((x) >> 20) & 0x3F) +#define C_008F14_DATA_FORMAT_GFX9 0xFC0FFFFF +#define V_008F14_IMG_DATA_FORMAT_INVALID 0x00 +#define V_008F14_IMG_DATA_FORMAT_8 0x01 +#define V_008F14_IMG_DATA_FORMAT_16 0x02 +#define V_008F14_IMG_DATA_FORMAT_8_8 0x03 +#define V_008F14_IMG_DATA_FORMAT_32 0x04 +#define V_008F14_IMG_DATA_FORMAT_16_16 0x05 +#define V_008F14_IMG_DATA_FORMAT_10_11_11 0x06 +#define V_008F14_IMG_DATA_FORMAT_11_11_10 0x07 +#define V_008F14_IMG_DATA_FORMAT_10_10_10_2 0x08 +#define V_008F14_IMG_DATA_FORMAT_2_10_10_10 0x09 +#define V_008F14_IMG_DATA_FORMAT_8_8_8_8 0x0A +#define V_008F14_IMG_DATA_FORMAT_32_32 0x0B +#define V_008F14_IMG_DATA_FORMAT_16_16_16_16 0x0C +#define V_008F14_IMG_DATA_FORMAT_32_32_32 0x0D +#define V_008F14_IMG_DATA_FORMAT_32_32_32_32 0x0E +#define V_008F14_IMG_DATA_FORMAT_RESERVED_15 0x0F +#define V_008F14_IMG_DATA_FORMAT_5_6_5 0x10 +#define V_008F14_IMG_DATA_FORMAT_1_5_5_5 0x11 +#define V_008F14_IMG_DATA_FORMAT_5_5_5_1 0x12 +#define V_008F14_IMG_DATA_FORMAT_4_4_4_4 0x13 +#define V_008F14_IMG_DATA_FORMAT_8_24 0x14 +#define V_008F14_IMG_DATA_FORMAT_24_8 0x15 +#define V_008F14_IMG_DATA_FORMAT_X24_8_32 0x16 +#define V_008F14_IMG_DATA_FORMAT_8_AS_8_8_8_8 0x17 +#define V_008F14_IMG_DATA_FORMAT_ETC2_RGB 0x18 +#define V_008F14_IMG_DATA_FORMAT_ETC2_RGBA 0x19 +#define V_008F14_IMG_DATA_FORMAT_ETC2_R 0x1A +#define V_008F14_IMG_DATA_FORMAT_ETC2_RG 0x1B +#define V_008F14_IMG_DATA_FORMAT_ETC2_RGBA1 0x1C +#define V_008F14_IMG_DATA_FORMAT_RESERVED_29 0x1D +#define V_008F14_IMG_DATA_FORMAT_RESERVED_30 0x1E +#define V_008F14_IMG_DATA_FORMAT_6E4 0x1F +#define V_008F14_IMG_DATA_FORMAT_GB_GR 0x20 +#define V_008F14_IMG_DATA_FORMAT_BG_RG 0x21 +#define V_008F14_IMG_DATA_FORMAT_5_9_9_9 0x22 +#define V_008F14_IMG_DATA_FORMAT_BC1 0x23 +#define V_008F14_IMG_DATA_FORMAT_BC2 0x24 +#define V_008F14_IMG_DATA_FORMAT_BC3 0x25 +#define V_008F14_IMG_DATA_FORMAT_BC4 0x26 +#define V_008F14_IMG_DATA_FORMAT_BC5 0x27 +#define V_008F14_IMG_DATA_FORMAT_BC6 0x28 +#define V_008F14_IMG_DATA_FORMAT_BC7 0x29 +#define V_008F14_IMG_DATA_FORMAT_16_AS_32_32 0x2A +#define V_008F14_IMG_DATA_FORMAT_16_AS_16_16_16_16_GFX9 0x2B +#define V_008F14_IMG_DATA_FORMAT_16_AS_32_32_32_32_GFX9 0x2C +#define V_008F14_IMG_DATA_FORMAT_FMASK 0x2D /* NUM_FORMAT selects the format */ +#define V_008F14_IMG_DATA_FORMAT_ASTC_2D_LDR 0x2E /* NUM_FORMAT selects the block size */ +#define V_008F14_IMG_DATA_FORMAT_ASTC_2D_HDR 0x2F /* ditto */ +#define V_008F14_IMG_DATA_FORMAT_ASTC_2D_LDR_SRGB 0x30 /* ditto */ +#define V_008F14_IMG_DATA_FORMAT_ASTC_3D_LDR 0x31 /* ditto */ +#define V_008F14_IMG_DATA_FORMAT_ASTC_3D_HDR 0x32 /* ditto */ +#define V_008F14_IMG_DATA_FORMAT_ASTC_3D_LDR_SRGB 0x33 /* ditto */ +#define V_008F14_IMG_DATA_FORMAT_N_IN_16 0x34 +#define V_008F14_IMG_DATA_FORMAT_N_IN_16_16 0x35 +#define V_008F14_IMG_DATA_FORMAT_N_IN_16_16_16_16 0x36 +#define V_008F14_IMG_DATA_FORMAT_N_IN_16_AS_16_16_16_16 0x37 +#define V_008F14_IMG_DATA_FORMAT_RESERVED_56 0x38 +#define V_008F14_IMG_DATA_FORMAT_4_4 0x39 +#define V_008F14_IMG_DATA_FORMAT_6_5_5 0x3A +#define V_008F14_IMG_DATA_S8_16 0x3B +#define V_008F14_IMG_DATA_S8_32 0x3C +#define V_008F14_IMG_DATA_FORMAT_8_AS_32 0x3D +#define V_008F14_IMG_DATA_FORMAT_8_AS_32_32 0x3E +#define V_008F14_IMG_DATA_FORMAT_32_AS_32_32_32_32 0x3F +#define S_008F14_NUM_FORMAT_GFX9(x) (((unsigned)(x) & 0x0F) << 26) +#define G_008F14_NUM_FORMAT_GFX9(x) (((x) >> 26) & 0x0F) +#define C_008F14_NUM_FORMAT_GFX9 0xC3FFFFFF +#define V_008F14_IMG_NUM_FORMAT_UNORM 0x00 +#define V_008F14_IMG_NUM_FORMAT_SNORM 0x01 +#define V_008F14_IMG_NUM_FORMAT_USCALED 0x02 +#define V_008F14_IMG_NUM_FORMAT_SSCALED 0x03 +#define V_008F14_IMG_NUM_FORMAT_UINT 0x04 +#define V_008F14_IMG_NUM_FORMAT_SINT 0x05 +#define V_008F14_IMG_NUM_FORMAT_RESERVED_6 0x06 +#define V_008F14_IMG_NUM_FORMAT_FLOAT 0x07 +#define V_008F14_IMG_NUM_FORMAT_METADATA 0x08 +#define V_008F14_IMG_NUM_FORMAT_SRGB 0x09 +#define V_008F14_IMG_NUM_FORMAT_UNORM_UINT 0x0A +#define S_008F14_NUM_FORMAT_FMASK(x) (((unsigned)(x) & 0x0F) << 26) +#define G_008F14_NUM_FORMAT_FMASK(x) (((x) >> 26) & 0x0F) +#define C_008F14_NUM_FORMAT_FMASK 0xC3FFFFFF +#define V_008F14_IMG_FMASK_8_2_1 0x00 +#define V_008F14_IMG_FMASK_8_4_1 0x01 +#define V_008F14_IMG_FMASK_8_8_1 0x02 +#define V_008F14_IMG_FMASK_8_2_2 0x03 +#define V_008F14_IMG_FMASK_8_4_2 0x04 +#define V_008F14_IMG_FMASK_8_4_4 0x05 +#define V_008F14_IMG_FMASK_16_16_1 0x06 +#define V_008F14_IMG_FMASK_16_8_2 0x07 +#define V_008F14_IMG_FMASK_32_16_2 0x08 +#define V_008F14_IMG_FMASK_32_8_4 0x09 +#define V_008F14_IMG_FMASK_32_8_8 0x0A +#define V_008F14_IMG_FMASK_64_16_4 0x0B +#define V_008F14_IMG_FMASK_64_16_8 0x0C +#define S_008F14_NUM_FORMAT_ASTC_2D(x) (((unsigned)(x) & 0x0F) << 26) +#define G_008F14_NUM_FORMAT_ASTC_2D(x) (((x) >> 26) & 0x0F) +#define C_008F14_NUM_FORMAT_ASTC_2D 0xC3FFFFFF +#define V_008F14_IMG_ASTC_2D_4x4 0x00 +#define V_008F14_IMG_ASTC_2D_5x4 0x01 +#define V_008F14_IMG_ASTC_2D_5x5 0x02 +#define V_008F14_IMG_ASTC_2D_6x5 0x03 +#define V_008F14_IMG_ASTC_2D_6x6 0x04 +#define V_008F14_IMG_ASTC_2D_8x5 0x05 +#define V_008F14_IMG_ASTC_2D_8x6 0x06 +#define V_008F14_IMG_ASTC_2D_8x8 0x07 +#define V_008F14_IMG_ASTC_2D_10x5 0x08 +#define V_008F14_IMG_ASTC_2D_10x6 0x09 +#define V_008F14_IMG_ASTC_2D_10x8 0x0A +#define V_008F14_IMG_ASTC_2D_10x10 0x0B +#define V_008F14_IMG_ASTC_2D_12x10 0x0C +#define V_008F14_IMG_ASTC_2D_12x12 0x0D +#define S_008F14_NUM_FORMAT_ASTC_3D(x) (((unsigned)(x) & 0x0F) << 26) +#define G_008F14_NUM_FORMAT_ASTC_3D(x) (((x) >> 26) & 0x0F) +#define C_008F14_NUM_FORMAT_ASTC_3D 0xC3FFFFFF +#define V_008F14_IMG_ASTC_3D_3x3x3 0x00 +#define V_008F14_IMG_ASTC_3D_4x3x3 0x01 +#define V_008F14_IMG_ASTC_3D_4x4x3 0x02 +#define V_008F14_IMG_ASTC_3D_4x4x4 0x03 +#define V_008F14_IMG_ASTC_3D_5x4x4 0x04 +#define V_008F14_IMG_ASTC_3D_5x5x4 0x05 +#define V_008F14_IMG_ASTC_3D_5x5x5 0x06 +#define V_008F14_IMG_ASTC_3D_6x5x5 0x07 +#define V_008F14_IMG_ASTC_3D_6x6x5 0x08 +#define V_008F14_IMG_ASTC_3D_6x6x6 0x09 #define S_008F14_NV(x) (((unsigned)(x) & 0x1) << 30) #define G_008F14_NV(x) (((x) >> 30) & 0x1) #define C_008F14_NV 0xBFFFFFFF @@ -7126,6 +7247,10 @@ #define S_028C74_RESOURCE_TYPE(x) (((unsigned)(x) & 0x03) << 28) #define G_028C74_RESOURCE_TYPE(x) (((x) >> 28) & 0x03) #define C_028C74_RESOURCE_TYPE 0xCFFFFFFF +#define V_028C74_1D 0 +#define V_028C74_2D 1 +#define V_028C74_3D 2 +#define V_028C74_RESERVED 3 #define S_028C74_RB_ALIGNED(x) (((unsigned)(x) & 0x1) << 30) #define G_028C74_RB_ALIGNED(x) (((x) >> 30) & 0x1) #define C_028C74_RB_ALIGNED 0xBFFFFFFF diff --git a/src/amd/common/sid.h b/src/amd/common/sid.h index 9145624db33..61e14067ce9 100644 --- a/src/amd/common/sid.h +++ b/src/amd/common/sid.h @@ -2064,9 +2064,9 @@ #define S_008F14_MIN_LOD(x) (((unsigned)(x) & 0xFFF) << 8) #define G_008F14_MIN_LOD(x) (((x) >> 8) & 0xFFF) #define C_008F14_MIN_LOD 0xFFF000FF -#define S_008F14_DATA_FORMAT(x) (((unsigned)(x) & 0x3F) << 20) -#define G_008F14_DATA_FORMAT(x) (((x) >> 20) & 0x3F) -#define C_008F14_DATA_FORMAT 0xFC0FFFFF +#define S_008F14_DATA_FORMAT_GFX6(x) (((unsigned)(x) & 0x3F) << 20) +#define G_008F14_DATA_FORMAT_GFX6(x) (((x) >> 20) & 0x3F) +#define C_008F14_DATA_FORMAT_GFX6 0xFC0FFFFF #define V_008F14_IMG_DATA_FORMAT_INVALID 0x00 #define V_008F14_IMG_DATA_FORMAT_8 0x01 #define V_008F14_IMG_DATA_FORMAT_16 0x02 @@ -2109,8 +2109,8 @@ #define V_008F14_IMG_DATA_FORMAT_BC5 0x27 #define V_008F14_IMG_DATA_FORMAT_BC6 0x28 #define V_008F14_IMG_DATA_FORMAT_BC7 0x29 -#define V_008F14_IMG_DATA_FORMAT_16_AS_16_16_16_16 0x2A /* stoney+ */ -#define V_008F14_IMG_DATA_FORMAT_16_AS_32_32_32_32 0x2B /* stoney+ */ +#define V_008F14_IMG_DATA_FORMAT_16_AS_16_16_16_16_GFX6 0x2A /* stoney+ */ +#define V_008F14_IMG_DATA_FORMAT_16_AS_32_32_32_32_GFX6 0x2B /* stoney+ */ #define V_008F14_IMG_DATA_FORMAT_FMASK8_S2_F1 0x2C #define V_008F14_IMG_DATA_FORMAT_FMASK8_S4_F1 0x2D #define V_008F14_IMG_DATA_FORMAT_FMASK8_S8_F1 0x2E @@ -2131,9 +2131,9 @@ #define V_008F14_IMG_DATA_FORMAT_32_AS_8 0x3D /* not on stoney */ #define V_008F14_IMG_DATA_FORMAT_32_AS_8_8 0x3E /* not on stoney */ #define V_008F14_IMG_DATA_FORMAT_32_AS_32_32_32_32 0x3F -#define S_008F14_NUM_FORMAT(x) (((unsigned)(x) & 0x0F) << 26) -#define G_008F14_NUM_FORMAT(x) (((x) >> 26) & 0x0F) -#define C_008F14_NUM_FORMAT 0xC3FFFFFF +#define S_008F14_NUM_FORMAT_GFX6(x) (((unsigned)(x) & 0x0F) << 26) +#define G_008F14_NUM_FORMAT_GFX6(x) (((x) >> 26) & 0x0F) +#define C_008F14_NUM_FORMAT_GFX6 0xC3FFFFFF #define V_008F14_IMG_NUM_FORMAT_UNORM 0x00 #define V_008F14_IMG_NUM_FORMAT_SNORM 0x01 #define V_008F14_IMG_NUM_FORMAT_USCALED 0x02 @@ -2144,10 +2144,10 @@ #define V_008F14_IMG_NUM_FORMAT_FLOAT 0x07 #define V_008F14_IMG_NUM_FORMAT_RESERVED_8 0x08 #define V_008F14_IMG_NUM_FORMAT_SRGB 0x09 -#define V_008F14_IMG_NUM_FORMAT_UBNORM 0x0A -#define V_008F14_IMG_NUM_FORMAT_UBNORM_OGL 0x0B -#define V_008F14_IMG_NUM_FORMAT_UBINT 0x0C -#define V_008F14_IMG_NUM_FORMAT_UBSCALED 0x0D +#define V_008F14_IMG_NUM_FORMAT_UBNORM 0x0A /* not on VI+ */ +#define V_008F14_IMG_NUM_FORMAT_UBNORM_OGL 0x0B /* not on VI+ */ +#define V_008F14_IMG_NUM_FORMAT_UBINT 0x0C /* not on VI+ */ +#define V_008F14_IMG_NUM_FORMAT_UBSCALED 0x0D /* not on VI+ */ #define V_008F14_IMG_NUM_FORMAT_RESERVED_14 0x0E #define V_008F14_IMG_NUM_FORMAT_RESERVED_15 0x0F /* CIK */ diff --git a/src/amd/vulkan/radv_image.c b/src/amd/vulkan/radv_image.c index 2e03e26ff05..0ada7ffa615 100644 --- a/src/amd/vulkan/radv_image.c +++ b/src/amd/vulkan/radv_image.c @@ -297,8 +297,8 @@ si_make_texture_descriptor(struct radv_device *device, depth = image->array_size / 6; state[0] = 0; - state[1] = (S_008F14_DATA_FORMAT(data_format) | - S_008F14_NUM_FORMAT(num_format)); + state[1] = (S_008F14_DATA_FORMAT_GFX6(data_format) | + S_008F14_NUM_FORMAT_GFX6(num_format)); state[2] = (S_008F18_WIDTH(width - 1) | S_008F18_HEIGHT(height - 1)); state[3] = (S_008F1C_DST_SEL_X(radv_map_swizzle(swizzle[0])) | @@ -359,8 +359,8 @@ si_make_texture_descriptor(struct radv_device *device, fmask_state[0] = va >> 8; fmask_state[1] = S_008F14_BASE_ADDRESS_HI(va >> 40) | - S_008F14_DATA_FORMAT(fmask_format) | - S_008F14_NUM_FORMAT(V_008F14_IMG_NUM_FORMAT_UINT); + S_008F14_DATA_FORMAT_GFX6(fmask_format) | + S_008F14_NUM_FORMAT_GFX6(V_008F14_IMG_NUM_FORMAT_UINT); fmask_state[2] = S_008F18_WIDTH(width - 1) | S_008F18_HEIGHT(height - 1); fmask_state[3] = S_008F1C_DST_SEL_X(V_008F1C_SQ_SEL_X) | diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c index b05152f7d30..acfa809376c 100644 --- a/src/gallium/drivers/radeonsi/si_state.c +++ b/src/gallium/drivers/radeonsi/si_state.c @@ -2928,8 +2928,8 @@ si_make_texture_descriptor(struct si_screen *screen, depth = res->array_size / 6; state[0] = 0; - state[1] = (S_008F14_DATA_FORMAT(data_format) | - S_008F14_NUM_FORMAT(num_format)); + state[1] = (S_008F14_DATA_FORMAT_GFX6(data_format) | + S_008F14_NUM_FORMAT_GFX6(num_format)); state[2] = (S_008F18_WIDTH(width - 1) | S_008F18_HEIGHT(height - 1) | S_008F18_PERF_MOD(4)); @@ -2989,8 +2989,8 @@ si_make_texture_descriptor(struct si_screen *screen, fmask_state[0] = va >> 8; fmask_state[1] = S_008F14_BASE_ADDRESS_HI(va >> 40) | - S_008F14_DATA_FORMAT(fmask_format) | - S_008F14_NUM_FORMAT(V_008F14_IMG_NUM_FORMAT_UINT); + S_008F14_DATA_FORMAT_GFX6(fmask_format) | + S_008F14_NUM_FORMAT_GFX6(V_008F14_IMG_NUM_FORMAT_UINT); fmask_state[2] = S_008F18_WIDTH(width - 1) | S_008F18_HEIGHT(height - 1); fmask_state[3] = S_008F1C_DST_SEL_X(V_008F1C_SQ_SEL_X) | |