From 28c07f336379b5fdb12eff17709544d8b5db7afb Mon Sep 17 00:00:00 2001 From: fincs Date: Mon, 2 Mar 2015 17:37:46 +0100 Subject: [PATCH] Add more output types & correct number of integer uniforms --- Manual.md | 10 +++++++--- source/picasso.h | 8 ++++++-- source/picasso_assembler.cpp | 10 +++++++++- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/Manual.md b/Manual.md index 7191f5b..eef5b7f 100644 --- a/Manual.md +++ b/Manual.md @@ -40,7 +40,7 @@ PICA200 registers are often used as arguments to instructions. There exist the f - `v0` through `v7`: Input registers (usable as a source operand). - `r0` through `r15`: Scratch registers (usable as both destination and source operands). - `c0` through `c95`: Floating-point vector uniforms (usable as a special type of source operand called SRC1). -- `i0` through `i7`: Integer vector uniforms (special purpose). +- `i0` through `i3`: Integer vector uniforms (special purpose). - `b0` through `b15`: Boolean uniforms (special purpose). All registers contain 32-bit floating point vectors; except for integer vector uniforms (containing 8-bit integers) and boolean uniforms. Vectors have 4 components: x, y, z and w. Uniforms are special registers that are writable by the CPU; thus they are used to pass configuration parameters to the shader such as transformation matrices. Sometimes they are preloaded with constant values that may be used in the logic of the shader. @@ -138,10 +138,14 @@ Reserves a new integer vector uniform to be preloaded with the specified constan Allocates a new output register, wires it to a certain output property and creates an alias for it that points to the allocated register. The following property names are supported: - `position` (or `pos`): In vertex shaders, this represents the position of the outputted vertex. +- `normalquat` (or `nquat`): Under investigation. - `color` (or `clr`): In vertex shaders, this represents the color of the outputted vertex. Its format is (R, G, B, xx) where R,G,B are values ranging from 0.0 to 1.0. The W component isn't used. - `texcoord0` (or `tcoord0`): In vertex shaders, this represents the texture coordinate that is fed to the Texture Unit 0. The Z and W components are not used. -- `texcoord1` (or `tcoord1`): As above, but for the Texture Unit 1. -- `texcoord2` (or `tcoord2`): As above, but for the Texture Unit 2. +- `texcoord0w` (or `tcoord0w`): Under investigation. +- `texcoord1` (or `tcoord1`): As `texcoord0`, but for the Texture Unit 1. +- `texcoord2` (or `tcoord2`): As `texcoord0`, but for the Texture Unit 2. +- `7`: Under investigation. +- `view`: Under investigation. Example: diff --git a/source/picasso.h b/source/picasso.h index 1d6269f..7dd87bf 100644 --- a/source/picasso.h +++ b/source/picasso.h @@ -112,10 +112,14 @@ extern int g_uniformCount; enum { OUTTYPE_POS = 0, - OUTTYPE_CLR = 2, + OUTTYPE_NQUAT, + OUTTYPE_CLR, OUTTYPE_TCOORD0, - OUTTYPE_TCOORD1 = 5, + OUTTYPE_TCOORD0W, + OUTTYPE_TCOORD1, OUTTYPE_TCOORD2, + OUTTYPE_7, + OUTTYPE_VIEW, }; #define MAX_OUTPUT 8 diff --git a/source/picasso_assembler.cpp b/source/picasso_assembler.cpp index 2a7c861..c195499 100644 --- a/source/picasso_assembler.cpp +++ b/source/picasso_assembler.cpp @@ -1144,7 +1144,7 @@ static inline int& getAllocVar(int type, int& bound) { default: case UTYPE_FVEC: bound = 0x80; return fvecUnifPos; - case UTYPE_IVEC: bound = 0x88; return ivecUnifPos; + case UTYPE_IVEC: bound = 0x84; return ivecUnifPos; case UTYPE_BOOL: bound = 0x98; return boolUnifPos; } } @@ -1253,14 +1253,22 @@ static int parseOutType(const char* text) { if (stricmp(text,"pos")==0 || stricmp(text,"position")==0) return OUTTYPE_POS; + if (stricmp(text,"nquat")==0 || stricmp(text,"normalquat")==0) + return OUTTYPE_NQUAT; if (stricmp(text,"clr")==0 || stricmp(text,"color")==0) return OUTTYPE_CLR; if (stricmp(text,"tcoord0")==0 || stricmp(text,"texcoord0")==0) return OUTTYPE_TCOORD0; + if (stricmp(text,"tcoord0w")==0 || stricmp(text,"texcoord0w")==0) + return OUTTYPE_TCOORD0W; if (stricmp(text,"tcoord1")==0 || stricmp(text,"texcoord1")==0) return OUTTYPE_TCOORD1; if (stricmp(text,"tcoord2")==0 || stricmp(text,"texcoord2")==0) return OUTTYPE_TCOORD2; + if (stricmp(text,"7")==0) + return OUTTYPE_7; + if (stricmp(text,"view")==0) + return OUTTYPE_VIEW; return -1; }