<div dir="ltr"><br><div class="gmail_extra"><div class="gmail_quote">On Thu, Nov 21, 2013 at 5:56 PM, Brian Paul <span dir="ltr"><<a href="mailto:brianp@vmware.com" target="_blank">brianp@vmware.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class="im">On 11/19/2013 04:16 PM, Courtney Goeltzenleuchter wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Add helper function to set texture_view state from TexStorage calls.<br>
<br>
Signed-off-by: Courtney Goeltzenleuchter <courtney@LunarG.com><br>
---<br>
  src/mesa/main/textureview.c | 59 ++++++++++++++++++++++++++++++<u></u>+++++++++++++++<br>
  src/mesa/main/textureview.h |  4 +++<br>
  2 files changed, 63 insertions(+)<br>
<br>
diff --git a/src/mesa/main/textureview.c b/src/mesa/main/textureview.c<br>
index 1858465..a25b928 100644<br>
--- a/src/mesa/main/textureview.c<br>
+++ b/src/mesa/main/textureview.c<br>
@@ -379,6 +379,65 @@ compatible_format(struct gl_context *ctx, struct gl_texture_object *origTexObj,<br>
                 _mesa_lookup_enum_by_nr(<u></u>origInternalFormat));<br>
     return GL_FALSE;<br>
  }<br>
