yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
b415760d7
master
1// gpu-printing-op.h 2 3// This file defines the various opcodes that 4// will be used for GPU printing commands. 5// 6// Because the CPU will be doing printing on 7// behalf of the GPU, the two processors need 8// to agree on the values of these opcodes. 9// Therefore we have set up this file to be 10// included into both the C++ `gpu-printing.cpp` 11// implementation and the Slang `printing.slang` 12// file. 13// 14// Client code should defiine the `GPU_PRINTING_OP` 15// macro appropriately, before including this file. 16// 17#ifndef GPU_PRINTING_OP 18#error "Must define 'GPU_PRINTING_OP(NAME)' before including" 19#endif 20 21// The `Nop` opcode is used to represent a vacuous 22// printing command that does nothing. 23// 24// It's main purpose is to allow GPU code to zero 25// out parts of the printing buffer to disable 26// or shorten a printing command that was started. 27// 28GPU_PRINTING_OP (Nop ) 29 30// The `NewLine` command is a compact way to 31// print a newline character (`\n`) 32GPU_PRINTING_OP (NewLine ) 33 34// Simple value types like `int`, `uint`, and `float` 35// can have their own printing commands for when 36// they will be printed directly. 37// 38GPU_PRINTING_OP (Int32 ) 39GPU_PRINTING_OP (UInt32 ) 40GPU_PRINTING_OP (Float32 ) 41 42// String values are encoded in the print buffer as 43// a 32-bit hash code, and are thus similar to 44// the simple value cases in practice. 45// 46GPU_PRINTING_OP (String ) 47 48// The final opcode we define is a complex `printf()` 49// style operation that combines a format string with 50// a variable amount of argument data to be referenced 51// by that format string. 52// 53GPU_PRINTING_OP (PrintF ) 54 55#undef GPU_PRINTING_OP