Commit Graph

49 Commits

Author SHA1 Message Date
Dave Airlie
bb31ecf4fb mesa/st: split updating vertex and fragment shader stages.
this seems like a logical thing to do and sets the correct st flags
for vertex textures.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-05-18 17:31:51 +10:00
Dave Airlie
c9aa3bbda4 st/mesa: overhaul vertex/fragment sampler and sampler views.
This fixes piglits fragment-and-vertex-texturing test on llvmpipe for me.

I've no idea if someone had another plan for this that is smarter than what
I've done here, but what I've basically done is

split fragment and vertex sampler and sampler_view setup function, factor
out the common chunks of both.

side-cleanups:
drop st->state.sampler_list - unused
don't update border color if we have no border color.

should fix https://bugs.freedesktop.org/show_bug.cgi?id=35849

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
2011-05-16 06:40:26 +10:00
Eric Anholt
1f32c665c8 intel: Add support for ARB_sampler_objects.
This extension support consists of replacing
"gl_texture_obj->Sampler." with "_mesa_get_samplerobj(ctx, unit)->".
One instance of referencing the texture's base sampler remains in the
initial miptree allocation, where I'm not sure we have a clear
association with any texture unit.

Tested with piglit ARB_sampler_objects/sampler-objects.

Reviewed-by: Brian Paul <brianp@vmware.com>
2011-04-23 13:21:57 -07:00
Brian Paul
4cbb261eba st/mesa: minor clean-ups in update_textures() 2011-04-13 07:37:03 -06:00
Brian Paul
ecfaab88b2 mesa: move sampler state into new gl_sampler_object type
gl_texture_object contains an instance of this type for the regular
texture object sampling state.  glGenSamplers() generates new instances
of gl_sampler_object which can override that state with glBindSampler().
2011-04-10 13:12:49 -06:00
Henri Verbeet
2ecb73379e st/mesa: Set samplers views' first_level.
Base level and min LOD aren't equivalent. In particular, min LOD has no
effect on image array selection for magnification and non-mipmapped
minification.

Signed-off-by: Brian Paul <brianp@vmware.com>
2011-04-08 04:44:21 +02:00
Brian Paul
7330f8b2bc st/mesa: clean up the sampler view format code 2011-01-20 08:56:36 -07:00
Brian Paul
f579a05a9f st/mesa: formatting, whitespace fixes 2011-01-20 08:56:32 -07:00
Dave Airlie
527bf67682 gallium: add EXT_texture_sRGB_decode.
This uses a sampler view to access the texture with the alternate format.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-01-16 12:54:07 +10:00
Dave Airlie
71a079fb4e mesa/st: initial attempt at RG support for gallium drivers
passes all piglit RG tests with softpipe.
2010-10-02 17:03:15 +10:00
Marek Olšák
e794fac35a st/mesa: implement depth texture modes 2010-07-20 18:09:12 +02:00
Brian Paul
ec2b92f98c mesa: rename src/mesa/shader/ to src/mesa/program/ 2010-06-10 23:23:13 -06:00
Dave Airlie
a2817f6ae5 st/mesa: attempt to fix TFP by using sampler views (v1)
Okay I think this is good enough for now, I can't see any other reason
for mesa to want to use a sampler view so lets just leave it at all the A->X conversions for now.

I've been running gnome-shell under r300g with this for day or so and it seems fine.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-06-08 19:08:36 +10:00
Dave Airlie
42ebe3dfd9 mesa/st: add support for EXT_texture_swizzle.
This passes on r300g, the only bit I'm not really sure about is the handling
of the sampler_view in st_atom_texture.c, I unreference it there if the swizzle
value changes and I also have to create a new set of functions to create a new
one since the u_sampler.c ones don't handle swizzle so much.

adds r300g + softpipe enables, I think other drivers could pass easily enough.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-06-05 16:53:43 +10:00
Brian Paul
d8306c9caf st/mesa: remove dead code 2010-05-03 16:13:57 -06:00
Brian Paul
295a87f6c2 st/mesa: remove unused needFlush parameter to st_finalize_texture() 2010-05-03 16:13:20 -06:00
Brian Paul
e648d4a1d1 st/mesa: ignore gl_texture_object::BaseLevel when allocating gallium textures
Previously, when we created a gallium texture for a corresponding Mesa
texture we'd only allocate space for mipmap levels >= BaseLevel.

This patch undoes that mechanism.  This fixes a render-to-texture bug
when rendering to level 0 when BaseLevel=1.

Also, it makes sense to allocate the whole texture object memory when
BaseLevel > 0 since a common use of GL_TEXTURE_BASE_LEVEL is to
progressively load/render mipmaps.  Eventually, the app almost always
fills in the level=0 mipmap image.

