-
Notifications
You must be signed in to change notification settings - Fork 56
HLSL printf support ? #245
Description
Would there there any plans to support printf .
Fxc does support and works great with Ref rast not Warp / HAL and would be a neat quick debug tool.
Drivers probably just drop the opcode from dxbc path.
float4 main(float4 Color : COLOR0,float4 Pos : SV_POSITION) : SV_Target
{
if(Pos.x == 100.5 && Pos.y == 100.5)
{
printf("Color R = %f",Color.r );
}
return Color;
}
D:\temp\printf>"c:\Program Files (x86)\Windows Kits\10\bin\x64\fxc.exe" /Tps_5_0 printf.fx
ps_5_0
dcl_globalFlags refactoringAllowed
dcl_input_ps linear v0.xyzw
dcl_input_ps_siv linear noperspective v1.xy, position
dcl_output o0.xyzw
dcl_temps 1
eq r0.xy, v1.xyxx, l(100.500000, 100.500000, 0.000000, 0.000000)
and r0.x, r0.y, r0.x
if_nz r0.x
printf "Color R = %f", v0.x
endif
mov o0.xyzw, v0.xyzw
ret
D:\temp\printf>d:\DXC\dump\Debug\bin\dxc.exe printf.fx /Tps_5_0
printf.fx:5:2: error: use of undeclared identifier 'printf'
printf("Color R = %f",Color.r );
^
Its a great debugging tool. If Microsoft can spec out the expected behavior for driver world.
(should the print be via stdio / output debug string or some new driver debug log buffer ?). Something like
https://www.khronos.org/registry/OpenCL/sdk/2.0/docs/man/xhtml/printfFunction.html
Sample o/p from Ref
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
