Clone of mesa.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

MESA_texture_signed_rgba.spec 8.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. Name
  2. MESA_texture_signed_rgba
  3. Name Strings
  4. GL_MESA_texture_signed_rgba
  5. Contact
  6. Notice
  7. IP Status
  8. No known IP issues
  9. Status
  10. Version
  11. 0.3, 2009-03-24
  12. Number
  13. Not assigned ?
  14. Dependencies
  15. Written based on the wording of the OpenGL 2.0 specification.
  16. This extension trivially interacts with ARB_texture_float.
  17. This extension shares some language with ARB_texture_compression_rgtc
  18. but does not depend on it.
  19. Overview
  20. OpenGL prior to 3.1 does not support any signed texture formats.
  21. ARB_texture_compression_rgtc introduces some compressed red and
  22. red_green signed formats but no uncompressed ones, which might
  23. still be useful. NV_texture_shader adds signed texture formats,
  24. but also a lot of functionality which has been superceded by fragment
  25. shaders.
  26. It is usually possible to get the same functionality
  27. using a unsigned format by doing scale and bias in a shader, but this
  28. is undesirable since modern hardware has direct support for this.
  29. This extension adds a signed 4-channel texture format by backporting
  30. the relevant features from OpenGL 3.1, as a means to support this in
  31. OpenGL implementations only supporting older versions.
  32. Issues
  33. 1) What should this extension be called?
  34. RESOLVED: MESA_texture_signed_rgba seems reasonable.
  35. The rgba part is there because only 4 channel format is supported.
  36. 2) Should the full set of signed formats (alpha, luminance, rgb, etc.)
  37. be supported?
  38. RESOLVED: NO. To keep this extension simple, only add the most
  39. universal format, rgba. alpha/luminance can't be trivially supported
  40. since OpenGL 3.1 does not support them any longer, and there is some
  41. implied dependency on ARB_texture_rg for red/red_green formats so
  42. avoid all this. Likewise, only 8 bits per channel is supported.
  43. 3) Should this extension use new enums for the texture formats?
  44. RESOLVED: NO. Same enums as those used in OpenGL 3.1.
  45. 4) How are signed integer values mapped to floating-point values?
  46. RESOLVED: Same as described in issue 5) of
  47. ARB_texture_compression_rgtc (quote):
  48. A signed 8-bit two's complement value X is computed to
  49. a floating-point value Xf with the formula:
  50. { X / 127.0, X > -128
  51. Xf = {
  52. { -1.0, X == -128
  53. This conversion means -1, 0, and +1 are all exactly representable,
  54. however -128 and -127 both map to -1.0. Mapping -128 to -1.0
  55. avoids the numerical awkwardness of have a representable value
  56. slightly more negative than -1.0.
  57. This conversion is intentionally NOT the "byte" conversion listed
  58. in Table 2.9 for component conversions. That conversion says:
  59. Xf = (2*X + 1) / 255.0
  60. The Table 2.9 conversion is incapable of exactly representing
  61. zero.
  62. (Difference to ARB_texture_compression_rgtc):
  63. This is the same mapping as OpenGL 3.1 uses.
  64. This is also different to what NV_texture_shader used.
  65. The above mapping should be considered the reference, but there
  66. is some leeway so other mappings are allowed for implementations which
  67. cannot do this. Particulary the mapping given in NV_texture_shader or
  68. the standard OpenGL byte/float mapping is considered acceptable too, as
  69. might be a mapping which represents -1.0 by -128, 0.0 by 0 and 1.0 by
  70. 127 (that is, uses different scale factors for negative and positive
  71. numbers).
  72. Also, it is ok to store incoming GL_BYTE user data as-is, without
  73. converting to GL_FLOAT (using the standard OpenGL float/byte mapping)
  74. and converting back (using the mapping described here).
  75. Other than those subtle issues there are no other non-standard
  76. conversions used, so when using for instance CopyTexImage2D with
  77. a framebuffer clamped to [0,1] all converted numbers will be in the range
  78. [0, 127] (and not scaled and biased).
  79. 5) How will signed components resulting from RGBA8_SNORM texture
  80. fetches interact with fragment coloring?
  81. RESOLVED: Same as described in issue 6) of
  82. ARB_texture_compression_rgtc (quote):
  83. The specification language for this extension is silent
  84. about clamping behavior leaving this to the core specification
  85. and other extensions. The clamping or lack of clamping is left
  86. to the core specification and other extensions.
  87. For assembly program extensions supporting texture fetches
  88. (ARB_fragment_program, NV_fragment_program, NV_vertex_program3,
  89. etc.) or the OpenGL Shading Language, these signed formats will
  90. appear as expected with unclamped signed components as a result
  91. of a texture fetch instruction.
  92. If ARB_color_buffer_float is supported, its clamping controls
  93. will apply.
  94. NV_texture_shader extension, if supported, adds support for
  95. fixed-point textures with signed components and relaxed the
  96. fixed-function texture environment clamping appropriately. If the
  97. NV_texture_shader extension is supported, its specified behavior
  98. for the texture environment applies where intermediate values
  99. are clamped to [-1,1] unless stated otherwise as in the case
  100. of explicitly clamped to [0,1] for GL_COMBINE. or clamping the
  101. linear interpolation weight to [0,1] for GL_DECAL and GL_BLEND.
  102. Otherwise, the conventional core texture environment clamps
  103. incoming, intermediate, and output color components to [0,1].
  104. This implies that the conventional texture environment
  105. functionality of unextended OpenGL 1.5 or OpenGL 2.0 without
  106. using GLSL (and with none of the extensions referred to above)
  107. is unable to make proper use of the signed texture formats added
  108. by this extension because the conventional texture environment
  109. requires texture source colors to be clamped to [0,1]. Texture
  110. filtering of these signed formats would be still signed, but
  111. negative values generated post-filtering would be clamped to
  112. zero by the core texture environment functionality. The
  113. expectation is clearly that this extension would be co-implemented
  114. with one of the previously referred to extensions or used with
  115. GLSL for the new signed formats to be useful.
  116. 6) Should the RGBA_SNORM tokens also be accepted by CopyTexImage
  117. functions?
  118. RESOLVED: YES.
  119. 7) What to do with GetTexParameter if ARB_texture_float is supported,
  120. in particular what datatype should this return for TEXTURE_RED_TYPE_ARB,
  121. TEXTURE_GREEN_TYPE_ARB, TEXTURE_BLUE_TYPE_ARB, TEXTURE_ALPHA_TYPE_ARB?
  122. RESOLVED: ARB_texture_float states type is either NONE,
  123. UNSIGNED_NORMALIZED_ARB, or FLOAT. This extension adds a new enum,
  124. SIGNED_NORMALIZED, which will be returned accordingly. This is the
  125. same behaviour as in OpenGL 3.1.
  126. New Tokens
  127. Accepted by the <internalformat> parameter of
  128. TexImage1D, TexImage2D, TexImage3D, CopyTexImage1D, and CopyTexImage2D:
  129. RGBA_SNORM 0x8F93
  130. RGBA8_SNORM 0x8F97
  131. Returned by the <params> parameter of GetTexLevelParameter:
  132. SIGNED_NORMALIZED 0x8F9C
  133. Additions to Chapter 3 of the OpenGL 2.0 Specification (Rasterization):
  134. -- Section 3.8.1, Texture Image Specification
  135. Add to Table 3.16 (page 154): Sized internal formats
  136. Sized Base R G B A L I D
  137. Internal Format Internal Format bits bits bits bits bits bits bits
  138. --------------- --------------- ---- ---- ---- ---- ---- ---- ----
  139. RGBA8_SNORM RGBA 8 8 8 8 0 0 0
  140. Dependencies on ARB_texture_float extension:
  141. If ARB_texture_float is supported, GetTexParameter queries with <value>
  142. of TEXTURE_RED_TYPE_ARB, TEXTURE_GREEN_TYPE_ARB, TEXTURE_BLUE_TYPE_ARB or
  143. TEXTURE_ALPHA_TYPE_ARB return SIGNED_NORMALIZED if
  144. the base internal format is RGBA_SNORM.