On Mon, 7 Mar 2022 at 17:47, Zebediah Figura zfigura@codeweavers.com wrote:
On 3/7/22 05:40, Henri Verbeet wrote:
On Mon, 7 Mar 2022 at 03:05, Zebediah Figura zfigura@codeweavers.com wrote: The traditional way to do this kind of thing is a here-document/here-string construction. Is that something we've considered?
Not per se, although I'm not sure it's an improvement. Here-strings are kind of more inconvenient to type, and get away with it in the general case because they're kind of rare, but we'll have at least one per file.
Would we? HLSL attributes aren't uncommon, but we certainly already have a fair number of existing .shader_test files without them. We should be able to keep those as-is.
Perhaps more saliently, I'd like to be able to easily visually parse sections (especially since we won't have anything like syntax highlighting to help us), which implies at least that the test header should be dissimilar to HLSL attributes.
I suppose we could also just indent the shaders by one level, and then strip that indentation before compilation. E.g.:
[pixel shader] uniform float4 colour;
float4 main() : sv_target { return colour; }
[vertex shader] ...
The other option is defining an escape character, of course, but it it tends to be less convenient than either of the options mentioned above.