On Wed, Feb 29, 2012 at 7:48 PM, Brian Paul <span dir="ltr"><<a href="mailto:brian.e.paul@gmail.com">brian.e.paul@gmail.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5">On Wed, Feb 29, 2012 at 6:44 PM, Anuj Phogat <<a href="mailto:anuj.phogat@gmail.com">anuj.phogat@gmail.com</a>> wrote:<br>
> Intel and Gallium drivers don't support texture borders. Border is stripped<br>
> before texture is used inside the driver. So, glGetTexLevelParameteriv()<br>
> returns the stripped values of texture dimensions. But it returns un-<br>
> stripped values for proxy textures. This patch adds strip_texture_border()<br>
> for proxy textures as well.<br>
><br>
> Signed-off-by: Anuj Phogat <<a href="mailto:anuj.phogat@gmail.com">anuj.phogat@gmail.com</a>><br>
> ---<br>
> A piglit test case for this patch will be posted on piglit mailing list<br>
> for review.<br>
><br>
> src/mesa/main/teximage.c | 9 +++++++++<br>
> 1 files changed, 9 insertions(+), 0 deletions(-)<br>
><br>
> diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c<br>
> index b8ff67e..5a2ef70 100644<br>
> --- a/src/mesa/main/teximage.c<br>
> +++ b/src/mesa/main/teximage.c<br>
> @@ -2543,6 +2543,15 @@ teximage(struct gl_context *ctx, GLuint dims,<br>
> }<br>
> else {<br>
> /* no error, set the tex image parameters */<br>
> +<br>
> + /* Allow a hardware driver to just strip out the border, to provide<br>
> + * reliable but slightly incorrect hardware rendering instead of<br>
> + * rarely-tested software fallback rendering.<br>
> + */<br>
> + if (border && ctx->Const.StripTextureBorder)<br>
> + strip_texture_border(target, &border, &width, &height, &depth, unpack,<br>
> + &unpack_no_border);<br>
> +<br>
> struct gl_texture_object *texObj =<br>
> _mesa_get_current_tex_object(ctx, target);<br>
> gl_format texFormat = _mesa_choose_texture_format(ctx, texObj,<br>
<br>
</div></div>Actually, I'm not sure we want to do this.<br>
<br>
The typical usage of proxy textures is:<br>
<br>
glTexImage2D(GL_PROXY_TEXTURE_2D, border=1, width, height, ...);<br>
glGetTexLevelParameteriv(GL_PROXY_TEXTURE_2D, GL_TEXTURE_WIDTH, &w);<br>
if (w != width) {<br>
// the proxy texture failed, do something else<br>
}</blockquote><div>I agree. This is the typical usage. </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> </blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
If we stripped the texture border for the proxy texture, the<br>
conditional above would then fail. Have you found a different case<br>
where it makes sense to strip the border for proxies?</blockquote><div> </div><div>I thought of a case where below 2 cases gives you different values without this patch:</div><div>1. glTexImage2D(GL_PROXY_TEXTURE_2D, border=1, width, height, ...);</div>
<div> glGetTexLevelParameteriv(GL_PROXY_TEXTURE_2D, GL_TEXTURE_WIDTH, &w);</div><div> /*you get an unstripped width value*/</div><div><br></div><div><div>2. glTexImage2D(GL_TEXTURE_2D, border=1, width, height, ...);</div>
<div> glGetTexLevelParameteriv(GL_TEXTURE_2D, GL_TEXTURE_WIDTH, &w);</div></div><div> /*you get a stripped width value*/</div><div><br></div><div>But i haven't seen a case where any application compare these two values to make</div>
<div>a decision. We can leave proxy textures unstripped if this is not an important use case.</div></div>