Finally, the texture image code is bit easier to understand now.
2010-04-30 12:33:40 -06:00
Brian Paul
5d3d63d45a st/mesa: remove st_texture_object::pipe field
Just pass the pipe context to st_get_texture_sampler_view()
as is done for st_get_renderbuffer_sampler_view().
2010-04-18 18:02:42 -06:00
Brian Paul
8a7ea577ac st/mesa: s/st_get_stobj_sampler_view/st_get_texture_sampler_view/ 2010-04-18 18:02:42 -06:00
Michal Krol
b8030c6561 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.
2010-03-12 14:38:23 +01:00
José Fonseca
28486880ca gallium: pipe/p_inlines.h -> util/u_inlines.h 2010-02-02 14:42:17 +00:00
Michal Krol
853d4807fe mesa: Update vertex texture code after gallium changes. 2009-12-01 11:21:21 +01:00
Michel Dänzer
45bde75bd6 gallium: Remove some superfluous instances of #include "p_inlines.h". 2009-03-04 11:58:52 +01:00
Brian Paul
d917ad5dbd gallium: assorted state tracker fixes for > 8 texture samplers 2009-01-02 16:54:11 -07:00
Brian
9271662ae9 gallium: check vertex shaders for samplers/texture usage as we do for fragment shaders 2008-12-04 09:58:54 -07:00
Brian Paul
8f6d9e12be gallium: use a default texture in update_textures(), update_samplers() when needed
The default texture is used when the current fragment shader has texture
sample instructions but the user has not provided/bound a texture.
2008-08-14 15:44:28 -06:00
Brian Paul
1a82d9648b gallium: fix some render to texture bugs
Before, we were sometimes rendering into a stale texture because
st_finalize_texture() would discard the old texture and create a new one.

Moved st_update_framebuffer atom after texture validation so that we
can create a new renderbuffer surface if the texture changes.

Also, split texture validation into two parts: finalize_textures and
update_textures.  Do finalize_textures first to avoid getting into the
situtation where we're doing a pipe->surface_copy() mid-way through
state validation.

Some debug code still in place, but disabled...
2008-05-07 16:44:33 -06:00
Michel Dänzer
d4074c509b gallium: Reallocate pipe_texture in st_TexImage if the texture object was used.
Fixes problems with interleaved glTexImage and rendering calls.
2008-05-02 16:22:20 +01:00
Alan Hourihane
54507125e7 Some changed for non-C99 compilers 2008-05-02 10:30:34 +00:00
Brian Paul
332b77b852 gallium: use simple color pass-through fragment shader if textures don't exist
If we run out of texture memory we may not have the texture needed by the
fragment shader.  If this happens, plug in a color passthrough shader.
So instead of crashing, we just don't see the texture.
GL_OUT_OF_MEMORY is raised, of course.
2008-04-25 15:24:07 -06:00
Brian
74a6a46b74 gallium: adjust the code in update_textures() to look more like update_samplers() 2008-04-04 16:45:05 -06:00
Brian Paul
762e96c804 gallium: check SamplersUsed to determine if texture needed, as in st_atom_sampler.c
Otherwise, we were sometimes setting texture state but not the corresponding
sampler state.
2008-03-24 17:21:18 -06:00
Brian Paul
3b3774b122 gallium: catch some out of memory conditions in the texture image code.
st_finalize_texture()'s return code now indicates success/fail instead of
presence of texture border (which we discard earlier).
2008-03-20 17:08:07 -06:00
Brian Paul
4984487bc3 gallium: add face, dirtyLevels params to pipe->texture_update()
This provides better information about which images in texture object have changed.
Also, call texture_update() from more places previously missed.
2008-03-19 17:15:14 -06:00
Keith Whitwell
4528287e04 gallium: michel's patch to rework texture/sampler binding interface
Bind all the samplers/textures at once rather than piecemeal.
This is easier for drivers to understand.
2008-03-05 10:56:49 +01:00
Brian Paul
07d6347e8a gallium: change st->state.sampler_texture[] to store pipe_texture pointers
This is a better fix for the previous check-in.
Fixes texadd.c conform test, and probably other bugs.
2008-02-29 16:16:16 -07:00
Brian Paul
c8bca8d8a9 gallium: fix update_textures() bug in pipe_texture binding logic
The 'st' pointer might not have changed, but st->pt might have.  The dirtyData flag
will indicate when that's happened, so check it.
2008-02-29 15:38:43 -07:00
Brian
d5640a2dbd gallium: new pipe->texture_update() function
Called whenever texture data is changed (glTexImage, glTexSubImage,
glCopyTexSubImage, etc).
2008-02-20 13:24:52 -07:00
Brian
58edb0683d gallium: state tracker didn't always notify drivers of texobj data changes
Calling glTexSubImage() or glTexImage() to replace texture data didn't
reliably cause pipe->set_sampler_texture() to get called so drivers didn't
always get notified of new texture data.
The st_texture_object->pt pointer doesn't always indicate changed data so
added a dirtyData field.
2008-02-20 11:20:25 -07:00
Brian
105b3596be added comment 2008-02-06 09:35:39 -07:00
Brian
71984d76aa clean-up 2008-02-06 09:35:38 -07:00
Keith Whitwell
c3af68dc50 gallium: remove set_sampler_units interface
The effect of this mapping can be acheived by the state tracker and
setting up the pipe texture state pointers to incorporate its affects.
2007-12-11 14:39:37 +00:00
Michel Dänzer
753db0d840 Hide texture layout details from the state tracker.
pipe->get_tex_surface() has to be used for access to texture image data.
2007-12-06 11:18:11 +01:00
Brian
64988ff7fe silence the finalize_mipmap_tree msg 2007-11-01 18:01:47 -06:00
keithw
4185da4681 add names to tracked state atoms to improve debug 2007-08-25 22:01:32 +01:00
Brian
8cc668a4a8 fix some issues with texture/mipmap_tree state tracking 2007-08-13 15:20:08 -06:00
Brian
b4784862b4 debug info 2007-08-07 18:24:29 -06:00
Brian
d78dab1267 plug in texture/sampler state update 2007-08-07 15:12:22 -06:00
Brian
28d64d398b texture image state handling 2007-08-07 15:11:20 -06:00