Re: [Mesa3d-dev] Mesa (gallium-sampler-view): st/mesa: Associate a sampler view with an st texture object.
On Fri, Mar 12, 2010 at 8:23 AM, Keith Whitwell wrote: > On Fri, 2010-03-12 at 06:54 -0800, Luca Barbieri wrote: >> What if you have a non-integer min LOD? >> While the integer part may belong to the sampler view, the fractional >> part really seems to be a sampler property. >> Requiring min_lod < 1.0 also doesn't seem to make much sense, so >> shouldn't it be kept as it is now? >> Same thing for last_level / max_lod. > > Hmm, I see your point. Fractional values don't have a lot of meaning in > the views, but without a fraction from somewhere we don't capture all of > GL semantics. > > I guess this is the underlying reason GL has such a wide variety of ways > of specifying the min/max level also. > > And finally, it seems like DX10 has done the same thing - with both > integer min/max in views and float min/max in the sampler state. > > It looks like we really do want to keep them both. I agree. The OpenGL GL_TEXTURE_BASE/MAX_LEVEL attributes are used to indicate which mipmap images are actually present so that OpenGL can determine if the texture is 'complete'. An app might load texture LODs on demand over time. For example, loading level 2, then 1, then finally 0, decrementing GL_TEXTURE_BASE_LEVEL each time. The Mesa state tracker currently always puts the OpenGL base-level mipmap image into level[0] of the gallium texture. I'd like to move away from that. The GL_TEXTURE_MIN/MAX_LOD attributes clamp the range of LODs that the sampler accesses. These can be fractional values, as Luca said, which is significant for linear mipmap level interpolation. Finally, the OpenGL implementatoin should internally restrict GL_TEXTURE_MIN/MAX_LOD to the range of levels indicated by GL_TEXTURE_BASE/MAX_LEVEL, to avoid grabbing invalid/missing texels. -Brian -- Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Mesa3d-dev mailing list Mesa3d-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mesa3d-dev
Re: [Mesa3d-dev] Mesa (gallium-sampler-view): st/mesa: Associate a sampler view with an st texture object.
On 12.03.2010 15:08, michal wrote: > Keith Whitwell wrote on 2010-03-12 14:46: > >> Michal, >> >> Is the intention to have >1 sampler view active in the Mesa state >> tracker, specifically in the cases where min_lod varies? >> >> In other words, you seem to have two ways of specifying the same state: >> >> pipe_sampler_view::first_level >> >> and >> >> pipe_sampler::min_lod >> >> Is there a case to keep both of these? Or is one enough? >> >> >> > It looks like one has to go away, and that would be > pipe_sampler::min_lod. And we want to have a per-texture cache of > sampler views in mesa. > > But there *is* a difference between GL_TEXTURE_MIN_LOD and GL_TEXTURE_BASE_LEVEL which those two seem to reflect. How do you implement that if you just remove one ? > -- > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, find bugs > proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > ___ > Mesa3d-dev mailing list > Mesa3d-dev@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/mesa3d-dev > -- Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Mesa3d-dev mailing list Mesa3d-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mesa3d-dev
Re: [Mesa3d-dev] Mesa (gallium-sampler-view): st/mesa: Associate a sampler view with an st texture object.
On Fri, 2010-03-12 at 06:54 -0800, Luca Barbieri wrote: > What if you have a non-integer min LOD? > While the integer part may belong to the sampler view, the fractional > part really seems to be a sampler property. > Requiring min_lod < 1.0 also doesn't seem to make much sense, so > shouldn't it be kept as it is now? > Same thing for last_level / max_lod. Hmm, I see your point. Fractional values don't have a lot of meaning in the views, but without a fraction from somewhere we don't capture all of GL semantics. I guess this is the underlying reason GL has such a wide variety of ways of specifying the min/max level also. And finally, it seems like DX10 has done the same thing - with both integer min/max in views and float min/max in the sampler state. It looks like we really do want to keep them both. Keith -- Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Mesa3d-dev mailing list Mesa3d-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mesa3d-dev
Re: [Mesa3d-dev] Mesa (gallium-sampler-view): st/mesa: Associate a sampler view with an st texture object.
What if you have a non-integer min LOD? While the integer part may belong to the sampler view, the fractional part really seems to be a sampler property. Requiring min_lod < 1.0 also doesn't seem to make much sense, so shouldn't it be kept as it is now? Same thing for last_level / max_lod. -- Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Mesa3d-dev mailing list Mesa3d-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mesa3d-dev
Re: [Mesa3d-dev] Mesa (gallium-sampler-view): st/mesa: Associate a sampler view with an st texture object.
On Fri, 2010-03-12 at 06:19 -0800, Christoph Bumiller wrote: > On 12.03.2010 15:08, michal wrote: > > Keith Whitwell wrote on 2010-03-12 14:46: > > > >> Michal, > >> > >> Is the intention to have >1 sampler view active in the Mesa state > >> tracker, specifically in the cases where min_lod varies? > >> > >> In other words, you seem to have two ways of specifying the same state: > >> > >> pipe_sampler_view::first_level > >> > >> and > >> > >> pipe_sampler::min_lod > >> > >> Is there a case to keep both of these? Or is one enough? > >> > >> > >> > > It looks like one has to go away, and that would be > > pipe_sampler::min_lod. And we want to have a per-texture cache of > > sampler views in mesa. > > > > > But there *is* a difference between > GL_TEXTURE_MIN_LOD > and > GL_TEXTURE_BASE_LEVEL > which those two seem to reflect. > > How do you implement that if you just remove one ? Note that we currently only have the one (sampler::min_lod), and the other is a synonym for the same value that has been introduced by this branch. Those GL values are currently both consolidated down by the mesa state-tracker (along with other stuff) into sampler::min_lod. Although Michal has chosen a different name for the new member, it has the same meaning and the GL semantics can be implemented on top of it as they currently are for sampler::min_lod. Keith -- Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Mesa3d-dev mailing list Mesa3d-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mesa3d-dev
Re: [Mesa3d-dev] Mesa (gallium-sampler-view): st/mesa: Associate a sampler view with an st texture object.
On Fri, 2010-03-12 at 06:08 -0800, michal wrote: > Keith Whitwell wrote on 2010-03-12 14:46: > > Michal, > > > > Is the intention to have >1 sampler view active in the Mesa state > > tracker, specifically in the cases where min_lod varies? > > > > In other words, you seem to have two ways of specifying the same state: > > > > pipe_sampler_view::first_level > > > > and > > > > pipe_sampler::min_lod > > > > Is there a case to keep both of these? Or is one enough? > > > > > It looks like one has to go away, and that would be > pipe_sampler::min_lod. And we want to have a per-texture cache of > sampler views in mesa. OK, I'm fine with this if you're ok to go ahead and implement the caching. It's worth noting that drivers can discard any vram backing sampler views at any time (when they're not in use), so if we have a situation where large numbers of views are gobbling up vram, the driver has the option of running though all the views and discarding their cached contents. Keith -- Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Mesa3d-dev mailing list Mesa3d-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mesa3d-dev
Re: [Mesa3d-dev] Mesa (gallium-sampler-view): st/mesa: Associate a sampler view with an st texture object.
On Fri, 2010-03-12 at 06:08 -0800, michal wrote: > Keith Whitwell wrote on 2010-03-12 14:46: > > Michal, > > > > Is the intention to have >1 sampler view active in the Mesa state > > tracker, specifically in the cases where min_lod varies? > > > > In other words, you seem to have two ways of specifying the same state: > > > > pipe_sampler_view::first_level > > > > and > > > > pipe_sampler::min_lod > > > > Is there a case to keep both of these? Or is one enough? > > > > > It looks like one has to go away, and that would be > pipe_sampler::min_lod. And we want to have a per-texture cache of > sampler views in mesa. Yeah. There is hardware out there that is modeled after DX9 that doesn't support min_lod, which would be greatly simplified with this. Jose -- Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Mesa3d-dev mailing list Mesa3d-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mesa3d-dev
Re: [Mesa3d-dev] Mesa (gallium-sampler-view): st/mesa: Associate a sampler view with an st texture object.
Keith Whitwell wrote on 2010-03-12 14:46: > Michal, > > Is the intention to have >1 sampler view active in the Mesa state > tracker, specifically in the cases where min_lod varies? > > In other words, you seem to have two ways of specifying the same state: > > pipe_sampler_view::first_level > > and > > pipe_sampler::min_lod > > Is there a case to keep both of these? Or is one enough? > > It looks like one has to go away, and that would be pipe_sampler::min_lod. And we want to have a per-texture cache of sampler views in mesa. -- Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Mesa3d-dev mailing list Mesa3d-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mesa3d-dev
Re: [Mesa3d-dev] Mesa (gallium-sampler-view): st/mesa: Associate a sampler view with an st texture object.
Michal, Is the intention to have >1 sampler view active in the Mesa state tracker, specifically in the cases where min_lod varies? In other words, you seem to have two ways of specifying the same state: pipe_sampler_view::first_level and pipe_sampler::min_lod Is there a case to keep both of these? Or is one enough? Keith On Fri, 2010-03-12 at 05:39 -0800, Micha?? Kr??l wrote: > Module: Mesa > Branch: gallium-sampler-view > Commit: b8030c6561e019e079b5be2fe64ec804df4bfa03 > URL: > http://cgit.freedesktop.org/mesa/mesa/commit/?id=b8030c6561e019e079b5be2fe64ec804df4bfa03 > > Author: Michal Krol > Date: Fri Mar 12 14:37:36 2010 +0100 > > st/mesa: Associate a sampler view with an st texture object. > > Lazily create a sampler view when the texture is being bound > for the first time. > > --- > > src/mesa/state_tracker/st_atom_pixeltransfer.c |2 + > src/mesa/state_tracker/st_atom_texture.c | 20 +- > src/mesa/state_tracker/st_cb_bitmap.c | 48 +++ > src/mesa/state_tracker/st_cb_drawpixels.c | 46 ++ > src/mesa/state_tracker/st_cb_texture.c |4 ++ > src/mesa/state_tracker/st_context.c|4 +- > src/mesa/state_tracker/st_context.h|3 +- > src/mesa/state_tracker/st_texture.h| 39 +++ > 8 files changed, 119 insertions(+), 47 deletions(-) > > diff --git a/src/mesa/state_tracker/st_atom_pixeltransfer.c > b/src/mesa/state_tracker/st_atom_pixeltransfer.c > index 0b2e3f5..e766b3a 100644 > --- a/src/mesa/state_tracker/st_atom_pixeltransfer.c > +++ b/src/mesa/state_tracker/st_atom_pixeltransfer.c > @@ -257,6 +257,8 @@ get_pixel_transfer_program(GLcontext *ctx, const struct > state_key *key) >/* create the colormap/texture now if not already done */ >if (!st->pixel_xfer.pixelmap_texture) { > st->pixel_xfer.pixelmap_texture = create_color_map_texture(ctx); > + st->pixel_xfer.pixelmap_sampler_view = > st_sampler_view_from_texture(ctx->st->pipe, > + > st->pixel_xfer.pixelmap_texture); >} > >/* with a little effort, we can do four pixel map look-ups with > diff --git a/src/mesa/state_tracker/st_atom_texture.c > b/src/mesa/state_tracker/st_atom_texture.c > index 57b71c1..241c001 100644 > --- a/src/mesa/state_tracker/st_atom_texture.c > +++ b/src/mesa/state_tracker/st_atom_texture.c > @@ -56,7 +56,7 @@ update_textures(struct st_context *st) > > /* loop over sampler units (aka tex image units) */ > for (su = 0; su < st->ctx->Const.MaxTextureImageUnits; su++) { > - struct pipe_texture *pt = NULL; > + struct pipe_sampler_view *sampler_view = NULL; > >if (samplersUsed & (1 << su)) { > struct gl_texture_object *texObj; > @@ -84,7 +84,7 @@ update_textures(struct st_context *st) > > st->state.num_textures = su + 1; > > - pt = st_get_stobj_texture(stObj); > + sampler_view = st_get_stobj_sampler_view(stObj); >} > >/* > @@ -96,17 +96,17 @@ update_textures(struct st_context *st) >} >*/ > > - pipe_texture_reference(&st->state.sampler_texture[su], pt); > + pipe_sampler_view_reference(&st->state.sampler_views[su], > sampler_view); > } > > - cso_set_sampler_textures(st->cso_context, > -st->state.num_textures, > -st->state.sampler_texture); > + cso_set_fragment_sampler_views(st->cso_context, > + st->state.num_textures, > + st->state.sampler_views); > if (st->ctx->Const.MaxVertexTextureImageUnits > 0) { > - cso_set_vertex_sampler_textures(st->cso_context, > - MIN2(st->state.num_textures, > - > st->ctx->Const.MaxVertexTextureImageUnits), > - st->state.sampler_texture); > + cso_set_vertex_sampler_views(st->cso_context, > + MIN2(st->state.num_textures, > + > st->ctx->Const.MaxVertexTextureImageUnits), > + st->state.sampler_views); > } > } > > diff --git a/src/mesa/state_tracker/st_cb_bitmap.c > b/src/mesa/state_tracker/st_cb_bitmap.c > index f326601..25d33b9 100644 > --- a/src/mesa/state_tracker/st_cb_bitmap.c > +++ b/src/mesa/state_tracker/st_cb_bitmap.c > @@ -398,7 +398,7 @@ setup_bitmap_vertex_data(struct st_context *st, > static void > draw_bitmap_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z, > GLsizei width, GLsizei height, > - struct pipe_texture *pt, > + struct pipe_sampler_view *sv, > const GLfloat *color) > { > struct st_context *st = ctx->st; > @@ -436,7 +436,7 @@ draw_bitmap_qu