From cefa910b5887f62f82bac6de0c67ffefd20b824f Mon Sep 17 00:00:00 2001 From: fincs Date: Sat, 22 Aug 2015 23:21:49 +0200 Subject: [PATCH] Implement .gsh directive --- Changelog.md | 2 +- Manual.md | 8 +++++++- source/picasso_assembler.cpp | 14 ++++++++++++++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/Changelog.md b/Changelog.md index b5ab333..23411e3 100644 --- a/Changelog.md +++ b/Changelog.md @@ -4,7 +4,7 @@ - (**Breaking change**) Command line format changed. - Added support for assembling multiple shaders (DVLEs) into a single SHBIN. -- Added new directives: `.entry`, `.nodvle`, `.setf`, `.seti`, `.setb`. +- Added new directives: `.entry`, `.nodvle`, `.gsh`, `.setf`, `.seti`, `.setb`. - Added auto-detection of inverted forms of opcodes. (Explicitly using `dphi`, `sgei`, `slti` and `madi` is now deprecated) - Several miscellaneous bug fixes. diff --git a/Manual.md b/Manual.md index 763a1bc..2dc70d5 100644 --- a/Manual.md +++ b/Manual.md @@ -72,7 +72,7 @@ DVLEs are generated in the same order as the files in the command line. The entry point of a DVLE may be set with the `.entry` directive. If this directive is not used, `main` is assumed as the entrypoint. -A DVLE is marked by default as a vertex shader, unless `setemit` is used (in the case of which a geometry shader is assumed). +A DVLE is marked by default as a vertex shader, unless `setemit` or `.gsh` are used (in the case of which a geometry shader is assumed). Uniforms that start with the underscore (`_`) character are not exposed in the DVLE table of uniforms. This allows for creating private uniforms that can be internally used to configure the behaviour of shared procedures. @@ -188,6 +188,12 @@ Specifies the name of the procedure to use as the entrypoint of the current DVLE ``` This directive tells `picasso` not to generate a DVLE for the source code file that is being processed. This allows for writing files that contain shared procedures to be used by other files. +### .gsh +``` +.gsh +``` +This directive explicitly flags the current DVLE as a geometry shader. + ### .setf ``` .setf register(x, y, z, w) diff --git a/source/picasso_assembler.cpp b/source/picasso_assembler.cpp index 754f693..0a985fc 100644 --- a/source/picasso_assembler.cpp +++ b/source/picasso_assembler.cpp @@ -1557,6 +1557,19 @@ DEF_DIRECTIVE(nodvle) } } +DEF_DIRECTIVE(gsh) +{ + DVLEData* dvle = GetDvleData(); + ENSURE_NO_MORE_ARGS(); + + if (dvle->nodvle) + return throwError(".gsh has no effect if .nodvle is used\n"); + + dvle->isGeoShader = true; + return 0; +} + + static const cmdTableType dirTable[] = { DEC_DIRECTIVE(proc), @@ -1571,6 +1584,7 @@ static const cmdTableType dirTable[] = DEC_DIRECTIVE(out), DEC_DIRECTIVE(entry), DEC_DIRECTIVE(nodvle), + DEC_DIRECTIVE(gsh), DEC_DIRECTIVE2(setf, setfi, UTYPE_FVEC), DEC_DIRECTIVE2(seti, setfi, UTYPE_IVEC), DEC_DIRECTIVE(setb),