summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* nir: convert the glsl intrinsic image_size to nir_intrinsic_image_sizeMartin Peres2015-08-202-6/+17
| | | | | | | | | | | | | | | | | v2, review from Francisco Jerez: - make the destination variable as large as what the nir instrinsic defines (4) instead of the size of the return variable of glsl. This is still safe for the already existing code because all the intrinsics affected returned the same amount of components as expected by glsl IR. In the case of image_size, it is not possible to do so because the returned number of component depends on the image type and this case is not well handled by nir. v3: - Style fix Signed-off-by: Martin Peres <[email protected]> Reviewed-by: Francisco Jerez <[email protected]>
* glsl: add support for the imageSize builtinMartin Peres2015-08-201-16/+92
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The code is heavily inspired from Francisco Jerez's code supporting the image_load_store extension. Backends willing to support this builtin should handle __intrinsic_image_size. v2: Based on the review of Ilia Mirkin - Enable the extension for GLES 3.1 - Fix indentation - Fix the return type (float to int, number of components for CubeImages) - Add a warning related to GLES 3.1 v3: Based on the review of Francisco Jerez - Refactor the code to share both add_image_function and _image with the other image-related functions v4: Based on Topi Pohjolainen's comments - Do not add parenthesis for the return value v5: based on Francisco Jerez's comments: - Fix a few indent issues - Reduce the size of a condition by testing the dimension and array properties instead of enumerating all the formats. Signed-off-by: Martin Peres <[email protected]> Reviewed-by: Francisco Jerez <[email protected]>
* main: add extension GL_ARB_shader_image_sizeMartin Peres2015-08-205-0/+8
| | | | | | Reviewed-by: Edward O'Callaghan <[email protected]> Reviewed-by: Francisco Jerez <[email protected]> Signed-off-by: Martin Peres <[email protected]>
* mesa: Add ES31 API tag for the extension table.Francisco Jerez2015-08-201-0/+7
| | | | | | | | | | I'll mark the OES_shader_image_atomic extension entry with this tag to make sure that we don't expose it on earlier GLES API versions accidentally, because according to the extension: "OpenGL ES 3.1 and GLSL ES 3.10 are required." Reviewed-by: Tapani Pälli <[email protected]>
* glsl: Parse the allowed image format qualifiers in GLSL ES 3.1.Francisco Jerez2015-08-201-41/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This includes the minimum required desktop/ES GLSL version in the format qualifier table in anticipation of new GLSL versions extending the set of supported image formats. According to section 4.4.7 of the GLSL ES 3.1 spec: "The format layout qualifier identifiers for image variable declarations are: [...] rgba32f rgba16f r32f rgba8 rgba8_snorm [...] rgba32i rgba16i rgba8i r32i [...] rgba32ui rgba16ui rgba8ui r32ui" Reviewed-by: Tapani Pälli <[email protected]>
* glsl: Recognise image memory qualifiers in GLSL ES 3.1.Francisco Jerez2015-08-201-5/+5
| | | | Reviewed-by: Tapani Pälli <[email protected]>
* glsl: Define image-related built-in constants required by GLSL ES 3.1.Francisco Jerez2015-08-201-7/+15
| | | | Reviewed-by: Tapani Pälli <[email protected]>
* glsl: Remove duplicate definition of gl_MaxTess*ImageUniforms built-in ↵Francisco Jerez2015-08-201-2/+0
| | | | | | | | | | | constants. These seem to have been re-added at some point during the ARB_tessellation_shader implementation work. AFAICT the second (correct) definition of each constant would have had no effect because the symbols were already defined. Reviewed-by: Tapani Pälli <[email protected]>
* glsl: Accept atomic_uint type in GLSL ES 3.1.Francisco Jerez2015-08-201-1/+1
| | | | Reviewed-by: Tapani Pälli <[email protected]>
* glsl: Accept supported image types in GLSL ES 3.1.Francisco Jerez2015-08-202-24/+24
| | | | | | | | These are a subset of the image types supported by desktop GL, excluding 1D, 1D array, rectangle, buffer, cube array, 2D MS and 2D MS array texture targets. Reviewed-by: Tapani Pälli <[email protected]>
* glsl: Expose image load and store built-ins in GLSL ES 3.1.Francisco Jerez2015-08-201-1/+1
| | | | Reviewed-by: Tapani Pälli <[email protected]>
* glsl: Use a separate availability class for image atomic built-ins.Francisco Jerez2015-08-201-11/+23
| | | | | | | These are not part of unextended GLSL ES 3.1. Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
* glsl: Allow precision qualifiers on general opaque types.Francisco Jerez2015-08-201-4/+6
| | | | | | | | | | From the GLSL ES 3.1 spec, section 4.7.3: "Any floating point, integer, opaque type declaration can have the type preceded by one of these precision qualifiers: [...] highp [...], mediump [...], lowp [...]." Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
* glsl: Implement GLSL ES restriction on images being either readonly or ↵Francisco Jerez2015-08-201-0/+18
| | | | | | writeonly. Reviewed-by: Tapani Pälli <[email protected]>
* glsl: Require that all image uniforms have a format qualifier in GLSL ES.Francisco Jerez2015-08-201-4/+10
| | | | | | | | | | | | | | | | | | | | Note that this is slightly more permissive than the spec language requires: "Any image variable must specify a format layout qualifier." The GLSL ES spec seems really sketchy regarding format layout qualifiers on function formal parameters -- On the one hand they are required, but on the other hand it doesn't provide any syntax to specify them (see section 6.1.1), they don't participate in parameter type matching for overload resolution, and are in fact explictly forbidden ("Layout qualifiers cannot be used on formal function parameters"). Of course none of the image built-in functions defined by the spec specify format layout qualifiers (and they probably couldn't sensibly), to contradict its own requirement. This probably qualifies for a spec bug, but in the meantime do the sensible thing and require layout qualifiers on uniforms *only*. Reviewed-by: Timothy Arceri <[email protected]>
* glsl: Add support for image binding qualifiers.Francisco Jerez2015-08-202-8/+33
| | | | | | | | Support for binding an image to an image unit explicitly in the shader source is required by both GLSL 4.2 and GLSL ES 3.1, but not by the original ARB_shader_image_load_store extension. Reviewed-by: Timothy Arceri <[email protected]>
* glsl: Forbid non-constant image array indexing in GLSL ES 3.1.Francisco Jerez2015-08-201-0/+15
| | | | Reviewed-by: Timothy Arceri <[email protected]>
* mesa: Refuse to bind image uniforms using glUniform in GLES.Francisco Jerez2015-08-201-1/+3
| | | | | | | | The GLES 3.1 spec removed support for updating the image unit bound to an image uniform using glUniform1i() calls. Reviewed-by: Tapani Pälli <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: Refuse to bind a mutable texture object to an image unit in GLES.Francisco Jerez2015-08-201-0/+12
| | | | | Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* mesa: Initialize image unit state to different defaults in GLES.Francisco Jerez2015-08-201-2/+3
| | | | | | | | | There is no GL_R8 image format in GLES, according to the state table 20.32 of the GLES 3.1 spec the default value should be GL_R32UI. The ES31-CTS.shader_image_load_store.basic-api-bind Khronos conformance test checks that this is the case. Reviewed-by: Ian Romanick <[email protected]>
* mesa: Reset image unit state to the default values when a bound image is ↵Francisco Jerez2015-08-203-7/+23
| | | | | | | | | | | | | | | deleted. The ES31-CTS.shader_image_load_store.basic-api-bind conformance test expects the whole image unit state to be reset when the bound texture object is deleted. The ARB_shader_image_load_store extension is rather vague regarding what should happen with image unit state other than the texture object in that case, but the GL 4.2 and GLES 3.1 specifications (section "Automatic Unbinding of Deleted Objects") explicitly require it to be reset to the default values. Reviewed-by: Tapani Pälli <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: Reject image formats not supported by GLES.Francisco Jerez2015-08-201-2/+65
| | | | | | Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Tapani Pälli <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: Don't lose track of the shader image layer originally specified by the ↵Francisco Jerez2015-08-203-8/+15
| | | | | | | | | | | | | | | | user. The spec requires that all layers of the image starting from the 0-th are bound to the image unit regardless of the Layer parameter when Layered is true, so I was setting gl_image_unit::Layer to zero in that case for the convenience of the driver back-end. However the ES31-CTS.shader_image_load_store.basic-api-bind conformance test checks that the layer value returned by glGetInteger is the same that was originally specified, regardless of the value of layered. Rename Layer to _Layer as is usual for other derived state and keep track of the original layer value as gl_image_unit::Layer. Reviewed-by: Ian Romanick <[email protected]>
* mesa: Rename MaxCombinedImageUnitsAndFragmentOutputs to ↵Francisco Jerez2015-08-207-7/+7
| | | | | | | | | | | | | MaxCombinedShaderOutputResources. The name of both the GLSL built-in variable and the glGetInteger param with the same value changed in GLSL ES 3.1 and GL 4.5. Its semantics also changed slightly, since the limit now also takes into account the number of SSBs in use. Switch our internal data structures to the up-to-date name. Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* nir: Use nir_builder in nir_lower_io's get_io_offset().Kenneth Graunke2015-08-191-28/+14
| | | | | | | Much more readable. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* nir: Pull nir_lower_io's load_op selection into a helper function.Kenneth Graunke2015-08-191-17/+22
| | | | | | | Makes the function a bit smaller. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* mesa/formats: refactor by collapsing cases in switch statement by typeNanley Chery2015-08-191-135/+17
| | | | | | | Combine the adjacent cases which have the same GL type in the switch statemnt. Reviewed-by: Chad Versace <[email protected]> Signed-off-by: Nanley Chery <[email protected]>
* mesa/formats: add more MESA_FORMAT_LAYOUTsNanley Chery2015-08-194-33/+19
| | | | | | | | | | Add the classes of compressed formats as layouts. This allows the detection of compressed formats belonging to a certain category of compressed formats. v2. simplify layout name construction (Ilia). Reviewed-by: Chad Versace <[email protected]> Signed-off-by: Nanley Chery <[email protected]>
* glsl: Fix up GL_ARB_compute_shader for GLSL ES 3.1Marta Lofstedt2015-08-192-3/+7
| | | | | | | | | | GL_ARB_compute_shader is limited for GLSL version 430. This enables for GLSL ES version 310. V2: Updated error string to also include GLSL 3.10 Signed-off-by: Marta Lofstedt <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* mesa/main: Add GL_IMAGE_FORMAT_COMPATIBILITY_TYPE to glGetTexParameterfvMarta Lofstedt2015-08-191-0/+6
| | | | | | | | | According to Open GL ES 3.1 specification, section 8.10.2 GL_IMAGE_FORMAT_COMPATIBILITY_TYPE should be supported by glGetTexParameterfv. Signed-off-by: Marta Lofstedt <[email protected]> Reviewed-by: Francisco Jerez <[email protected]>
* radeonsi: fix a typo as_es -> as_ls in a stringMarek Olšák2015-08-191-1/+1
| | | | Trivial.
* winsys/amdgpu: fix the type of memory usage countersMarek Olšák2015-08-191-2/+2
| | | | | | | | | If the 32-bit types overflowed, the driver could submit an IB that uses much more memory than is available. Reviewed-by: Alex Deucher <[email protected]> Reviewed-by: Edward O'Callaghan <[email protected]> Reviewed-by: Michel Dänzer <[email protected]>
* radeonsi: fix indirect indexing of MSAA texturesMarek Olšák2015-08-191-4/+13
| | | | | | FMASK wasn't handled correctly. Reviewed-by: Michel Dänzer <[email protected]>
* st/mesa: add fake ARB_copy_image support in GalliumIlia Mirkin2015-08-191-0/+27
| | | | | | | | | | | | | | | This support should be removed in favor of something that actually works in all the weird cases. However this is simple and is enough to allow Bioshock Infinite to render properly on nvc0. Since the functionality is not implemented correctly, the extension will not appear in the extension string and mesa will still return INVALID_OPERATION for any glCopyImageSubData calls. In order to make use of this functionality, run with MESA_EXTENSION_OVERRIDE=GL_ARB_copy_image Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
* glsl: enable textureSize and texelFetch on GLSL ES 3.10 with MS samplersTapani Pälli2015-08-191-6/+13
| | | | | | | | Patch separates array samplers from the texture_multisample check so that we can enable only [iu]sampler2DMS, [iu]sampler2DMSArray are not supported. Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* mesa: validate size parameters for glTexStorage*MultisampleTapani Pälli2015-08-191-0/+26
| | | | | | | | v2: code cleanup v3: check only dimensions, samples is checked separately later Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* mesa: expose dimension check for glTex*Storage functionsTapani Pälli2015-08-192-1/+22
| | | | | | | | | | | | This is done so that following patch can use it to verify dimensions for multisample variants of glTex*Storage. v2: move function to header, use bool instead GLboolean v3: small changes, cleanup Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Anuj Phogat <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* util/ra: (trivial) fix c99 loop variable initializationRoland Scheidegger2015-08-191-7/+8
| | | | Fails with old msvc otherwise.
* util: (trivial) include c99_math.h in rounding.hRoland Scheidegger2015-08-191-2/+1
| | | | Needed for rint/rintf.
* i965/bdw: Fix setting the instancing state for the SGVS elementNeil Roberts2015-08-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When gl_VertexID or gl_InstanceID is used a 3DSTATE_VF_SGVS instruction is sent to create a sort of element to store the generated values. The last instruction in this chunk of code looks like it was trying to set the instancing state for the element using the 3DSTATE_VF_INSTANCING instruction. However it was sending brw->vb.nr_buffers instead of the element index. This instruction is supposed to take an element index and that is how it is used further down in the function so the previous code looks wrong. Perhaps previously the number of buffers coincidentally matched the number of enabled elements so the value was generally correct anyway. In a subsequent patch I want to change a bit how it chooses the SGVS element index so this needs to be fixed. v2 [by Ben] Remove stable 10.5 stable tag (it's too late now) Commit update as follows: The number of vertex buffers emitted is always <= the number of vertex elements. To maximize reuse (actually, to minimize relocations - according to the code comments), a vertex buffer is only emitted once, even when we setup multiple components (3DSTATE_VERTEX_ELEMENT) from that buffer. This meant that the previous code would use the wrong indexed element for these reuse cases. This patch by itself prevents hangs on BSW in the linked bug. It doesn't make the test pass, the remaining patches are needed for that. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91610 Signed-off-by: Ben Widawsky <[email protected]> Reviewed-by: Ben Widawsky <[email protected]> Tested-by: Mark Janes <[email protected]> Cc: <[email protected]>
* util/ra: Make allocating conflict lists optionalJason Ekstrand2015-08-187-15/+25
| | | | | | | | | Since i965 is now using make_reg_conflicts_transitive and doesn't need q-value computations, they are disabled on i965. They are enabled everywhere else so that they get the old behavior. This reduces the time spent in eglInitialize() on BDW by around 10-15%. Reviewed-by: Eric Anholt <[email protected]>
* i965/reg_allocate: Use make_reg_conflicts_transitiveJason Ekstrand2015-08-182-3/+12
| | | | | | | | | | Instead of adding transitive conflicts as we go, we now add regular conflicts and them make them all transitive at the end. This reduces screen creation time substantially on BDW. The time spent in eglInitialize is reduced from 27.78 ms/call to 9.92 ms/call in debug mode and from 13.15 ms/call to 4.54 ms/call in release mode (about 65% in either case). Reviewed-by: Eric Anholt <[email protected]>
* util/ra: Add a function for making all conflicts on a register transitiveJason Ekstrand2015-08-182-0/+24
| | | | Reviewed-by: Eric Anholt <[email protected]>
* util/bitset: Add a BITSET_FOREACH_SET macroJason Ekstrand2015-08-181-0/+36
| | | | Reviewed-by: Eric Anholt <[email protected]>
* mesa: Move varying slots and FS output names to shader_enums.hEric Anholt2015-08-182-106/+102
| | | | | | | | | | They're used by glsl_to_nir.cpp, and I want to use them in TGSI-to-NIR as well (our use of the var->index slot to store slot properties no longer works since it got truncated). The *_MAX defines are left in mtypes.h, because they depend on config.h. Acked-by: Kenneth Graunke <[email protected]>
* mesa: undo split out of create shader codeTimothy Arceri2015-08-191-59/+50
| | | | | | | | This code was split out into a separate function to be used also by GL_EXT_separate_shader_objects which has since been removed from Mesa, so move it back. Reviewed-by: Ian Romanick <[email protected]>
* freedreno: use fd_pipe_wait_timeout()Rob Clark2015-08-182-21/+1
| | | | | | | | To properly support the case of waiting on a fence with a 0 timeout, we still need to call down to the kernel. Which requires the use of the new fd_pipe_wait_timeout() API. Signed-off-by: Rob Clark <[email protected]>
* freedreno: fence fixRob Clark2015-08-183-4/+8
| | | | | | | Don't take current timestamp/fence from current ring, as we might have already rolled over to new rb. Signed-off-by: Rob Clark <[email protected]>
* Add mesa.icd to the .gitignoreNeil Roberts2015-08-181-0/+1
| | | | | | Since 4d7e0fa8c731776 this file is generated by the configure script. Reviewed-by: Tapani Palli <[email protected]> Reviewed-by: Ben Widawsky <[email protected]>
* drirc: Add "Unigine Oil Rush" quirk (allow_glsl_extension_directive_midshader).Richard Yao2015-08-181-0/+2
| | | | | | | | | | | | | Appears to fix shader compilation. Tested by starting the client and observing that the screen was correct after the trailers ran when previously, it was blank. Play tested on amd64. This was suggested by "Kuuchan" on the Steam forums: https://steamcommunity.com/app/200390/discussions/0/540731690861139279/?insideModal=1#c594820656479479870 Acked-by: Matt Turner <[email protected]> Signed-off-by: Richard Yao <[email protected]>