[Mesa-dev] [PATCH 1/3] gallium: add PIPE_RESOURCE_FLAG_UNNORMALIZED_COORDS_HINT (v2)

Luca Barbieri luca at luca-barbieri.com
Wed Aug 11 21:37:53 PDT 2010


Changes in v2:
- Add a much longer and better comment

This allows the OpenGL state tracker to inform the driver that we
are using GL_TEXTURE_RECTANGLE as opposed to GL_TEXTURE_2D.
---
 src/gallium/include/pipe/p_defines.h |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
index 00aa207..23cf429 100644
--- a/src/gallium/include/pipe/p_defines.h
+++ b/src/gallium/include/pipe/p_defines.h
@@ -313,6 +313,32 @@ enum pipe_transfer_usage {
 /* Flags for the driver about resource behaviour:
  */
 #define PIPE_RESOURCE_FLAG_GEN_MIPS    (1 << 0)  /* Driver performs autogen mips */
+
+/* State trackers must set this flag if the user API intends to use only unnormalized
+ * coordinates with this resource. For instance, OpenGL rectangle textures will have
+ * this flag set.
+ *
+ * State trackers should support using either normalization in all internal drawing
+ * code.
+ *
+ * Drivers should set or clear the flag to inform the state tracker of the normalization
+ * it should use in internal drawing code. The state tracker should also ask the API
+ * user to do so too if the API supports that.
+ *
+ * Drivers who do not change this will have the best chance of always getting the
+ * same normalization for a given resource, while those that clear or set it will
+ * get the chosen normalization more often.
+ *
+ * Note that some drivers may only support the coordinate normalization that was set
+ * at resource creation. Currently, there is no way to tell this, since usually there
+ * is no way to adjust for this, except for not using state trackers that need both
+ * normalizations at once, or adding a fallback in the driver.
+ *
+ * Currently only OpenCL is known to need both normalizations on the same texture,
+ * while no version of OpenGL or Direct3D needs that.
+ */
+#define PIPE_RESOURCE_FLAG_UNNORMALIZED_COORDS_HINT (1 << 1)
+
 #define PIPE_RESOURCE_FLAG_DRV_PRIV    (1 << 16) /* driver/winsys private */
 #define PIPE_RESOURCE_FLAG_ST_PRIV     (1 << 24) /* state-tracker/winsys private */
 
-- 
1.7.0.4



More information about the mesa-dev mailing list