<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Mar 12, 2014 at 6:24 AM, 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=""><div class="h5">On 03/11/2014 06:51 PM, Anuj Phogat 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">
This patch is to verify a bug fix in mesa commit 079bff5. This commit<br>
allowed GL_DEPTH_COMPONENT and GL_DEPTH_STENCIL combinations in<br>
glTexImage{123}D functions.<br>
<br>
Signed-off-by: Anuj Phogat <<a href="mailto:anuj.phogat@gmail.com" target="_blank">anuj.phogat@gmail.com</a>><br>
---<br>
  tests/texturing/teximage-<u></u>errors.c | 73 ++++++++++++++++++++++++++++++<u></u>++++++++-<br>
  1 file changed, 72 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/tests/texturing/teximage-<u></u>errors.c b/tests/texturing/teximage-<u></u>errors.c<br>
index 39b7e9b..c01c5e0 100644<br>
--- a/tests/texturing/teximage-<u></u>errors.c<br>
+++ b/tests/texturing/teximage-<u></u>errors.c<br>
@@ -36,7 +36,37 @@ PIGLIT_GL_TEST_CONFIG_BEGIN<br>
<br>
  PIGLIT_GL_TEST_CONFIG_END<br>
<br>
+struct format_desc {<br>
+   GLenum internalformat;<br>
+   GLenum format;<br>
+   GLenum type;<br>
+};<br>
<br>
+static const struct format_desc formats_allowed[] = {<br>
+   {GL_DEPTH_COMPONENT16, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8},<br>
+   {GL_DEPTH_COMPONENT24, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8},<br>
+   {GL_DEPTH_COMPONENT32F, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8},<br>
+<br>
+   {GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT, GL_FLOAT},<br>
+   {GL_DEPTH_COMPONENT24, GL_DEPTH_COMPONENT, GL_FLOAT},<br>
+   {GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT, GL_FLOAT},<br>
+<br>
+   {GL_DEPTH24_STENCIL8, GL_DEPTH_COMPONENT, GL_FLOAT},<br>
+   {GL_DEPTH32F_STENCIL8, GL_DEPTH_COMPONENT, GL_FLOAT},<br>
</blockquote>
<br></div></div>
So for that combination, do the texture's stencil values get set to zero?</blockquote><div> From OpenGL 3.3 spec, page 140:</div><div>    "If the base internal format is DEPTH_STENCIL and format is not DEPTH_-</div>

<div>     STENCIL, then the values of the stencil index texture components are undefined."</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=""><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">
+   {GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8},<br>
+   {GL_DEPTH32F_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8}};<br>
+<br>
+static const struct format_desc formats_not_allowed[] = {<br>
+   {GL_DEPTH_COMPONENT16, GL_STENCIL_INDEX, GL_INT},<br>
+   {GL_DEPTH_COMPONENT24, GL_STENCIL_INDEX, GL_INT},<br>
+   {GL_DEPTH_COMPONENT32F, GL_STENCIL_INDEX, GL_INT},<br>
+<br>
+   {GL_DEPTH24_STENCIL8, GL_STENCIL_INDEX, GL_INT},<br>
+   {GL_DEPTH32F_STENCIL8, GL_STENCIL_INDEX, GL_INT},<br>
+<br>
+   {GL_RGBA8, GL_DEPTH_COMPONENT, GL_FLOAT},<br>
+   {GL_RGBA8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8}};<br>
<br>
  /** Test target params to glTexImage functions */<br>
  static GLboolean<br>
@@ -167,7 +197,34 @@ test_pos_and_sizes(void)<br>
     return GL_TRUE;<br>
  }<br>
<br>
-<br>
+/* Test the combinations of depth formats in glTexImage{123}D() */<br>
+static GLboolean<br>
</blockquote>
<br></div>
bool<div class=""><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">
+test_depth_formats(const struct format_desc *test, GLenum expected_error,<br>
+                   GLint n_tests)<br>
+{<br>
+   int i;<br>
+   bool result = true;<br>
+<br>
+   for(i = 0; i < n_tests; i++) {<br>
</blockquote>
<br></div>
We usually put a space after "for" and "if"<div class=""><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">
+      if((test[i].internalformat == GL_DEPTH_COMPONENT32F ||<br>
+          test[i].internalformat == GL_DEPTH32F_STENCIL8) &&<br>
+          !piglit_is_extension_<u></u>supported("GL_ARB_depth_<u></u>buffer_float"))<br>
+         continue;<br>
+<br>
+      glTexImage1D(GL_TEXTURE_1D, 0, test[i].internalformat, 16, 0,<br>
+                   test[i].format, test[i].type, NULL);<br>
+      result = piglit_check_gl_error(<u></u>expected_error) && result;<br>
+<br>
+      glTexImage2D(GL_TEXTURE_2D, 0, test[i].internalformat, 16, 16,<br>
+                   0, test[i].format, test[i].type, NULL);<br>
+      result = piglit_check_gl_error(<u></u>expected_error) && result;<br>
+<br>
+      glTexImage3D(GL_TEXTURE_2D_<u></u>ARRAY, 0, test[i].internalformat,<br>
+                   16, 16, 16, 0, test[i].format, test[i].type, NULL);<br>
</blockquote>
<br></div>
Do we need to check if the texture array extension is available?</blockquote><div>Yes. I'll add a check before  glTexImage3D() call.</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="">
<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">
+      result = piglit_check_gl_error(<u></u>expected_error) && result;<br>
+   }<br>
+   return result;<br>
+}<br>
  enum piglit_result<br>
  piglit_display(void)<br>
  {<br>
@@ -175,6 +232,20 @@ piglit_display(void)<br>
     pass = test_targets() && pass;<br>
     pass = test_pos_and_sizes() && pass;<br>
<br>
+  /*  From OpenGL 3.3 spec, page 141:<br>
+   *    "Textures with a base internal format of DEPTH_COMPONENT or<br>
+   *     DEPTH_STENCIL require either depth component data or depth/stencil<br>
+   *     component data. Textures with other base internal formats require<br>
+   *     RGBA component data. The error INVALID_OPERATION is generated if<br>
+   *     one of the base internal format and format is DEPTH_COMPONENT or<br>
+   *     DEPTH_STENCIL, and the other is neither of these values."<br>
+   */<br>
+   pass = test_depth_formats(formats_<u></u>allowed, GL_NO_ERROR,<br>
+                             ARRAY_SIZE(formats_allowed))<br>
+          && pass;<br>
+   pass = test_depth_formats(formats_<u></u>not_allowed, GL_INVALID_OPERATION,<br>
+                             ARRAY_SIZE(formats_not_<u></u>allowed))<br>
+          && pass;<br>
     return pass ? PIGLIT_PASS: PIGLIT_FAIL;<br>
  }<br>
<br>
<br>
</blockquote>
<br></div>
Looks OK otherwise.<br></blockquote><div> After fixing your comments, should I consider this r-b you?</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">


<br>
______________________________<u></u>_________________<br>
Piglit mailing list<br>
<a href="mailto:Piglit@lists.freedesktop.org" target="_blank">Piglit@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/piglit" target="_blank">http://lists.freedesktop.org/<u></u>mailman/listinfo/piglit</a><br>
</blockquote></div><br></div></div>