+/**<br>
+ * Helper function for TexStorage to set TextureView state<br>
+ */<br>
</blockquote>
<br></div>
Could you put a bit more info into that comment?</blockquote><div><br></div><div>How about:</div><div>/**</div><div> * Helper function for TexStorage and teximagemultisample to set immutable</div><div> * texture state needed by ARB_texture_view.</div>
<div> */</div><div>void</div><div>_mesa_set_texture_view_state(struct gl_context *ctx, struct gl_texture_object *texObj,</div><div>                       GLenum target, GLuint levels)</div><div>...</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
+void<br>
+set_texture_view_state(struct gl_context *ctx, struct gl_texture_object *texObj,<br>
+                       GLenum target, GLuint levels)<br>
</blockquote>
<br></div>
non-static functions should be prefixed with "_mesa_".</blockquote><div>See above. </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div class="im"><br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
+{<br>
+   struct gl_texture_image *texImage;<br>
+<br>
+   /* Get a reference to what will become this View's base level */<br>
+   texImage = _mesa_select_tex_image(ctx, texObj, target, 0);<br>
</blockquote>
<br></div>
Early return if texImage is NULL (out of memory, etc?)?</blockquote><div>Immutable textures have all their image levels allocated when they are created, so teximage should never be null at this point. At least as I understand things.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class="im"><br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
+<br>
+   /* If the command is successful,<br>
</blockquote>
<br></div>
If what command is successful?  glTexStorage()?</blockquote><div><br></div><div>That is a copy & paste from the ARB_texture_view spec, meaning that if the glTexStorage command is successful...</div></div></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px">
<div class="gmail_extra"><div class="gmail_quote"><div><pre style="color:rgb(0,0,0);word-wrap:break-word;white-space:pre-wrap">Modify subsection 3.9.16 (Immutable-Format Texture Images)</pre></div></div></div><div class="gmail_extra">
<div class="gmail_quote"><div><pre style="color:rgb(0,0,0);word-wrap:break-word;white-space:pre-wrap">Modify the second to last bullet on p. 258:</pre></div></div></div><div class="gmail_extra"><div class="gmail_quote"><div>
<pre style="color:rgb(0,0,0);word-wrap:break-word;white-space:pre-wrap">If the command is successful, TEXTURE_IMMUTABLE_FORMAT becomes TRUE,
<span style="font-family:arial">TEXTURE_IMMUTABLE_LEVELS and TEXTURE_VIEW_NUM_LEVELS become <levels>.</span></pre></div></div></div></blockquote><div class="gmail_extra"><div class="gmail_quote"><div>I can change that to something like: When an immutable texture is created via glTexStorage or glTexImageMultisample,</div>
<div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><div class="h5"><br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
+    * TEXTURE_IMMUTABLE_FORMAT becomes TRUE.<br>
+    * TEXTURE_IMMUTABLE_LEVELS and TEXTURE_VIEW_NUM_LEVELS become levels.<br>
+    * If the texture target is TEXTURE_1D_ARRAY then<br>
+    * TEXTURE_VIEW_NUM_LAYERS becomes height.<br>
+    * If the texture target is TEXTURE_2D_ARRAY, TEXTURE_CUBE_MAP_ARRAY,<br>
+    * or TEXTURE_2D_MULTISAMPLE_ARRAY then TEXTURE_VIEW_NUM_LAYERS becomes depth.<br>
+    * If the texture target is TEXTURE_CUBE_MAP, then<br>
+    * TEXTURE_VIEW_NUM_LAYERS becomes 6.<br>
+    * For any other texture target, TEXTURE_VIEW_NUM_LAYERS becomes 1.<br>
+    *<br>
+    * ARB_texture_multisample: Multisample textures do<br>
+    * not have multiple image levels.<br>
+    */<br>
+<br>
+   texObj->Immutable = GL_TRUE;<br>
+   texObj->ImmutableLevels = levels;<br>
+   texObj->MinLevel = 0;<br>
+   texObj->NumLevels = levels;<br>
+   texObj->MinLayer = 0;<br>
+   texObj->NumLayers = 1;<br>
+   switch (target) {<br>
+   case GL_TEXTURE_1D_ARRAY:<br>
+      texObj->NumLayers = texImage->Height;<br>
+      break;<br>
+<br>
+   case GL_TEXTURE_2D_MULTISAMPLE:<br>
+      texObj->NumLevels = 1;<br>
+      texObj->ImmutableLevels = 1;<br>
+      break;<br>
+<br>
+   case GL_TEXTURE_2D_MULTISAMPLE_<u></u>ARRAY:<br>
+      texObj->NumLevels = 1;<br>
+      texObj->ImmutableLevels = 1;<br>
+      /* fall through to set NumLayers */<br>
+<br>
+   case GL_TEXTURE_2D_ARRAY:<br>
+   case GL_TEXTURE_CUBE_MAP_ARRAY:<br>
+      texObj->NumLayers = texImage->Depth;<br>
+      break;<br>
+<br>
+   case GL_TEXTURE_CUBE_MAP:<br>
+      texObj->NumLayers = 6;<br>
+      break;<br>
+<br>
+   }<br>
+}<br>
<br>
  /**<br>
   * glTextureView (ARB_texture_view)<br>
diff --git a/src/mesa/main/textureview.h b/src/mesa/main/textureview.h<br>
index c2f0f32..36a8ed3 100644<br>
--- a/src/mesa/main/textureview.h<br>
+++ b/src/mesa/main/textureview.h<br>
@@ -36,4 +36,8 @@ _mesa_TextureView(GLuint texture, GLenum target, GLuint origtexture,<br>
                    GLuint minlevel, GLuint numlevels,<br>
                    GLuint minlayer, GLuint numlayers);<br>
<br>
+extern void<br>
+set_texture_view_state(struct gl_context *ctx, struct gl_texture_object *texObj,<br>
+                       GLenum target, GLuint levels);<br>
+<br>
  #endif /* TEXTUREVIEW_H */<br>
<br>
</blockquote>
<br></div></div>
______________________________<u></u>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">mesa-dev@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev" target="_blank">http://lists.freedesktop.org/<u></u>mailman/listinfo/mesa-dev</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr">Courtney Goeltzenleuchter<br><div>LunarG</div><div><img src="http://media.lunarg.com/wp-content/themes/LunarG/images/logo.png" width="96" height="65"><br>
</div></div>
</div></div>