summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* linker: Calculate used samplers and shadow samplers in the linkerIan Romanick2012-01-114-39/+64
| | | | | | | | | | | | It used to be done in ir_to_mesa, and that was kind of a bad place. I didn't change st_glsl_to_tgsi because there is some strange stuff happening in the code that generates glDrawPixels shaders. It looked like this would break horribly if I touched anything. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* linker: Calculate the sampler to texture target mapping during linkingIan Romanick2012-01-118-17/+28
| | | | | | | | | Track the calculated data in gl_shader_program instead of the individual assembly shaders. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Add glsl_type::sampler_indexIan Romanick2012-01-112-0/+35
| | | | | | Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Validate sampler settings using uniform storageIan Romanick2012-01-113-62/+48
| | | | | | | | | | | | | Rather than looking at the settings in individual assembly programs, look at the settings in the top-level uniform values. The old code was flawed because examining each shader stage in isolation could allow inconsitent usage across stages (e.g., bind unit 0 to a sampler2D in the vertex shader and sampler1DShadow in the fragment shader). Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Track fixed-function fragment shader as a shaderIan Romanick2012-01-117-5/+50
| | | | | | | | | | | | Previously the fixed-function fragment shader was tracked as a gl_program. This means that it shows up in the driver as a Mesa IR program instead of as a GLSL IR program. If a driver doesn't generate Mesa IR from the GLSL IR, that program is empty. If the program is empty there is either no rendering or a GPU hang. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Acked-by: Kenneth Graunke <[email protected]>
* mesa: Use static buffer for uniform nameIan Romanick2012-01-111-1/+6
| | | | | | Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Use uniform interfaces in fixed-function fragment shader codeIan Romanick2012-01-111-5/+24
| | | | | | | | | | | Poking directly at the backing resources works only by luck. Core Mesa code should only know about the gl_uniform_storage structure. Soon other code that looks at samplers will use the gl_uniform_storage structures instead of the data in the gl_program. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Acked-by: Kenneth Graunke <[email protected]>
* Clean up GL3 statusMatt Turner2012-01-111-39/+39
| | | | | Reviewed-by: Ian Romanick <[email protected]> Signed-off-by: Matt Turner <[email protected]>
* configure.ac: use AC_PROG_SEDMatt Turner2012-01-111-1/+1
| | | | | | | | | It looks like AC_PROG_SED was added in 2.59b, and wasn't in the original 2.59 in the original 2.59. Presumably that's why, though it could've been an oversight. Reviewed-by: Kenneth Graunke <[email protected]> Signed-off-by: Matt Turner <[email protected]>
* configure.ac: don't set HAVE_GTEST twiceMatt Turner2012-01-111-1/+0
| | | | | Reviewed-by: Ian Romanick <[email protected]> Signed-off-by: Matt Turner <[email protected]>
* i965: Don't reallocate push constant URB space on new VS programs.Kenneth Graunke2012-01-113-10/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The gen7_urb atom depends on CACHE_NEW_VS_PROG and CACHE_NEW_GS_PROG, causing gen7_upload_urb() to be called when switching to a new VS program. In addition to partitioning the URB space between the VS and GS, gen7_upload_urb() also allocated space for VS and PS push constants. Unfortunately, this meant that whenever CACHE_NEW_VS was flagged, we'd reallocate the space for the PS push constants. According to the BSpec, after sending 3DSTATE_PUSH_CONSTANT_ALLOC_PS, we must reprogram 3DSTATE_CONSTANT_PS prior to the next 3DPRIMITIVE. Since our URB allocation for push constants is entirely static, it makes sense to split it out into its own atom that only subscribes to BRW_NEW_CONTEXT. This avoids reallocating the space and trashing constants. Fixes a rendering artifact in Extreme Tuxracer, where instead of a snow trail, you'd get a bright red streak (affectionately known as the "bloody penguin bug"). This also explains why adding VS-related dirty bits to gen7_ps_state made the problem disappear: it made 3DSTATE_CONSTANT_PS be emitted after every 3DSTATE_PUSH_CONSTANT_ALLOC_PS packet. NOTE: This is a candidate for the 7.11 branch. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=38868 Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* glx/dri: Initialize api even if num_attribs == 0.Kenneth Graunke2012-01-111-1/+3
| | | | | | | | | | | | Both dri2_create_context_attribs and drisw_create_context_attribs call dri2_convert_glx_attribs, expecting it to fill in *api on success. However, when num_attribs == 0, it was returning true without setting *api, causing the caller to use an uninitialized value. Tested-by: Vadim Girlin <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Signed-off-by: Kenneth Graunke <[email protected]>
* svga: don't reference count svga_sampler_view's textureBrian Paul2012-01-111-2/+12
| | | | | | | | | | | | | | | | svga_sampler_view contains a pointer to a pipe_resource (base class of svga_texture) and svga_texture contains a pointer to an svga_sampler_view. This circular dependency prevented the objects from ever being freed when they pointed to each other. Make the svga_sampler_view::texture pointer a "weak reference" (no reference counting) to break the dependency. This is safe to do because the pipe_resource/texture always has a longer lifespan than the sampler view so when svga_sampler_view stops referencing the texture, the texture's refcount never hits zero. Fixes a memory leak seen with google earth and other apps. Reviewed-by: Jakob Bornecrantz <[email protected]>
* i965: Fix compiler warning from uninitialized "success" value.Eric Anholt2012-01-111-1/+1
| | | | | This shouldn't happen, because the DDX should only load this driver if IS_965. But better to do something defined in that case.
* i965/gen7: Fix segfault in transform feedback to DYNAMIC_DRAW buffers.Eric Anholt2012-01-111-2/+3
| | | | Fixes piglit EXT_transform_feedback/buffer-usage.
* i965/vs: Try to emit more components of constant vectors at once.Eric Anholt2012-01-111-2/+27
| | | | | | | | | | | | | | We were naively emitting each component at a time, even if we were emitting the same value to multiple channels. Improves on a codegen regression from the old VS to the new VS on some unigine shaders (because we emit constant vecs/matrices as immediates instead of loading them as push constants, so we had over 4x the instructions for using them). shader-db results: Total instructions: 58594 -> 58540 11/870 programs affected (1.3%) 765 -> 711 instructions in affected programs (7.1% reduction)
* mesa: add _mesa_HashNumEntries() functionBrian Paul2012-01-112-0/+23
| | | | | Useful when debugging to find the number of texture objects, shader programs, etc.
* st/wgl: Return NULL for NULL HDCs in wglGetExtensionsStringARB.José Fonseca2012-01-111-1/+3
| | | | | | | WGL_ARB_extensions_string states that wglGetExtensionsStringARB should return NULL for invalid HDCs. And some applications rely on it. Reviewed-By: "Keith Whitwell" <[email protected]>
* llvmpipe: disable native integersDave Airlie2012-01-111-1/+8
| | | | | | llvmpipe shouldn't be reporting native integer support. Signed-off-by: Dave Airlie <[email protected]>
* xlib: stop calling XShmQueryVersion()Brian Paul2012-01-111-8/+8
| | | | | | | | | | It caused an X protocol error in some (rare) situations. This is a follow-on to the previous commits which fixes a bug reported by Wayne E. Robertz. NOTE: This is a candidate for the 7.11 branch. Reviewed-by: Adam Jackson <[email protected]>
* st/glx/xlib: call register_with_display() in glXChooseFBConfig()Brian Paul2012-01-111-0/+3
| | | | | | | | | This is the same fix as the previous commit, except it's for the gallium glx/xlib state tracker. NOTE: This is a candidate for the 7.11 branch. Reviewed-by: Adam Jackson <[email protected]>
* xlib: call register_with_display() in Fake_glXChooseFBConfig()Brian Paul2012-01-111-0/+3
| | | | | | | | | | | | as we do in Fake_glXChooseVisual(). This registers the MesaGLX extension on the display so we can clean up buffers, etc. when the display connection is closed. Fixes a bug reported by Wayne E. Robertz. NOTE: This is a candidate for the 7.11 branch. Reviewed-by: Adam Jackson <[email protected]>
* nv50/ir: handle TGSI_OPCODE_ISSGChristoph Bumiller2012-01-111-3/+8
|
* nv50/ir: handle TGSI_TEXTURE_SHADOWCUBEChristoph Bumiller2012-01-111-0/+1
|
* nv50,nvc0: zero out program struct on program_destroyChristoph Bumiller2012-01-112-3/+13
| | | | | | | Prevent any state from carrying over to a new translation in cases where we assume that data is still zero from initial calloc (these would require us to do individual zeroing before translation which would be more code).
* wayland-drm: Drop the non-premul formats, use format codes from drm_fourcc.hKristian Høgsberg2012-01-119-67/+97
|
* draw: Store the new pre_clip_pos member as well.José Fonseca2012-01-111-6/+16
| | | | | Again, not much testing nor peer review, but should be better than what's now.
* egl_dri2: Put the _eglError call in the case switch caseKristian Høgsberg2012-01-111-2/+2
| | | | | Log an error in case we get an unknown format, not in case for XRGB32. I botched the edit of Roberts patch.
* st/mesa: rename translate_texture_target, and make translate_opcode static.Dave Airlie2012-01-113-8/+5
| | | | | | As suggested by Brian. Signed-off-by: Dave Airlie <[email protected]>
* softpipe: route correct coordinates for shadow cube sampling.Dave Airlie2012-01-111-1/+2
| | | | | | This fixes the shadow cube map sampling on softpipe. Signed-off-by: Dave Airlie <[email protected]>
* glsl_to_tgsi: add support for shadow cube map sampling.Dave Airlie2012-01-112-2/+4
| | | | | | | This along with the TGSI support lets the piglit sampler-cube-shadow test pass on softpipe. Signed-off-by: Dave Airlie <[email protected]>
* tgsi: add TGSI_TEXTURE_SHADOWCUBEMAPDave Airlie2012-01-114-1/+6
| | | | | | | | This adds support for shadow cubemap texture sampling instructions. This is required for GL 3.0. Signed-off-by: Dave Airlie <[email protected]>
* llvmpipe: Update for TGSI_INTERPOLATE_COLOR.José Fonseca2012-01-111-7/+3
| | | | | Not thoroughly tested nor reviewed. But should at least prevent the assertion failure.
* egl_dri2/wayland: handle creating xrgb8888 imagesRobert Bragg2012-01-113-56/+80
| | | | | | | | | | | | | | | | | | | | When creating an EGLImage from a struct wl_buffer * this ensures that we create an XRGB8888 image if the wayland buffer doesn't have an alpha channel. To determine if a wl_buffer has a valid alpha channel this patch adds an internal wayland_drm_buffer_has_alpha() function. It's important to get the internal format for an EGLImage right so that if a GL texture is later created from the image then the GL driver will know if it should sample the alpha from the texture or flatten it to a constant of 1.0. This avoids needing fragment program workarounds in wayland compositors to manually ignore the alpha component of textures created from wayland buffers. krh: Edited to use wl_buffer_get_format() instead of wl_buffer_has_alpha(). Reviewed-by: Kristian Høgsberg <[email protected]>
* glx: Suppress unused variable warning for cmdlenPaul Berry2012-01-111-1/+1
| | | | | | | | | | | | No functional change. In the function __indirect_glAreTexturesResident(), the variable cmdlen is only used if USE_XCB is not defined. This patch avoids a compile warning in the event that USE_XCB is defined. v2: just move cmdlen declaration inside the #else part. Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Move transform feedback error check to reduce array overflow risk.Paul Berry2012-01-111-20/+32
| | | | | | | | | | | | | | | | | | | | | | | | | Previous to this patch, we didn't do the limit check for MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS until the end of the store_tfeedback_info() function, *after* storing all of the transform feedback info in the gl_transform_feedback_info::Outputs array. This meant that the limit check wouldn't prevent us from overflowing the array and corrupting memory. This patch moves the limit check to the top of tfeedback_decl::store() so that there is no risk of overflowing the array. It also adds assertions to verify that the checks for MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS and MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS are sufficient to avoid array overflow. Note: strictly speaking this patch isn't necessary, since the maximum possible number of varyings is MAX_VARYING (16), whereas the size of the Outputs array is MAX_PROGRAM_OUTPUTS (64), so it's impossible to have enough varyings to overflow the array. However it seems prudent to do the limit check before the array access in case these limits change in the future. Reviewed-by: Ian Romanick <[email protected]>
* mesa: Fix transform feedback of unsubscripted gl_ClipDistance array.Paul Berry2012-01-112-33/+58
| | | | | | | | | | | | | | | | | | | | | On drivers that set gl_shader_compiler_options::LowerClipDistance (for example i965), we need to handle transform feedback of gl_ClipDistance specially, to account for the fact that the hardware represents it as an array of vec4's rather than an array of floats. The previous way this was accounted for (translating the request for gl_ClipDistance[n] to a request for a component of gl_ClipDistanceMESA[n/4]) doesn't work when performing transform feedback on the whole unsubscripted array, because we need to keep track of the size of the gl_ClipDistance array prior to the lowering pass. So I replaced it with a boolean is_clip_distance_mesa, which switches on the special logic that is needed to handle the lowered version of gl_ClipDistance. Fixes Piglit tests "EXT_transform_feedback/builtin-varyings gl_ClipDistance[{1,2,3,5,6,7}]-no-subscript". Reviewed-by: Eric Anholt <[email protected]>
* mesa: Fix computation of transform feedback num_components.Paul Berry2012-01-111-1/+7
| | | | | | | | | | | | | | | | | | The function tfeedback_decl::num_components() was not correctly accounting for transform feedback of whole arrays and gl_ClipDistance. The bug was hard to notice in tests, because it only affected the checks for MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS and MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS. This patch fixes the computation, and adds an assertion to verify num_components() even when MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS and MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS are not exceeded. The assertion requires keeping track of components_so_far in tfeedback_decl::store(); this will be useful in a future patch to fix non-multiple-of-4-sized gl_ClipDistance. Reviewed-by: Eric Anholt <[email protected]>
* st_extensions: fixup GLSL 1.30 related enables (v3)Dave Airlie2012-01-112-9/+33
| | | | | | | | | | | | | | | | This just fixes up the enables for native integers and EXT_texture_integer support in st/mesa. It also set the MaxClipPlanes to 8. We should consider exposing caps for MCP vs MCD, but since core mesa doesn't care yet maybe we can wait for now. v2: use 32-bit formats as per Marek's mail. v3: add calim's fix for INT_DIV_TO_MUL_RCP disabling. Signed-off-by: Dave Airlie <[email protected]>
* st_glsl_to_tgsi: use ISSG and fixup IABSDave Airlie2012-01-111-4/+4
| | | | | | | It doesn't look like the GLSL compiler will produce sign op for an unsigned anyways (seems insane anyways). Signed-off-by: Dave Airlie <[email protected]>
* tgsi: add ISSG supportDave Airlie2012-01-113-1/+17
| | | | | | | This adds integer version of SSG that GLSL 1.30 can produce. Signed-off-by: Dave Airlie <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* softpipe: enable clamping controlDave Airlie2012-01-112-3/+8
| | | | | | | | This enables fragment clamping in softpipe, it passes more tests than it did previously with no regressions, There are still a couple of failures in the SNORM types to investigate. Signed-off-by: Dave Airlie <[email protected]>
* softpipe: fix texel fetch swizzlesDave Airlie2012-01-111-26/+43
| | | | | | | This fixes a number of texelFetch swizzle tests, and consoldiates the swizzle handling in a new function. Signed-off-by: Dave Airlie <[email protected]>
* i915g: Fix bugs in the shader optimizer.Stéphane Marchesin2012-01-111-46/+80
|
* softpipe: fix llvm buildDave Airlie2012-01-113-3/+3
| | | | | | Thanks to Wubbbi on #dri-devel for pointing it out. Signed-off-by: Dave Airlie <[email protected]>
* draw: clipdistance support (v2)Dave Airlie2012-01-117-17/+79
| | | | | | | | | | Add support for using the clipdistance instead of clip plane. Passes all piglit clipdistance tests. v2: fixup some comments from Brian in review. Signed-off-by: Dave Airlie <[email protected]>
* tgsi_scan: add support to count number of output clip distancesDave Airlie2012-01-112-0/+5
| | | | | | Just add support to the scanner to count the number of clip distances. Signed-off-by: Dave Airlie <[email protected]>
* draw/softpipe: add clip vertex support. (v2)Dave Airlie2012-01-119-18/+58
| | | | | | | | | | | | | | | | softpipe always clipped using the position vector, however for unclipped vertices it stored the position in window coordinates, however when position and clipping are separated, we need to store the clip-space position and the clip-space vertex clip, so we can interpolate both separately. This means we have to take the clip space position and store it to use later. This allows softpipe to pass all the clip-vertex piglit tests. v2: fix llvm draw regression, the structure being passed into llvm needed updating, remove some hardcoded ints that should have been enums while there. Signed-off-by: Dave Airlie <[email protected]>
* tgsi/softpipe: add VertexID support.Dave Airlie2012-01-113-6/+19
| | | | | | | | | | This required changing the system value semantics, so we stored a system value per vertex, instance id is the only other system value we currently support, so I span it across the channels. This passes the 3 vertexid-* piglit tests + lots of instanceid tests. Signed-off-by: Dave Airlie <[email protected]>
* softpipe: allow softpipe to set shader params depending on runtime llvm (v3)Dave Airlie2012-01-113-9/+18
| | | | | | | | | | | | | If draw isn't using llvm we can support vertex texture and integers, These will be fixed up later, but for now allow this check to happen at run-time. v2: since 3e22c7a25321554a32fa6254485912fd53deff3a we can ask draw for a non-llvm context. Just track if ask and set the vars accordingly. This probably isn't perfect but should cover the cases we care about. v3: use debug option, restructure to store in screen, as suggested by Jakob. Signed-off-by: Dave Airlie <[email protected]>