1Name 2 3 INTEL_parallel_arrays 4 5Name Strings 6 7 GL_INTEL_parallel_arrays 8 9Version 10 11 $Date: 1997/05/08 22:57:31 $ $Revision: 1.1 $ INITIAL 12 13Number 14 15 136 16 17Dependencies 18 19 OpenGL 1.1 20 21Overview 22 23 This extension adds the ability to format vertex arrays in a way that's 24efficient for SIMD architectures as well as caching. In addition to storing 25vertex data in staggered in a single array, or sparsely in separate arrays as 26possible with existing vertex arrays, coordinates may be stored in individual 27arrays. 28The parallel array mode is enabled using Enable(PARALLEL_ARRAYS). 29Pointers to the coordinate arrays are specified using new vector versions of the 30Pointer functions. 31 32Issues 33 34 Should an Enable/Disbale be used to switch to/from parallel arrays, or 35 just infer it from the last type of Pointer called? 36 37 Is stride needed for anything? 38 39 Should this be called Coordinate Arrays? 40 41 Should the <pointer> to the Pointerv funcions be (void *) or (void **)? 42 43Reasoning 44 45 Alternative methods for specifying vertex data are provided for 46 vertex, normal, color, and texture pointers. Need to put in argument 47 for why this is faster on some architectures (cache lines, etc). 48 49 50New Procedures and Functions 51 52 void VertexPointervINTEL(int size, 53 enum type, 54 const void** pointer); 55 56 void NormalPointervINTEL(enum type, 57 const void** pointer); 58 59 void ColorPointervINTEL(int size, 60 enum type, 61 const void** pointer); 62 63 void TexCoordPointervINTEL(int size, 64 enum type, 65 const void** pointer); 66 67New Tokens 68 69 Accepted by the <cap> parameter of Enable, Disable, and IsEnabled, and 70 by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, and 71 GetDoublev: 72 73 PARALLEL_ARRAYS_INTEL 0x83F4 74 75 Accepted by the <pname> parameter of GetPointerv: 76 77 VERTEX_ARRAY_PARALLEL_POINTERS_INTEL 0x83F5 78 NORMAL_ARRAY_PARALLEL_POINTERS_INTEL 0x83F6 79 COLOR_ARRAY_PARALLEL_POINTERS_INTEL 0x83F7 80 TEXTURE_COORD_ARRAY_PARALLEL_POINTERS_INTEL 0x83F8 81 82Additions to Chapter 2 of the 1.1 Specification (OpenGL Operation) 83 84 Array Specification 85 ------------------- 86 87 VertexPointervINTEL specifies the location and data format of an 88 array of vertex coordinates. <pointer> specifies an array of pointers, 89 where pointer[0] is a pointer to the x coordinate of the first vertex in the 90 array, pointer[1] specifies a pointer to the y coordinate of the first 91 vertex in the array, pointer[2] specifies a pointer to the z coordinate of 92 the first vertex in the array, and pointer[3] specifies a pointer to the w 93 coordinate of the first vertex in the array. 94 <type> specifies the data type of each coordinate in the array, and must be 95 one of SHORT, INT, FLOAT, or DOUBLE, implying GL data types short, int, 96 float, and double respectively. <size> specifies the number of coordinates 97 per vertex, and must be 2, 3, or 4. 98 99 NormalPointervINTEL specifies the location and data format of an 100 array of normals. <pointer> specifies an array of pointers, where 101 pointer[0] is a pointer to the x coordinate of the first normal in the 102 array, pointer[1] specifies a pointer to the y coordinate of the first 103 normal in the array, pointer[2] specifies a pointer to the z coordinate of 104 the first normal in the array, and pointer[3] specifies a pointer to the w 105 coordinate of the first normal in the array. <type> specifies the 106 data type of each coordinate in the array, and must be one of BYTE, SHORT, 107 INT, FLOAT, or DOUBLE, implying GL data types byte, short, int, float, 108 and double respectively. It is understood that each normal comprises 109 three coordinates. 110 111 ColorPointervINTEL specifies the location and data format of an 112 array of color components. <pointer> specifies an array of pointers, 113 where pointer[0] is a pointer to the r coordinate of the first color in the 114 array, pointer[1] specifies a pointer to the g coordinate of the first 115 color in the array, pointer[2] specifies a pointer to the b coordinate of 116 the first color in the array, and pointer[3] specifies a pointer to the a 117 coordinate of the first color in the array. <type> specifies the data type 118 of each component in the array, and must be one of BYTE, UNSIGNED_BYTE, 119 SHORT, UNSIGNED_SHORT, INT, UNSIGNED_INT, FLOAT, or DOUBLE_EXT, implying GL 120 data types byte, ubyte, short, ushort, int, uint, float, and double 121 respectively. <size> specifies the number of components per color, and must 122 be 3 or 4. 123 124 TexCoordPointervINTEL specifies the location and data format of an 125 array of texture coordinates. <pointer> specifies an array of pointers, 126 where pointer[0] is a pointer to the u coordinate of the first element in 127 the array, pointer[1] specifies a pointer to the v coordinate of the first 128 element in the array, pointer[2] specifies a pointer to the s coordinate of 129 the first element in the array, and pointer[3] specifies a pointer to the t 130 coordinate of the first element in the array. <type> specifies the data 131 type of each coordinate in the array, and must be one of SHORT, INT, FLOAT, 132 or DOUBLE, implying GL data types short, int, float, and double 133 respectively. <size> specifies the number of coordinates per element, and 134 must be 1, 2, 3, or 4. 135 136 Rendering the Arrays 137 -------------------- 138 139 When ArrayElement is called, a single vertex is drawn, using vertex 140 and attribute data taken from location <i> of the enabled arrays. The 141 semantics of ArrayElement are defined in the C-code below: 142 143 void ArrayElement (int i) { 144 byte* p, px, py, pz, pw, pr, pg, pb, pa; 145 if (NORMAL_ARRAY) { 146 if (PARALLEL_ARRAYS) { 147 px = (byte*)normal_x_pointer + i * sizeof(normal_type); 148 py = (byte*)normal_y_pointer + i * sizeof(normal_type); 149 pz = (byte*)normal_z_pointer + i * sizeof(normal_type); 150 Normal3<normal_type> (*(normal_type*)px, *(normal_type*)py, 151 *(normal_type*)pz); 152 } else { 153 if (normal_stride == 0) 154 p = (byte*)normal_pointer + i * 3 * 155 sizeof(normal_type); 156 else 157 p = (byte*)normal_pointer + i * normal_stride; 158 Normal3<normal_type>v ((normal_type*)p); 159 } 160 } 161 if (COLOR_ARRAY) { 162 if (PARALLEL_ARRAYS) { 163 pr = (byte*)color_r_pointer + i * sizeof(color_type); 164 pg = (byte*)color_g_pointer + i * sizeof(color_type); 165 pb = (byte*)color_b_pointer + i * sizeof(color_type); 166 switch (<color_size>){ 167 case 3: 168 Color<color_size><color_type> (*(color_type*)pr, 169 *(color_type*)pg, *(color_type*)pb); break; 170 case 4: 171 pa = (byte*)color_a_pointer + i * 172 sizeof(color_type); 173 Color<color_size><color_type> (*(color_type*)pr, 174 *(color_type*)pg, *(color_type*)pb, 175 *(color_type*)pa); break; 176 } 177 } else { 178 if (color_stride == 0) 179 p = (byte*)color_pointer + 180 i * color_size * sizeof(color_type); 181 else 182 p = (byte*)color_pointer + i * color_stride; 183 Color<color_size><color_type>v ((color_type*)p); 184 } 185 } 186 if (INDEX_ARRAY) { 187 if (index_stride == 0) 188 p = (byte*)index_pointer + i * sizeof(index_type); 189 else 190 p = (byte*)index_pointer + i * index_stride; 191 Index<index_type>v ((index_type*)p); 192 } 193 if (TEXTURE_COORD_ARRAY_EXT) { 194 if (PARALLEL_ARRAYS) { 195 pu = (byte*)texcoord_u_pointer + i * sizeof(texcoord_type); 196 switch (<texcoord_size>){ 197 case 1: 198 TexCoord<texcoord_size><texcoord_type> 199 (*(texcoord_type*)pu); break; 200 case 2: 201 pv = (byte*)texcoord_v_pointer + i * 202 sizeof(texcoord_type); 203 TexCoord<texcoord_size><texcoord_type> 204 (*(texcoord_type*)pu, *(texcoord_type*)pv); 205 break; 206 case 3: 207 ps = (byte*)texcoord_s_pointer + i * 208 sizeof(texcoord_type); 209 TexCoord<texcoord_size><texcoord_type> 210 (*(texcoord_type*)pu, *(texcoord_type*)pv, 211 *(texcoord_type*)ps); break; 212 case 4: 213 pt = (byte*)texcoord_t_pointer + i * 214 sizeof(texcoord_type); 215 TexCoord<texcoord_size><texcoord_type> 216 (*(texcoord_type*)pu, *(texcoord_type*)pv, 217 *(texcoord_type*)ps, *(texcoord_type*)pt); 218 break; 219 } 220 } else { 221 if (texcoord_stride == 0) 222 p = (byte*)texcoord_pointer + 223 i * texcoord_size * sizeof(texcoord_type); 224 else 225 p = (byte*)texcoord_pointer + i * texcoord_stride; 226 TexCoord<texcoord_size><texcoord_type>v 227 ((texcoord_type*)p); 228 } 229 } 230 if (EDGE_FLAG_ARRAY) { 231 if (edgeflag_stride == 0) 232 p = (byte*)edgeflag_pointer + i * sizeof(boolean); 233 else 234 p = (byte*)edgeflag_pointer + i * edgeflag_stride; 235 EdgeFlagv ((boolean*)p); 236 } 237 if (VERTEX_ARRAY) { 238 if (PARALLEL_ARRAYS) { 239 px = (byte*)vertex_x_pointer + i * sizeof(vertex_type); 240 py = (byte*)vertex_y_pointer + i * sizeof(vertex_type); 241 Normal3<normal_type> ((normal_type*)px, (normal_type*)py, 242 (normal_type*)pz); 243 switch (<vertex_size>){ 244 case 2: 245 Vertex<vertex_size><vertex_type> (*(vertex_type*)px, 246 *(vertex_type*)py); 247 case 3: 248 pz = (byte*)vertex_z_pointer + i * 249 sizeof(vertex_type); 250 Vertex<vertex_size><vertex_type> (*(vertex_type*)px, 251 *(vertex_type*)py, *(vertex_type*)pz); 252 case 4: 253 pw = (byte*)vertex_w_pointer + i * 254 sizeof(vertex_type); 255 Vertex<vertex_size><vertex_type> (*(vertex_type*)px, 256 *(vertex_type*)py, *(vertex_type*)pz, 257 *(vertex_type*)pw); 258 } 259 } else { 260 if (vertex_stride == 0) 261 p = (byte*)vertex_pointer + 262 i * vertex_size * sizeof(vertex_type); 263 else 264 p = (byte*)vertex_pointer + i * vertex_stride; 265 Vertex<vertex_size><vertex_type>v ((vertex_type*)p); 266 } 267 } 268 } 269 270Additions to Chapter 3 of the 1.0 Specification (Rasterization) 271 272 None 273 274Additions to Chapter 4 of the 1.0 Specification (Per-Fragment Operations 275and the Frame buffer) 276 277 None 278 279Additions to Chapter 5 of the 1.0 Specification (Special Functions) 280 281 Array specification commands VertexParallelPointerINTEL, 282 NormalParallelPointerINTEL, ColorParallelPointerINTEL, and 283 TexCoordParallelPointerINTEL specify client side state, and are therefore 284 not included in display lists. Likewise Enable and Disable, when 285 called with <cap> set to PARALLEL_ARRAYS_INTEL, are not included in display 286 lists. 287 288Additions to Chapter 6 of the 1.0 Specification (State and State Requests) 289 290 GetPointerv returns in <param> the array pointer value specified 291 by <pname>. GetPointerv additional accepts the following values for <pname> 292 293 VERTEX_ARRAY_PARALLEL_POINTERS_INTEL, NORMAL_ARRAY_PARALLEL_POINTERS_INTEL, 294 COLOR_ARRAY_PARALLEL_POINTERS_INTEL, 295 TEXTURE_COORD_ARRAY_PARALLEL_POINTERS_INTEL. 296 In this case, <param> will return an array of pointers. 297 298Additions to the GLX Specification 299 300 None 301 302GLX Protocol 303 304 None 305 306Errors 307 308 INVALID_VALUE is generated if VertexPointervINTEL parameter <size> 309 is not 2, 3, or 4. 310 311 INVALID_ENUM is generated if VertexPointervINTEL parameter <type> 312 is not SHORT, INT, FLOAT, or DOUBLE. 313 314 INVALID_ENUM is generated if NormalPointervINTEL parameter <type> is 315 not BYTE, SHORT, INT, FLOAT, or DOUBLE. 316 317 INVALID_VALUE is generated if ColorPointervINTEL parameter <size> is 318 not 3 or 4. 319 320 INVALID_ENUM is generated if ColorPointervINTEL parameter <type> is 321 not BYTE, UNSIGNED_BYTE, SHORT, UNSIGNED_SHORT, INT, UNSIGNED_INT, FLOAT, 322 or DOUBLE. 323 324 INVALID_VALUE is generated if TexCoordPointervINTEL parameter <size> 325 is not 1, 2, 3, or 4. 326 327 INVALID_ENUM is generated if TexCoordPointervINTEL parameter <type> is not 328 SHORT, INT, FLOAT, or DOUBLE. 329 330 INVALID_ENUM is generated if GetPointerv parameter <pname> is not 331 VERTEX_ARRAY_POINTER, NORMAL_ARRAY_POINTER, 332 COLOR_ARRAY_POINTER, INDEX_ARRAY_POINTER, 333 TEXTURE_COORD_ARRAY_POINTER, EDGE_FLAG_ARRAY_POINTER, or 334 VERTEX_ARRAY_PARALLEL_POINTERS_INTEL, NORMAL_ARRAY_PARALLEL_POINTERS_INTEL, 335 COLOR_ARRAY_PARALLEL_POINTERS_INTEL, 336 TEXTURE_COORD_ARRAY_PARALLEL_POINTERS_INTEL 337 338New State 339 Initial 340 Get Value Get Command Type Value Attrib 341 --------- ----------- ---- ------- ------ 342 PARALLEL_ARRAYS_INTEL IsEnabled B False client 343 VERTEX_ARRAY_PARRALEL_POINTERS_INTEL GetPointerv Z+ 0 client 344 NORMAL_ARRAY_PARALLEL_POINTERS_INTEL GetPointerv Z+ 0 client 345 COLOR_ARRAY_PARALLEL_POINTERS_INTEL GetPointervEXT Z+ 0 client 346 TEXTURE_COORD_ARRAY_PARALLEL_POINTERS_INTEL GetPointerv Z+ 0 client 347 348New Implementation Dependent State 349 350 None 351