Description
- Implement
printf
clang builtin,Linkprintf
clang builtin withhlsl_intrinsics.h
Add sema checks forprintf
toCheckHLSLBuiltinFunctionCall
inSemaChecking.cpp
Add codegen forprintf
toEmitHLSLBuiltinExpr
inCGBuiltin.cpp
Add codegen tests toclang/test/CodeGenHLSL/builtins/printf.hlsl
Add sema tests toclang/test/SemaHLSL/BuiltIns/printf-errors.hlsl
Create theint_spv_printf
intrinsic inIntrinsicsSPIRV.td
In SPIRVInstructionSelector.cpp create theprintf
lowering and map it toint_spv_printf
inSPIRVInstructionSelector::selectIntrinsic
.Create SPIR-V backend test case inllvm/test/CodeGen/SPIRV/hlsl-intrinsics/printf.ll
DirectX
There is no support for printf
when targeting DirectX.
SPIR-V
See "Using Debug Printf in HLSL Shaders" in https://vulkan.lunarg.com/doc/sdk/1.3.283.0/windows/debug_printf.html
Test Case(s)
Example 1
//dxc printf_test.hlsl -T lib_6_8 -enable-16bit-types -O0
export void fn(string p1) {
return printf(p1);
}
HLSL:
Submits a custom shader message to the information queue.
Syntax
void printf(
string format,
argument ...
);
Parameters
-
format
-
The format string.
-
argument ...
-
Optional arguments.
Return value
This function does not return a value.
Remarks
This operation does nothing on devices that do not support it.
Minimum Shader Model
This function is supported in the following shader models.
Shader Model | Supported |
---|---|
Shader Model 4 (DirectX HLSL) or later. | yes |
See also
Metadata
Metadata
Assignees
Type
Projects
Status
No status
Milestone
Relationships
Development
No branches or pull requests
Activity