Skip to content

Commit 073d21a

Browse files
committed
Add 'require()' to interface in print.slang
Close #6764. Slang require to put require() capability keyword on the interface, because we can not propagate the requirement from the implementation to interface. So the shader needs to be changed. We need to develop mechanism for Metal specific to input the buffer length instead of using GetDimensions method to make this working on Metal.
1 parent fefeec6 commit 073d21a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/sgl/device/print.slang

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ interface IPrintOutput {
4343
/// \param total_data_count The total number of data elements in all arguments.
4444
/// \param[out] offset Offset into the output buffer. This needs to be passed to \c write_arg calls.
4545
/// \return True if the message was written successfully, false if there was not enough space.
46+
/// \TODO: Note that the implementation of this interface is using RWByteAddressBuffer::GetDimensions which
47+
/// has the requirement that the Metal is not supported. Slang requires the capability requirement on the interface,
48+
/// so we will add this requirement here to prevent Slang generating invalid code for Metal.
49+
/// See: https://github.com/shader-slang/slang/issues/6764
50+
[require(cpp_cuda_glsl_hlsl_spirv_wgsl, structuredbuffer_rw)]
4651
bool write_msg(String fmt, uint arg_count, uint total_data_count, out uint offset);
4752

4853
/// Write a single printable argument.

0 commit comments

Comments
 (0)