Closed BearishSun closed 7 years ago
Added another commit in order to avoid writing image layout format qualifiers if images aren't used for any reads (i.e. what I wrote in the last paragraph above).
I just looked at it for a moment, but it looks good so far.
The idea of using -E<TYPE>
for language extensions is great 👍 ,
but I think I should then change the -E ENTRY
command to -e ENTRY
, let's see.
Also making the enum ImageLayoutFormat
always available is sensible.
Ah indeed, I missed the fact that "-E" was already in use, something should get renamed.
Yes, but I appreciate the upper case letters for commands with integrated types like -W
, -S
, etc.
I'll take care of it. Maybe I find another suitable name for the extensions.
Thought you might find it useful :)
I amended the last commit, it was incorrectly applying writeonly
to non RW buffers.
I renamed your -E
language extension command to -X
for eXtension.
I also made the extensions
member and its enum in ShaderInput
always enabled, but it is ignored if XSC_ENABLE_LANGUAGE_EXT
is not defined.
In this way, the client programmer doesn't need to define XSC_ENABLE_LANGUAGE_EXT
for it's own projects (only to bulid the compiler).
In the XscDebugger the respective PropertyGrid entry is then disbaled, but visible so that you always see what is build into the ccompiler and what is not.
I've added support for the 'layout' attribute that allows the user to specify image layout format such as
rgba8
using a non-standard[layout(rgba8)]
attribute, as we discussed yesterday.This functionality is only enabled when
XSC_ENABLE_LANGUAGE_EXT
is enabled through CMake AND when the necessary extension is enabled through input options/CLI/GUI.I've added the
-E<TYPE>
CLI option which works similar to-W<TYPE>
, and allows specific (or all) extensions to be enabled. Since I know you are working on an extension of your own I assume this is preferred than having separate options for each extension.The core additions are:
ImageLayoutFormat
enumeration containing all image layout formats and a mapping to GLSL keywords. This is available even when extensions are disabled, since it is part of standard GLSL, and you might want to use this functionality for the input-option based solution to the image layout format problem (as discussed yesterday).ImageLayoutFormat
inHLSLAnalyzer
. Resulting image layout is stored on relevantBufferTypeDenoter
s.GLSLGenerator::WriteBufferDeclTexture
so that image layout stored onBufferTypeDenoter
is used if available. If one is not available or extension is disabled the system will try to deduce one automatically from base buffer type (similar how it worked so far). Finally if format cannot be deduced the buffer will be marked aswriteonly
, since formats are only needed for reads.I'll probably do a secondary PR in which I track which buffers are actually being written to. In that case we can always avoid writing out the layout format, and since most RW buffers are only used for writes, this should allow the user to avoid attributes in majority of situations.