summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
Commit message (Collapse)AuthorAgeFilesLines
* mesa: Introduce a _mesa_format_has_color_component() helper.Kenneth Graunke2014-03-242-0/+33
| | | | | | | | | | | | | When considering color write masks, we often want to know whether an RGBA component actually contains any meaningful data. This function provides an easy way to answer that question, and handles luminance, intensity, and alpha formats correctly. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Tested-by: Dylan Baker <[email protected]>
* mesa: Stop skipping the FinishRenderTexture calls for winsys FBOs.Eric Anholt2014-03-241-2/+3
| | | | | | | | | | Now that BindRenderbufferTexImage() is a thing that drivers can do, winsys FBOs *can* have NeedsFinishRenderTexture set. v2: Keep the short-circuit for non-BindRenderbufferTexImage() drivers (review by Ken). Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Generate FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT earlierChris Forbes2014-03-251-6/+6
| | | | | | | | | | | | | | The ARB_framebuffer_object spec lists this case before the FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER and FRAMEBUFFER_INCOMPLETE_READ_BUFFER cases. Fixes two broken cases in piglit's fbo-incomplete test, if ARB_ES2_compatibility is not advertised. (If it is, this is masked because the FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER / FRAMEBUFFER_INCOMPLETE_READ_BUFFER cases are removed by that extension) Signed-off-by: Chris Forbes <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: Fix format matching checks for GL_INTENSITY* internalformats.Chris Forbes2014-03-251-8/+12
| | | | | | | | | GL_INTENSITY has never been valid as a pixel format -- to get the memcpy pack/unpack paths, the app needs to specify GL_RED as the pixel format (or GL_RED_INTEGER for the integer formats). Signed-off-by: Chris Forbes <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: fix software fallback for generating mipmaps for 3D texturesMarek Olšák2014-03-211-21/+16
| | | | | | | | It didn't use the driver-provided src/dstRowStride at all. This was broken for the cases when stride != width*bpp. Cc: [email protected] Reviewed-by: Brian Paul <[email protected]>
* mesa: fix software fallback for generating mipmaps for cube arraysMarek Olšák2014-03-211-2/+5
| | | | | Cc: [email protected] Reviewed-by: Brian Paul <[email protected]>
* mesa: allow generating mipmaps for cube arraysMarek Olšák2014-03-211-0/+4
| | | | | Cc: [email protected] Reviewed-by: Brian Paul <[email protected]>
* mesa: fix texture border handling for cube arraysMarek Olšák2014-03-211-1/+4
| | | | | Cc: [email protected] Reviewed-by: Brian Paul <[email protected]>
* mesa/main: condition GL_DEPTH_STENCIL on ARB_depth_textureIlia Mirkin2014-03-191-8/+3
| | | | | | | | | | | | | | | | | | | EXT_packed_depth_stencil is supported by all drivers, but ARB_depth_texture isn't (notably nouveau_vieux). This should avoid passing unexpected values down to ChooseTextureFormat. The EXT_packed_depth_stencil spec does not make any explicit references to requiring ARB_depth_texture in order to allow textures with that format, however if there is no dependency, ARB_depth_texture would be practically implied by the extension. Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Francisco Jerez <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Cc: "10.0 10.1" <[email protected]> Note for 10.0 backport: This will produce a conflict, the solution is to move the surrounding if as well.
* mesa: mark GL_RGB9_E5 as not color-renderableMarek Olšák2014-03-151-4/+0
| | | | | | | | | | | | The GL 4.4 spec says it's not color-renderable and not accepted by RenderBufferStorage. The EXT_texture_shared_exponent spec says it's not color-renderable but it's accepted by RenderBufferStorageEXT. This seems to be a bug in the extension spec. Let's do what GL 4.4 says. Cc: [email protected] Reviewed-by: Ian Romanick <[email protected]>
* mesa: return v.value_int64 when the requested type is TYPE_INT64Emil Velikov2014-03-141-3/+3
| | | | | | | | Fixes "Operands don't affect result" defect reported by Coverity. Cc: "9.2 10.0 10.1" <[email protected]> Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* Add the EGL_MESA_configless_context extensionNeil Roberts2014-03-122-20/+68
| | | | | | | | | | | | | | | | | | | | This extension provides a way for an application to render to multiple surfaces with different buffer formats without having to use multiple contexts. An EGLContext can be created without an EGLConfig by passing EGL_NO_CONFIG_MESA. In that case there are no restrictions on the surfaces that can be used with the context apart from that they must be using the same EGLDisplay. _mesa_initialze_context can now take a NULL gl_config which will mark the context as ‘configless’. It will memset the visual to zero in that case. Previously the i965 and i915 drivers were explicitly creating a zeroed visual whenever 0 is passed for the EGLConfig. Mesa needs to be aware that the context is configless because it affects the initial value to use for glDrawBuffer. The first time the context is bound it will set the initial value for configless contexts depending on whether the framebuffer used is double-buffered. Reviewed-by: Kristian Høgsberg <[email protected]>
* Fix the initial value of glDrawBuffers for GLESNeil Roberts2014-03-121-1/+3
| | | | | | | | | | | | | | | | | | Under GLES 3 it is not valid to pass GL_FRONT to glDrawBuffers. Instead, GL_BACK has a magic interpretation which means it will render to the front buffer on single-buffered contexts and the back buffer on double-buffered. We were incorrectly setting the initial value to GL_FRONT for single-buffered contexts. This probably doesn't really matter at the moment except that presumably it would be exposed in the API via glGetIntegerv. When we switch to configless contexts this is more important because in that case we always want to rely on the magic interpretation of GL_BACK in order to automatically switch between the front and back buffer when a new surface with a different number of buffers is bound. We also do this for GLES 1 and 2 because the internal value doesn't matter in that case and it is convenient to use the same code to have the magic interpretation of GL_BACK. Reviewed-by: Kristian Høgsberg <[email protected]>
* Use the magic behaviour of GL_BACK in GLES 1 and 2 as well as 3Neil Roberts2014-03-121-1/+6
| | | | | | | | | | | | | | | | | | In GLES 3 it is not possible to select rendering to the front buffer and instead selecting GL_BACK has the magic interpretation that it is either the front buffer on single-buffered configs or the back buffer on double-buffered. GLES 1 and 2 have no way of selecting the draw buffer at all. In that case we were initialising the draw buffer to either GL_FRONT or GL_BACK depending on the context's config and then leaving it at that. When we switch to having configless contexts we ideally want Mesa to automatically switch between the front and back buffer whenever a double- or single-buffered surface is bound. To make this happen we can just allow the magic behaviour from GLES 3 in GLES 1 and 2 as well. It shouldn't matter what the internal value of the draw buffer is in GLES 1 and 2 because there is no way to query it from the external API. Reviewed-by: Kristian Høgsberg <[email protected]>
* mesa: Release gl_debug_state when destroying context.Mike Stroyan2014-03-121-1/+4
| | | | | | | | Commit 6e8d04a caused a leak by allocating ctx->Debug but never freeing it. Release the memory in _mesa_free_errors_data when destroying a context. Use FREE to match CALLOC_STRUCT from _mesa_get_debug_state. Reviewed-by: Brian Paul <[email protected]>
* mesa: s/GLhandleARB/GLuint/ for glGetUniform functionsBrian Paul2014-03-103-25/+25
| | | | | | | The GL specs say the parameter is GLuint, not GLhandleARB. Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: rename MESA_FORMAT_X8Z24_UNORM -> MESA_FORMAT_X8_UINT_Z24_UNORMBrian Paul2014-03-105-16/+16
| | | | | | | To follow the example of MESA_FORMAT_Z24_UNORM_X8_UINT. Reviewed-by: Michel Dänzer <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* mesa: reorder MESA_FORMAT enumsBrian Paul2014-03-102-1009/+936
| | | | | | | | | The MESA_FORMAT_x enums in formats.h weren't declared in any sort of reasonable order. Now it should be a little more logical. This also required reordering tables in formats.c and s_texfetch.c Reviewed-by: Michel Dänzer <[email protected]> Acked-by: Eric Anholt <[email protected]>
* mesa: trim down format.h commentsBrian Paul2014-03-101-169/+0
| | | | | | | There's no real reason to list all the formats in the comments. Reviewed-by: Michel Dänzer <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* mesa/glsl: introduce a remap table for uniform locationsTapani Pälli2014-03-104-37/+43
| | | | | | | | | | | | | | | | | Patch adds a remap table for uniforms that is used to provide a mapping from application specified uniform location to actual location in the UniformStorage. Existing UniformLocationBaseScale usage is removed as table can be used to set sequential values for array uniform elements. This mapping helps to implement GL_ARB_explicit_uniform_location so that uniforms locations can be reorganized and handled in a more easy manner. v2: small fixes + rename parameters for merge and split functions (Ian) improve documentation, remove old check for location bounds (Eric) Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* mesa: add missing DebugMessageControl typesTimothy Arceri2014-03-081-0/+2
| | | | | Signed-off-by: Timothy Arceri <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: make ARB_debug_output functions an alias ofTimothy Arceri2014-03-084-250/+88
| | | | | | | | | | | | | KHR_debug Also update dispatch sanity removing ARB_debug_output checks and removing KHR_debug placeholders as the checks have already been added V2: Make sure we exit case statements with conditional breaks rather than just dropping through. Signed-off-by: Timothy Arceri <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: fix the format of glEdgeFlagPointerMarek Olšák2014-03-071-2/+2
| | | | | | | | | | | Softpipe expects a float in the vertex shader, which is what glEdgeFlag generates. This fixes piglit/gl-2.0-edgeflag. Cc: [email protected] Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: Drop unused hash_table::mem_ctx field.Kenneth Graunke2014-03-063-3/+0
| | | | | | | | It's never used, and it's equivalent to ralloc_parent(ht) if you really need it. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* mesa: add MESA_FORMAT_R8G8B8A8_SRGBBrian Paul2014-03-065-0/+60
| | | | | | | | To match PIPE_FORMAT_R8G8B8A8_SRGB. v2: fix component name copy&paste bugs Reviewed-by: José Fonseca <[email protected]> Reviewed-by: Roland Scheidegger <[email protected]>
* mesa: Wrap SSE4.1 code in #ifdef __SSE4_1__.Matt Turner2014-03-061-0/+3
| | | | | | | | Because people insist on doing things like explicitly disabling SSE 4.1. Cc: "10.0 10.1" <[email protected]> Tested-by: David Heidelberger <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71547
* mesa: fix copy & paste bugs in pack_ubyte_SRGB8()Brian Paul2014-03-061-2/+2
| | | | | Cc: "10.0" "10.1" <[email protected]> Reviewed-by: Roland Scheidegger <[email protected]>
* mesa: fix copy & paste bugs in pack_ubyte_SARGB8()Brian Paul2014-03-061-2/+2
| | | | | Cc: "10.0" "10.1" <[email protected]> Reviewed-by: Jose Fonseca <[email protected]>
* mesa: add MESA_FORMAT_B8G8R8X8_SRGBChia-I Wu2014-03-065-4/+70
| | | | | | | 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-052-9/+9
| | | | | | | | | 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]>
* 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]>
* 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-035-5/+0
| | | | Reviewed-by: José Fonseca <[email protected]>
* mesa: switch to c11 mutex functionsBrian Paul2014-03-0319-136/+136
| | | | 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-021-9/+11
| | | | | | | | | | | | 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]>
* 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]>
* 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
|
* 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]>
* mesa: allow buffers to be mapped multiple timesMarek Olšák2014-02-2510-152/+173
| | | | | | | | | | | | | | | | | | | OpenGL allows a buffer to be mapped only once, but we also map buffers internally, e.g. in the software primitive restart fallback, for PBOs, vbo_get_minmax_index, etc. This has always been a problem, but it will be a bigger problem with persistent buffer mappings, which will prevent all Mesa functions from mapping buffers for internal purposes. This adds a driver interface to core Mesa which supports multiple buffer mappings and allows 2 mappings: one for the GL user and one for Mesa. Note that Gallium supports an unlimited number of buffer and texture mappings, so it's not really an issue for Gallium. v2: fix unmapping in xm_dd.c, remove the GL errors there v3: fix the intel driver (by Fredrik) Reviewed-by: Fredrik Höglund <[email protected]>
* mesa: allow buffers mapped with the persistent flag to be used by the GPUMarek Olšák2014-02-257-21/+35
| | | | | | v2: also fixed InvalidateBufferData, added citations from the 4.4 spec Reviewed-by: Fredrik Höglund <[email protected]>
* mesa: add error checks to glMapBufferRange, glMapBuffer for ARB_buffer_storageMarek Olšák2014-02-251-7/+57
| | | | Reviewed-by: Fredrik Höglund <[email protected]>
* mesa: implement glBufferStorage, immutable buffers; add extension enable flagMarek Olšák2014-02-254-0/+100
| | | | | | | Reviewed-by: Fredrik Höglund <[email protected]> v2: dropped the error that DYNAMIC_STORAGE is required for MAP_WRITE_BIT, the error is removed in the latest revision of GL 4.4