summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
Commit message (Collapse)AuthorAgeFilesLines
* mesa: implement SPIR-V loading in glShaderBinaryNicolai Hähnle2017-12-125-3/+97
| | | | | | | | | | | | | | | | | | v2: * Add a gl_shader_spirv_data member to gl_shader, which already encapsulates a gl_spirv_module where the binary will be saved. (Eduardo Lima) * Just use the 'spirv_data' member to know whether a gl_shader has the SPIR_V_BINARY_ARB state. (Timothy Arceri) * Remove redundant argument checks. Move extension presence check to API entry point where the rest of checks are. Retype 'n' and 'length'arguments to use the correct and more standard types. (Ian Romanick) * Fix some nitpicks. (Ian Romanick) Reviewed-by: Ian Romanick <[email protected]>
* mesa/glspirv: Add struct gl_shader_spirv_dataEduardo Lima Mitev2017-12-122-0/+42
| | | | | | | | | | | | | | | | | This is a per-shader structure holding the SPIR-V data associated with the shader (binary module, specialization constants and entry-point). This is needed because both gl_shader and gl_linked_shader need to share this data. Instead of copying the data, we pass a reference to it upon program linking. That's why it is reference-counted. This struct is created and associated with the shader upon calling glShaderBinary(), then subsequently filled up by the call to glSpecializeShaderARB(). v2: Readability improvements (Ian Romanick) Reviewed-by: Ian Romanick <[email protected]>
* mesa/glspirv: Add struct gl_spirv_moduleNicolai Hähnle2017-12-122-0/+33
| | | | | | | | | v2: * Make the SPIR-V module struct part of a larger gl_shader_spirv_data struct that will be introduced later, and don't reference it directly in gl_shader. (Eduardo Lima) * Readability improvements (Ian Romanick) Reviewed-by: Ian Romanick <[email protected]>
* mesa: add GL_ARB_gl_spirv boilerplateNicolai Hähnle2017-12-125-0/+95
| | | | | | | | | | | | v2: * Add meson build bits (Eric Engestrom) * Return INVALID_OPERATION error on SpecializeShaderARB (Ian Romanick) v3: Include boilerplate for the GL 4.6 alias of glSpecializeShaderARB (Neil Roberts) Reviewed-by: Emil Velikov <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* main: Clear shader program data whenever ProgramBinary is calledJordan Justen2017-12-081-0/+3
| | | | | | | | | | | | | | | The GL_ARB_get_program_binary extension spec says: "If ProgramBinary fails to load a binary, no error is generated, but any information about a previous link or load of that program object is lost." v2: * Re-initialize shProg->data after clear. (Jordan) (Required after 6a72eba755fea15a0d97abb913a6315d9d32e274) Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* main: add binary support to ProgramBinaryJordan Justen2017-12-081-17/+19
| | | | | | | | | | V2: call generic mesa_program_binary() helper rather than driver function directly to allow greater code sharing. Signed-off-by: Timothy Arceri <[email protected]> Signed-off-by: Jordan Justen <[email protected]> (v1) Reviewed-by: Nicolai Hähnle <[email protected]> (v1) Reviewed-by: Tapani Pälli <[email protected]>
* main: add binary support to GetProgramBinaryJordan Justen2017-12-081-6/+9
| | | | | | | | | | V2: call generic _mesa_get_program_binary() helper rather than driver function directly to allow greater code sharing. Signed-off-by: Timothy Arceri <[email protected]> Signed-off-by: Jordan Justen <[email protected]> (v1) Reviewed-by: Nicolai Hähnle <[email protected]> (v1) Reviewed-by: Tapani Pälli <[email protected]>
* main: Support getting GL_PROGRAM_BINARY_LENGTHJordan Justen2017-12-081-1/+6
| | | | | | | | | | | V2: call generic _mesa_get_program_binary_length() helper rather than driver function directly to allow greater code sharing. Signed-off-by: Timothy Arceri <[email protected]> Signed-off-by: Jordan Justen <[email protected]> (v1) Reviewed-by: Nicolai Hähnle <[email protected]>i (v1) Reviewed-by: Tapani Pälli <[email protected]>
* mesa: Add Mesa ARB_get_program_binary helper functionsJordan Justen2017-12-082-0/+347
| | | | | | | | | | | | | | | V2 (Timothy Arceri): - add extra code comment - stop passing around void *binary and just pass program_binary_header *hdr instead. - move to src/mesa/main rather than src/util V3 (Timothy Arceri): - Move more code out of the backend and into the common helpers. Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
* mesa: add driver callbacks for serialising ProgramBinary blobsTimothy Arceri2017-12-081-0/+17
| | | | Reviewed-by: Jordan Justen <[email protected]>
* main: Support 1 Mesa format with get for GL_PROGRAM_BINARY_FORMATSJordan Justen2017-12-082-1/+10
| | | | | | | | | Mesa supports either 0 or 1 formats. If 1 format is supported, it is GL_PROGRAM_BINARY_FORMAT_MESA as defined in the GL_MESA_program_binary_formats extension spec. Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* main: Allow non-zero NUM_PROGRAM_BINARY_FORMATSJordan Justen2017-12-082-1/+4
| | | | | Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* main, glsl: Add UniformDataDefaults which stores uniform defaultsJordan Justen2017-12-081-0/+11
| | | | | | | | | | | | | | | | | | | The ARB_get_program_binary extension requires that uniform values in a program be restored to their initial value just after linking. This patch saves off the initial values just after linking. When the program is restored by glProgramBinary, we can use this to copy the initial value of uniforms into UniformDataSlots. V2 (Timothy Arceri): - Store UniformDataDefaults only when serializing GLSL as this is what we want for both disk cache and ARB_get_program_binary. This saves us having to come back later and reset the Uniforms on program binary restores. Signed-off-by: Timothy Arceri <[email protected]> Signed-off-by: Jordan Justen <[email protected]> (v1) Reviewed-by: Tapani Pälli <[email protected]>
* mesa/spirv: move and rename nir_spirv_supported_capabilitiesAlejandro Piñeiro2017-12-071-13/+0
| | | | | | | | | | To avoid any vulkan driver to include the GL mtypes.h. Renamed as eventually this could be used by drivers not using nir. v2: remove compiler/spirv/spirv.h from mtypes (Alejandro) v3: added the definition at compiler/shader_info.h (Jason Ekstrand) Reviewed-by: Jason Ekstrand <[email protected]>
* mesa: remove set_entry from forward type declarationsAlejandro Piñeiro2017-12-071-1/+0
| | | | | | This type was used at gl_sync_object, but it is not used anymore. Reviewed-by: Timothy Arceri <[email protected]>
* mesa: define nir_spirv_supported_capabilitiesAlejandro Piñeiro2017-12-061-0/+12
| | | | | | | | | Until now it was part of spirv_to_nir_options. But it will be used on the implementation of ARB_gl_spirv and ARB_spirv_extensions, and added to the OpenGL context, as a way to save what SPIR-V capabilities the current OpenGL implementation supports. Reviewed-by: Ian Romanick <[email protected]>
* mesa: document _mesa_extension_override_* variablesEmil Velikov2017-12-061-0/+9
| | | | | | | | | Currently there are no users of these outside of extensions.c. Provide some information why they exist and how to use them. Cc: Jordan Justen <[email protected]> Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Andres Gomez <[email protected]>
* mesa: add const qualifier on _mesa_is_renderable_texture_format()Brian Paul2017-12-052-2/+4
| | | | Reviewed-by: Timothy Arceri <[email protected]>
* mesa: add const qualifier on _mesa_base_fbo_format()Brian Paul2017-12-052-2/+2
| | | | Reviewed-by: Timothy Arceri <[email protected]>
* mesa: s/%u/%d/ in _mesa_error() call in check_layer()Brian Paul2017-12-051-2/+1
| | | | | | | | The layer parameter is signed. Fixes the error message seen when running the arb_texture_multisample-errors test which checks a negative layer value. Reviewed-by: Marek Olšák <[email protected]>
* mesa: simplify/improve some _mesa_error() calls in teximage.cBrian Paul2017-12-051-9/+5
| | | | Reviewed-by: Marek Olšák <[email protected]>
* mesa: trivial whitespace fixes in transformfeedback.cBrian Paul2017-12-051-9/+9
| | | | Reviewed-by: Marek Olšák <[email protected]>
* mesa: add const qualifier in test_attachment_completeness()Brian Paul2017-12-051-1/+1
| | | | Reviewed-by: Marek Olšák <[email protected]>
* glsl: Fix gl_NormalScale.Fabian Bieler2017-12-032-1/+5
| | | | | | | | | | | | | | | | GLSL shaders can access the normal scale factor with the built-in gl_NormalScale. Mesa's modelspace lighting optimization uses a different normal scale factor than defined in the spec. We have to take care not to use this factor for gl_NormalScale. Mesa already defines two seperate states: state.normalScale and state.internal.normalScale. The first is used by the glsl compiler while the later is used by the fixed function T&L pipeline. Previously the only difference was some component swizzling. With this commit state.normalScale always uses the normal scale factor for eyespace lighting. Reviewed-by: Brian Paul <[email protected]>
* mesa: add AllowGLSLCrossStageInterpolationMismatch workaroundTapani Pälli2017-11-301-0/+5
| | | | | | | | | | | | | This fixes issues seen with certain versions of Unreal Engine 4 editor and games built with that using GLSL 4.30. v2: add driinfo_gallium change (Emil Velikov) Signed-off-by: Tapani Pälli <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97852 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103801 Acked-by: Andres Gomez <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa/gles: adjust internal format in glTexSubImage2D error checksTapani Pälli2017-11-281-1/+55
| | | | | | | | | | | | | | | | | | | | | When floating point textures are created on OpenGL ES 2.0, driver is free to choose used internal format. Mesa makes this decision in adjust_for_oes_float_texture. Error checking for glTexImage2D properly checks that sized formats are not used. We use same error checking path for glTexSubImage2D (since there is lot of overlap), however since those checks include internalFormat checks, we need to pass original internalFormat passed by the client. Patch adds oes_float_internal_format that does reverse adjust_for_oes_float_texture to get that format. Fixes following test failure: ES2-CTS.gtf.GL2ExtensionTests.texture_float.texture_float (when running test with MESA_GLES_VERSION_OVERRIDE=2.0) Signed-off-by: Tapani Pälli <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103227 Cc: "17.3" <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* st/glsl_to_tgsi: make use of driver_cache_blob with the disk cacheTimothy Arceri2017-11-281-7/+0
| | | | | | | | | | | | driver_cache_blob was introduced with the i965 disk cache, it allows us to simplify the cache a little and possibly offers some minor speed improvements since we load the GLSL metadata and TGSI from disk in one pass. Using driver_cache_blob should also make it straight forward to implement binary support for ARB_get_program_binary in gallium. Reviewed-by: Marek Olšák <[email protected]>
* mesa: shrink VERT_ATTRIB bitfields to 32 bitsMarek Olšák2017-11-258-18/+28
| | | | | | There are only 32 vertex attribs now. Reviewed-by: Ian Romanick <[email protected]>
* mesa: remove unused vertex attrib WEIGHTMarek Olšák2017-11-252-4/+0
| | | | | | | | | | | | We don't support ARB_vertex_blend. Note that the attribute aliasing check for ARB_vertex_program had to be rewritten. vbo_context: 20344 -> 20008 bytes gl_context: 74672 -> 74616 bytes Reviewed-by: Ian Romanick <[email protected]>
* mesa/teximage: add TEXTURE_CUBE_MAP_ARRAY target for CompressedTexImage3DJuan A. Suarez Romero2017-11-211-1/+19
| | | | | | | | | | | | | | | | | | | | | From section 8.7, page 179 of OpenGL ES 3.2 spec: An INVALID_OPERATION error is generated by CompressedTexImage3D if internalformat is one of the the formats in table 8.17 and target is not TEXTURE_2D_ARRAY, TEXTURE_CUBE_MAP_ARRAY or TEXTURE_3D. An INVALID_OPERATION error is generated by CompressedTexImage3D if internalformat is TEXTURE_CUBE_MAP_ARRAY and the “Cube Map Array” column of table 8.17 is not checked, or if internalformat is TEXTURE_3D and the “3D Tex.” column of table 8.17 is not checked. So far it was only considering TEXTURE_2D_ARRAY as valid target. But as "Cube Map Array" column is checked for all the cases, in practice we can consider also TEXTURE_CUBE_MAP_ARRAY. This fixes KHR-GLES32.core.texture_cube_map_array.etc2_texture Reviewed-by: Nanley Chery <[email protected]>
* mesa/main/texcompress_s3tc_tmp.h: Fix two -Wparam-unused warnings.Gert Wollny2017-11-171-2/+2
| | | | | | | | | Decorate the params accordingly with "UNUSED". v2: move UNUSED decoration in front of parameter declaration Signed-off-by: Gert Wollny <[email protected]> Reviewed-by: Brian Paul <[email protected]> (v1)
* mesa: return 'unrecognized' extensions in glGetStringiEmil Velikov2017-11-161-0/+13
| | | | | | | | Analogous to the glGetString() case - report all the extensions enabled via MESA_EXTENSION_OVERRIDE Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: rework the way we manage extra_extensionsEmil Velikov2017-11-162-43/+39
| | | | | | | | | | | | | | Store pointers to the tokenized strings in the gl_extensions struct. This way we can reuse them in glGetStringi() while we construct the really long string only in _mesa_make_extension_string. Only 16 pointers/strings are stored for now. v2: Warn only once when we provide more than 16 unk. extensions, rebase Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Brian Paul <[email protected]> (v1)
* mesa: pass the ctx to _mesa_one_time_init_extension_overridesEmil Velikov2017-11-163-3/+3
| | | | | | | Will be needed with next commit Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: call atexit() only as neededEmil Velikov2017-11-161-3/+1
| | | | | | | | | | If the extra_extensions string is empty there's no need to call atexit() - there's nothing to free. v2: Rebase Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Brian Paul <[email protected]> (v1)
* mesa: remove unnecessary 'sort by year' for the GL extensionsEmil Velikov2017-11-161-50/+3
| | | | | | | | | | | | | | | | | | | The sorting was originally added to work around broken games (comment says Quake3 demo) that were copying the extensions list into small buffer. Sorting does not solve the problem, since we'll still overflow and cause corruption/crash. Better workaround is to actually trim the string ... as done with a later commit which introduces the MESA_EXTENSION_MAX_YEAR env. variable. Side note: On my machine, the existing sorting makes no changes to the extensions string. Cc: Jose Fonseca <[email protected]> Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: reuse set_extension() for _mesa_extension_override_disablesEmil Velikov2017-11-161-4/+3
| | | | | | | | We already use it for _mesa_extension_override_enables. Improve consistency and use it for both extension lists. Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: drop unnecessary coping of extra_extensionsEmil Velikov2017-11-161-11/+6
| | | | | | | | | | The function get_extension_override() returns a copy of a string, only for it to be copied again ... Drop the unneeded calloc/strdup/free dance. Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: remove duplicate 'disabled extensions' listEmil Velikov2017-11-161-7/+1
| | | | | | | | | | | | | | | While parsing MESA_EXTENSION_OVERRIDE we keep track of the disabled extensions, twice - in _mesa_extension_override_disables and disabled_extensions. Upon context creation, we use the former to modify the extensions list. Yet, we still check the updated list against disabled_extensions. Remove disabled_extensions, it's obsolete. Cc: Jordan Justen <[email protected]> Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: call _mesa_make_extension_string only as neededEmil Velikov2017-11-162-2/+2
| | | | | | | | | | | | | | As of previous commit we removed the extension overrides from this function. Thus we no longer need to call it during MakeCurrent, so we can construct the extensions string when needed - _mesa_GetString. This commit effectively reverts a879d14ecf8 ("mesa: initialize extension string when context is first bound") Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: split extensions overrides and glGetString(GL_EXTENSIONS)Emil Velikov2017-11-163-20/+15
| | | | | | | | | | | | | Currently we apply the extension overrides and construct the extensions string upon MakeCurrent. They are two distinct things, so let's slit the two while pushing the overrides management _before_ _mesa_compute_version(). This ensures that the version is updated to reflect the enabled/disabled extensions. Cc: Jordan Justen <[email protected]> Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: minor tidy up for memory object error stringsAndres Rodriguez2017-11-141-16/+14
| | | | | Signed-off-by: Andres Rodriguez <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* mesa: enable ARB_texture_buffer_* extensions in the Compatibility profileMarek Olšák2017-11-095-21/+19
| | | | | | | | | | | | | | We already have piglit tests testing alpha, luminance, and intensity formats. They were skipped by piglit until now. Additionally, I'm enabling one ARB_texture_buffer_range piglit test to run with the compat profile. i965 behavior is unchanged except that it doesn't expose TBOs in the Compat profile. Not sure how that affects the GL version override. Reviewed-by: Nicolai Hähnle <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* mesa/program: add hw atomic counter fileDave Airlie2017-11-101-0/+1
| | | | | | | | | This is needed for the GLSL->TGSI translation for hw atomic counters. Reviewed-by: Nicolai Hähnle <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Tested-By: Gert Wollny <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* mesa: s/GLint/gl_buffer_index/ for _ColorDrawBufferIndexesBrian Paul2017-11-094-15/+16
| | | | | | | Also fix local variable declarations and replace -1 with BUFFER_NONE. No Piglit changes. Reviewed-by: Charmaine Lee <[email protected]>
* mesa: s/GLint/gl_buffer_index/ for _ColorReadBufferIndexBrian Paul2017-11-091-1/+1
| | | | | | BUFFER_NONE is -1 so no reason for GLint. Reviewed-by: Charmaine Lee <[email protected]>
* mesa: minor reformatting, add const to gl_external_samplers()Brian Paul2017-11-091-1/+4
| | | | | | This function should probably be moved elsewhere, too. Reviewed-by: Charmaine Lee <[email protected]>
* mesa: flush and wait after creating a fallback textureNicolai Hähnle2017-11-091-0/+5
| | | | | | | | Fixes non-deterministic failures in dEQP-EGL.functional.sharing.gles2.multithread.simple_egl_sync.images.texture_source.teximage2d_render and others in dEQP-EGL.functional.sharing.gles2.multithread.* Reviewed-by: Marek Olšák <[email protected]>
* mesa: increase MaxServerWaitTimeoutNicolai Hähnle2017-11-091-1/+1
| | | | | | | | | | | | The current value was introduced in commit a27180d0d8666, which claims that it represents ~1.11 years. However, it is interpreted in nanoseconds, so it actually only represents ~9.8 hours. That seems a bit short. Use the largest value consistent with both int32 and int64. It corresponds to ~292 years in nanoseconds. Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
* mesa: use simple mtx in core mesaTimothy Arceri2017-11-0912-73/+74
| | | | | | | | | Results from x11perf -copywinwin10 on Eric's SKL: 4.33338% ± 0.905054% (n=40) Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]> Tested-by: Yogesh Marathe <[email protected]>