Add more output types & correct number of integer uniforms

This commit is contained in:
fincs 2015-03-02 17:37:46 +01:00
parent 8437350b4b
commit 28c07f3363
3 changed files with 22 additions and 6 deletions

View File

@ -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:

View File

@ -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

View File

@ -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;
}