15bd8deadSopenharmony_ciXXX - incomplete (needs number, glx protocol)
25bd8deadSopenharmony_ci
35bd8deadSopenharmony_ciName
45bd8deadSopenharmony_ci
55bd8deadSopenharmony_ci    SGIX_fragments_instrument
65bd8deadSopenharmony_ci
75bd8deadSopenharmony_ciName Strings
85bd8deadSopenharmony_ci
95bd8deadSopenharmony_ci    GL_SGIX_fragments_instrument
105bd8deadSopenharmony_ci
115bd8deadSopenharmony_ciVersion
125bd8deadSopenharmony_ci
135bd8deadSopenharmony_ci    $Date: 1999/04/27 01:20:04 $  $Revision: 1.5 $
145bd8deadSopenharmony_ci
155bd8deadSopenharmony_ciNumber
165bd8deadSopenharmony_ci
175bd8deadSopenharmony_ci    180
185bd8deadSopenharmony_ci
195bd8deadSopenharmony_ciDependencies
205bd8deadSopenharmony_ci
215bd8deadSopenharmony_ci    SGIX_instruments is required
225bd8deadSopenharmony_ci
235bd8deadSopenharmony_ciOverview
245bd8deadSopenharmony_ci
255bd8deadSopenharmony_ci    This extension defines an instrument that uses the API defined in
265bd8deadSopenharmony_ci    SGIX_instruments.  The instrument specified by this extension is a
275bd8deadSopenharmony_ci    counter of the number of fragments generated during pixel and
285bd8deadSopenharmony_ci    geometry rasterization.  The maximum value of the counter is an
295bd8deadSopenharmony_ci    implementation-dependent constant.
305bd8deadSopenharmony_ci
315bd8deadSopenharmony_ci    Some systems may maintain counters on different parts of the
325bd8deadSopenharmony_ci    system.  For example, a system with rasterization distributed
335bd8deadSopenharmony_ci    across multiple chips may maintain a count of the fragments
345bd8deadSopenharmony_ci    generated on each individual chip.  In this extension, a queriable
355bd8deadSopenharmony_ci    constant is defined that indicates the number of responses to
365bd8deadSopenharmony_ci    expect when a measurement is taken.  This mechanism allows GL
375bd8deadSopenharmony_ci    implementations to be as efficient as possible.
385bd8deadSopenharmony_ci
395bd8deadSopenharmony_ciIssues
405bd8deadSopenharmony_ci
415bd8deadSopenharmony_ci    *   If an operation such as a clear is implemented
425bd8deadSopenharmony_ci        internally as a draw operation but according to the GL spec
435bd8deadSopenharmony_ci        does not generate any fragments, should the counter be
445bd8deadSopenharmony_ci        updated?  Updating would give a less accurate idea of
455bd8deadSopenharmony_ci        fragments generated from a GL spec point of view, but would
465bd8deadSopenharmony_ci        give a more accurate idea of rasterizer load during a given
475bd8deadSopenharmony_ci        interval. 
485bd8deadSopenharmony_ci
495bd8deadSopenharmony_ci        A:  It's better to keep the single meaning of GL fragments
505bd8deadSopenharmony_ci            generated.  Counting internal fragments wouldn't always be
515bd8deadSopenharmony_ci            a good measure of rasterizer load and more accurate
525bd8deadSopenharmony_ci            mechanisms can be imagined easily.
535bd8deadSopenharmony_ci            
545bd8deadSopenharmony_ci    *   Having each counter response appear as an independent
555bd8deadSopenharmony_ci        instrument is awkward and wastes space in the buffer.  Could
565bd8deadSopenharmony_ci        we have GL combine them?
575bd8deadSopenharmony_ci
585bd8deadSopenharmony_ci        A:  See explanation in depth_pass_instrument spec.
595bd8deadSopenharmony_ci
605bd8deadSopenharmony_ci    *   We say that invisible fragments culled early as an
615bd8deadSopenharmony_ci        implementation optimization do not need to be counted.  For
625bd8deadSopenharmony_ci        example, if an entire triangle is not visible an
635bd8deadSopenharmony_ci        implementation can not rasterize it and not count the
645bd8deadSopenharmony_ci        fragments it contains.  From a GL point of view, these
655bd8deadSopenharmony_ci        fragments *were* generated, but counting them would require
665bd8deadSopenharmony_ci        really generating them (in most implementations anyway).  
675bd8deadSopenharmony_ci
685bd8deadSopenharmony_ci        A:  This extension is aimed at performance-sensitive applications,
695bd8deadSopenharmony_ci            so slowing stuff down is not a good idea.  Just don't
705bd8deadSopenharmony_ci            count them.
715bd8deadSopenharmony_ci
725bd8deadSopenharmony_ci    *   Is the name for this extension ok?  It's not very descriptive
735bd8deadSopenharmony_ci        but the more descriptive names suggested all came out rather
745bd8deadSopenharmony_ci        long (eg FRAGMENTS_GENERATED_INSTRUMENT_SGIX).
755bd8deadSopenharmony_ci
765bd8deadSopenharmony_ciNew Tokens
775bd8deadSopenharmony_ci
785bd8deadSopenharmony_ci    Accepted by the <cap> parameter of Enable, Disable and IsEnabled:
795bd8deadSopenharmony_ci
805bd8deadSopenharmony_ci        FRAGMENTS_INSTRUMENT_SGIX			0x8313
815bd8deadSopenharmony_ci
825bd8deadSopenharmony_ci    Accepted by the <pname> parameter of GetBooleanv, GetIntegerv,
835bd8deadSopenharmony_ci    GetFloatv, and GetDoublev:
845bd8deadSopenharmony_ci
855bd8deadSopenharmony_ci	FRAGMENTS_INSTRUMENT_COUNTERS_SGIX		0x8314
865bd8deadSopenharmony_ci	FRAGMENTS_INSTRUMENT_MAX_SGIX			0x8315
875bd8deadSopenharmony_ci
885bd8deadSopenharmony_ciAdditions to Chapter 2 of the 1.0 Specification (OpenGL Operation)
895bd8deadSopenharmony_ci
905bd8deadSopenharmony_ci    None
915bd8deadSopenharmony_ci
925bd8deadSopenharmony_ciAdditions to Chapter 3 of the 1.0 Specification (Rasterization)
935bd8deadSopenharmony_ci
945bd8deadSopenharmony_ci    Add a section 3.X (The Fragment Instrument) after the section 3.1
955bd8deadSopenharmony_ci    (Invariance):
965bd8deadSopenharmony_ci
975bd8deadSopenharmony_ci    If FRAGMENTS_INSTRUMENT_SGIX is enabled and instruments have been
985bd8deadSopenharmony_ci    started via a call to StartInstrumentSGIX, a counter or counters
995bd8deadSopenharmony_ci    of the number of fragments generated by rasterization (geometry or
1005bd8deadSopenharmony_ci    pixel rectangle) is maintained.  The number of counters can be
1015bd8deadSopenharmony_ci    queried using the token FRAGMENTS_INSTRUMENT_COUNTERS_SGIX.  The
1025bd8deadSopenharmony_ci    fragments are counted at the end of the rasterization stage just
1035bd8deadSopenharmony_ci    before per-fragment operations are applied.  For each fragment,
1045bd8deadSopenharmony_ci    the counter is incremented by one.  If the increment would have
1055bd8deadSopenharmony_ci    caused the counter to go beyond is maximum representable value,
1065bd8deadSopenharmony_ci    the count is clamped to the maximum.  The maximum value of the
1075bd8deadSopenharmony_ci    counters may be queried using FRAGMENTS_INSTRUMENT_MAX_SGIX.  The
1085bd8deadSopenharmony_ci    counter values are unsigned, so FRAGMENTS_INSTRUMENT_MAX_SGIX may
1095bd8deadSopenharmony_ci    be as high as the maximum value of an unsigned integer.
1105bd8deadSopenharmony_ci
1115bd8deadSopenharmony_ci    Some GL implementations may detect early that a fragment or set of
1125bd8deadSopenharmony_ci    fragments will not effect the contents of the frame buffer and
1135bd8deadSopenharmony_ci    therefore will get a performance increase by not generating them.
1145bd8deadSopenharmony_ci    For example, an entire triangle may be in a region of the frame
1155bd8deadSopenharmony_ci    buffer that is covered by another window.  Previously, this type of
1165bd8deadSopenharmony_ci    optimization had been invisible from a GL spec point of view and
1175bd8deadSopenharmony_ci    could be detected by the application only as a change in
1185bd8deadSopenharmony_ci    performance.  It is legal for an implementation to not increment
1195bd8deadSopenharmony_ci    the counter for fragments that have been eliminated due to this
1205bd8deadSopenharmony_ci    sort of optimization.  However, a fragment must be counted if it
1215bd8deadSopenharmony_ci    will effect frame buffer contents.
1225bd8deadSopenharmony_ci
1235bd8deadSopenharmony_ci    If an implementation can detect during rasterization that a
1245bd8deadSopenharmony_ci    fragment (or set of fragments) will not
1255bd8deadSopenharmony_ci    effect the contents of the frame buffer, the implementation can
1265bd8deadSopenharmony_ci    transparently avoid rasterizing the .  It is legal for an implementation to not increment the
1275bd8deadSopenharmony_ci    fragment counter in this case.  
1285bd8deadSopenharmony_ci
1295bd8deadSopenharmony_ciAdditions to Chapter 4 of the 1.0 Specification (Per-Fragment Operations
1305bd8deadSopenharmony_ciand the Frame Buffer)
1315bd8deadSopenharmony_ci
1325bd8deadSopenharmony_ci    None
1335bd8deadSopenharmony_ci
1345bd8deadSopenharmony_ciAdditions to Chapter 5 of the 1.0 Specification (Special Functions)
1355bd8deadSopenharmony_ci
1365bd8deadSopenharmony_ci    Add to the end of section 5.X entitled Instruments:
1375bd8deadSopenharmony_ci
1385bd8deadSopenharmony_ci    The instrument FRAGMENTS_INSTRUMENT_SGIX returns for each
1395bd8deadSopenharmony_ci    measurement a system-dependent constant number of responses to the
1405bd8deadSopenharmony_ci    buffer.  The constant may be queried using the Get with an
1415bd8deadSopenharmony_ci    argument of FRAGMENTS_INSTRUMENT_COUNTERS_SGIX.  Each response is
1425bd8deadSopenharmony_ci    formatted as though it came from an independent instrument.  If
1435bd8deadSopenharmony_ci    more than one instrument is enabled, the responses from the depth
1445bd8deadSopenharmony_ci    pass instrument will be placed successively (as opposed to
1455bd8deadSopenharmony_ci    possibly being interrupted by responses from other instruments).
1465bd8deadSopenharmony_ci    
1475bd8deadSopenharmony_ci    FRAGMENTS_INSTRUMENT_SGIX responses are formatted as follows
1485bd8deadSopenharmony_ci    (starting at the first word):
1495bd8deadSopenharmony_ci
1505bd8deadSopenharmony_ci	FRAGMENTS_INSTRUMENT_SGIX
1515bd8deadSopenharmony_ci	Number of int's in the response (4)
1525bd8deadSopenharmony_ci	Counter value
1535bd8deadSopenharmony_ci	Marker value
1545bd8deadSopenharmony_ci
1555bd8deadSopenharmony_ci    The counter value is padded to the size of an int if necessary by
1565bd8deadSopenharmony_ci    zero-filling the most significant bits.
1575bd8deadSopenharmony_ci
1585bd8deadSopenharmony_ci    Assuming that none of the counters overflowed, the total number of
1595bd8deadSopenharmony_ci    fragments generated while the instrument was enabled is equal to
1605bd8deadSopenharmony_ci    the sum of all the counter values.
1615bd8deadSopenharmony_ci
1625bd8deadSopenharmony_ci    Although different responses come from different hardware
1635bd8deadSopenharmony_ci    counters, they should be considered identical by the software and
1645bd8deadSopenharmony_ci    no guarantee is made about how the responses for each counter are
1655bd8deadSopenharmony_ci    ordered within a single query response.  For example, a hardware
1665bd8deadSopenharmony_ci    implementation may maintain a counter for each quadrant of the
1675bd8deadSopenharmony_ci    screen, but which response in the buffer came from which counter
1685bd8deadSopenharmony_ci    is not exposed to the application.
1695bd8deadSopenharmony_ci
1705bd8deadSopenharmony_ci
1715bd8deadSopenharmony_ciAdditions to Chapter 6 of the 1.0 Specification (State and State Requests)
1725bd8deadSopenharmony_ci
1735bd8deadSopenharmony_ci    None
1745bd8deadSopenharmony_ci
1755bd8deadSopenharmony_ciAdditions to the GLX Specification
1765bd8deadSopenharmony_ci
1775bd8deadSopenharmony_ci    XXX
1785bd8deadSopenharmony_ci
1795bd8deadSopenharmony_ciErrors
1805bd8deadSopenharmony_ci
1815bd8deadSopenharmony_ci    None
1825bd8deadSopenharmony_ci
1835bd8deadSopenharmony_ciNew State
1845bd8deadSopenharmony_ci
1855bd8deadSopenharmony_ci    Get Value				Get Command		Type	Initial Value		Attribute
1865bd8deadSopenharmony_ci    ---------				-----------		----	-------------		---------
1875bd8deadSopenharmony_ci    FRAGMENTS_INSTRUMENT_SGIX		ReadInstrumentsSGIX	1*xZ+	0			-
1885bd8deadSopenharmony_ci
1895bd8deadSopenharmony_ciNew Implementation Dependent State
1905bd8deadSopenharmony_ci
1915bd8deadSopenharmony_ci    Get Value				Get Command		Type	Minimum Value
1925bd8deadSopenharmony_ci    ---------				-----------		----	-------------
1935bd8deadSopenharmony_ci    FRAGMENTS_INSTRUMENT_COUNTERS_SGIX	GetIntegerv		Z+      1
1945bd8deadSopenharmony_ci
195