Mesa (gallium-rect-textures): gallium: add PIPE_TEXTURE_RECT target

Luca Barbieri lb at kemper.freedesktop.org
Wed Aug 18 18:45:14 UTC 2010


Module: Mesa
Branch: gallium-rect-textures
Commit: 84ce64c65c549151b4ed96661d462306aa898751
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=84ce64c65c549151b4ed96661d462306aa898751

Author: Luca Barbieri <luca at luca-barbieri.com>
Date:   Thu Apr 15 09:02:29 2010 +0200

gallium: add PIPE_TEXTURE_RECT target

This allows to properly support OpenGL rectangle textures in a well
defined way, especially on drivers that don't expose
PIPE_CAP_NPOT_TEXTURES.

---

 src/gallium/docs/source/index.rst     |    1 +
 src/gallium/docs/source/resources.rst |   43 +++++++++++++++++++++++++++++++++
 src/gallium/include/pipe/p_defines.h  |    4 ++-
 3 files changed, 47 insertions(+), 1 deletions(-)

diff --git a/src/gallium/docs/source/index.rst b/src/gallium/docs/source/index.rst
index 6c19842..2a73e3a 100644
--- a/src/gallium/docs/source/index.rst
+++ b/src/gallium/docs/source/index.rst
@@ -15,6 +15,7 @@ Contents:
    debugging
    tgsi
    screen
+   resources
    context
    cso
    distro
diff --git a/src/gallium/docs/source/resources.rst b/src/gallium/docs/source/resources.rst
new file mode 100644
index 0000000..da0f880
--- /dev/null
+++ b/src/gallium/docs/source/resources.rst
@@ -0,0 +1,43 @@
+Resources
+=========
+
+Resources are a core part of Gallium's API.
+
+They represent objects that hold data: textures and buffers.
+
+They are mostly modelled after the resources in Direct3D 10/11, but with a
+different transfer/update mechanism, and more features for OpenGL support.
+
+Resource targets
+----------------
+
+Resource targets determine the type of a resource.
+
+Note that drivers may not actually have the restrictions listed regarding
+coordinate normalization and wrap modes, and in fact efficient OpenCL
+support will probably require drivers that don't have any of them, which
+will probably advertised with an appropriate cap.
+
+TODO: document all targets. Note that both 3D and cube have restrictions
+that depend on the hardware generation.
+TODO: can buffers have a non-R8 format?
+
+PIPE_TEXTURE_RECT
+^^^^^^^^^^^^^^^^^
+2D surface with OpenGL GL_TEXTURE_RECTANGLE semantics.
+
+depth must be 1
+- last_level must be 0
+- Must use unnormalized coordinates
+- Must use a clamp wrap mode
+
+PIPE_TEXTURE_2D
+^^^^^^^^^^^^^^^
+2D surface accessed with normalized coordinates.
+
+- If PIPE_CAP_NPOT_TEXTURES is not supported,
+      width and height must be powers of two
+- Mipmaps can be used
+- Must use normalized coordinates
+- No special restrictions on wrap modes
+
diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
index 00aa207..35eccf1 100644
--- a/src/gallium/include/pipe/p_defines.h
+++ b/src/gallium/include/pipe/p_defines.h
@@ -135,13 +135,15 @@ enum pipe_error {
 #define PIPE_STENCIL_OP_DECR_WRAP  6
 #define PIPE_STENCIL_OP_INVERT     7
 
-/** Texture types */
+/** Texture types.
+ * See the documentation for info on PIPE_TEXTURE_RECT vs PIPE_TEXTURE_2D */
 enum pipe_texture_target {
    PIPE_BUFFER       = 0,
    PIPE_TEXTURE_1D   = 1,
    PIPE_TEXTURE_2D   = 2,
    PIPE_TEXTURE_3D   = 3,
    PIPE_TEXTURE_CUBE = 4,
+   PIPE_TEXTURE_RECT = 5,
    PIPE_MAX_TEXTURE_TYPES
 };
 




More information about the mesa-commit mailing list