OSDN Git Service

Support predicates.
authormichal <michal@michal-laptop.(none)>
Fri, 10 Aug 2007 10:45:06 +0000 (11:45 +0100)
committermichal <michal@michal-laptop.(none)>
Fri, 10 Aug 2007 10:45:56 +0000 (11:45 +0100)
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.

src/mesa/pipe/tgsi/core/tgsi_token.h

index 3552331..a94595c 100644 (file)
@@ -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