[GPU] Move all xenos.h to gpu::xenos, disambiguate Dimension/TextureDimension

This commit is contained in:
Triang3l
2020-07-11 15:54:22 +03:00
parent 39490f3c3a
commit 4bb0ca0e09
61 changed files with 1411 additions and 1365 deletions

View File

@@ -16,6 +16,7 @@
namespace xe {
namespace gpu {
namespace xenos {
enum class ShaderType : uint32_t {
kVertex = 0,
@@ -53,8 +54,8 @@ enum class PrimitiveType : uint32_t {
k2DTriStrip = 0x16,
// Tessellation patches when VGT_OUTPUT_PATH_CNTL::path_select is
// xenos::VGTOutputPath::kTessellationEnable. The vertex shader receives patch
// index rather than control point indices.
// VGTOutputPath::kTessellationEnable. The vertex shader receives patch index
// rather than control point indices.
kLinePatch = 0x10,
kTrianglePatch = 0x11,
kQuadPatch = 0x12,
@@ -80,9 +81,11 @@ inline bool IsPrimitiveTwoFaced(bool tessellated, PrimitiveType type) {
return false;
}
enum class Dimension : uint32_t {
// For the texture fetch constant (not the tfetch instruction), stacked stored
// as 2D.
enum class DataDimension : uint32_t {
k1D = 0,
k2D = 1,
k2DOrStacked = 1,
k3D = 2,
kCube = 3,
};
@@ -133,23 +136,23 @@ enum class BorderColor : uint32_t {
k_ACBCRY_BLACK = 3,
};
// For the tfetch instruction, not the fetch constant - slightly different
// meaning, as stacked textures are stored as 2D, but fetched using tfetch3D.
enum class TextureDimension : uint32_t {
// For the tfetch instruction (not the fetch constant) and related instructions,
// stacked accessed using tfetch3D.
enum class FetchOpDimension : uint32_t {
k1D = 0,
k2D = 1,
k3D = 2,
k3DOrStacked = 2,
kCube = 3,
};
inline int GetTextureDimensionComponentCount(TextureDimension dimension) {
inline int GetFetchOpDimensionComponentCount(FetchOpDimension dimension) {
switch (dimension) {
case TextureDimension::k1D:
case FetchOpDimension::k1D:
return 1;
case TextureDimension::k2D:
case FetchOpDimension::k2D:
return 2;
case TextureDimension::k3D:
case TextureDimension::kCube:
case FetchOpDimension::k3DOrStacked:
case FetchOpDimension::kCube:
return 3;
default:
assert_unhandled_case(dimension);
@@ -488,8 +491,6 @@ enum class BlendOp : uint32_t {
kRevSubtract = 4,
};
namespace xenos {
typedef enum {
XE_GPU_INVALIDATE_MASK_VERTEX_SHADER = 1 << 8,
XE_GPU_INVALIDATE_MASK_PIXEL_SHADER = 1 << 9,
@@ -731,14 +732,14 @@ XEPACKEDUNION(xe_gpu_texture_fetch_t, {
// which can be texture components 0/1/2/3 or constant 0/1) and R6xx
// (signedness is FORMAT_COMP_X/Y/Z/W, while the swizzle is DST_SEL_X/Y/Z/W,
// which is named in resources the same as DST_SEL in fetch clauses).
TextureSign sign_x : 2; // +2
TextureSign sign_y : 2; // +4
TextureSign sign_z : 2; // +6
TextureSign sign_w : 2; // +8
ClampMode clamp_x : 3; // +10
ClampMode clamp_y : 3; // +13
ClampMode clamp_z : 3; // +16
xenos::SignedRepeatingFractionMode signed_rf_mode_all : 1; // +19
TextureSign sign_x : 2; // +2
TextureSign sign_y : 2; // +4
TextureSign sign_z : 2; // +6
TextureSign sign_w : 2; // +8
ClampMode clamp_x : 3; // +10
ClampMode clamp_y : 3; // +13
ClampMode clamp_z : 3; // +16
SignedRepeatingFractionMode signed_rf_mode_all : 1; // +19
// TODO(Triang3l): 1 or 2 dim_tbd bits?
uint32_t unk_0 : 2; // +20
uint32_t pitch : 9; // +22 byte_pitch >> 5
@@ -772,14 +773,14 @@ XEPACKEDUNION(xe_gpu_texture_fetch_t, {
uint32_t num_format : 1; // +0 dword_3 frac/int
// xyzw, 3b each (XE_GPU_SWIZZLE)
uint32_t swizzle : 12; // +1
int32_t exp_adjust : 6; // +13
TextureFilter mag_filter : 2; // +19
TextureFilter min_filter : 2; // +21
TextureFilter mip_filter : 2; // +23
AnisoFilter aniso_filter : 3; // +25
xenos::ArbitraryFilter arbitrary_filter : 3; // +28
uint32_t border_size : 1; // +31
uint32_t swizzle : 12; // +1
int32_t exp_adjust : 6; // +13
TextureFilter mag_filter : 2; // +19
TextureFilter min_filter : 2; // +21
TextureFilter mip_filter : 2; // +23
AnisoFilter aniso_filter : 3; // +25
ArbitraryFilter arbitrary_filter : 3; // +28
uint32_t border_size : 1; // +31
uint32_t vol_mag_filter : 1; // +0 dword_4
uint32_t vol_min_filter : 1; // +1
@@ -796,11 +797,11 @@ XEPACKEDUNION(xe_gpu_texture_fetch_t, {
BorderColor border_color : 2; // +0 dword_5
uint32_t force_bc_w_to_max : 1; // +2
// Also known as TriJuice.
uint32_t tri_clamp : 2; // +3
int32_t aniso_bias : 4; // +5
Dimension dimension : 2; // +9
uint32_t packed_mips : 1; // +11
uint32_t mip_address : 20; // +12 mip address >> 12
uint32_t tri_clamp : 2; // +3
int32_t aniso_bias : 4; // +5
DataDimension dimension : 2; // +9
uint32_t packed_mips : 1; // +11
uint32_t mip_address : 20; // +12 mip address >> 12
});
XEPACKEDSTRUCTANONYMOUS({
uint32_t dword_0;