<div dir="ltr">Thank you very much Nicolai for deep explanation.<br>You're totally right.</div><div class="gmail_extra"><br><div class="gmail_quote">2017-04-11 9:27 GMT+02:00 Nicolai Hähnle <span dir="ltr"><<a href="mailto:nhaehnle@gmail.com" target="_blank">nhaehnle@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 10.04.2017 00:26, Dorian Apanel wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Nicolai,<br>
<br>
Thanks for checking it.<br>
Yes I can add some negative tests for it - as another patch, maybe in<br>
this week.<br>
</blockquote>
<br></span>
Thanks.<span class=""><br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
As I understand the spec, log2(size) is not relevant here.<br>
Example: You create texture, default filter uses mipmaps, and default<br>
max level is 1000, base 0. You supply 5 mips (16,8,4,2,1). At this<br>
point, even if log2(16)+1 == 5, texture is not complete. OGL expects 995<br>
more levels of size 1.<br>
<br>
>From Spec: "required width for mipmap level i is max(1, floor(w_b / 2^i))"<br>
See also this SO answer <a href="http://stackoverflow.com/a/3906855/1688267" rel="noreferrer" target="_blank">http://stackoverflow.com/a/390<wbr>6855/1688267</a> and<br>
"Creating a complete texture" paragraph<br>
here <a href="https://www.khronos.org/opengl/wiki/Common_Mistakes" rel="noreferrer" target="_blank">https://www.khronos.org/opengl<wbr>/wiki/Common_Mistakes</a><br>
</blockquote>
<br></span>
Section 8.17 (Texture Completeness) says:<br>
<br>
"Image levels k where k < level_base or k > q are insignificant to the definition of completeness."<br>
<br>
... and Section 8.14.3 (Mipmapping) defines q as:<br>
<br>
p = floor(log2 (maxsize)) + level_base<br>
q = min{p, level_max}<br>
<br>
Explicitly setting TEXTURE_MAX_LEVEL has *never* been a necessity in OpenGL. You only need it if, as in this test, you don't define the smallest levels in the mip tree.<br>
<br>
Cheers,<br>
Nicolai<br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
<br>
Thanks,<br>
Dorian<br>
<br>
2017-04-05 15:58 GMT+02:00 Nicolai Hähnle <<a href="mailto:nhaehnle@gmail.com" target="_blank">nhaehnle@gmail.com</a><br></span>
<mailto:<a href="mailto:nhaehnle@gmail.com" target="_blank">nhaehnle@gmail.com</a>>>:<span class=""><br>
<br>
On 05.04.2017 09:55, Dorian Apanel wrote:<br>
<br>
From: Dorian Apanel <<a href="mailto:dorian.apanel%2Bpiglit@gmail.com" target="_blank">dorian.apanel+piglit@gmail.co<wbr>m</a><br></span>
<mailto:<a href="mailto:dorian.apanel%252Bpiglit@gmail.com" target="_blank">dorian.apanel%2Bpiglit<wbr>@gmail.com</a>>><span class=""><br>
<br>
Textures created by image load/store tests are not complete (max<br>
level defaults to 1000).<br>
Load/Store on incomplete textures should return zeros/change<br>
nothing.<br>
This fix sets proper base and max level of textures.<br>
<br>
Signed-off-by: Dorian Apanel <<a href="mailto:dorian.apanel@gmail.com" target="_blank">dorian.apanel@gmail.com</a><br></span>
<mailto:<a href="mailto:dorian.apanel@gmail.com" target="_blank">dorian.apanel@gmail.co<wbr>m</a>>><div><div class="h5"><br>
<br>
<br>
Interesting. It seems you're right, but could you please also add a<br>
corresponding negative test and check it against whatever drivers<br>
you have? I.e., a test that creates a texture with mipmaps enabled,<br>
defines only the first level image, and then tries to use it from a<br>
shader to make sure that (a) reads return 0 and (b) writes are ignored?<br>
<br>
Also, the commit message doesn't quite capture the heart of it as<br>
far as I understand it. The textures are incomplete because<br>
num_levels levels are created, which may be less than log2(size). So<br>
GL_TEXTURE_MAX_LEVEL is used to restrict the required number of levels.<br>
<br>
Thanks,<br>
Nicolai<br>
<br>
<br>
<br>
---<br>
tests/spec/arb_shader_image_l<wbr>oad_store/common.c | 9 +++++++++<br>
1 file changed, 9 insertions(+)<br>
<br>
diff --git a/tests/spec/arb_shader_image_<wbr>load_store/common.c<br>
b/tests/spec/arb_shader_image_<wbr>load_store/common.c<br>
index cbeaac7..fdc2ef3 100644<br>
--- a/tests/spec/arb_shader_image_<wbr>load_store/common.c<br>
+++ b/tests/spec/arb_shader_image_<wbr>load_store/common.c<br>
@@ -141,6 +141,11 @@ upload_image_levels(const struct image_info<br>
img, unsigned num_levels,<br>
glGenTextures(1, &textures[unit]);<br>
glBindTexture(img.target->tar<wbr>get, textures[unit]);<br>
<br>
+ if (img.target->target != GL_TEXTURE_BUFFER) {<br>
+ glTexParameteri(img.target->ta<wbr>rget,<br>
GL_TEXTURE_BASE_LEVEL, 0);<br>
+ glTexParameteri(img.target->ta<wbr>rget,<br>
GL_TEXTURE_MAX_LEVEL, num_levels - 1);<br>
+ }<br>
+<br>
switch (img.target->target) {<br>
case GL_TEXTURE_1D:<br>
for (l = 0; l < num_levels; ++l) {<br>
@@ -301,6 +306,8 @@ upload_image_levels(const struct image_info<br>
img, unsigned num_levels,<br>
<br>
glGenTextures(1, &tmp_tex);<br>
glBindTexture(GL_TEXTURE_2D, tmp_tex);<br>
+ glTexParameteri(GL_TEXTURE_2D,<br>
GL_TEXTURE_BASE_LEVEL, 0);<br>
+ glTexParameteri(GL_TEXTURE_2D,<br>
GL_TEXTURE_MAX_LEVEL, 0);<br>
<br>
if (img.target->target ==<br>
GL_TEXTURE_2D_MULTISAMPLE_ARRA<wbr>Y) {<br>
<br>
glTexImage3DMultisample(GL_TE<wbr>XTURE_2D_MULTISAMPLE_ARRAY,<br>
@@ -462,6 +469,8 @@ download_image_levels(const struct<br>
image_info img, unsigned num_levels,<br>
<br>
glGenTextures(1, &tmp_tex);<br>
glBindTexture(GL_TEXTURE_2D, tmp_tex);<br>
+ glTexParameteri(GL_TEXTURE_2D,<br>
GL_TEXTURE_BASE_LEVEL, 0);<br>
+ glTexParameteri(GL_TEXTURE_2D,<br>
GL_TEXTURE_MAX_LEVEL, 0);<br>
<br>
glTexImage2D(GL_TEXTURE_2D, 0, img.format->format,<br>
grid.size.x, grid.size.y, 0,<br>
<br>
<br>
<br>
--<br>
Lerne, wie die Welt wirklich ist,<br>
Aber vergiss niemals, wie sie sein sollte.<br>
<br>
<br>
</div></div></blockquote><div class="HOEnZb"><div class="h5">
<br>
<br>
-- <br>
Lerne, wie die Welt wirklich ist,<br>
Aber vergiss niemals, wie sie sein sollte.<br>
</div></div></blockquote></div><br></div>