Skip to content

Request for basic string support in HLSL #279

@TheRealMJP

Description

@TheRealMJP

Hello,

Since DXC + D3D12 currently don't have support for a shader printf (it's supported for Vulkan/SPIR-V, and fxc supported it for the old reference rasterizer), we currently have our own system built into our engine that can emulate basic debug printing through shader atomics and readback buffers. However, this functionality is quite awkward to use since HLSL also lacks any support for passing string literals and iterating over the characters. To work around this, we currently have many overloads of our DebugPrint function and pass characters one by one as uint arguments:

DebugPrint('H', 'e, 'l', 'l', 'o', '!'); 

It would be really great if we could properly pass a string literal instead, and also be able to know the number of characters and iterate over them as integers. For this use case we really only care about strings that are defined at compile-time, and we don't need to modify the strings in any way. Even something that could convert the string literal to an array of uint could potentially be a lot more usable than what we currently do.

Thanks in advance!

-Matt

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    Status

    Triaged

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions