Implement .gsh directive

This commit is contained in:
fincs 2015-08-22 23:21:49 +02:00
parent 8366ecf660
commit cefa910b58
3 changed files with 22 additions and 2 deletions

View File

@ -4,7 +4,7 @@
- (**Breaking change**) Command line format changed. - (**Breaking change**) Command line format changed.
- Added support for assembling multiple shaders (DVLEs) into a single SHBIN. - 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) - Added auto-detection of inverted forms of opcodes. (Explicitly using `dphi`, `sgei`, `slti` and `madi` is now deprecated)
- Several miscellaneous bug fixes. - Several miscellaneous bug fixes.

View File

@ -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. 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. 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. 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
``` ```
.setf register(x, y, z, w) .setf register(x, y, z, w)

View File

@ -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[] = static const cmdTableType dirTable[] =
{ {
DEC_DIRECTIVE(proc), DEC_DIRECTIVE(proc),
@ -1571,6 +1584,7 @@ static const cmdTableType dirTable[] =
DEC_DIRECTIVE(out), DEC_DIRECTIVE(out),
DEC_DIRECTIVE(entry), DEC_DIRECTIVE(entry),
DEC_DIRECTIVE(nodvle), DEC_DIRECTIVE(nodvle),
DEC_DIRECTIVE(gsh),
DEC_DIRECTIVE2(setf, setfi, UTYPE_FVEC), DEC_DIRECTIVE2(setf, setfi, UTYPE_FVEC),
DEC_DIRECTIVE2(seti, setfi, UTYPE_IVEC), DEC_DIRECTIVE2(seti, setfi, UTYPE_IVEC),
DEC_DIRECTIVE(setb), DEC_DIRECTIVE(setb),