aboutsummaryrefslogtreecommitdiff
path: root/contrib/microsoft.direct3d.d3d12.1.618.4/build/native/include/d3dx12/d3dx12_property_format_table.h
diff options
context:
space:
mode:
author3gg <3gg@shellblade.net>2025-12-02 16:39:36 -0800
committer3gg <3gg@shellblade.net>2025-12-02 16:39:36 -0800
commit6c8ae19be66cee247980a48e736a4e05d14de179 (patch)
treed860767907bf0cbe17ec66422e11bea700cf56d9 /contrib/microsoft.direct3d.d3d12.1.618.4/build/native/include/d3dx12/d3dx12_property_format_table.h
parent8f594c8ebd11f0e5f8a0c6369c3fe7383d250cbe (diff)
Immediate-mode renderer, triangle demo, shader compilation in cmake, Agility SDKHEADmain
Diffstat (limited to 'contrib/microsoft.direct3d.d3d12.1.618.4/build/native/include/d3dx12/d3dx12_property_format_table.h')
-rw-r--r--contrib/microsoft.direct3d.d3d12.1.618.4/build/native/include/d3dx12/d3dx12_property_format_table.h128
1 files changed, 128 insertions, 0 deletions
diff --git a/contrib/microsoft.direct3d.d3d12.1.618.4/build/native/include/d3dx12/d3dx12_property_format_table.h b/contrib/microsoft.direct3d.d3d12.1.618.4/build/native/include/d3dx12/d3dx12_property_format_table.h
new file mode 100644
index 0000000..66c7600
--- /dev/null
+++ b/contrib/microsoft.direct3d.d3d12.1.618.4/build/native/include/d3dx12/d3dx12_property_format_table.h
@@ -0,0 +1,128 @@
1//*********************************************************
2//
3// Copyright (c) Microsoft Corporation.
4// Licensed under the MIT License (MIT).
5//
6//*********************************************************
7#ifndef __D3D12_PROPERTY_LAYOUT_FORMAT_TABLE_H__
8#define __D3D12_PROPERTY_LAYOUT_FORMAT_TABLE_H__
9#include "d3d12.h"
10#define MAP_ALIGN_REQUIREMENT 16 // Map is required to return 16-byte aligned addresses
11
12struct D3D12_PROPERTY_LAYOUT_FORMAT_TABLE
13{
14public:
15 // ----------------------------------------------------------------------------
16 // Information describing everything about a D3D Resource Format
17 // ----------------------------------------------------------------------------
18 typedef struct FORMAT_DETAIL
19 {
20 DXGI_FORMAT DXGIFormat;
21 DXGI_FORMAT ParentFormat;
22 const DXGI_FORMAT* pDefaultFormatCastSet; // This is dependent on FL/driver version, but is here to save a lot of space
23 UINT8 BitsPerComponent[4]; // only used for D3DFTL_PARTIAL_TYPE or FULL_TYPE
24 UINT8 BitsPerUnit;
25 BYTE SRGBFormat : 1;
26 UINT WidthAlignment : 4; // number of texels to align to in a mip level.
27 UINT HeightAlignment : 4; // Top level dimensions must be a multiple of these
28 UINT DepthAlignment : 1; // values.
29 D3D_FORMAT_LAYOUT Layout : 1;
30 D3D_FORMAT_TYPE_LEVEL TypeLevel : 2;
31 D3D_FORMAT_COMPONENT_NAME ComponentName0 : 3; // RED ... only used for D3DFTL_PARTIAL_TYPE or FULL_TYPE
32 D3D_FORMAT_COMPONENT_NAME ComponentName1 : 3; // GREEN ... only used for D3DFTL_PARTIAL_TYPE or FULL_TYPE
33 D3D_FORMAT_COMPONENT_NAME ComponentName2 : 3; // BLUE ... only used for D3DFTL_PARTIAL_TYPE or FULL_TYPE
34 D3D_FORMAT_COMPONENT_NAME ComponentName3 : 3; // ALPHA ... only used for D3DFTL_PARTIAL_TYPE or FULL_TYPE
35 D3D_FORMAT_COMPONENT_INTERPRETATION ComponentInterpretation0 : 3; // only used for D3DFTL_FULL_TYPE
36 D3D_FORMAT_COMPONENT_INTERPRETATION ComponentInterpretation1 : 3; // only used for D3DFTL_FULL_TYPE
37 D3D_FORMAT_COMPONENT_INTERPRETATION ComponentInterpretation2 : 3; // only used for D3DFTL_FULL_TYPE
38 D3D_FORMAT_COMPONENT_INTERPRETATION ComponentInterpretation3 : 3; // only used for D3DFTL_FULL_TYPE
39 bool bDX9VertexOrIndexFormat : 1;
40 bool bDX9TextureFormat : 1;
41 bool bFloatNormFormat : 1;
42 bool bPlanar : 1;
43 bool bYUV : 1;
44 bool bDependantFormatCastSet : 1; // This indicates that the format cast set is dependent on FL/driver version
45 bool bInternal : 1;
46 } FORMAT_DETAIL;
47
48private:
49 static const FORMAT_DETAIL s_FormatDetail[];
50 static const UINT s_NumFormats;
51 static const LPCSTR s_FormatNames[]; // separate from above structure so it can be compiled out of runtime.
52public:
53 static UINT GetNumFormats();
54 static const FORMAT_DETAIL* GetFormatTable();
55 static D3D_FEATURE_LEVEL GetHighestDefinedFeatureLevel();
56
57 static DXGI_FORMAT GetFormat (SIZE_T Index);
58 static bool FormatExists (DXGI_FORMAT Format);
59 static bool FormatExistsInHeader (DXGI_FORMAT Format, bool bExternalHeader = true);
60 static UINT GetByteAlignment (DXGI_FORMAT Format);
61 static bool IsBlockCompressFormat (DXGI_FORMAT Format);
62 static LPCSTR GetName (DXGI_FORMAT Format, bool bHideInternalFormats = true);
63 static bool IsSRGBFormat (DXGI_FORMAT Format);
64 static UINT GetBitsPerStencil (DXGI_FORMAT Format);
65 static UINT GetBitsPerDepth (DXGI_FORMAT Format);
66 static void GetFormatReturnTypes (DXGI_FORMAT Format, D3D_FORMAT_COMPONENT_INTERPRETATION* pInterpretations); // return array of 4 components
67 static UINT GetNumComponentsInFormat(DXGI_FORMAT Format);
68 static UINT GetMinNumComponentsInFormats(DXGI_FORMAT FormatA, DXGI_FORMAT FormatB);
69
70 // Converts the sequential component index (range from 0 to GetNumComponentsInFormat()) to
71 // the absolute component index (range 0 to 3).
72 static UINT Sequential2AbsoluteComponentIndex (DXGI_FORMAT Format, UINT SequentialComponentIndex);
73 static bool CanBeCastEvenFullyTyped (DXGI_FORMAT Format, D3D_FEATURE_LEVEL fl);
74 static UINT8 GetAddressingBitsPerAlignedSize (DXGI_FORMAT Format);
75 static DXGI_FORMAT GetParentFormat (DXGI_FORMAT Format);
76 static const DXGI_FORMAT* GetFormatCastSet (DXGI_FORMAT Format);
77 static D3D_FORMAT_LAYOUT GetLayout (DXGI_FORMAT Format);
78 static D3D_FORMAT_TYPE_LEVEL GetTypeLevel (DXGI_FORMAT Format);
79 static UINT GetBitsPerUnit (DXGI_FORMAT Format);
80 static UINT GetBitsPerUnitThrow (DXGI_FORMAT Format);
81 static UINT GetBitsPerElement (DXGI_FORMAT Format); // Legacy function used to support D3D10on9 only. Do not use.
82 static UINT GetWidthAlignment (DXGI_FORMAT Format);
83 static UINT GetHeightAlignment (DXGI_FORMAT Format);
84 static UINT GetDepthAlignment (DXGI_FORMAT Format);
85 static BOOL Planar (DXGI_FORMAT Format);
86 static BOOL NonOpaquePlanar (DXGI_FORMAT Format);
87 static BOOL YUV (DXGI_FORMAT Format);
88 static BOOL Opaque (DXGI_FORMAT Format);
89 static bool FamilySupportsStencil (DXGI_FORMAT Format);
90 static UINT NonOpaquePlaneCount (DXGI_FORMAT Format);
91 static BOOL DX9VertexOrIndexFormat (DXGI_FORMAT Format);
92 static BOOL DX9TextureFormat (DXGI_FORMAT Format);
93 static BOOL FloatNormTextureFormat (DXGI_FORMAT Format);
94 static bool DepthOnlyFormat (DXGI_FORMAT format);
95 static UINT8 GetPlaneCount (DXGI_FORMAT Format);
96 static bool MotionEstimatorAllowedInputFormat (DXGI_FORMAT Format);
97 static bool SupportsSamplerFeedback (DXGI_FORMAT Format);
98 static bool DecodeHistogramAllowedForOutputFormatSupport(DXGI_FORMAT Format);
99 static UINT8 GetPlaneSliceFromViewFormat (DXGI_FORMAT ResourceFormat, DXGI_FORMAT ViewFormat);
100 static bool FloatAndNotFloatFormats (DXGI_FORMAT FormatA, DXGI_FORMAT FormatB);
101 static bool SNORMAndUNORMFormats (DXGI_FORMAT FormatA, DXGI_FORMAT FormatB);
102 static bool ValidCastToR32UAV (DXGI_FORMAT from, DXGI_FORMAT to);
103 static bool IsSupportedTextureDisplayableFormat (DXGI_FORMAT, bool bMediaFormatOnly);
104 static D3D_FORMAT_COMPONENT_INTERPRETATION GetFormatComponentInterpretation (DXGI_FORMAT Format, UINT AbsoluteComponentIndex);
105 static UINT GetBitsPerComponent (DXGI_FORMAT Format, UINT AbsoluteComponentIndex);
106 static D3D_FORMAT_COMPONENT_NAME GetComponentName (DXGI_FORMAT Format, UINT AbsoluteComponentIndex);
107 static HRESULT CalculateExtraPlanarRows (DXGI_FORMAT format, UINT plane0Height, _Out_ UINT& totalHeight);
108 static HRESULT CalculateMinimumRowMajorRowPitch (DXGI_FORMAT Format, UINT Width, _Out_ UINT& RowPitch);
109 static HRESULT CalculateMinimumRowMajorSlicePitch (DXGI_FORMAT Format, UINT ContextBasedRowPitch, UINT Height, _Out_ UINT& SlicePitch);
110 static void GetYCbCrChromaSubsampling (DXGI_FORMAT Format, _Out_ UINT& HorizontalSubsampling, _Out_ UINT& VerticalSubsampling);
111
112 static HRESULT CalculateResourceSize (UINT width, UINT height, UINT depth, DXGI_FORMAT format, UINT mipLevels, UINT subresources, _Out_ SIZE_T& totalByteSize, _Out_writes_opt_(subresources) D3D12_MEMCPY_DEST* pDst = nullptr);
113 static void GetTileShape (D3D12_TILE_SHAPE* pTileShape, DXGI_FORMAT Format, D3D12_RESOURCE_DIMENSION Dimension, UINT SampleCount);
114 static void Get4KTileShape (D3D12_TILE_SHAPE* pTileShape, DXGI_FORMAT Format, D3D12_RESOURCE_DIMENSION Dimension, UINT SampleCount);
115 static void GetMipDimensions (UINT8 mipSlice, _Inout_ UINT64* pWidth, _Inout_opt_ UINT64* pHeight = nullptr, _Inout_opt_ UINT64* pDepth = nullptr);
116 static void GetPlaneSubsampledSizeAndFormatForCopyableLayout(UINT PlaneSlice, DXGI_FORMAT Format, UINT Width, UINT Height, _Out_ DXGI_FORMAT& PlaneFormat, _Out_ UINT& MinPlanePitchWidth, _Out_ UINT& PlaneWidth, _Out_ UINT& PlaneHeight);
117
118 static UINT GetDetailTableIndex (DXGI_FORMAT Format);
119 static UINT GetDetailTableIndexNoThrow (DXGI_FORMAT Format);
120 static UINT GetDetailTableIndexThrow (DXGI_FORMAT Format);
121 static bool SupportsDepth (DXGI_FORMAT Format);
122 static bool SupportsStencil (DXGI_FORMAT Format);
123private:
124 static const FORMAT_DETAIL* GetFormatDetail (DXGI_FORMAT Format);
125
126};
127
128#endif \ No newline at end of file