• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1Name
2
3    NV_register_combiners
4
5Name Strings
6
7    GL_NV_register_combiners
8
9Contact
10
11    Mark J. Kilgard, NVIDIA Corporation (mjk 'at' nvidia.com)
12
13Notice
14
15    Copyright NVIDIA Corporation, 1999, 2000, 2001, 2002, 2003.
16
17IP Status
18
19    NVIDIA Proprietary.
20
21Status
22
23    Shipping (version 1.6)
24
25Version
26
27    NVIDIA Date: February 1, 2007 (version 1.7)
28
29Number
30
31    191
32
33Dependencies
34
35    ARB_multitexture, assuming the value of MAX_TEXTURE_UNITS_ARB is
36    at least 2.
37
38    Written based on the wording of the OpenGL 1.2 specification with
39    the ARB_multitexture appendix E.
40
41    NV_texture_shader affects the definition of this extension.
42
43    ARB_depth_texture and ARB_shadow -or- SGIX_depth_texture and
44    SGIX_shadow affect the definition of this extension.
45
46    ARB_color_buffer_float affects the definiton of this extension.
47
48Overview
49
50    NVIDIA's next-generation graphics processor and its derivative
51    designs support an extremely configurable mechanism know as "register
52    combiners" for computing fragment colors.
53
54    The register combiner mechanism is a significant redesign of NVIDIA's
55    original TNT combiner mechanism as introduced by NVIDIA's RIVA
56    TNT graphics processor.  Familiarity with the TNT combiners will
57    help the reader appreciate the greatly enhanced register combiners
58    functionality (see the NV_texture_env_combine4 OpenGL extension
59    specification for this background).  The register combiner mechanism
60    has the following enhanced functionality:
61
62      The numeric range of combiner computations is from [-1,1]
63      (instead of TNT's [0,1] numeric range),
64
65      The set of available combiner inputs is expanded to include the
66      secondary color, fog color, fog factor, and a second combiner
67      constant color (TNT's available combiner inputs consist of
68      only zero, a single combiner constant color, the primary color,
69      texture 0, texture 1, and, in the case of combiner 1, the result
70      of combiner 0).
71
72      Each combiner variable input can be independently scaled and
73      biased into several possible numeric ranges (TNT can only
74      complement combiner inputs).
75
76      Each combiner stage computes three distinct outputs (instead
77      TNT's single combiner output).
78
79      The output operations include support for computing dot products
80      (TNT has no support for computing dot products).
81
82      After each output operation, there is a configurable scale and bias
83      applied (TNT's combiner operations builds in a scale and/or bias
84      into some of its combiner operations).
85
86      Each input variable for each combiner stage is fetched from any
87      entry in a combiner register set.  Moreover, the outputs of each
88      combiner stage are written into the register set of the subsequent
89      combiner stage (TNT could only use the result from combiner 0 as
90      a possible input to combiner 1; TNT lacks the notion of an
91      input/output register set).
92
93      The register combiner mechanism supports at least two general
94      combiner stages and then a special final combiner stage appropriate
95      for applying a color sum and fog computation (TNT provides two
96      simpler combiner stages, and TNT's color sum and fog stages are
97      hard-wired and not subsumed by the combiner mechanism as in register
98      combiners).
99
100    The register combiners fit into the OpenGL pipeline as a rasterization
101    processing stage operating in parallel to the traditional OpenGL
102    texture environment, color sum, AND fog application.  Enabling this
103    extension bypasses OpenGL's existing texture environment, color
104    sum, and fog application processing and instead use the register
105    combiners.  The combiner and texture environment state is orthogonal
106    so modifying combiner state does not change the traditional OpenGL
107    texture environment state and the texture environment state is
108    ignored when combiners are enabled.
109
110    OpenGL application developers can use the register combiner mechanism
111    for very sophisticated shading techniques.  For example, an
112    approximation of Blinn's bump mapping technique can be achieved with
113    the combiner mechanism.  Additionally, multi-pass shading models
114    that require several passes with unextended OpenGL 1.2 functionality
115    can be implemented in several fewer passes with register combiners.
116
117Issues
118
119    Should we expose the full register combiners mechanism?
120
121      RESOLUTION:  NO.  We ignore small bits of NV10 hardware
122      functionality.  The texture LOD input is ignored.  We also ignore
123      the inverts on input to the EF product.
124
125    Do we provide full gets for all the combiner state?
126
127      RESOLUTION:  YES.
128
129    Do we parameterize combiner input and output updates to avoid
130    enumerant explosions?
131
132      RESOLUTION:  YES.  To update a combiner stage input variable, you
133      need to specify the <stage>, <portion>, and <variable>.  To update a
134      combiner stage output operation, you need to specify the <stage> and
135      <portion>.  This does mean that we need to add special Get routines
136      that are likewise parameterized.  Hence, GetCombinerInputParameter*,
137      GetCombinerOutputParameter*, and GetFinalCombinerInputParameter*.
138
139   Is the register combiner functionality a super-set of the TNT combiner
140   functionality?
141
142      Yes, but only in the sense of being a computational super-set.
143      All computations performed with the TNT combiners can be performed
144      with the register combiners, but the sequence of operations necessary
145      to configure an identical computational result can be quite
146      different.
147
148      For example, the TNT combiners have an operation that includes
149      a final complement operation.  The register combiners can perform
150      range mappings only on inputs, but not on outputs.  The register
151      combiners can mimic the TNT operation with a post-operation
152      complement only by taking pains to complement on input any uses
153      of the output in later combiner stages.
154
155      What this does mean is that NV10's hardware functionality
156      will permit support for both the NV_register_combiners AND
157      NV_texture_env_combine4 extensions.
158
159      Note the existance of an "speclit" input complement bit supported
160      by NV10 (but not accessible through the NV_register_combiners
161      extensions).
162
163   Should we say anything about the precision of the combiner
164   computations?
165
166      RESOLUTION:  NO.  The spec is written as if the computations are
167      done on floating point values ranging from -1.0 to 1.0 (clamping is
168      specified where this range is exceeded).  The fact that NV10 does
169      the computations as 9-bit signed fixed point is not mentioned in
170      the spec.  This permits a future design to support more precision
171      or use a floating pointing representation.
172
173    What should the initial combiner state be?
174
175      RESOLUTION:  See tables NV_register_combiners.5 and
176      NV_register_combiners.6.  The default state has one general combiner
177      stage active that modulates the incoming color with texture 0.
178      The final combiner is setup initially to implement OpenGL 1.2's
179      standard color sum and fog stages.
180
181    What should happen to the TEXTURE0_ARB and TEXTUER1_ARB inputs if
182    one or both textures are disabled?
183
184      RESOLUTION:  The value of these inputs is undefined.
185
186    What do the TEXTURE0_ARB and TEXTURE1_ARB inputs correspond to?
187    Does the number correspond to the absolute texture unit number
188    or is the number based on how many textures are enabled (ie,
189    TEXTURE_ARB0 would correspond to the 2nd texture unit if the
190    2nd unit is enabled, but the 1st is disabled).
191
192      RESOLUTION:  The absolute texture unit.
193
194      This should be a lot less confusing to the programmer than having
195      the texture inputs switch textures if texture 0 is disabled.
196
197      Note that the proposed hardware actually determines the TEXTURE0
198      and TEXTURE1 input based on which texture is enabled.  This means
199      it is up to the ICD to properly update the combiner state when just
200      one texture is enabled.  Since we will already have to do this to
201      track the standard OpenGL texture environment for ARB_multitexture,
202      we can do it for this extension too.
203
204    Should the combiners state be PushAttrib/PopAttrib'ed along with
205    the texture state?
206
207      RESOLUTION:  YES.
208
209    Should we advertise the LOD fractional input to the combiners?
210
211      RESOLUTION:  NO.
212
213    There will be a performance impact when two combiner stages are
214    enabled versus just one stage.  Should we mention that somewhere?
215
216      RESOLUTION:  NO.  (But it is worth mentioning in this issues
217      section.)
218
219    Should the scale and bias for the CombinerOutputNV be indicated
220    by enumerants or specified outright as floats?
221
222      RESOLUTION:  ENUMERANTS.  While some future combiners might
223      support an arbitrary scale & bias specified as floats, NV10 just
224      does the enumerated options.
225
226    Should a dot product be computed in parralel with the sum of
227    products?
228
229      RESOLUTION:  YES (changed for version 1.6).  The hardware is
230      capable of summing the two dot products.
231
232      Versions of this specification prior to version 1.6 documented that
233      an INVALID_OPERATION should be generated if either <abDotProduct>
234      or <cdDotProduct> is true and then <sumOutput> is not GL_DISCARD.
235      However, this check was never added to the driver and some
236      applications found the mode useful.
237
238    Does the GL_E_TIMES_F_NV token for the final combiner perform any
239    mapping on E or F before the mapping?  Is the multiply signed?
240    Can the result be negative?
241
242      RESOLUTION:  Input mappings and component usage is applied to E or
243      F before their product is computed.  Yes, the product is a signed
244      multiplication.  The result can be negative, but the two allowed
245      final combiner input mapping modes (GL_UNSIGNED_IDENTITY_NV and
246      GL_UNSIGNED_INVERT_NV) both effectively clamp their results to
247      [0,1].
248
249      A negative value resulting from the "E times F" product with the
250      GL_UNSIGNED_IDENTITY_NV mapping mode would be clamped to zero.
251
252      A negative value resulting from the "E times F" product with the
253      GL_UNSIGNED_INVERT_NV mpaping mode would be clamped to zero but
254      then one minus that clamped result (zero) would generate one.
255
256New Procedures and Functions
257
258    void CombinerParameterfvNV(GLenum pname,
259                               const GLfloat *params);
260
261    void CombinerParameterivNV(GLenum pname,
262                               const GLint *params);
263
264    void CombinerParameterfNV(GLenum pname,
265                              GLfloat param);
266
267    void CombinerParameteriNV(GLenum pname,
268                              GLint param);
269
270    void CombinerInputNV(GLenum stage,
271                         GLenum portion,
272                         GLenum variable,
273                         GLenum input,
274                         GLenum mapping,
275                         GLenum componentUsage);
276
277    void CombinerOutputNV(GLenum stage,
278                          GLenum portion,
279                          GLenum abOutput,
280                          GLenum cdOutput,
281                          GLenum sumOutput,
282                          GLenum scale,
283                          GLenum bias,
284                          GLboolean abDotProduct,
285                          GLboolean cdDotProduct,
286                          GLboolean muxSum);
287
288    void FinalCombinerInputNV(GLenum variable,
289                              GLenum input,
290                              GLenum mapping,
291                              GLenum componentUsage);
292
293    void GetCombinerInputParameterfvNV(GLenum stage,
294                                       GLenum portion,
295                                       GLenum variable,
296                                       GLenum pname,
297                                       GLfloat *params);
298
299    void GetCombinerInputParameterivNV(GLenum stage,
300                                       GLenum portion,
301                                       GLenum variable,
302                                       GLenum pname,
303                                       GLint *params);
304
305    void GetCombinerOutputParameterfvNV(GLenum stage,
306                                        GLenum portion,
307                                        GLenum pname,
308                                        GLfloat *params);
309
310    void GetCombinerOutputParameterivNV(GLenum stage,
311                                        GLenum portion,
312                                        GLenum pname,
313                                        GLint *params);
314
315    void GetFinalCombinerInputParameterfvNV(GLenum variable,
316                                            GLenum pname,
317                                            GLfloat *params);
318
319    void GetFinalCombinerInputParameterivNV(GLenum variable,
320                                            GLenum pname,
321                                            GLint *params);
322
323New Tokens
324
325    Accepted by the <cap> parameter of Enable, Disable, and IsEnabled,
326    and by the <pname> parameter of GetBooleanv, GetIntegerv,
327    GetFloatv, and GetDoublev:
328
329        REGISTER_COMBINERS_NV              0x8522
330
331    Accepted by the <stage> parameter of CombinerInputNV,
332    CombinerOutputNV, GetCombinerInputParameterfvNV,
333    GetCombinerInputParameterivNV, GetCombinerOutputParameterfvNV,
334    and GetCombinerOutputParameterivNV:
335
336        COMBINER0_NV                       0x8550
337        COMBINER1_NV                       0x8551
338        COMBINER2_NV                       0x8552
339        COMBINER3_NV                       0x8553
340        COMBINER4_NV                       0x8554
341        COMBINER5_NV                       0x8555
342        COMBINER6_NV                       0x8556
343        COMBINER7_NV                       0x8557
344
345    Accepted by the <variable> parameter of CombinerInputNV,
346    GetCombinerInputParameterfvNV, and GetCombinerInputParameterivNV:
347
348        VARIABLE_A_NV                      0x8523
349        VARIABLE_B_NV                      0x8524
350        VARIABLE_C_NV                      0x8525
351        VARIABLE_D_NV                      0x8526
352
353    Accepted by the <variable> parameter of FinalCombinerInputNV,
354    GetFinalCombinerInputParameterfvNV, and
355    GetFinalCombinerInputParameterivNV:
356
357        VARIABLE_A_NV
358        VARIABLE_B_NV
359        VARIABLE_C_NV
360        VARIABLE_D_NV
361        VARIABLE_E_NV                      0x8527
362        VARIABLE_F_NV                      0x8528
363        VARIABLE_G_NV                      0x8529
364
365    Accepted by the <input> parameter of CombinerInputNV:
366
367        ZERO                                          (not new)
368        CONSTANT_COLOR0_NV                 0x852A
369        CONSTANT_COLOR1_NV                 0x852B
370        FOG                                           (not new)
371        PRIMARY_COLOR_NV                   0x852C
372        SECONDARY_COLOR_NV                 0x852D
373        SPARE0_NV                          0x852E
374        SPARE1_NV                          0x852F
375        TEXTURE0_ARB                                  (see ARB_multitexture)
376        TEXTURE1_ARB                                  (see ARB_multitexture)
377
378    Accepted by the <mapping> parameter of CombinerInputNV:
379
380        UNSIGNED_IDENTITY_NV               0x8536
381        UNSIGNED_INVERT_NV                 0x8537
382        EXPAND_NORMAL_NV                   0x8538
383        EXPAND_NEGATE_NV                   0x8539
384        HALF_BIAS_NORMAL_NV                0x853A
385        HALF_BIAS_NEGATE_NV                0x853B
386        SIGNED_IDENTITY_NV                 0x853C
387        SIGNED_NEGATE_NV                   0x853D
388
389    Accepted by the <input> parameter of FinalCombinerInputNV:
390
391        ZERO                                          (not new)
392        CONSTANT_COLOR0_NV
393        CONSTANT_COLOR1_NV
394        FOG                                           (not new)
395        PRIMARY_COLOR_NV
396        SECONDARY_COLOR_NV
397        SPARE0_NV
398        SPARE1_NV
399        TEXTURE0_ARB                                  (see ARB_multitexture)
400        TEXTURE1_ARB                                  (see ARB_multitexture)
401        E_TIMES_F_NV                       0x8531
402        SPARE0_PLUS_SECONDARY_COLOR_NV     0x8532
403
404    Accepted by the <mapping> parameter of FinalCombinerInputNV:
405
406        UNSIGNED_IDENTITY_NV
407        UNSIGNED_INVERT_NV
408
409    Accepted by the <scale> parameter of CombinerOutputNV:
410
411        NONE                                          (not new)
412        SCALE_BY_TWO_NV                    0x853E
413        SCALE_BY_FOUR_NV                   0x853F
414        SCALE_BY_ONE_HALF_NV               0x8540
415
416    Accepted by the <bias> parameter of CombinerOutputNV:
417
418        NONE                                          (not new)
419        BIAS_BY_NEGATIVE_ONE_HALF_NV       0x8541
420
421    Accepted by the <abOutput>, <cdOutput>, and <sumOutput> parameter
422    of CombinerOutputNV:
423
424        DISCARD_NV                         0x8530
425        PRIMARY_COLOR_NV
426        SECONDARY_COLOR_NV
427        SPARE0_NV
428        SPARE1_NV
429        TEXTURE0_ARB                                  (see ARB_multitexture)
430        TEXTURE1_ARB                                  (see ARB_multitexture)
431
432    Accepted by the <pname> parameter of GetCombinerInputParameterfvNV
433    and GetCombinerInputParameterivNV:
434
435        COMBINER_INPUT_NV                  0x8542
436        COMBINER_MAPPING_NV                0x8543
437        COMBINER_COMPONENT_USAGE_NV        0x8544
438
439    Accepted by the <pname> parameter of GetCombinerOutputParameterfvNV
440    and GetCombinerOutputParameterivNV:
441
442        COMBINER_AB_DOT_PRODUCT_NV         0x8545
443        COMBINER_CD_DOT_PRODUCT_NV         0x8546
444        COMBINER_MUX_SUM_NV                0x8547
445        COMBINER_SCALE_NV                  0x8548
446        COMBINER_BIAS_NV                   0x8549
447        COMBINER_AB_OUTPUT_NV              0x854A
448        COMBINER_CD_OUTPUT_NV              0x854B
449        COMBINER_SUM_OUTPUT_NV             0x854C
450
451    Accepted by the <pname> parameter of CombinerParameterfvNV,
452    CombinerParameterivNV, GetBooleanv, GetDoublev, GetFloatv, and
453    GetIntegerv:
454
455        CONSTANT_COLOR0_NV
456        CONSTANT_COLOR1_NV
457
458    Accepted by the <pname> parameter of CombinerParameterfvNV,
459    CombinerParameterivNV, CombinerParameterfNV, CombinerParameteriNV,
460    GetBooleanv, GetDoublev, GetFloatv, and GetIntegerv:
461
462        NUM_GENERAL_COMBINERS_NV           0x854E
463        COLOR_SUM_CLAMP_NV                 0x854F
464
465    Accepted by the <pname> parameter of GetFinalCombinerInputParameterfvNV
466    and GetFinalCombinerInputParameterivNV:
467
468        COMBINER_INPUT_NV
469        COMBINER_MAPPING_NV
470        COMBINER_COMPONENT_USAGE_NV
471
472    Accepted by the <pname> parameter of GetBooleanv, GetDoublev,
473    GetFloatv, and GetIntegerv:
474
475        MAX_GENERAL_COMBINERS_NV           0x854D
476
477Additions to Chapter 2 of the 1.2 Specification (OpenGL Operation)
478
479     None
480
481Additions to Chapter 3 of the 1.2 Specification (Rasterization)
482
483 --  Figure 3.1 "Rasterization" (page 58)
484
485     +  Change the "Texturing" block to say "Texture Fetching".
486
487     +  Insert a new block between "Texture Fetching" and "Color Sum".
488        Name the new block "Texture Environment Application".
489
490     +  Insert a new block after "Texture Fetching".  Name the new block
491        "Register Combiners Application".
492
493     +  The output of the "Texture Fetching" stage feeds to both "Texture
494        Environment Application" and "Register Combiners Application".
495
496     +  The input for "Color Sum" comes from "Texture Environment
497        Application".
498
499     +  The output to "Fragments" is switched (controlled by
500        Disable/Enable REGISTER_COMBINERS_NV) between the output of "Fog"
501        and "Register Combiners Application".
502
503     Essentially, when register combiners are enabled, the entire standard
504     texture environment application, color sum, and fog blocks are
505     replaced with the single register combiners block.  [Note that this
506     is different from how the NV_texture_env_combine4 extension works;
507     that extension controls the texture environment application
508     block, but still uses the standard color sum and fog blocks.]
509
510 --  NEW Section 3.8.12 "Register Combiners Application"
511
512     "In parallel to the texture application, color sum, and fog processes
513     described in sections 3.8.10, 3.9, and 3.10, register combiners
514     provide a means of computing fcoc, the final combiner output color,
515     for each fragment generated by rasterization.
516
517     The register combiners consist of two or more general combiner stages
518     arranged in a fixed sequence ordered by each combiner stage's number.
519     An implementation supports a maximum number of general combiners
520     stages, which may be queried by calling GetIntegerv with the symbolic
521     constant MAX_GENERAL_COMBINERS_NV.  Implementations must
522     support at least two general combiner stages.  The general combiner
523     stages are named COMBINER0_NV, COMBINER1_NV, and so on.
524
525     Each general combiner in the sequence receives its inputs and
526     computes its outputs in an identical manner.  At the end of the
527     sequence of general combiner stages, there is a final combiner stage
528     that operates in a different manner than the general combiner stages.
529     The general combiner operation is described first, followed by a
530     description of the final combiner operation.
531
532     Each combiner stage (the general combiner stages and the final
533     combiner stage) has an associated combiner register set.  Each
534     combiner register set contains <n> RGBA vectors with components
535     ranging from -1.0 to 1.0 where <n> is 8 plus the maximum number
536     of active textures supported (that is, the implementation's value
537     for MAX_TEXTURE_UNITS_ARB).  The combiner register set entries
538     are listed in the table NV_register_combiners.1.
539
540     [ Table NV_register_combiners.1 ]
541
542                                Initial                        Output
543        Register Name           Value       Reference          Status
544        ---------------------   ----------  ----------------   ---------
545        ZERO                    0           -                  read only
546        CONSTANT_COLOR0_NV      ccc0        Section 3.8.12.1   read only
547        CONSTANT_COLOR1_NV      ccc1        Section 3.8.12.1   read only
548        FOG                     Cf          Section 3.10       read only
549        PRIMARY_COLOR_NV        cpri        Section 2.13.1     read/write
550        SECONDARY_COLOR_NV      csec        Section 2.13.1     read/write
551        SPARE0_NV               see below   Section 3.8.12     read/write
552        SPARE1_NV               undefined   Section 3.8.12     read/write
553        TEXTURE0_ARB            CT0         Figure E.2         read/write
554        TEXTURE1_ARB            CT1         Figure E.2         read/write
555        TEXTURE<i>_ARB          CT<i>       Figure E.2         read/write
556
557     The register set of COMBINER0_NV, the first combiner stage,
558     is initialized as described in table NV_register_combiners.1.
559
560     The initial value of the alpha portion of register SECONDARY_COLOR_NV
561     is undefined.  The initial value of the alpha portion of register
562     SPARE0_NV is the alpha component of texture 0 if texturing is
563     enabled for texture 0; however, the initial value of the RGB portion
564     SPARE0_NV is undefined.  The initial value of the SPARE1_NV register
565     is undefined.  The initial of registers TEXTURE0_ARB, TEXTURE1_ARB,
566     and TEXTURE<i>_ARB are undefined if texturing is not enabled for
567     textures 0, 1, and <i>, respectively.
568
569     The mapping of texture components to components of texture registers
570     is summarized in Table NV_register_combiners.2.  In the following
571     table, At, Lt, It, Rt, Gt, Bt, and Dt, are the filtered texel
572     values.
573
574     [Table NV_register_combiners.2]: Correspondence of texture components
575     to register components for texture registers.
576
577        Base Internal Format            RGB Values      Alpha Value
578        --------------------            ----------      -----------
579        ALPHA                           0,  0,  0       At
580        LUMINANCE                       Lt, Lt, Lt      1
581        LUMINANCE_ALPHA                 Lt, Lt, Lt      At
582        INTENSITY                       It, It, It      It
583        RGB                             Rt, Gt, Bt      1
584        RGBA                            Rt, Gt, Bt      At
585
586        DEPTH_COMPONENT                 0,  0,  0,      Lt
587          (when TEXTURE_COMPARE_MODE_ARB is NONE -or-
588                TEXTURE_COMPARE_SGIX is false)
589        DEPTH_COMPONENT                 Lt, Lt, Lt,     Lt
590          (when TEXTURE_COMPARE_MODE_ARB is COMPARE_R_TO_TEXTURE -or-
591                TEXTURE_COMPARE_SGIX is true)
592
593        HILO_NV                         0,  0,  0,      0
594        DSDT_NV                         0,  0,  0,      0
595        DSDT_MAG_NV                     0,  0,  0,      0
596        DSDT_MAG_INTENSITY_NV           0,  0,  0,      It
597
598     Note that the ALPHA, DEPTH_COMPONENT, and DSDT_MAG_INTENSITY_NV
599     base internal formats are mapped to components differently than
600     one could infer from the standard texture environment operations
601     with this formats.  A texture's DEPTH_TEXTURE_MODE_ARB state (see
602     the ARB_depth_texture extension) is irrelevant for determining the
603     correspondence of texture components to register components for
604     texture registers when REGISTER_COMBINERS_NV is enabled.
605
606     3.8.12.1  Combiner Parameters
607
608     Combiner parameters are specified by
609
610         CombinerParameterfvNV(GLenum pname, const GLfloat *params);
611         CombinerParameterivNV(GLenum pname, const GLint *params);
612         CombinerParameterfNV(GLenum pname, GLfloat param);
613         CombinerParameteriNV(GLenum pname, GLint param);
614
615     <pname> is a symbolic constant indicating which parameter is to be
616     set as described in the table NV_register_combiners.3:
617
618     [ Table NV_register_combiners.3 ]
619                                               Number
620       Parameter   Name                        of values   Type
621       ---------   -------------------------   ---------   ---------------
622       ccc0        CONSTANT_COLOR0_NV          4           color
623       ccc1        CONSTANT_COLOR1_NV          4           color
624       ngc         NUM_GENERAL_COMBINERS_NV    1           positive integer
625       csc         COLOR_SUM_CLAMP_NV          1           boolean
626
627     <params> is a pointer to a group of values to which to set the
628     indicated parameter.  <param> is simply the indicated parameter.
629     The number of values pointed to depends on the parameter being
630     set as shown in the table above.  Color parameters specified with
631     CombinerParameter*NV are converted to floating-point values (if
632     specified as integers) as indicated by Table 2.6 for signed integers.
633     The floating-point color values are then clamped to the range [0,1].
634
635     The values ccc0 and ccc1 named by CONSTANT_COLOR0_NV and
636     CONSTANT_COLOR1_NV are constant colors available for inputs to the
637     combiner stages.  The value ngc named by NUM_GENERAL_COMBINERS_NV
638     is a positive integer indicating how many general combiner stages are
639     active, that is, how many general combiner stages a fragment should
640     be processed by.  Setting ngc to a value less than one or
641     greater than the value of MAX_GENERAL_COMBINERS_NV generates an
642     INVALID_VALUE error.  The value csc named by COLOR_SUM_CLAMP_NV
643     is a boolean described in section 3.8.12.3.
644
645     3.8.12.2  General Combiner Stage Operation
646
647     The command
648
649         CombinerInputNV(GLenum stage,
650                         GLenum portion,
651                         GLenum variable,
652                         GLenum input,
653                         GLenum mapping,
654                         GLenum componentUsage);
655
656     controls the assignment of all the general combiner input variables.
657     For the RGB combiner portion, these are Argb, Brgb, Crgb, and
658     Drgb; and for the combiner alpha portion, these are Aa, Ba, Ca,
659     and Da.  The <stage> parameter is a symbolic constant of the form
660     COMBINER<i>_NV, indicating that general combiner stage <i> is to
661     be updated.  The constant COMBINER<i>_NV = COMBINER0_NV + <i>
662     where <i> is in the range 0 to <k>-1 and <k> is the implementation
663     dependent value of MAX_COMBINERS_NV.  The <portion> parameter
664     may be either RGB or ALPHA and determines whether the RGB color
665     vector or alpha scalar portion of the specified combiner stage is
666     updated.  The <variable> parameter may be one of VARIABLE_A_NV,
667     VARIABLE_B_NV, VARIABLE_C_NV, or VARIABLE_D_NV and determines
668     which respective variable of the specified combiner stage and
669     combiner stage portion is updated.
670
671     The <input>, <mapping>, and <componentUsage> parameters specify
672     the assignment of a value for the input variable indicated by
673     <stage>, <portion>, and <variable>.  The <input> parameter may be
674     one of the register names from table NV_register_combiners.1.
675
676     The <componentUsage> parameter may be one of RGB, ALPHA, or BLUE.
677
678     When the <portion> parameter is RGB, a <componentUsage> parameter
679     of RGB indicates that the RGB portion of the indicated register
680     should be assigned to the RGB portion of the combiner input variable,
681     while an ALPHA <componentUsage> parameter indicates that the
682     alpha portion of the indicated register should be replicated across
683     the RGB portion of the combiner input variable.
684
685     When the <portion> parameter is ALPHA, the <componentUsage>
686     parameter of ALPHA indicates that the alpha portion of the indicated
687     register should be assigned to the alpha portion of the combiner
688     input variable, while a BLUE <componentUsage> parameter indicates
689     that the blue component of the indicated register should be assigned
690     to the alpha portion of the combiner input variable.
691
692     When the <portion> parameter is ALPHA, a <componentUsage> parameter
693     of RGB generates an INVALID_OPERATION error.  When the <portion>
694     parameter is RGB, a <componentUsage> parameter of BLUE generates
695     an INVALID_OPERATION error.
696
697     When the <componentUsage> parameter is ALPHA, an <input> parameter
698     of FOG generates an INVALID_OPERATION error.  The alpha component of
699     the fog register is only available in the final combiner.  The alpha
700     component of the fog register is the fragment's fog factor when fog
701     is enabled; otherwise, the alpha component of the fog register is
702     one.
703
704     Before the value in the register named by <input> is assigned to the
705     specified input variable, a range mapping is performed based on
706     <mapping>.  The mapping may be one of the tokens from the table
707     NV_register_combiners.4.
708
709     [ Table NV_register_combiners.4 ]
710
711       Mapping Name              Mapping Function
712       -----------------------   -------------------------------------
713       UNSIGNED_IDENTITY_NV      max(0.0, e)
714       UNSIGNED_INVERT_NV        1.0 - min(max(e, 0.0), 1.0)
715       EXPAND_NORMAL_NV          2.0 * max(0.0, e) - 1.0
716       EXPAND_NEGATE_NV          -2.0 * max(0.0, e) + 1.0
717       HALF_BIAS_NORMAL_NV       max(0.0, e) - 0.5
718       HALF_BIAS_NEGATE_NV       -max(0.0, e) + 0.5
719       SIGNED_IDENTITY_NV        e
720       SIGNED_NEGATE_NV          -e
721
722     Based on the <mapping> parameter, the mapping function in the table
723     above is evaluated for each element <e> of the input vector before
724     assigning the result to the specified input variable.  Note that
725     the mapping for the RGB and alpha portion of each input variable
726     is distinct.
727
728     Each general combiner stage computes the following ten expressions
729     based on the values assigned to the variables Argb, Brgb, Crgb,
730     Drgb, Aa, Ba, Ca, and Da as determined by the combiner state set
731     by CombinerInputNV.
732
733     ["gcc" stands for general combiner computation.]
734
735        gcc1rgb = [ Argb[r]*Brgb[r], Argb[g]*Brgb[g], Argb[b]*Brgb[b] ]
736
737        gcc2rgb = [ Argb[r]*Brgb[r] + Argb[g]*Brgb[g] + Argb[b]*Brgb[b],
738                    Argb[r]*Brgb[r] + Argb[g]*Brgb[g] + Argb[b]*Brgb[b],
739                    Argb[r]*Brgb[r] + Argb[g]*Brgb[g] + Argb[b]*Brgb[b] ]
740
741        gcc3rgb = [ Crgb[r]*Drgb[r], Crgb[g]*Drgb[g], Crgb[b]*Drgb[b] ]
742
743        gcc4rgb = [ Crgb[r]*Drgb[r] + Crgb[g]*Drgb[g] + Crgb[b]*Drgb[b],
744                    Crgb[r]*Drgb[r] + Crgb[g]*Drgb[g] + Crgb[b]*Drgb[b],
745                    Crgb[r]*Drgb[r] + Crgb[g]*Drgb[g] + Crgb[b]*Drgb[b] ]
746
747        gcc5rgb = gcc1rgb + gcc3rgb
748
749        gcc6rgb = gcc1rgb or gcc3rgb               [see below]
750
751        gcc1a   = Aa * Ba
752
753        gcc2a   = Ca * Da
754
755        gcc3a   = gcc1a + gcc2a
756
757        gcc4a   = gcc1a or gcc2a                   [see below]
758
759     The computation of gcc6rgb and gcc4a involves a special "or"
760     operation.  This operation evaluates to the left-hand operand if
761     the alpha component of the combiner's SPARE0_NV register is less than
762     0.5; otherwise, the operation evaluates to the right-hand operand.
763
764     The command
765
766         CombinerOutputNV(GLenum stage,
767                          GLenum portion,
768                          GLenum abOutput,
769                          GLenum cdOutput,
770                          GLenum sumOutput,
771                          GLenum scale,
772                          GLenum bias,
773                          GLboolean abDotProduct,
774                          GLboolean cdDotProduct,
775                          GLboolean muxSum);
776
777     controls the general combiner output operation including designating
778     the register set locations where results of the general combiner's
779     three computations are written.  The <stage> and <portion>
780     parameters take the same values as the respective parameters for
781     CombinerInputNV.
782
783     If the <portion> parameter is ALPHA, specifying a non-FALSE value
784     for either of the parameters <abDotProduct> or <cdDotProduct>,
785     generates an INVALID_VALUE error.
786
787     The <scale> parameter must be one of NONE, SCALE_BY_TWO_NV,
788     SCALE_BY_FOUR_NV, or SCALE_BY_ONE_HALF_NV and specifies the
789     value of the combiner stage's portion scale, either cscalergb or
790     cscalea depending on the <portion> parameter, to 1.0, 2.0, 4.0,
791     or 0.5, respectively.
792
793     The <bias> parameter must be either NONE or
794     BIAS_BY_NEGATIVE_ONE_HALF_NV and specifies the value of the
795     combiner stage's portion bias, either cbiasrgb or cbiasa depending
796     on the <portion> parameter, to 0.0 or -0.5, respectively.  If <scale>
797     is either SCALE_BY_ONE_HALF_NV or SCALE_BY_FOUR_NV, a <bias> of
798     BIAS_BY_NEGATIVE_ONE_HALF_NV generates an INVALID_OPERATION error.
799
800     If the <abDotProduct> parameter is FALSE, then
801
802        if <portion> is RGB,     out1rgb = max(min(gcc1rgb + cbiasrgb) * cscalergb, 1), -1)
803        if <portion> is ALPHA,   out1a   = max(min((gcc1a + cbiasa) * cscalea, 1), -1)
804
805     otherwise <portion> must be RGB and
806
807        out1rgb = max(min((gcc2rgb + cbiasrgb) * cscalergb, 1), -1)
808
809     If the <cdDotProduct> parameter is FALSE, then
810
811        if <portion> is RGB,      out2rgb = max(min((gcc3rgb + cbiasrgb) * cscalergb, 1), -1)
812        if <portion> is ALPHA,    out2a   = max(min((gcc2a + cbiasa) * cscalea, 1), -1)
813
814     otherwise <portion> must be RGB so
815
816        out2rgb = max(min((gcc4rgb + cbiasrgb) * cscalergb, 1), -1)
817
818     If the <muxSum> parameter is FALSE, then
819
820        if <portion> is RGB,      out3rgb = max(min((gcc5rgb + cbiasrgb) * cscalergb, 1), -1)
821        if <portion> is ALPHA,    out3a   = max(min((gcc3a + cbiasa) * cscalea, 1), -1)
822
823     otherwise
824
825        if <portion> is RGB,      out3rgb = max(min((gcc6rgb + cbiasrgb) * cscalergb, 1), -1)
826        if <portion> is ALPHA,    out3a   = max(min((gcc4a + cbiasa) * cscalea, 1), -1)
827
828     out1rgb, out2rgb, and out3rgb are written to the RGB portion of
829     combiner stage's registers named by <abOutput>, <cdOutput>, and
830     <sumOutput> respectively.  out1a, out2a, and out3a are written to
831     the alpha portion of combiner stage's registers named by <abOutput>,
832     <cdOutput>, and <sumOutput> respectively.  The parameters <abOutput>,
833     <cdOutput>, and <sumOutput> must be either DISCARD_NV or one of
834     the register names from table NV_register_combiners.1 that has an output
835     status of read/write.  If an output is set to DISCARD_NV, that
836     output is not written to any register.  The error INVALID_OPERATION
837     is generated if <abOutput>, <cdOutput>, and <sumOutput> do not all
838     name unique register names (though multiple outputs to DISCARD_NV
839     are legal).
840
841     When the general combiner stage's register set is written based on
842     the computed outputs, the updated register set is copied to the
843     register set of the subsequent combiner stage in the combiner
844     sequence.  Copied undefined values are likewise undefined.
845     The subsequent combiner stage following the last active general
846     combiner stage, indicated by the general combiner stage's number
847     being equal to ngc-1, in the sequence is the final combiner
848     stage.  In other words, the number of general combiner stages
849     each fragment is transformed by is determined by the value of
850     NUM_GENERAL_COMBINERS_NV.
851
852     3.8.12.3  Final Combiner Stage Operation
853
854     The final combiner stage operates differently from the general
855     combiner stages.  While a general combiner stage updates its register
856     set and passes the register set to the next combiner stage, the final
857     combiner outputs an RGBA color fcoc, the final combiner output color.
858     The final combiner stage is capable of applying the standard OpenGL
859     color sum and fog operations, but has the configurability to be
860     used for other purposes.
861
862     The command
863
864        FinalCombinerInputNV(GLenum variable,
865                             GLenum input,
866                             GLenum mapping,
867                             GLenum componentUsage);
868
869     controls the assignment of all the final combiner input variables.
870     The variables A, B, C, D, E, and F are RGB vectors.  The variable
871     G is an alpha scalar.  The <variable> parameter may be one of
872     VARIABLE_A_NV, VARIABLE_B_NV, VARIABLE_C_NV, VARIABLE_D_NV,
873     VARIABLE_E_NV, VARIABLE_F_NV, and VARIABLE_G_NV, and determines
874     which respective variable of the final combiner stage is updated.
875
876     The <input>, <mapping>, and <componentUsage> parameters specify
877     the assignment of a value for the input variable indicated by
878     <variable>.
879
880     The <input> parameter may be any one of the register names from
881     table NV_register_combiners.1 or be one of two pseudo-register
882     names, either E_TIMES_F_NV or SPARE0_PLUS_SECONDARY_COLOR_NV.
883     The value of E_TIMES_F_NV is the product of the value of
884     variable E times the value of variable F.  The value of
885     SPARE0_PLUS_SECONDARY_COLOR_NV is the value the SPARE0_NV
886     register mapped using the UNSIGNED_IDENITY_NV input mapping plus
887     the value of the SECONDARY_COLOR_NV register mapped using the
888     UNSIGNED_IDENTITY_NV input mapping.  If csc, the color sum clamp,
889     is non-FALSE, the value of SPARE0_PLUS_SECONDARY_COLOR_NV is first
890     clamped to the range [0,1].  The alpha component of E_TIMES_F_NV
891     and SPARE0_PLUS_SECONDARY_COLOR_NV is always zero.
892
893     When <variable> is one of VARIABLE_E_NV, VARIABLE_F_NV,
894     or VARIABLE_G_NV and <input> is either E_TIMES_F_NV or
895     SPARE0_PLUS_SECONDARY_COLOR_NV, generate an INVALID_OPERATION
896     error.  When <variable> is VARIABLE_A_NV and <input> is
897     SPARE0_PLUS_SECONDARY_COLOR_NV, generate an INVALID_OPERATION
898     error.
899
900     The <componentUsage> parameter may be one of RGB, BLUE, ALPHA
901     (with certain restrictions depending on the <variable> and <input>
902     as described below).
903
904     When the <variable> parameter is not VARIABLE_G_NV, a
905     <componentUsage> parameter of RGB indicates that the RGB portion of
906     the indicated register should be assigned to the RGB portion of the
907     combiner input variable, while an ALPHA <componentUsage> parameter
908     indicates that the alpha portion of the indicated register should
909     be replicated across the RGB portion of the combiner input variable.
910
911     When the <variable> parameter is VARIABLE_G_NV, a <componentUsage>
912     parameter of ALPHA indicates that the alpha component of the
913     indicated register should be assigned to the alpha portion of the
914     G input variable, while a BLUE <componentUsage> parameter indicates
915     that the blue component of the indicated register should be assigned
916     to the alpha portion of the G input variable.
917
918     The INVALID_OPERATION error is generated when <componentUsage> is
919     BLUE and <variable> is not VARIABLE_G_NV.  The INVALID_OPERATION
920     error is generated when <componentUsage> is RGB and <variable>
921     is VARIABLE_G_NV.
922
923     The INVALID_OPERATION error is generated when both the <input>
924     parameter is either E_TIMES_F_NV or SPARE0_PLUS_SECONDARY_COLOR_NV
925     and the <componentUsage> parameter is ALPHA or BLUE.
926
927     Before the value in the register named by <input> is assigned to
928     the specified input variable, a range mapping is performed based
929     on <mapping>.  The mapping may be either UNSIGNED_IDENTITY_NV
930     or UNSIGNED_INVERT_NV and operates as specified in table
931     NV_register_combiners.4.
932
933     The final combiner stage computes the following expression based
934     on the values assigned to the variables A, B, C, D, E, F, and G as
935     determined by the combiner state set by FinalCombinerInputNV
936
937       fcoc = [ min(ab[r] + iac[r] + D[r], 1.0),
938                min(ab[g] + iac[g] + D[g], 1.0),
939                min(ab[b] + iac[b] + D[b], 1.0),
940                G ]
941
942     where
943
944       ab   = [ A[r]*B[r], A[g]*B[g], A[b]*B[b] ]
945       iac  = [ (1.0 -A [r])*C[r], (1.0 - A[g])*C[g], (1.0 - A[b])*C[b] ]
946
947     3.8.12.4  Required State
948
949     The state required for the register combiners is a bit indicating
950     whether register combiners are enabled or disabled, an integer
951     indicating how many general combiners are active, a bit indicating
952     whether or not the color sum clamp to 1 should be performed, two
953     RGBA constant colors, <n> sets of general combiner stage state where
954     <n> is the value of MAX_GENERAL_COMBINERS_NV, and the final
955     combiner stage state.  The per-stage general combiner state consists
956     of the RGB input portion state and the alpha input portion state.
957     Each portion (RGB and alpha) of the per-stage general combiner
958     state consists of: four integers indicating the input register for
959     the four variables A, B, C, and D; four integers to indicate each
960     variable's range mapping; four bits to indicate whether to use the
961     alpha component of the input for each variable; a bit indicating
962     whether the AB dot product should be output; a bit indicating
963     whether the CD dot product should be output; a bit indicating
964     whether the sum or mux output should be output; two integers to
965     maintain the output scale and bias enumerants; three integers to
966     maintain the output register set names.  The final combiner stage
967     state consists of seven integers to indicate the input register
968     for the seven variables A, B, C, D, E, F, and G; seven integers to
969     indicate each variable's range mapping; and seven bits to indicate
970     whether to use the alpha component of the input for each variable.
971
972     The general combiner per-stage state is initialized as described
973     in table NV_register_combiners.5.
974
975     [ Table NV_register_combiners.5 ]
976
977                                                  Component
978        Portion   Variable   Input                Usage       Mapping
979        -------   --------   ------------------   ---------   ----------------------
980         RGB       A         PRIMARY_COLOR_NV     RGB         UNSIGNED_IDENTITY_NV
981         RGB       B         ZERO                 RGB         UNSIGNED_INVERT_NV
982         RGB       C         ZERO                 RGB         UNSIGNED_IDENTITY_NV
983         RGB       D         ZERO                 RGB         UNSIGNED_IDENTITY_NV
984         alpha     A         PRIMARY_COLOR_NV     ALPHA       UNSIGNED_IDENTITY_NV
985         alpha     B         ZERO                 ALPHA       UNSIGNED_INVERT_NV
986         alpha     C         ZERO                 ALPHA       UNSIGNED_IDENTITY_NV
987         alpha     D         ZERO                 ALPHA       UNSIGNED_IDENTITY_NV
988
989     The final combiner stage state is initialized as described in table
990     NV_register_combiners.6.
991
992     [ Table NV_register_combiners.6 ]
993
994                                                      Component
995        Variable   Input                              Usage       Mapping
996        --------   --------------------------------   ---------   ----------------------
997         A         FOG                                ALPHA       UNSIGNED_IDENTITY_NV
998         B         SPARE0_PLUS_SECONDARY_COLOR_NV     RGB         UNSIGNED_IDENTITY_NV
999         C         FOG                                RGB         UNSIGNED_IDENTITY_NV
1000         D         ZERO                               RGB         UNSIGNED_IDENTITY_NV
1001         E         ZERO                               RGB         UNSIGNED_IDENTITY_NV
1002         F         ZERO                               RGB         UNSIGNED_IDENTITY_NV
1003         G         SPARE0_NV                          ALPHA       UNSIGNED_IDENTITY_NV"
1004
1005 --  NEW Section 3.8.11 "Antialiasing Application"
1006
1007     Insert the following paragraph BEFORE the section's first paragraph:
1008
1009     "Register combiners are enabled or disabled using the generic Enable
1010     and Disable commands, respectively, with the symbolic constant
1011     REGISTER_COMBINERS_NV.  If the register combiners are enabled (and not in color
1012     index mode), the fragment's color value is replaced with fcoc, the
1013     final combiner output color, computed in section 3.8.12; otherwise,
1014     the fragment's color value is the result of the fog application
1015     in section 3.10."
1016
1017Additions to Chapter 4 of the 1.2 Specification (Per-Fragment Operations
1018and the Frame Buffer)
1019
1020     None
1021
1022Additions to Chapter 5 of the 1.2 Specification (Special Functions)
1023
1024     None
1025
1026Additions to Chapter 6 of the 1.2 Specification (State and State Requests)
1027
1028 --  Section 6.1.3 "Enumerated Queries"
1029
1030     Change the first two sentences (page 182) to say:
1031
1032     "Other commands exist to obtain state variables that are identified by
1033     a category (clip plane, light, material, combiners, etc.) as well as
1034     a symbolic constant.  These are"
1035
1036     Add to the bottom of the list of function prototypes (page 183):
1037
1038       void GetCombinerInputParameterfvNV(GLenum stage, GLenum portion, GLenum variable,
1039                                          GLenum pname, const GLfloat *params);
1040       void GetCombinerInputParameterivNV(GLenum stage, GLenum portion, GLenum variable,
1041                                          GLenum pname, const GLint *params);
1042       void GetCombinerOutputParameterfvNV(GLenum stage, GLenum portion, GLenum pname, const GLfloat *params);
1043       void GetCombinerOutputParameterivNV(GLenum stage, GLenum portion, GLenum pname, GLint *params);
1044       void GetFinalCombinerInputParameterfvNV(GLenum variable, GLenum pname, const GLfloat *params);
1045       void GetFinalCombinerInputParameterivNV(GLenum variable, GLenum pname, const GLfloat *params);
1046
1047     Add the following paragraph to the end of the section (page 184):
1048
1049     "The GetCombinerInputParameterfvNV,
1050     GetCombinerInputParameterivNV, GetCombinerOutputParameterfvNV,
1051     and GetCombinerOutputParameterivNV parameter <stage> may be one of
1052     COMBINER0_NV, COMBINER1_NV, and so on, indicating which general
1053     combiner stage to query.  The GetCombinerInputParameterfvNV,
1054     GetCombinerInputParameterivNV, GetCombinerOutputParameterfvNV,
1055     and GetCombinerOutputParameterivNV parameter <portion> may be
1056     either RGB or ALPHA, indicating which portion of the general
1057     combiner stage to query.  The GetCombinerInputParameterfvNV
1058     and GetCombinerInputParameterivNV parameter <variable> may
1059     be one of VARIABLE_A_NV, VARIABLE_B_NV, VARIABLE_C_NV,
1060     or VARIABLE_D_NV, indicating which variable of the general
1061     combiner stage to query.  The GetFinalCombinerInputParameterfvNV
1062     and GetFinalCombinerInputParameterivNV parameter <variable> may be one
1063     of VARIABLE_A_NV, VARIABLE_B_NV, VARIABLE_C_NV, VARIABLE_D_NV,
1064     VARIABLE_E_NV, VARIABLE_F_NV, or VARIABLE_G_NV."
1065
1066Additions to the GLX Specification
1067
1068    None.
1069
1070GLX Protocol
1071
1072    Thirteen new GL commands are added.
1073
1074    The following seven rendering commands are sent to the sever as part
1075    of a glXRender request:
1076
1077        CombinerParameterfNV
1078            2           12              rendering command length
1079            2           4136            rendering command opcode
1080            4           ENUM            pname
1081            4           FLOAT32         param
1082
1083        CombinerParameterfvNV
1084            2           8+4*n           rendering command length
1085            2           4137            rendering command opcode
1086            4           ENUM            pname
1087                        0x852A   n=4    GL_CONSANT_COLOR0_NV
1088                        0x852B   n=4    GL_CONSANT_COLOR1_NV
1089                        0x854E   n=1    GL_NUM_GENERAL_COMBINERS_NV
1090                        0x854F   n=1    GL_COLOR_SUM_CLAMP_NV
1091                        else     n=0
1092            4*n         LISTofFLOAT32   params
1093
1094        CombinerParameteriNV
1095            2           12              rendering command length
1096            2           4138            rendering command opcode
1097            4           ENUM            pname
1098            4           INT32           param
1099
1100        CombinerParameterivNV
1101            2           8+4*n           rendering command length
1102            2           4139            rendering command opcode
1103            4           ENUM            pname
1104                        0x852A   n=4    GL_CONSANT_COLOR0_NV
1105                        0x852B   n=4    GL_CONSANT_COLOR1_NV
1106                        0x854E   n=1    GL_NUM_GENERAL_COMBINERS_NV
1107                        0x854F   n=1    GL_COLOR_SUM_CLAMP_NV
1108                        else     n=0
1109            4*n         LISTofINT32     params
1110
1111        CombinerInputNV
1112            2           28              rendering command length
1113            2           4140            rendering command opcode
1114            4           ENUM            stage
1115            4           ENUM            portion
1116            4           ENUM            variable
1117            4           ENUM            input
1118            4           ENUM            mapping
1119            4           ENUM            componentUsage
1120
1121        CombinerOutputNV
1122            2           36              rendering command length
1123            2           4141            rendering command opcode
1124            4           ENUM            stage
1125            4           ENUM            portion
1126            4           ENUM            abOutput
1127            4           ENUM            cdOutput
1128            4           ENUM            sumOutput
1129            4           ENUM            scale
1130            4           ENUM            bias
1131            1           BOOL            abDotProduct
1132            1           BOOL            cdDotProduct
1133            1           BOOL            muxSum
1134            1           BOOL            unused
1135
1136        FinalCombinerInputNV
1137            2           20              rendering command length
1138            2           4142            rendering command opcode
1139            4           ENUM            variable
1140            4           ENUM            input
1141            4           ENUM            mapping
1142            4           ENUM            componentUsage
1143
1144    The remaining six commands are non-rendering commands.  These commands
1145    are sent separately (i.e., not as part of a glXRender or glXRenderLarge
1146    request), using the glXVendorPrivateWithReply request:
1147
1148        GetCombinerInputParameterfvNV
1149            1           CARD8           opcode (X assigned)
1150            1           17              GLX opcode (glXVendorPrivateWithReply)
1151            2           7               request length
1152            4           1270            vendor specific opcode
1153            4           GLX_CONTEXT_TAG context tag
1154            4           ENUM            stage
1155            4           ENUM            portion
1156            4           ENUM            variable
1157            4           ENUM            pname
1158          =>
1159            1           1               reply
1160            1                           unused
1161            2           CARD16          sequence number
1162            4           m               reply length, m = (n==1 ? 0 : n)
1163            4                           unused
1164            4           CARD32          unused
1165
1166            if (n=1) this follows:
1167
1168            4           FLOAT32         params
1169            12                          unused
1170
1171            otherwise this follows:
1172
1173            16                          unused
1174            n*4         LISTofFLOAT32   params
1175
1176        GetCombinerInputParameterivNV
1177            1           CARD8           opcode (X assigned)
1178            1           17              GLX opcode (glXVendorPrivateWithReply)
1179            2           7               request length
1180            4           1271            vendor specific opcode
1181            4           GLX_CONTEXT_TAG context tag
1182            4           ENUM            stage
1183            4           ENUM            portion
1184            4           ENUM            variable
1185            4           ENUM            pname
1186          =>
1187            1           1               reply
1188            1                           unused
1189            2           CARD16          sequence number
1190            4           m               reply length, m = (n==1 ? 0 : n)
1191            4                           unused
1192            4           CARD32          unused
1193
1194            if (n=1) this follows:
1195
1196            4           INT32           params
1197            12                          unused
1198
1199            otherwise this follows:
1200
1201            16                          unused
1202            n*4         LISTofINT32     params
1203
1204        GetCombinerOutputParameterfvNV
1205            1           CARD8           opcode (X assigned)
1206            1           17              GLX opcode (glXVendorPrivateWithReply)
1207            2           6               request length
1208            4           1272            vendor specific opcode
1209            4           GLX_CONTEXT_TAG context tag
1210            4           ENUM            stage
1211            4           ENUM            portion
1212            4           ENUM            pname
1213          =>
1214            1           1               reply
1215            1                           unused
1216            2           CARD16          sequence number
1217            4           m               reply length, m = (n==1 ? 0 : n)
1218            4                           unused
1219            4           CARD32          unused
1220
1221            if (n=1) this follows:
1222
1223            4           FLOAT32         params
1224            12                          unused
1225
1226            otherwise this follows:
1227
1228            16                          unused
1229            n*4         LISTofFLOAT32   params
1230
1231        GetCombinerOutputParameterivNV
1232            1           CARD8           opcode (X assigned)
1233            1           17              GLX opcode (glXVendorPrivateWithReply)
1234            2           6               request length
1235            4           1273            vendor specific opcode
1236            4           GLX_CONTEXT_TAG context tag
1237            4           ENUM            stage
1238            4           ENUM            portion
1239            4           ENUM            pname
1240          =>
1241            1           1               reply
1242            1                           unused
1243            2           CARD16          sequence number
1244            4           m               reply length, m = (n==1 ? 0 : n)
1245            4                           unused
1246            4           CARD32          unused
1247
1248            if (n=1) this follows:
1249
1250            4           INT32           params
1251            12                          unused
1252
1253            otherwise this follows:
1254
1255            16                          unused
1256            n*4         LISTofINT32     params
1257
1258        GetFinalCombinerInputParameterfvNV
1259            1           CARD8           opcode (X assigned)
1260            1           17              GLX opcode (glXVendorPrivateWithReply)
1261            2           5               request length
1262            4           1274            vendor specific opcode
1263            4           GLX_CONTEXT_TAG context tag
1264            4           ENUM            variable
1265            4           ENUM            pname
1266          =>
1267            1           1               reply
1268            1                           unused
1269            2           CARD16          sequence number
1270            4           m               reply length, m = (n==1 ? 0 : n)
1271            4                           unused
1272            4           CARD32          unused
1273
1274            if (n=1) this follows:
1275
1276            4           FLOAT32         params
1277            12                          unused
1278
1279            otherwise this follows:
1280
1281            16                          unused
1282            n*4         LISTofFLOAT32   params
1283
1284        GetFinalCombinerInputParameterivNV
1285            1           CARD8           opcode (X assigned)
1286            1           17              GLX opcode (glXVendorPrivateWithReply)
1287            2           5               request length
1288            4           1275            vendor specific opcode
1289            4           GLX_CONTEXT_TAG context tag
1290            4           ENUM            variable
1291            4           ENUM            pname
1292          =>
1293            1           1               reply
1294            1                           unused
1295            2           CARD16          sequence number
1296            4           m               reply length, m = (n==1 ? 0 : n)
1297            4                           unused
1298            4           CARD32          unused
1299
1300            if (n=1) this follows:
1301
1302            4           INT32           params
1303            12                          unused
1304
1305            otherwise this follows:
1306
1307            16                          unused
1308            n*4         LISTofINT32     params
1309
1310Dependencies on NV_texture_shader
1311
1312     If NV_texture_shader is not supported, references to HILO_NV,
1313     DSDT_NV, DSDT_MAG_NV, and DSDT_MAG_INTENSITY_NV base internal
1314     formats in this document are invalid and should be ignored.
1315
1316Dependencies on ARB_depth_texture and ARB_shadow -or- SGIX_depth_texture
1317and SGIX_shadow
1318
1319     If ARB_depth_texture and ARB_shadow -or- SGIX_depth_texture and
1320     SGIX_shadow are not supported, references to the DEPTH_COMPONENT base
1321     internal format in this document are invalid and should be ignored.
1322
1323     If ARB_depth_texture and ARB_shadow are not supported, references
1324     to the DEPTH_TEXTURE_MODE_ARB state in this document are invalid
1325     and should be ignored.
1326
1327Dependencies on ARB_color_buffer_float
1328
1329     If ARB_color_buffer_float is also implemented, then the "max(0,x)",
1330     "max(-1,x)" "min(1,x)", "min(x,1)", and "max(x,-1)" functions used
1331     in Table NV_register_combiners.4 and the formulas for computing
1332     out1rgb, out1a, out2rgb, out2a, out3rgb, out3a, and fcoc  when
1333     CLAMP_FRAGMENT_COLOR_ARB is either FIXED_ONLY_ARB when rendering
1334     to a floating-point color framebuffer or FALSE.
1335
1336     Also when CLAMP_FRAGMENT_COLOR_ARB is either FIXED_ONLY_ARB when
1337     rendering to a floating-point color framebuffer or FALSE, the
1338     COLOR COLOR_SUM_CLAMP_NV state operates as if TRUE regardless of
1339     its actual state.
1340
1341     The intent of these interactions is to eliminate the specified
1342     clamping behavior of register combiners when CLAMP_FRAGMENT_COLOR_ARB
1343     indicates clamping should not be performed.
1344
1345Errors
1346
1347     INVALID_VALUE is generated when CombinerParameterfvNV
1348     or CombinerParameterivNV is called with <pname> set to
1349     NUM_GENERAL_COMBINERS and the value pointed to by <params>
1350     is less than one or greater or equal to the value of
1351     MAX_GENERAL_COMBINERS_NV.
1352
1353     INVALID_OPERATION is generated when CombinerInputNV is called
1354     with a <componentUsage> parameter of RGB and a <portion> parameter
1355     of ALPHA.
1356
1357     INVALID_OPERATION is generated when CombinerInputNV is called
1358     with a <componentUsage> parameter of BLUE and a <portion> parameter
1359     of RGB.
1360
1361     INVALID_OPERATION is generated When CombinerInputNV is called with a
1362     <componentUsage> parameter of ALPHA and an <input> parameter of FOG.
1363
1364     INVALID_VALUE is generated when CombinerOutputNV is called with
1365     a <portion> parameter of ALPHA, but a non-FALSE value for either
1366     of the parameters <abDotProduct> or <cdDotProduct>.
1367
1368     INVALID_OPERATION is generated when CombinerOutputNV is called with
1369     a <scale> of either SCALE_BY_ONE_HALF_NV or SCALE_BY_FOUR_NV and
1370     a <bias> of BIAS_BY_NEGATIVE_ONE_HALF_NV.
1371
1372     INVALID_OPERATION is generated when CombinerOutputNV is called such
1373     that <abOutput>, <cdOutput>, and <sumOutput> do not all name unique
1374     register names (though multiple outputs to DISCARD_NV are legal).
1375
1376     INVALID_OPERATION is generated when FinalCombinerInputNV
1377     is called where <variable> is one of VARIABLE_E_NV,
1378     VARIABLE_F_NV, or VARIABLE_G_NV and <input> is E_TIMES_F_NV or
1379     SPARE0_PLUS_SECONDARY_COLOR_NV.
1380
1381     INVALID_OPERATION is generated when FinalCombinerInputNV
1382     is called where <variable> is VARIABLE_A_NV and <input> is
1383     SPARE0_PLUS_SECONDARY_COLOR_NV.
1384
1385     INVALID_OPERATION is generated when FinalCombinerInputNV is called
1386     with VARIABLE_G_NV for <variable> and RGB for <componentUsage>.
1387
1388     INVALID_OPERATION is generated when FinalCombinerInputNV is called
1389     with a value other than VARIABLE_G_NV for <variable> and BLUE for
1390     <componentUsage>.
1391
1392     INVALID_OPERATION is generated when FinalCombinerInputNV is
1393     called where the <input> parameter is either E_TIMES_F_NV or
1394     SPARE0_PLUS_SECONDARY_COLOR_NV and the <componentUsage> parameter
1395     is ALPHA.
1396
1397New State
1398
1399 --  (NEW table 6.29, after p217)
1400
1401Get Value                          Type      Get Command                          Initial Value           Description        Sec       Attribute
1402---------                          --------  ----------------------------------   ----------------------  ----------------   --------  --------------
1403REGISTER_COMBINERS_NV              B         IsEnabled                            False                   register           3.8.11    texture/enable
1404                                                                                                          combiners enable
1405NUM_GENERAL_COMBINERS_NV           Z+        GetIntegerv                          1                       number of active   3.8.12.1  texture
1406                                                                                                          combiner stages
1407COLOR_SUM_CLAMP_NV                 B         GetBooleanv                          True                    whether or not     3.8.12.1  texture
1408                                                                                                          SPARE0_PLUS_
1409                                                                                                          SECONDARY_
1410                                                                                                          COLOR_NV clamps
1411                                                                                                          combiner stages
1412CONSTANT_COLOR0_NV                 C         GetFloatv                            0,0,0,0                 combiner constant  3.8.12.1  texture
1413                                                                                                          color zero
1414CONSTANT_COLOR1_NV                 C         GetFloatv                            0,0,0,0                 combiner constant  3.8.12.1  texture
1415                                                                                                          color one
1416COMBINER_INPUT_NV                  Z8x#x2x4  GetCombinerInputParameter*NV         see 3.8.12.4            combiner input     3.8.12.2  texture
1417                                                                                                          variables
1418COMBINER_COMPONENT_USAGE_NV        Z3x#x2x4  GetCombinerInputParameter*NV         see 3.8.12.4            use alpha for      3.8.12.2  texture
1419                                                                                                          combiner input
1420COMBINER_MAPPING_NV                Z8x#x2x4  GetCombinerInputParameter*NV         see 3.8.12.4            complement         3.8.12.2  texture
1421                                                                                                          combiner input
1422COMBINER_AB_DOT_PRODUCT_NV         Bx#x2     GetCombinerOutputParameter*NV        False                   output AB dot      3.8.12.3  texture
1423                                                                                                          product
1424COMBINER_CD_DOT_PRODUCT_NV         Bx#x2     GetCombinerOutputParameter*NV        False                   output CD dot      3.8.12.3  texture
1425                                                                                                          product
1426COMBINER_MUX_SUM_NV                Bx#x2     GetCombinerOutputParameter*NV        False                   output mux sum     3.8.12.3  texture
1427COMBINER_SCALE_NV                  Z2x#x2    GetCombinerOutputParameter*NV        NONE                    output scale       3.8.12.3  texture
1428COMBINER_BIAS_NV                   Z2x#x2    GetCombinerOutputParameter*NV        NONE                    output bias        3.8.12.3  texture
1429COMBINER_AB_OUTPUT_NV              Z7x#x2    GetCombinerOutputParameter*NV        DISCARD_NV              AB output          3.8.12.3  texture
1430                                                                                                          register
1431COMBINER_CD_OUTPUT_NV              Z7x#x2    GetCombinerOutputParameter*NV        DISCARD_NV              CD output          3.8.12.3  texture
1432                                                                                                          register
1433COMBINER_SUM_OUTPUT_NV             Z7x#x2    GetCombinerOutputParameter*NV        SPARE0_NV               sum output         3.8.12.3  texture
1434                                                                                                          register
1435COMBINER_INPUT_NV                  Z10x7     GetFinalCombinerInputParameter*NV    see 3.8.12.4            final combiner     3.8.12.4  texture
1436                                                                                                          input
1437COMBINER_MAPPING_NV                Z2x7      GetFinalCombinerInputParameter*NV    UNSIGNED_IDENTITY_NV    final combiner     3.8.12.4  texture
1438                                                                                                          input mapping
1439COMBINER_COMPONENT_USAGE_NV        Z2x7      GetFinalCombinerInputParameter*NV    see 3.8.12.4            use alpha for      3.8.12.4  texture
1440                                                                                                          final combiner
1441                                                                                                          input mapping
1442
1443[ where # is the value of MAX_GENERAL_COMBINERS_NV   ]
1444
1445New Implementation Dependent State
1446
1447(table 6.24, p214) add the following entry:
1448
1449    Get Value                    Type    Get Command   Minimum Value   Description         Sec     Attribute
1450    --------------------------   ----    -----------   -------------   ----------------    ------  --------------
1451    MAX_GENERAL_COMBINERS_NV     Z+      GetIntegerv   2               Maximum num of      3.8.12  -
1452                                                                       general combiner
1453
1454NVIDIA Implementation Details
1455
1456    The effective range of the RGB portion of the final combiner should
1457    be [0,4] if the color sum clamp is false.  Exercising  this range
1458    requires assigning SPARE0_PLUS_SECONDARY_COLOR_NV to the D variable
1459    and either B or C or both B and C.  In practice this is a very
1460    unlikely configuration.
1461
1462    However due to a bug in the GeForce 256 and Quadro hardware, values
1463    generated above 2 in the RGB portion of the final combiner will be
1464    computed incorrectly.  GeForce2 GTS and subsequent NVIDIA GPUs have
1465    fixed this bug.
1466
1467    The behavior of the SIGNED_NEGATE_NV mapping mode is undefined on
1468    GeForce3 GPUs (NV20) when used to map the initial value of a texture
1469    register corresponding to an enabled texture with a base internal
1470    format of GL_DEPTH_COMPONENT and a GL_TEXTURE_COMPARE_MODE_ARB mode of
1471    GL_COMPARE_R_TO_TEXTURE (or for SGIX_shadow, GL_TEXTURE_COMPARE_SGIX
1472    mode of true) mode when multiple enabled textures have different
1473    values for GL_TEXTURE_COMPARE_FUNC_ARB (or for SGIX_shadow,
1474    GL_TEXTURE_COMPARE_OPERATOR_SGIX).  Values subsequently assigned
1475    to such registers and then mapped with SIGNED_NEGATIE_NV operate
1476    as expected.  This issue does not affect GeForce4 Ti (NV25) and
1477    subsequent GPUs.
1478
1479Revision History
1480
1481    April 4, 2000 - Document that alpha component of the FOG register
1482    should be zero when fog is disabled.  The Release 4 NVIDIA drivers
1483    have a bug where this is not always true (though it often still is).
1484    The bug is fixed in the Release 5 NVIDIA drivers.
1485
1486    June 8, 2000 - The alpha component of the FOG register is not
1487    available for use until the final combiner.  The specification
1488    previously incorrectly stated:
1489
1490      "INVALID_OPERATION is generated When CombinerInputNV is called with
1491      a <portion> parameter of ALPHA and an <input> parameter of FOG."
1492
1493    It is actually the <componentUsage> (not the <portion>) that should
1494    not be allowed to be ALPHA.  The Release 4 NVIDIA drivers implemented
1495    the above incorrect error check.  The Release 5 (and later) NVIDIA
1496    drivers (after June 8, 2000) have fixed this bug and correctly
1497    implement the error based on <componentUsage>.
1498
1499    The specification previously did not allow BLUE for the
1500    <componentUsage> of the G variable in the final combiner.  This is
1501    now allowed in the Release 5 (and later) NVIDIA drivers (after June
1502    8, 2000).  The Release 4 NVIDIA drivers do not permit BLUE for the
1503    <componentUsage> of the G variable and generate an INVALID_OPERATION
1504    error if this is attempted.  The Release 5 NVIDIA drivers (after June
1505    8, 2000) have fixed this bug and permit BLUE for the <componentUsage>
1506    of the G variable.
1507
1508    August 11, 2000 - The "mux" operation was incorrectly documented in
1509    previous versions of this specification.  The correct mux behave is
1510    as follows:
1511
1512       spare0_alpha >= 0.5 ? C*D : A*B
1513
1514    or
1515
1516       spare0_alpha <  0.5 ? A*B : C*D
1517
1518    Previous versions of this specification had the mux sense reversed.
1519
1520    October 31, 2000 - The initial general combiner state
1521    was misdocumented for the B variable.  Previously, Table
1522    NV_register_combiners.5 said that the RGB and alpha inputs for B
1523    were GL_TEXTURE#_ARB and the RGB and alpha input mappings for B
1524    were GL_UNSIGNED_IDENTITY_NV.  The table is now updated so that the
1525    RGB and alpha inputs for B are GL_ZERO and the RGB and alpha input
1526    mappings for B are GL_UNSIGNED_INVERT_NV.  The implementation has
1527    always behaved in the manner described by the updated specification.
1528
1529    December 13, 2000 - Added a new table NV_register_combiners.2
1530    describing the correspondence of texture components to register
1531    components for texture registers.  This table is based on the
1532    table in the EXT_texture_env_combine extension.  The table includes
1533    correspondences for HILO, DSDT, DSDT_MAG, DSDT_MAG_INTENSITY, and
1534    DEPTH_COMPONENT formatted textures when supported in conjunction
1535    with the NV_texture_shader, SGIX_depth_texture, and SGIX_shadow
1536    extensions.
1537
1538    Because a new table 2 was inserted, all the tables beyond it are
1539    renumbered.
1540
1541    Document the behavior of SIGNED_NEGATE_NV in conjunction with shadow
1542    mapping in the "NVIDIA Implementation Details" section.
1543
1544    June 28, 2002 - Properly document NV_register_combiners interactions
1545    with the ARB_depth_texture and ARB_shadow extensions (previously,
1546    the extension just addressed the SGIX versions of these extensions).
1547
1548    September 30, 2003 - Remove an error (not implemented in early NVIDIA
1549    drivers prior to Release 4x.xx drivers; implemented in Relase
1550    4x.xx drivers; and again removed for Release 5x.xx drivers and up)
1551    that was meant to restrict the API to not allow the summing of dot
1552    product outputs.  NVIDIA hardware handles this case correctly however
1553    so the functionality might as well be supported; some applications
1554    found it useful.  The deleted error read:
1555
1556       If the <abDotProduct> or <cdDotProduct> parameter is non-FALSE,
1557       the value of the <sumOutput> parameter must be GL_DISCARD_NV;
1558       otherwise, generate an INVALID_OPERATION error.
1559
1560    October 19, 2006 - Add interaction with ARB_color_buffer_float to
1561    document how ths extension behaves when ARB_color_buffer_float is
1562    also supported and when its CLAMP_FRAGMENT_COLOR_ARB state is either
1563    FIXED_ONLY_ARB when rendering to a floating-point color framebuffer
1564    or FALSE.
1565