| 
									
										
										
										
											2022-12-14 16:42:35 -03:00
										 |  |  | [require] | 
					
						
							|  |  |  | shader model >= 4.0 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
											
												vkd3d-shader/hlsl: Reinterpret minimum precision types as their regular counterparts.
Reinterpret min16float, min10float, min16int, min12int, and min16uint
as their regular counterparts: float, float, int, int, uint,
respectively.
A proper implementation would require adding minimum precision
indicators to all the dxbc-tpf instructions that use these types.
Consider the output of fxc 10.1 with the following shader:
    uniform int i;
    float4 main() : sv_target
    {
        min16float4 a = {0, 1, 2, i};
        min16int2 b = {4, i};
        min10float3 c = {6.4, 7, i};
        min12int d = 9.4;
        min16uint4x2 e = {14.4, 15, 16, 17, 18, 19, 20, i};
        return mul(e, b) + a + c.xyzx + d;
    }
However, if the graphics driver doesn't have minimum precision support,
it ignores the minimum precision indicators and runs at 32-bit
precision, which is equivalent as working with regular types.
											
										 
											2022-12-07 18:06:06 -03:00
										 |  |  | [pixel shader] | 
					
						
							| 
									
										
										
										
											2022-12-14 16:42:35 -03:00
										 |  |  | float4 main() : sv_target | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     min16float4 a = {0, 1, 2, 3}; | 
					
						
							|  |  |  |     min10float2 b = {4, 5}; | 
					
						
							|  |  |  |     min16int3 c = {6.4, 7, 8}; | 
					
						
							|  |  |  |     min12int d = 9.4; | 
					
						
							|  |  |  |     min16uint4x2 e = {14.4, 15, 16, 17, 18, 19, 20, 21}; | 
					
						
							|  |  |  |     vector<min10float, 3> g = {22, 23, 24}; | 
					
						
							|  |  |  |     matrix<min16uint, 3, 2> h = {25.4, 26, 27, 28, 29, 30}; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     return mul(e, b) + a + c.xyzx + d + g.xxyz + h[2].xyxy; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [test] | 
					
						
							| 
									
										
										
										
											2024-03-19 12:36:23 +01:00
										 |  |  | todo(glsl) draw quad | 
					
						
							| 
									
										
										
										
											2024-02-10 13:16:22 -06:00
										 |  |  | probe (0, 0) rgba (197.0, 218.0, 238.0, 257.0) | 
					
						
							| 
									
										
										
										
											2023-12-13 13:49:40 +10:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [pixel shader] | 
					
						
							|  |  |  | uniform min16uint2 u; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | uint4 main() : sv_target | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     min16uint i = 0x7fff, j = 0xffff; | 
					
						
							|  |  |  |     return uint4(u.x + i, u.y + j, 0, 0); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-06-13 16:51:11 +10:00
										 |  |  | [require] | 
					
						
							|  |  |  | shader model >= 4.0 | 
					
						
							|  |  |  | shader model < 6.0 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-12-13 13:49:40 +10:00
										 |  |  | [test] | 
					
						
							|  |  |  | uniform 0 uint4 0 0 0 0 | 
					
						
							| 
									
										
										
										
											2024-03-19 12:36:23 +01:00
										 |  |  | todo(glsl) draw quad | 
					
						
							| 
									
										
										
										
											2024-02-10 13:16:22 -06:00
										 |  |  | probe (0, 0) rgbaui (0x7fff, 0xffff, 0, 0) | 
					
						
							| 
									
										
										
										
											2023-12-13 13:49:40 +10:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-06-13 16:51:11 +10:00
										 |  |  | [require] | 
					
						
							|  |  |  | shader model >= 6.0 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [test] | 
					
						
							|  |  |  | uniform 0 uint4 0 0 0 0 | 
					
						
							|  |  |  | draw quad | 
					
						
							| 
									
										
										
										
											2024-02-10 13:16:22 -06:00
										 |  |  | probe (0, 0) rgbaui (0x7fff, 0xffffffff, 0, 0) | 
					
						
							| 
									
										
										
										
											2023-06-13 16:51:11 +10:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-12-13 13:49:40 +10:00
										 |  |  | 
 | 
					
						
							|  |  |  | % The code d3dcompiler_47 produces for this appears correct, but the result | 
					
						
							|  |  |  | % is still zero in Windows. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [pixel shader] | 
					
						
							|  |  |  | uniform min16uint4 u; | 
					
						
							|  |  |  | uniform uint i; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | uint4 main() : sv_target | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     min16uint arr[4] = {1, 2, 0x7fff, 0xffff}; | 
					
						
							|  |  |  |     return uint4(u.x + arr[i], u.y + arr[i + 1], 0, 0); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [test] | 
					
						
							|  |  |  | uniform 0 uint4 0 0 0 0 | 
					
						
							|  |  |  | uniform 4 uint 2 | 
					
						
							|  |  |  | draw quad | 
					
						
							| 
									
										
										
										
											2024-02-10 13:16:22 -06:00
										 |  |  | probe (0, 0) rgbaui (0x7fff, 0xffffffff, 0, 0) | 
					
						
							| 
									
										
										
										
											2023-12-13 13:49:40 +10:00
										 |  |  | uniform 0 uint4 0 0 0 0 | 
					
						
							|  |  |  | uniform 4 uint 0 | 
					
						
							|  |  |  | draw quad | 
					
						
							| 
									
										
										
										
											2024-02-10 13:16:22 -06:00
										 |  |  | probe (0, 0) rgbaui (1, 2, 0, 0) |