1
1
namespace Hexa . NET . DirectXTex . Tests
2
2
{
3
- using Silk . NET . DXGI ;
4
-
5
3
public unsafe class DXGIFormatUtilities
6
4
{
7
5
[ Test ]
8
6
public void IsValid ( )
9
7
{
10
- if ( ! DirectXTex . IsValid ( ( int ) Format . FormatR16G16B16A16Uint ) )
8
+ if ( ! DirectXTex . IsValid ( ( int ) Format . R16G16B16A16Uint ) )
11
9
Trace . Fail ( "Should be valid" ) ;
12
10
if ( DirectXTex . IsValid ( ( int ) ( Format ) ( - 1561658 ) ) )
13
11
Trace . Fail ( "Should be invalid" ) ;
@@ -16,115 +14,115 @@ public void IsValid()
16
14
[ Test ]
17
15
public void IsCompressed ( )
18
16
{
19
- if ( ! DirectXTex . IsCompressed ( ( int ) Format . FormatBC7Unorm ) )
17
+ if ( ! DirectXTex . IsCompressed ( ( int ) Format . Bc7Unorm ) )
20
18
Trace . Fail ( "Should be compressed" ) ;
21
- if ( DirectXTex . IsCompressed ( ( int ) Format . FormatR16G16B16A16Uint ) )
19
+ if ( DirectXTex . IsCompressed ( ( int ) Format . R16G16B16A16Uint ) )
22
20
Trace . Fail ( "Shouldn't be compressed" ) ;
23
21
}
24
22
25
23
[ Test ]
26
24
public void IsPacked ( )
27
25
{
28
- if ( ! DirectXTex . IsPacked ( ( int ) Format . FormatR8G8B8G8Unorm ) )
26
+ if ( ! DirectXTex . IsPacked ( ( int ) Format . R8G8B8G8Unorm ) )
29
27
Trace . Fail ( "Should be packed" ) ;
30
- if ( DirectXTex . IsPacked ( ( int ) Format . FormatR16G16B16A16Uint ) )
28
+ if ( DirectXTex . IsPacked ( ( int ) Format . R16G16B16A16Uint ) )
31
29
Trace . Fail ( "Shouldn't be packed" ) ;
32
30
}
33
31
34
32
[ Test ]
35
33
public void IsVideo ( )
36
34
{
37
- if ( ! DirectXTex . IsVideo ( ( int ) Format . FormatNV12 ) )
35
+ if ( ! DirectXTex . IsVideo ( ( int ) Format . Nv12 ) )
38
36
Trace . Fail ( "Should be video" ) ;
39
- if ( DirectXTex . IsVideo ( ( int ) Format . FormatR16G16B16A16Uint ) )
37
+ if ( DirectXTex . IsVideo ( ( int ) Format . R16G16B16A16Uint ) )
40
38
Trace . Fail ( "Shouldn't be video" ) ;
41
39
}
42
40
43
41
[ Test ]
44
42
public void IsPlanar ( )
45
43
{
46
- if ( ! DirectXTex . IsPlanar ( ( int ) Format . FormatP010 ) )
44
+ if ( ! DirectXTex . IsPlanar ( ( int ) Format . P010 ) )
47
45
Trace . Fail ( "Should be planar" ) ;
48
- if ( DirectXTex . IsPlanar ( ( int ) Format . FormatR16G16B16A16Uint ) )
46
+ if ( DirectXTex . IsPlanar ( ( int ) Format . R16G16B16A16Uint ) )
49
47
Trace . Fail ( "Shouldn't be planar" ) ;
50
48
}
51
49
52
50
[ Test ]
53
51
public void IsPalettized ( )
54
52
{
55
- if ( ! DirectXTex . IsPalettized ( ( int ) Format . FormatAI44 ) )
53
+ if ( ! DirectXTex . IsPalettized ( ( int ) Format . Ai44 ) )
56
54
Trace . Fail ( "Should be palettized" ) ;
57
- if ( DirectXTex . IsPalettized ( ( int ) Format . FormatR16G16B16A16Uint ) )
55
+ if ( DirectXTex . IsPalettized ( ( int ) Format . R16G16B16A16Uint ) )
58
56
Trace . Fail ( "Shouldn't be palettized" ) ;
59
57
}
60
58
61
59
[ Test ]
62
60
public void IsDepthStencil ( )
63
61
{
64
- if ( ! DirectXTex . IsDepthStencil ( ( int ) Format . FormatD24UnormS8Uint ) )
62
+ if ( ! DirectXTex . IsDepthStencil ( ( int ) Format . D24UnormS8Uint ) )
65
63
Trace . Fail ( "Should be depthStencil" ) ;
66
- if ( DirectXTex . IsDepthStencil ( ( int ) Format . FormatR16G16B16A16Uint ) )
64
+ if ( DirectXTex . IsDepthStencil ( ( int ) Format . R16G16B16A16Uint ) )
67
65
Trace . Fail ( "Shouldn't be depthStencil" ) ;
68
66
}
69
67
70
68
[ Test ]
71
69
public void IsSRGB ( )
72
70
{
73
- if ( ! DirectXTex . IsSRGB ( ( int ) Format . FormatB8G8R8A8UnormSrgb ) )
71
+ if ( ! DirectXTex . IsSRGB ( ( int ) Format . B8G8R8A8UnormSrgb ) )
74
72
Trace . Fail ( "Should be SRGB" ) ;
75
- if ( DirectXTex . IsSRGB ( ( int ) Format . FormatR16G16B16A16Uint ) )
73
+ if ( DirectXTex . IsSRGB ( ( int ) Format . R16G16B16A16Uint ) )
76
74
Trace . Fail ( "Shouldn't be SRGB" ) ;
77
75
}
78
76
79
77
[ Test ]
80
78
public void IsTypeless ( )
81
79
{
82
- if ( ! DirectXTex . IsTypeless ( ( int ) Format . FormatB8G8R8A8Typeless , true ) )
80
+ if ( ! DirectXTex . IsTypeless ( ( int ) Format . B8G8R8A8Typeless , true ) )
83
81
Trace . Fail ( "Should be partial Typeless" ) ;
84
- if ( ! DirectXTex . IsTypeless ( ( int ) Format . FormatR32FloatX8X24Typeless , true ) )
82
+ if ( ! DirectXTex . IsTypeless ( ( int ) Format . R32FloatX8X24Typeless , true ) )
85
83
Trace . Fail ( "Should be partial Typeless" ) ;
86
- if ( DirectXTex . IsTypeless ( ( int ) Format . FormatBC1Unorm , true ) )
84
+ if ( DirectXTex . IsTypeless ( ( int ) Format . Bc1Unorm , true ) )
87
85
Trace . Fail ( "Shouldn't be partial Typeless" ) ;
88
86
89
- if ( ! DirectXTex . IsTypeless ( ( int ) Format . FormatB8G8R8A8Typeless , false ) )
87
+ if ( ! DirectXTex . IsTypeless ( ( int ) Format . B8G8R8A8Typeless , false ) )
90
88
Trace . Fail ( "Should be Typeless" ) ;
91
- if ( DirectXTex . IsTypeless ( ( int ) Format . FormatX32TypelessG8X24Uint , false ) )
89
+ if ( DirectXTex . IsTypeless ( ( int ) Format . X32TypelessG8X24Uint , false ) )
92
90
Trace . Fail ( "Shouldn't be Typeless" ) ;
93
91
}
94
92
95
93
[ Test ]
96
94
public void HasAlpha ( )
97
95
{
98
- if ( ! DirectXTex . HasAlpha ( ( int ) Format . FormatB8G8R8A8UnormSrgb ) )
96
+ if ( ! DirectXTex . HasAlpha ( ( int ) Format . B8G8R8A8UnormSrgb ) )
99
97
Trace . Fail ( "Should have alpha" ) ;
100
- if ( DirectXTex . HasAlpha ( ( int ) Format . FormatG8R8G8B8Unorm ) )
98
+ if ( DirectXTex . HasAlpha ( ( int ) Format . G8R8G8B8Unorm ) )
101
99
Trace . Fail ( "Shouldn't have alpha" ) ;
102
100
}
103
101
104
102
[ Test ]
105
103
public void BitsPerPixel ( )
106
104
{
107
- if ( DirectXTex . BitsPerPixel ( ( int ) Format . FormatR8G8B8A8Uint ) != 32 )
105
+ if ( DirectXTex . BitsPerPixel ( ( int ) Format . R8G8B8A8Uint ) != 32 )
108
106
Trace . Fail ( "Should have 32Bits" ) ;
109
- if ( DirectXTex . BitsPerPixel ( ( int ) Format . FormatR32G32B32A32Uint ) == 32 )
107
+ if ( DirectXTex . BitsPerPixel ( ( int ) Format . R32G32B32A32Uint ) == 32 )
110
108
Trace . Fail ( "Shouldn't have 32Bits" ) ;
111
109
}
112
110
113
111
[ Test ]
114
112
public void BitsPerColor ( )
115
113
{
116
- if ( DirectXTex . BitsPerColor ( ( int ) Format . FormatR8G8B8A8Uint ) != 8 )
114
+ if ( DirectXTex . BitsPerColor ( ( int ) Format . R8G8B8A8Uint ) != 8 )
117
115
Trace . Fail ( "Should have 8Bits per color" ) ;
118
- if ( DirectXTex . BitsPerColor ( ( int ) Format . FormatR32G32B32A32Uint ) == 8 )
116
+ if ( DirectXTex . BitsPerColor ( ( int ) Format . R32G32B32A32Uint ) == 8 )
119
117
Trace . Fail ( "Shouldn't have 8Bits per color" ) ;
120
118
}
121
119
122
120
[ Test ]
123
121
public void FormatDataType ( )
124
122
{
125
- if ( DirectXTex . FormatDataType ( ( int ) Format . FormatA8Unorm ) != FormatType . Unorm )
123
+ if ( DirectXTex . FormatDataType ( ( int ) Format . A8Unorm ) != FormatType . Unorm )
126
124
Trace . Fail ( "Should be unorm" ) ;
127
- if ( DirectXTex . FormatDataType ( ( int ) Format . FormatR32G32B32A32Uint ) == FormatType . Float )
125
+ if ( DirectXTex . FormatDataType ( ( int ) Format . R32G32B32A32Uint ) == FormatType . Float )
128
126
Trace . Fail ( "Shouldn't be float" ) ;
129
127
}
130
128
@@ -135,7 +133,7 @@ public void ComputePitch()
135
133
uint height = 64 ;
136
134
nuint rowPitch = 0 ;
137
135
nuint slicePitch = 0 ;
138
- DirectXTex . ComputePitch ( ( int ) Format . FormatR8G8B8A8Uint , width , height , & rowPitch , & slicePitch , CPFlags . None ) . ThrowIf ( ) ;
136
+ DirectXTex . ComputePitch ( ( int ) Format . R8G8B8A8Uint , width , height , & rowPitch , & slicePitch , CPFlags . None ) . ThrowIf ( ) ;
139
137
140
138
nuint rowPitch2 = width * 4 ;
141
139
nuint slicePitch2 = rowPitch2 * height ;
@@ -148,37 +146,37 @@ public void ComputePitch()
148
146
public void ComputeScanlines ( )
149
147
{
150
148
uint height = 64 ;
151
- var result = DirectXTex . ComputeScanlines ( ( int ) Format . FormatR8G8B8A8Uint , height ) ;
149
+ var result = DirectXTex . ComputeScanlines ( ( int ) Format . R8G8B8A8Uint , height ) ;
152
150
nuint expected = 64 ;
153
151
Assert . That ( expected , Is . EqualTo ( result ) ) ;
154
152
}
155
153
156
154
[ Test ]
157
155
public void MakeSRGB ( )
158
156
{
159
- var result = DirectXTex . MakeSRGB ( ( int ) Format . FormatBC1Unorm ) ;
160
- Assert . That ( ( Format ) result , Is . EqualTo ( Format . FormatBC1UnormSrgb ) ) ;
157
+ var result = DirectXTex . MakeSRGB ( ( int ) Format . Bc1Unorm ) ;
158
+ Assert . That ( ( Format ) result , Is . EqualTo ( Format . Bc1UnormSrgb ) ) ;
161
159
}
162
160
163
161
[ Test ]
164
162
public void MakeTypeless ( )
165
163
{
166
- var result = DirectXTex . MakeTypeless ( ( int ) Format . FormatBC1Unorm ) ;
167
- Assert . That ( ( Format ) result , Is . EqualTo ( Format . FormatBC1Typeless ) ) ;
164
+ var result = DirectXTex . MakeTypeless ( ( int ) Format . Bc1Unorm ) ;
165
+ Assert . That ( ( Format ) result , Is . EqualTo ( Format . Bc1Typeless ) ) ;
168
166
}
169
167
170
168
[ Test ]
171
169
public void MakeTypelessUNORM ( )
172
170
{
173
- var result = DirectXTex . MakeTypelessUNORM ( ( int ) Format . FormatBC1Typeless ) ;
174
- Assert . That ( ( Format ) result , Is . EqualTo ( Format . FormatBC1Unorm ) ) ;
171
+ var result = DirectXTex . MakeTypelessUNORM ( ( int ) Format . Bc1Typeless ) ;
172
+ Assert . That ( ( Format ) result , Is . EqualTo ( Format . Bc1Unorm ) ) ;
175
173
}
176
174
177
175
[ Test ]
178
176
public void MakeTypelessFLOAT ( )
179
177
{
180
- var result = DirectXTex . MakeTypelessFLOAT ( ( int ) Format . FormatR32G32B32A32Typeless ) ;
181
- Assert . That ( ( Format ) result , Is . EqualTo ( Format . FormatR32G32B32A32Float ) ) ;
178
+ var result = DirectXTex . MakeTypelessFLOAT ( ( int ) Format . R32G32B32A32Typeless ) ;
179
+ Assert . That ( ( Format ) result , Is . EqualTo ( Format . R32G32B32A32Float ) ) ;
182
180
}
183
181
}
184
182
}
0 commit comments