aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker/st_atom_texture.c
Commit message (Collapse)AuthorAgeFilesLines
* st/mesa: improve sampler view handlingChristian König2014-04-041-29/+26
| | | | | | | | | | | Keep a dynamically increasing array of all the views created for a texture instead of just the last one. v2: add comments, fix array size calculation, release only the first sampler view found Signed-off-by: Christian König <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* st/mesa: overhaul texture / sample swizzle codeBrian Paul2014-03-271-53/+114
| | | | | | | | | | | | | | | | | | | | | | Previously we only examined the GL_DEPTH_MODE state to determine the sampler view swizzle for depth textures. Now we also consider the texture base format for color textures too. The basic idea is if we're sampling from a RGB texture we always want to get A=1, even if the actual hardware format might be RGBA. We had assumed that the texture's A values were always one since that's what Mesa's texstore code does. But if we render to the RGBA texture, the A values might not be 1. Subsequent sampling didn't return the right values. Now we examine the user-specified texture base format vs. the actual gallium format to determine the right swizzle. Fixes several fbo-blending-formats, fbo-clear-formats and fbo-tex-rgbx failures with VMware/svga driver (and possibly other drivers). No other piglit regressions with softpipe or VMware/svga. Reviewed-by: Marek Olšák <[email protected]>
* st/mesa: simplify apply_depthmode()Brian Paul2014-03-271-38/+47
| | | | | | | In preparation for following changes. I used a temporary test harness to compare the old code to the new for all possible swizzle inputs. No change in results.
* st/mesa: recreate sampler view on context change v3Christian König2014-03-241-0/+10
| | | | | | | | | | | | | With shared glx contexts it is possible that a texture is create and used in one context and then used in another one resulting in incorrect sampler view usage. v2: avoid template copy v3: add XXX comment Signed-off-by: Christian König <[email protected]> Cc: "10.0 10.1" <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* s/Tungsten Graphics/VMware/José Fonseca2014-01-171-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Tungsten Graphics Inc. was acquired by VMware Inc. in 2008. Leaving the old copyright name is creating unnecessary confusion, hence this change. This was the sed script I used: $ cat tg2vmw.sed # Run as: # # git reset --hard HEAD && find include scons src -type f -not -name 'sed*' -print0 | xargs -0 sed -i -f tg2vmw.sed # # Rename copyrights s/Tungsten Gra\(ph\|hp\)ics,\? [iI]nc\.\?\(, Cedar Park\)\?\(, Austin\)\?\(, \(Texas\|TX\)\)\?\.\?/VMware, Inc./g /Copyright/s/Tungsten Graphics\(,\? [iI]nc\.\)\?\(, Cedar Park\)\?\(, Austin\)\?\(, \(Texas\|TX\)\)\?\.\?/VMware, Inc./ s/TUNGSTEN GRAPHICS/VMWARE/g # Rename emails s/[email protected]/[email protected]/ s/[email protected]/[email protected]/g s/jrfonseca-at-tungstengraphics-dot-com/jfonseca-at-vmware-dot-com/ s/jrfonseca\[email protected]/[email protected]/g s/keithw\[email protected]/[email protected]/g s/[email protected]/[email protected]/g s/thomas-at-tungstengraphics-dot-com/thellstom-at-vmware-dot-com/ s/[email protected]/[email protected]/ # Remove dead links s@Tungsten Graphics (http://www.tungstengraphics.com)@Tungsten Graphics@g # C string src/gallium/state_trackers/vega/api_misc.c s/"Tungsten Graphics, Inc"/"VMware, Inc"/ Reviewed-by: Brian Paul <[email protected]>
* mesa: replace ctx->Const.{Vertex,Fragment,Geomtery}Program with an array.Paul Berry2014-01-091-4/+4
| | | | | | | | | | | | | | | | | | | | These are replaced with ctx->Const.Program[MESA_SHADER_{VERTEX,FRAGMENT,GEOMETRY}]. In patches to follow, this will allow us to replace a lot of ad-hoc logic with a variable index into the array. With the exception of the changes to mtypes.h, this patch was generated entirely by the command: find src -type f '(' -iname '*.c' -o -iname '*.cpp' -o -iname '*.py' \ -o -iname '*.y' ')' -print0 | xargs -0 sed -i \ -e 's/Const\.VertexProgram/Const.Program[MESA_SHADER_VERTEX]/g' \ -e 's/Const\.GeometryProgram/Const.Program[MESA_SHADER_GEOMETRY]/g' \ -e 's/Const\.FragmentProgram/Const.Program[MESA_SHADER_FRAGMENT]/g' Suggested-by: Brian Paul <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* st/mesa: use pipe_sampler_view_release()Jonathan Liu2013-12-221-1/+1
| | | | | | | | | | | | This fixes a crash where old_view->context was already freed in the pipe_sampler_view_reference function contained in src/gallium/auxiliary/utils/u_inlines.h. As a result, the sampler_view_destroy function pointer contained 0xfeeefeee indicating freed heap memory. Cc: "10.0" <[email protected]> Signed-off-by: Jonathan Liu <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* st/mesa: handle texture_from_pixmap and other surface-based textures correctlyMarek Olšák2013-05-151-1/+2
| | | | | | | | | | | | | | | | | | | | | There were 2 issues with it: 1) The texture format which should be used for texturing was only set in gl_texture_image::TexFormat, which wasn't used for sampler views. 2) Textures are sometimes reallocated under some circumstances in st_finalize_texture, which is unacceptable if the texture comes from a window system. The issues are resolved as follows: 1) If surface_based is true (texture_from_pixmap, etc.), store the format in a new variable st_texture_object::surface_format. 2) Don't reallocate a surface-based texture in st_finalize_texture. Also don't use st_ChooseTextureFormat is st_context_teximage, because the format is dictated by the caller. This fixes the glx-tfp piglit test. Reviewed-by: Adam Jackson <[email protected]>
* mesa: move max texture image unit constants to gl_program_constantsMarek Olšák2013-05-111-4/+4
| | | | | | | | | | Const.MaxTextureImageUnits -> Const.FragmentProgram.MaxTextureImageUnits Const.MaxVertexTextureImageUnits -> Const.VertexProgram.MaxTextureImageUnits etc. Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* st/mesa: fix texture buffer objectsMarek Olšák2013-02-131-4/+10
| | | | | | Broken by 624528834f53f54c7a934f929769b7e6b230a0b1. Reviewed-by: Brian Paul <[email protected]>
* st/mesa: simplify the update_single_texture() functionBrian Paul2013-02-041-28/+7
| | | | | | | | In particular, rework the sRGB/linear format selection code. There's no reason to mess with the Mesa format. Just do everything in terms of the gallium pipe_format. Reviewed-by: Marek Olšák <[email protected]>
* st/mesa: add support for GL_ARB_texture_buffer_rangeChristoph Bumiller2013-01-301-1/+21
| | | | | | | | v2: Update to handle BufferSize being -1 and return a NULL sampler view if the specified range would cause out of bounds access. Reviewed-by: Brian Paul <[email protected]> Acked-by: Ian Romanick <[email protected]>
* st/mesa: add texture buffer object support to state tracker (v1.1)Dave Airlie2012-12-081-6/+12
| | | | | | | | | | This adds the necessary changes to the st to allow texture buffer object support if the driver advertises it. v1.1: remove extra blank line and whitespace Reviewed-by: Brian Paul <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* st/mesa: fix sampler view countingBrian Paul2012-08-181-2/+9
| | | | | | | | | | | | | | | | | In the past, when we called pipe::set_sampler_views(n) the drivers set samplers [n..MAX] to NULL. We no longer do that. The state tracker code was already trying to set unused sampler views to NULL to cover that case, but the logic was broken and unnoticed until now. This patch fixes it. Strictly speaking, this patch shouldn't be necessary. Drivers should simply ignore unused samplers and sampler views. But some drivers like llvmpipe (and others?) count those things and they figure into state validation. That could be fixed in the future. Fixes http://bugs.freedesktop.org/show_bug.cgi?id=53617 Reviewed-by: Marek Olšák <[email protected]>
* st/mesa: add support for GS textures and samplersBrian Paul2012-08-161-1/+27
|
* st/mesa: combine vertex/fragment sampler state in arraysBrian Paul2012-08-161-4/+4
| | | | | | As with other recent changes, put the vertex and fragment sampler state into arrays indexed by the shader type. This will let us easily add support for other types of shaders in the future.
* st/mesa: merge fragment/vertex texture update codeBrian Paul2012-08-061-58/+42
| | | | Reviewed-by: José Fonseca <[email protected]>
* st/mesa: massage the update_vertex_textures() codeBrian Paul2012-08-061-4/+14
| | | | | | | ...to look like update_fragment_textures() code. The next step would be to merge the two functions. Reviewed-by: José Fonseca <[email protected]>
* st/mesa: rename some vertex/fragment state fields for better consistencyBrian Paul2012-08-061-8/+9
| | | | Reviewed-by: José Fonseca <[email protected]>
* gallium: consolidate CSO sampler and sampler_view functionsBrian Paul2012-08-031-6/+8
| | | | | | | | | | | | | Merge the vertex/fragment versions of the cso_set/save/restore_samplers() functions. Now we pass the shader stage (PIPE_SHADER_x) to the function to indicate vertex/fragment/geometry samplers. For example: cso_single_sampler(cso, PIPE_SHADER_FRAGMENT, unit, sampler); This results in quite a bit of code reduction, fewer CSO functions and support for geometry shaders. Reviewed-by: Marek Olšák <[email protected]>
* mesa: Move DepthMode to texture objectPauli Nieminen2012-08-011-2/+2
| | | | | | | | | | | | | | | | | | | | | | | GL_DEPTH_TEXTURE_MODE isn't meant to be part of sampler state based on compatibility profile specifications. OpenGL specification 4.1 compatibility 20100725 3.9.2: "... The values accepted in the pname parameter are TEXTURE_WRAP_S, TEXTURE_WRAP_T, TEXTURE_WRAP_R, TEXTURE_MIN_- FILTER, TEXTURE_MAG_FILTER, TEXTURE_BORDER_COLOR, TEXTURE_MIN_- LOD, TEXTURE_MAX_LOD, TEXTURE_LOD_BIAS, TEXTURE_COMPARE_MODE, and TEXTURE_COMPARE_FUNC. Texture state listed in table 6.25 but not listed here and in the sampler state in table 6.26 is not part of the sampler state, and remains in the texture object." The list of states is in Table 6.24 "Textures (state per texture object)" instead of 6.25 mentioned in the specification text. Same can be found from 3.3 compatibility specification. Signed-off-by: Pauli Nieminen <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* st/mesa: remove INLINE qualifiersBrian Paul2012-02-151-2/+2
| | | | | | | from st_get/create_texture_sampler_view_from stobj() functions. No real value in these cases. Reviewed-by: Jose Fonseca <[email protected]>
* st/mesa: remove st_get_default_texture()Brian Paul2012-02-151-1/+2
| | | | | | Just use _mesa_get_fallback_texture() instead. Reviewed-by: Jose Fonseca <[email protected]>
* st/mesa: exit the update fragment samplers/textures loops early.Dave Airlie2012-02-091-6/+13
| | | | | | | | | | If we have no more enabled samplers and we've reset all the previously used ones, no need to keep going around this loop. (just moved some stuff around to clean it up a bit). Signed-off-by: Dave Airlie <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* st/mesa: avoid vertex texture and sampler updates for 0 caseDave Airlie2012-02-081-0/+3
| | | | | | | | | | | If we had no vertex textures or samplers previously and we have none now, don't bother doing the enables dance. I was profiling nexuiz on noop and noticed these two functions in the profile, this drops their usage from 0.86% to 0.03% and 0.23% to 0.03% for texture and samplers. Signed-off-by: Dave Airlie <[email protected]>
* st/mesa: whitespace fixes, 80-column wrappingBrian Paul2012-01-121-14/+21
|
* st/mesa: fix indentationMorgan Armand2011-11-071-6/+5
| | | | Signed-off-by: Brian Paul <[email protected]>
* st/mesa: fix comment languageBrian Paul2011-07-281-3/+3
|
* st/mesa: replace st->ctx with ctxBrian Paul2011-06-141-13/+17
|
* mesa/st: split updating vertex and fragment shader stages.Dave Airlie2011-05-181-8/+10
| | | | | | | this seems like a logical thing to do and sets the correct st flags for vertex textures. Signed-off-by: Dave Airlie <[email protected]>
* st/mesa: overhaul vertex/fragment sampler and sampler views.Dave Airlie2011-05-161-74/+111
| | | | | | | | | | | | | | | | | | | 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 <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* intel: Add support for ARB_sampler_objects.Eric Anholt2011-04-231-1/+3
| | | | | | | | | | | | 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 <[email protected]>
* st/mesa: minor clean-ups in update_textures()Brian Paul2011-04-131-4/+8
|
* mesa: move sampler state into new gl_sampler_object typeBrian Paul2011-04-101-5/+13
| | | | | | 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().
* st/mesa: Set samplers views' first_level.Henri Verbeet2011-04-081-1/+3
| | | | | | | | 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 <[email protected]>
* st/mesa: clean up the sampler view format codeBrian Paul2011-01-201-7/+14
|
* st/mesa: formatting, whitespace fixesBrian Paul2011-01-201-10/+15
|
* gallium: add EXT_texture_sRGB_decode.Dave Airlie2011-01-161-0/+4
| | | | | | This uses a sampler view to access the texture with the alternate format. Signed-off-by: Dave Airlie <[email protected]>
* mesa/st: initial attempt at RG support for gallium driversDave Airlie2010-10-021-1/+9
| | | | passes all piglit RG tests with softpipe.
* st/mesa: implement depth texture modesMarek Olšák2010-07-201-11/+85
|
* mesa: rename src/mesa/shader/ to src/mesa/program/Brian Paul2010-06-101-1/+1
|
* st/mesa: attempt to fix TFP by using sampler views (v1)Dave Airlie2010-06-081-7/+21
| | | | | | | | | 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 <[email protected]>
* mesa/st: add support for EXT_texture_swizzle.Dave Airlie2010-06-051-2/+55
| | | | | | | | | | | 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 <[email protected]>
* st/mesa: remove dead codeBrian Paul2010-05-031-9/+0
|
* st/mesa: remove unused needFlush parameter to st_finalize_texture()Brian Paul2010-05-031-4/+4
|
* st/mesa: ignore gl_texture_object::BaseLevel when allocating gallium texturesBrian Paul2010-04-301-3/+0
| | | | | | | | | | | | | | | 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.
* st/mesa: remove st_texture_object::pipe fieldBrian Paul2010-04-181-1/+2
| | | | | Just pass the pipe context to st_get_texture_sampler_view() as is done for st_get_renderbuffer_sampler_view().
* st/mesa: s/st_get_stobj_sampler_view/st_get_texture_sampler_view/Brian Paul2010-04-181-1/+1
|
* st/mesa: Associate a sampler view with an st texture object.Michal Krol2010-03-121-10/+10
| | | | | Lazily create a sampler view when the texture is being bound for the first time.
* gallium: pipe/p_inlines.h -> util/u_inlines.hJosé Fonseca2010-02-021-0/+1
|