Selaa lähdekoodia

Support predicates.

Predicates, as per D3D9 spec, are a complete subset of NVIDIA's
condition codes. However, due to its broad support in non-NVIDIA
hardware, it is being exposed in TGSI to ease hw driver development.
Two decomposition functions are expected in the future.
1. GetRidOfPredicates() - predicates are implemented with condition
codes.
2. There is no second function, it's just this pesky VI that does not
allow me to move with arrow keys and so I cannot edit previous paragraphs.
tags/mesa_20090313
michal 18 vuotta sitten
vanhempi
commit
9cad4dde97
1 muutettua tiedostoa jossa 54 lisäystä ja 17 poistoa
  1. 54
    17
      src/mesa/pipe/tgsi/core/tgsi_token.h

+ 54
- 17
src/mesa/pipe/tgsi/core/tgsi_token.h Näytä tiedosto

@@ -1102,6 +1102,7 @@ struct tgsi_instruction
#define TGSI_INSTRUCTION_EXT_TYPE_NV 0
#define TGSI_INSTRUCTION_EXT_TYPE_LABEL 1
#define TGSI_INSTRUCTION_EXT_TYPE_TEXTURE 2
#define TGSI_INSTRUCTION_EXT_TYPE_PREDICATE 3

struct tgsi_instruction_ext
{
@@ -1120,6 +1121,9 @@ struct tgsi_instruction_ext
* If tgsi_instruction_ext::Type is TGSI_INSTRUCTION_EXT_TYPE_TEXTURE, it
* should be cast to tgsi_instruction_ext_texture.
*
* If tgsi_instruction_ext::Type is TGSI_INSTRUCTION_EXT_TYPE_PREDICATE, it
* should be cast to tgsi_instruction_ext_predicate.
*
* If tgsi_instruction_ext::Extended is TRUE, another tgsi_instruction_ext
* follows.
*/
@@ -1201,6 +1205,32 @@ struct tgsi_instruction_ext_texture
GLuint Extended : 1; /* BOOL */
};

#define TGSI_WRITEMASK_NONE 0x00
#define TGSI_WRITEMASK_X 0x01
#define TGSI_WRITEMASK_Y 0x02
#define TGSI_WRITEMASK_XY 0x03
#define TGSI_WRITEMASK_Z 0x04
#define TGSI_WRITEMASK_XZ 0x05
#define TGSI_WRITEMASK_YZ 0x06
#define TGSI_WRITEMASK_XYZ 0x07
#define TGSI_WRITEMASK_W 0x08
#define TGSI_WRITEMASK_XW 0x09
#define TGSI_WRITEMASK_YW 0x0A
#define TGSI_WRITEMASK_XYW 0x0B
#define TGSI_WRITEMASK_ZW 0x0C
#define TGSI_WRITEMASK_XZW 0x0D
#define TGSI_WRITEMASK_YZW 0x0E
#define TGSI_WRITEMASK_XYZW 0x0F

struct tgsi_instruction_ext_predicate
{
GLuint Type : 4; /* TGSI_INSTRUCTION_EXT_TYPE_PREDICATE */
GLuint PredDstIndex : 4; /* UINT */
GLuint PredWriteMask : 4; /* TGSI_WRITEMASK_ */
GLuint Padding : 19;
GLuint Extended : 1; /* BOOL */
};

/*
* File specifies the register array to access.
*
@@ -1331,23 +1361,6 @@ struct tgsi_dimension
GLuint Extended : 1; /* BOOL */
};

#define TGSI_WRITEMASK_NONE 0x00
#define TGSI_WRITEMASK_X 0x01
#define TGSI_WRITEMASK_Y 0x02
#define TGSI_WRITEMASK_XY 0x03
#define TGSI_WRITEMASK_Z 0x04
#define TGSI_WRITEMASK_XZ 0x05
#define TGSI_WRITEMASK_YZ 0x06
#define TGSI_WRITEMASK_XYZ 0x07
#define TGSI_WRITEMASK_W 0x08
#define TGSI_WRITEMASK_XW 0x09
#define TGSI_WRITEMASK_YW 0x0A
#define TGSI_WRITEMASK_XYW 0x0B
#define TGSI_WRITEMASK_ZW 0x0C
#define TGSI_WRITEMASK_XZW 0x0D
#define TGSI_WRITEMASK_YZW 0x0E
#define TGSI_WRITEMASK_XYZW 0x0F

struct tgsi_dst_register
{
GLuint File : 4; /* TGSI_FILE_ */
@@ -1367,6 +1380,7 @@ struct tgsi_dst_register

#define TGSI_DST_REGISTER_EXT_TYPE_CONDCODE 0
#define TGSI_DST_REGISTER_EXT_TYPE_MODULATE 1
#define TGSI_DST_REGISTER_EXT_TYPE_PREDICATE 2

struct tgsi_dst_register_ext
{
@@ -1382,6 +1396,9 @@ struct tgsi_dst_register_ext
* If tgsi_dst_register_ext::Type is TGSI_DST_REGISTER_EXT_TYPE_MODULATE,
* it should be cast to tgsi_dst_register_ext_modulate.
*
* If tgsi_dst_register_ext::Type is TGSI_DST_REGISTER_EXT_TYPE_PREDICATE,
* it should be cast to tgsi_dst_register_ext_predicate.
*
* If tgsi_dst_register_ext::Extended is TRUE, another tgsi_dst_register_ext
* follows.
*/
@@ -1415,6 +1432,26 @@ struct tgsi_dst_register_ext_modulate
GLuint Extended : 1; /* BOOL */
};

/*
* Currently, the following constraints apply.
*
* - PredSwizzleXYZW is either set to identity or replicate.
* - PredSrcIndex is 0.
*/

struct tgsi_dst_register_ext_predicate
{
GLuint Type : 4; /* TGSI_DST_REGISTER_EXT_TYPE_PREDICATE */
GLuint PredSwizzleX : 2; /* TGSI_SWIZZLE_ */
GLuint PredSwizzleY : 2; /* TGSI_SWIZZLE_ */
GLuint PredSwizzleZ : 2; /* TGSI_SWIZZLE_ */
GLuint PredSwizzleW : 2; /* TGSI_SWIZZLE_ */
GLuint PredSrcIndex : 4; /* UINT */
GLuint Negate : 1; /* BOOL */
GLuint Padding : 14;
GLuint Extended : 1; /* BOOL */
};

#if defined __cplusplus
} // extern "C"
#endif // defined __cplusplus

Loading…
Peruuta
Tallenna