aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa
Commit message (Collapse)AuthorAgeFilesLines
* mesa: add MESA_FORMAT_B8G8R8X8_SRGBChia-I Wu2014-03-066-4/+76
| | | | | | | The format is needed to represent an RGB-only winsys framebuffer that is sRGB-capable. Reviewed-by: Brian Paul <[email protected]>
* mesa: fix packing/unpacking for MESA_FORMAT_A4R4G4B4_UNORMBrian Paul2014-03-053-13/+13
| | | | | | | | | Spotted by Chia-I Wu. v2: also fix unpack_ubyte_ARGB4444_REV() Reviewed-by: Roland Scheidegger <[email protected]> Reviewed-by: Chia-I Wu <[email protected]> Reviewed-by: Anuj Phogat <[email protected]>
* i965: Fix predicated-send-based discards with MRT.Eric Anholt2014-03-051-2/+2
| | | | | | | | | | | | | | | | | | | We need the header setup to not be predicated on which pixels are undiscarded. I'm not sure originally if I had thought that the mask disable implied predicate disable, or if I had just misread the mask disable as predicate disable. Either way, I know I had spent more time thinking about this in the gen8 generator than the gen7 generator. Plus, it turns out that I had mis-implemented the "the GPU will use the predicate unless this header is present" comment, by skipping setting up the pixel mask when the header was present. Fixes GPU hangs in piglit glsl-fs-discard-mrt, Trine, Trine 2 and preusmably MLL. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=75207 Tested-by: Tapani Pälli <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: remove remaining uses of _glthread_GetID()Brian Paul2014-03-052-8/+1
| | | | | | | | | | | | | | | It was really only used in the radeon driver for a debug printf. And evidently, libGL.so referenced it just to work around some sort of linker issue. This patch removes the two calls to the function and the function itself. Fixes undefined _glthread_GetID symbol in libGL reported by 'nm'. Though, the missing symbol doesn't cause any issues on my system but it does cause glxinfo to fail on one of our test systems. Reviewed-by: Jose Fonseca <[email protected]>
* mesa: new init_teximage_fields_ms() function to init MS texture imagesBrian Paul2014-03-051-15/+29
| | | | | | | Before, it was kind of ugly to set the multisample fields with assignments after we called _mesa_init_teximage_fields(). Reviewed-by: Anuj Phogat <[email protected]>
* i965: Mark invariants in backend_visitor as constantsTopi Pohjolainen2014-03-051-6/+6
| | | | | Reviewed-by: Matt Turner <[email protected]> Signed-off-by: Topi Pohjolainen <[email protected]>
* i965: Merge resolving of shader program sourceTopi Pohjolainen2014-03-0511-26/+23
| | | | | Reviewed-by: Matt Turner <[email protected]> Signed-off-by: Topi Pohjolainen <[email protected]>
* i965: Merge initialisation of backend_visitorTopi Pohjolainen2014-03-054-14/+23
| | | | | Reviewed-by: Matt Turner <[email protected]> Signed-off-by: Topi Pohjolainen <[email protected]>
* i965/wm: Use resolved miptree consistently in surface setupTopi Pohjolainen2014-03-052-13/+13
| | | | | | | | | | | | Most of the logic refers to the local variable 'mt' directly but a few cases use 'intelObj->mt' instead. These are the same for now but will be different once stencil miptree gets used. v2 (Ian): fixed also indentation in surrounding lines Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Signed-off-by: Topi Pohjolainen <[email protected]>
* i965/vec4: Mark invariant members as constants in vec4_visitorTopi Pohjolainen2014-03-052-7/+7
| | | | | | Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Signed-off-by: Topi Pohjolainen <[email protected]>
* i965: Mark sources for offset getters as constantsTopi Pohjolainen2014-03-054-9/+9
| | | | | | Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Signed-off-by: Topi Pohjolainen <[email protected]>
* i965: Implement ARB_stencil_texturing on Gen8+.Kenneth Graunke2014-03-044-4/+20
| | | | | | | | | | | | | | | | | | | | On earlier hardware, we had to implement math in the shader to translate Y-tiled or untiled coordinates to W-tiled coordinates (which is what BLORP does today in order to texture from stencil buffers). On Broadwell, we can simply state that it's W-tiled in SURFACE_STATE, and adjust the pitch. This is much easier. In the surface state code, I chose to handle the "should we sample depth or stencil?" question separately from the setup for sampling from stencil. This should make it work with the BindRenderbufferTexImage hook as well, and hopefully be reusable for GL_ARB_texture_stencil8 someday. v2: Update docs/GL3.txt (caught by Matt). Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* mesa: Add core API support for GL_ARB_stencil_texturing (from 4.3).Kenneth Graunke2014-03-045-0/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | While the GL_ARB_stencil_texturing extension does not allow the creation of stencil textures, it does allow shaders to sample stencil values stored in packed depth/stencil textures. Specifically, applications can call glTexParameter* with a pname of GL_DEPTH_STENCIL_TEXTURE_MODE and value of either GL_DEPTH_COMPONENT or GL_STENCIL_INDEX to select which component they wish to sample. The default value is GL_DEPTH_COMPONENT (for traditional depth sampling). Shaders should use an unsigned integer sampler (presumably usampler2D) to access stencil data. Otherwise, results are undefined. Using shadow samplers with GL_STENCIL_INDEX selected also is undefined behavior. This patch creates a new gl_texture_object field, StencilSampling, to indicate that stencil should be sampled rather than depth. (I chose to use a boolean since I figured it would be more convenient for drivers.) It also introduces the [Get]TexParameter code to get and set the value, and of course the extension plumbing. v2: Also consider textures incomplete when sampling stencil with non-NEAREST min/mag filters (caught by Eric Anholt). Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* mesa: Allow GL_DEPTH_COMPONENT and GL_DEPTH_STENCIL combinations in ↵Anuj Phogat2014-03-041-2/+11
| | | | | | | | | | | | | | | | | | glTexImage{123}D() From OpenGL 3.3 spec, page 141: "Textures with a base internal format of DEPTH_COMPONENT or DEPTH_STENCIL require either depth component data or depth/stencil component data. Textures with other base internal formats require RGBA component data. The error INVALID_OPERATION is generated if one of the base internal format and format is DEPTH_COMPONENT or DEPTH_STENCIL, and the other is neither of these values." Fixes Khronos OpenGL CTS test failure: proxy_textures_invalid_size Cc: <[email protected]> Signed-off-by: Anuj Phogat <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: Use clear_teximage_fields() in place of _mesa_init_teximage_fields()Anuj Phogat2014-03-041-2/+1
| | | | | | | This patch makes no functional changes to the code. Signed-off-by: Anuj Phogat <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: Set initial internal format of a texture to GL_RGBAAnuj Phogat2014-03-041-3/+10
| | | | | | | | | | | | | From OpenGL 4.0 spec, page 398: "The initial internal format of a texel array is RGBA instead of 1. TEXTURE_COMPONENTS is deprecated; always use TEXTURE_INTERNAL_FORMAT." Fixes Khronos OpenGL CTS test failure: proxy_textures_invalid_size Cc: <[email protected]> Signed-off-by: Anuj Phogat <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: remove empty glthread.h fileBrian Paul2014-03-036-6/+1
| | | | Reviewed-by: José Fonseca <[email protected]>
* xlib: remove unneeded context tracking codeBrian Paul2014-03-031-43/+4
| | | | | | This removes the only use of _glthread_Get/SetTSD(), etc. Reviewed-by: José Fonseca <[email protected]>
* xlib: simplify context handlingBrian Paul2014-03-033-109/+28
| | | | | | | Get rid of the fake_glx_context struct. Now, an XMesaContext is the same as a GLXContext. Reviewed-by: José Fonseca <[email protected]>
* xlib: remove unused realglx.[ch] filesBrian Paul2014-03-033-517/+4
| | | | | | | At one point in time, the xlib driver could call the real GLX functions. But that's long dead. Reviewed-by: José Fonseca <[email protected]>
* mesa: switch to c11 mutex functionsBrian Paul2014-03-0320-140/+140
| | | | Reviewed-by: José Fonseca <[email protected]>
* xlib: switch to c11 mutex functionsBrian Paul2014-03-033-14/+14
| | | | | | | The _glthread_LOCK/UNLOCK_MUTEX() macros are just wrappers around the c11 mutex functions. Let's start getting rid of those wrappers. Reviewed-by: José Fonseca <[email protected]>
* mesa: update packed format layout commentsBrian Paul2014-03-031-50/+50
| | | | | | | | | Update the comments for the packed formats to accurately reflect the layout of the bits in the pixel. For example, for the packed format MESA_FORMAT_R8G8B8A8, R is in the least significant position while A is in the most-significant position of the 32-bit word. v2: also fix MESA_FORMAT_A1B5G5R5_UNORM, per Roland.
* mesa: don't define c99 math functions for MSVC >= 1800Hans2014-03-031-1/+1
| | | | | Signed-off-by: Brian Paul <[email protected]> Cc: "10.0" "10.1" <[email protected]>
* mesa: don't call ctx->Driver.ClearBufferSubData() if size==0Brian Paul2014-03-031-4/+8
| | | | | | | | Fixes failed assertion when trying to map zero-length region. https://bugs.freedesktop.org/show_bug.cgi?id=75660 Cc: "10.0" "10.1" <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
* NV_vdpau_interop: fix IsSurfaceNV return typeGrigori Goronzy2014-03-032-5/+6
| | | | | | | | The spec incorrectly used void as return type, when it should have been GLboolean. This has now been fixed. According to Nvidia, their implementation always used GLboolean. Reviewed-by: Christian König <[email protected]>
* mesa: Move MESA_GLSL=dump output to stderr.Kenneth Graunke2014-03-022-20/+23
| | | | | | | | | | | | i965 recently moved debug printfs to use stderr, including ones which trigger on MESA_GLSL=dump. This resulted in scrambled output. For drivers using ir_to_mesa, print_program was already using stderr, yet all the code around it was using stdout. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* i965: Validate (and resolve) all the bound textures.Chris Forbes2014-03-022-2/+2
| | | | | | | | | | | | | | | | | | | BRW_MAX_TEX_UNIT is the static limit on the number of textures we support per-stage, not in total. Core's `Unit` array is sized by MAX_COMBINED_TEXTURE_IMAGE_UNITS, which is significantly larger, and across the various shader stages, up to ctx->Const.MaxCombinedTextureImageUnits elements of it may be actually used. Fixes invisible bad behavior in piglit's max-samplers test (although this escalated to an assertion failure on HSW with texture_view, since non-immutable textures only have _Format set by validation.) Signed-off-by: Chris Forbes <[email protected]> Cc: "9.2 10.0 10.1" <[email protected]> Cc: Kenneth Graunke <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* i965: Widen sampler key bitfields for 32 samplersChris Forbes2014-03-021-3/+3
| | | | | | | | | | | | | Previously the `high` 16 samplers on Haswell+ would not get sampler workarounds applied. Don't bother widening YUV fields, since they're ignored and going away soon anyway. Signed-off-by: Chris Forbes <[email protected]> Cc: "10.1" <[email protected]> Cc: Kenneth Graunke <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* dri/i9*5: correctly calculate the amount of system memoryEmil Velikov2014-03-012-2/+2
| | | | | | | | | The variable name states megabytes, while we calculate the amount in kilobytes. Correct this by dividing with the correct amount. Signed-off-by: Emil Velikov <[email protected]> Cc: "10.0 10.1" <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: add unpacking code for MESA_FORMAT_Z32_FLOAT_S8X24_UINTBrian Paul2014-02-281-0/+22
| | | | | | | | | Fixes glGetTexImage() when converting from MESA_FORMAT_Z32_FLOAT_S8X24_UINT to GL_UNSIGNED_INT_24_8. Hit by the piglit ext_packed_depth_stencil-getteximage test. Cc: "10.0" "10.1" <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* i915: Allocate the sys_buffer using _mesa_align_mallocIan Romanick2014-02-281-7/+8
| | | | | | | | | | | | | Though it won't matter on Linux, use _mesa_align_free to release it. Since i965 doesn't have sys_buffer, I overlooked this in the GL_ARB_map_buffer_alignment work a few months ago. Fixes i915 (and presumably i830) regressions in ARB_map_buffer_range tests and the failure in arb_map_buffer_alignment-sanity_test. Signed-off-by: Ian Romanick <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74960 Cc: "10.1" <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* i915: Only allow 8 vertex texture unitsIan Romanick2014-02-281-0/+1
| | | | | | | | | | | | | | There's no reason to have more vertex texture units than fragment texture units on this hardware. Since increasing the default maximum number of texture units from 16 to 32, this has triggered some segfault in i915 driver. There's probably some array or bitfield that isn't properly sized now. This really papers over the bug, but I don't think I'll lose any sleep over that. Signed-off-by: Ian Romanick <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74071 Cc: "10.1" <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* i965: Assert array index on access to vec4_visitor's arrays.Petri Latvala2014-02-282-0/+8
| | | | | | | | | v2: vec4_visitor::pack_uniform_registers(): Use correct comparison in the assert, this->uniforms is already adjusted. Compare the actual value used to index uniform_size and uniform_vector_size instead. Signed-off-by: Petri Latvala <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* i965: Allocate vec4_visitor's uniform_size and uniform_vector_size arrays ↵Petri Latvala2014-02-284-2/+28
| | | | | | | | | | | | | | | | | | | | | | dynamically. v2: Don't add function parameters, pass the required size in prog_data->nr_params. v3: - Use the name uniform_array_size instead of uniform_param_count. - Round up when dividing param_count by 4. - Use MAX2() instead of taking the maximum by hand. - Don't crash if prog_data passed to vec4_visitor constructor is NULL v4: Rebase for current master v5 (idr): Trivial whitespace change. Signed-off-by: Petri Latvala <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71254 Cc: "10.1" <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: do depth/stencil format conversion in glGetTexImageBrian Paul2014-02-281-2/+9
| | | | | | | | | | | | | | | | glGetTexImage(GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8) was just using memcpy() instead of _mesa_unpack_uint_24_8_depth_stencil_row() to convert texels from the hardware format to the GL format. Fixes issue reported by David Meng at Intel. The new piglit ext_packed_depth_stencil-getteximage test checks for this bug. Also, add some format/type assertions. We don't yet handle the GL_FLOAT_32_UNSIGNED_INT_24_8_REV type. That should be fixed in a follow-on patch. Reviewed-by: Eric Anholt <[email protected]> Cc: "10.0" "10.1" <[email protected]>
* mesa: fix depth/stencil comments in formats.hBrian Paul2014-02-281-2/+2
|
* meta: Drop ctx->API checks.Kenneth Graunke2014-02-272-92/+50
| | | | | | | | | | | | | API is always API_OPENGL_COMPAT (since commit 4e4a537ad55f61a25, "meta: Push into desktop GL mode when doing meta operations."), so most of these checks do nothing. We could instead check save->API to only bother setting/restoring relevant GL state, but I'm not sure saving a few _mesa_set_enable calls is worth the complexity. My understanding is the point of the ctx->API guards was to avoid raising GL errors. Signed-off-by: Kenneth Graunke <[email protected]>
* meta: Restore API at the end of _mesa_meta_end(), not the start.Kenneth Graunke2014-02-271-2/+2
| | | | | | | | | | | In _mesa_meta_begin(), we switch to API_OPENGL_COMPAT, then munge a lot of state (including some that doesn't exist in the actual API - like PolygonStipple in API_OPENGL_CORE). It seems reasonable that in _mesa_meta_end(), we should restore it, then switch back to the original API. This at least makes it symmetric. Signed-off-by: Kenneth Graunke <[email protected]>
* i965: Convert VUE map generation checks to if rather than switch.Kenneth Graunke2014-02-271-11/+2
| | | | | | | | | | | | There are currently only two VUE map layouts: one for Gen4-5, and one for everything else. We keep having to add new "case N+1" labels for every new hardware generation, and so far it's always been the same. This patch makes it so we only have to do work in the case where something actually changes. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* i965: Only emit VS state pipe control workaround on IVB and BYT.Kenneth Graunke2014-02-273-3/+5
| | | | | | | | | | | | | | According to the BSpec's 3D workarounds page, this is unnecessary on shipping Haswell hardware, and was never necessary on Broadwell. It unfortunately doesn't say anything about Baytrail. The workaround database confirms those results for Ivybridge, Haswell, and Broadwell. Baytrail is less clear - one page says it's necessary, while the other says it isn't. For now, be conservative and leave it enabled. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* i965: Fix the region's pitch condition to use blitterAnuj Phogat2014-02-261-3/+3
| | | | | | | | | intelEmitCopyBlit uses a signed 16-bit integer to represent buffer pitch, so it can only handle buffer pitches < 32k. Cc: [email protected] Signed-off-by: Anuj Phogat <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* meta: Use a #define for the vector type to avoid %svec4 everywhere.Kenneth Graunke2014-02-261-10/+7
| | | | | | | | | | | | | | | | By adding "#define gvec4 %svec4" to the top of our fragment shader, we can write generic code without needing to specialize it to vec4, ivec4, or uvec4 via asprintf. This also makes the INT and UNSIGNED_INT merge function code identical, so I combined those two cases. It's not a big savings, but a little bit tidier. v2: Rebase on Vinson's MSVC build fixes. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* i965: Don't try to dump shader source for fixed-function FS programs.Kenneth Graunke2014-02-261-1/+1
| | | | | | | | | | sh->Source is NULL and this will segfault. Fixes MESA_GLSL=dump with "The Swapper". Cc: [email protected] Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* i965: Don't forget to subtract mt->first_level in minify calls.Kenneth Graunke2014-02-265-12/+13
| | | | | | | | | | | This fixes fbo-clear-formats GL_ARB_depth_texture on Ironlake, which regressed since commit f128bcc7c293013f4b44e4b661638333de0077c2 ("i965: Drop mt->levels[].width/height.") intel_miptree_copy_slice was calling minify(.., 7) on a 2x2 texture with mt->first_level == 7. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=75292 Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* i965: Stop lowering ir_triop_lrp.Kenneth Graunke2014-02-261-2/+0
| | | | | | | | | | Both the vector and scalar backends now support it natively, so there's no point in lowering it. Cc: "10.1" <[email protected]> Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]> Acked-by: Eric Anholt <[email protected]>
* i965/vec4: Handle ir_triop_lrp on Gen4-5 as well.Kenneth Graunke2014-02-262-7/+38
| | | | | | | | | | | | | | | | | | | | | | | When the vec4 backend encountered an ir_triop_lrp, it always emitted an actual LRP instruction, which only exists on Gen6+. Gen4-5 used lower_instructions() to decompose ir_triop_lrp at the IR level. Since commit 8d37e9915a3b21 ("glsl: Optimize open-coded lrp into lrp."), we've had an bug where lower_instructions translates ir_triop_lrp into arithmetic, but opt_algebraic reassembles it back into a lrp. To avoid this ordering concern, just handle ir_triop_lrp in the backend. The FS backend already does this, so we may as well do likewise. v2: Add a comment reminding us that we could emit better assembly if we implemented the infrastructure necessary to support using MAC. (Assembly code provided by Eric Anholt). Cc: "10.1" <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=75253 Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]> Acked-by: Eric Anholt <[email protected]>
* i965/vec4: Add a brw->gen >= 6 assertion in three-source emitters.Kenneth Graunke2014-02-261-0/+1
| | | | | | | | | | | Three source instructions didn't exist until Gen6. vec4_generator has assertions to catch this, but catching it in the visitor provides a nicer backtrace. Cc: "10.1" <[email protected]> Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]> Acked-by: Eric Anholt <[email protected]>
* mesa: Add GL_ARB_buffer_storage to dispatch_sanity.cpp.Vinson Lee2014-02-251-0/+3
| | | | | | | | | Fixes 'make check' failure introduced with commit 119ffa7307d62e7310ce3902fded662ee4021c92. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=75503 Signed-off-by: Vinson Lee <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* i965: Fix segfaults since the buffer_storage changes.Eric Anholt2014-02-251-1/+1
|