summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* glsl: add is_valid_constructor() helper functionSamuel Pitoiset2017-05-061-2/+8
| | | | | | | | | This will help for the explicit conversions for sampler and image types as specified by ARB_bindless_texture. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* glsl: add ARB_bindless_texture operationsSamuel Pitoiset2017-05-064-0/+35
| | | | | | | | For the explicit pack/unpack conversions. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* glsl: allow bindless samplers/images to be initializedSamuel Pitoiset2017-05-061-3/+14
| | | | | | | | | | | | | | | | | | | From section 4.1.7 of the ARB_bindless_texture spec: "Samplers may be declared as shader inputs and outputs, as uniform variables, as temporary variables, and as function parameters." From section 4.1.X of the ARB_bindless_texture spec: "Images may be declared as shader inputs and outputs, as uniform variables, as temporary variables, and as function parameters." v3: - add spec comment - update the glsl error message Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* glsl: allow bindless samplers/images to be l-valuesSamuel Pitoiset2017-05-061-0/+14
| | | | | | | | | | | | | | | | | | | From section 4.1.7 of the ARB_bindless_texture spec: "Samplers can be used as l-values, so can be assigned into and used as "out" and "inout" function parameters." From section 4.1.X of the ARB_bindless_texture spec: "Images can be used as l-values, so can be assigned into and used as "out" and "inout" function parameters." v4: - invert the logic v3: - update spec comment formatting - keep the read_only check Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* glsl: add _mesa_glsl_parse_state object to is_lvalue()Samuel Pitoiset2017-05-064-7/+9
| | | | | | | | | | | | | | | Yes, this is a bit hacky but we don't really have the choice. Plain GLSL doesn't accept bindless samplers/images as l-values while it's allowed when ARB_bindless_texture is enabled. The default NULL parameter is because we can't access the _mesa_glsl_parse_state object in few places in the compiler. One is_lvalue(NULL) call is for IR validation but other checks happen elsewhere, should be safe. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* glsl: relax bindless sampler arrays indexingSamuel Pitoiset2017-05-061-1/+7
| | | | | | | | | | | | | From section 4.1.7 of the ARB_bindless_texture spec: "Samplers aggregated into arrays within a shader (using square brackets []) can be indexed with arbitrary integer expressions." v3: - update spec comment formatting Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* glsl: reject bindless samplers/images frag inputs without 'flat'Samuel Pitoiset2017-05-061-0/+20
| | | | | | | | | | | | | | | | | | | From section 4.3.4 of the ARB_bindless_texture spec "(modify last paragraph, p. 35, allowing samplers and images as fragment shader inputs) ... Fragment inputs can only be signed and unsigned integers and integer vectors, floating point scalars, floating-point vectors, matrices, sampler and image types, or arrays or structures of these. Fragment shader inputs that are signed or unsigned integers, integer vectors, or any double-precision floating- point type, or any sampler or image type must be qualified with the interpolation qualifier "flat"." v3: - update spec comment formatting Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* glsl: allow bindless samplers/images as vertex shader inputsSamuel Pitoiset2017-05-061-0/+14
| | | | | | | | | | | | | | | | From section 4.3.4 of the ARB_bindless_texture spec: "(modify third paragraph of the section to allow sampler and image types) ... Vertex shader inputs can only be float, single-precision floating-point scalars, single-precision floating-point vectors, matrices, signed and unsigned integers and integer vectors, sampler and image types." v3: - update spec comment formatting Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* glsl: allow bindless samplers/images as varying variablesSamuel Pitoiset2017-05-061-0/+20
| | | | | | | | | | | | | | | | | | | | | | | From section 4.3.4 of the ARB_bindless_texture spec: "(modify third paragraph of the section to allow sampler and image types) ... Vertex shader inputs can only be float, single-precision floating-point scalars, single-precision floating-point vectors, matrices, signed and unsigned integers and integer vectors, sampler and image types." From section 4.3.6 of the ARB_bindless_texture spec: "Output variables can only be floating-point scalars, floating-point vectors, matrices, signed or unsigned integers or integer vectors, sampler or image types, or arrays or structures of any these." v3: - add spec comment Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* glsl: allow input memory qualifiers for imagesSamuel Pitoiset2017-05-061-0/+10
| | | | | | | | | | | ARB_bindless_texture spec allows images to be declared as shader inputs. v2: - put the */ on the following line (Timothy Arceri) Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* glsl: allow image qualifiers inside structuresSamuel Pitoiset2017-05-061-4/+23
| | | | | | | | | | | | ARB_bindless_texture allows to declare images inside structures which means that qualifiers like writeonly should be allowed. I have a got a confirmation from Jeff Bolz (one author of the spec), because the spec doesn't clearly explain this. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* glsl: allow bindless images to be declared inside structuresSamuel Pitoiset2017-05-061-1/+1
| | | | | | | | | The spec doesn't clearly state this, but I have got clarification from the spec authors. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* glsl: allow bindless samplers/images inside interface blocksSamuel Pitoiset2017-05-061-2/+12
| | | | | | | | | | | | | | | | | From section 4.3.7 of the ARB_bindless_texture spec: "(remove the following bullet from the last list on p. 39, thereby permitting sampler types in interface blocks; image types are also permitted in blocks by this extension)" * sampler types are not allowed v3: - update the spec comment - update the glsl error message Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* glsl: allow bindless samplers/images as function returnSamuel Pitoiset2017-05-061-3/+8
| | | | | | | | | | | | | The ARB_bindless_texture spec doesn't clearly state this, but as it says "Replace Section 4.1.7 (Samplers), p. 25" and, "Replace Section 4.1.X, (Images)", this should be allowed. v3: - add spec comment - update the glsl error message Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* glsl: allow bindless samplers/images as out and inout parametersSamuel Pitoiset2017-05-061-2/+14
| | | | | | | | | | | | | | | | | | | From section 4.1.7 of the ARB_bindless_texture spec: "Samplers can be used as l-values, so can be assigned into and used as "out" and "inout" function parameters." From section 4.1.X of the ARB_bindless_texture spec: "Images can be used as l-values, so can be assigned into and used as "out" and "inout" function parameters." v3: - add spec comment - update the glsl error message Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* glsl: allow to declare bindless samplers/images as non-uniformSamuel Pitoiset2017-05-061-17/+66
| | | | | | | | | | | | | | | | | | | | From section 4.1.7 of the ARB_bindless_texture spec: "Samplers may be declared as shader inputs and outputs, as uniform variables, as temporary variables, and as function parameters." From section 4.1.X of the ARB_bindless_texture spec: "Images may be declared as shader inputs and outputs, as uniform variables, as temporary variables, and as function parameters." v3: - add validate_storage_for_sampler_image_types() - update spec comment - update the glsl error message Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* glsl: process bindless/bound layout qualifiersSamuel Pitoiset2017-05-0610-3/+198
| | | | | | | | | | | | This adds bindless_sampler and bound_sampler (and respectively bindless_image and bound_image) to the parser. v3: - add an extra space in apply_bindless_qualifier_to_variable() - fix indentation in merge_qualifier() Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* glsl: do not make sampler/image types readonly variablesSamuel Pitoiset2017-05-062-4/+0
| | | | | | | | | | | | | | | | | In plain GLSL, sampler and image types can only be declared uniform-qualified global variables or 'in' function parameters. Setting the read_only flag seems quite useless because other checks will prevent sampler/image variables to be assigned and also because the flag is not set for atomic_uint types which are opaque types. This will also help for ARB_bindless_texture because samplers and images can be assigned when they are considered bindless. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* glsl: make sampler/image scalar typesSamuel Pitoiset2017-05-061-1/+1
| | | | | | | | | | As a side effect, this will magically fix std140/std430 interfaces for bindless samplers/images and will help for implementing the explicit conversions with constructors. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* glsl: make count_attribute_slots() returns 1 for samplers/imagesSamuel Pitoiset2017-05-061-2/+2
| | | | | | | | For packed varyings. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* glsl: make component_slots() returns 2 for samplers/imagesSamuel Pitoiset2017-05-062-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | Bindless samplers/images are 64-bit unsigned integers, which means they consume two components as specified by ARB_bindless_texture. It looks like we are not wasting uniform storage by changing this because default-block uniforms are not packed. So, if we use N uint uniforms, they occupy N * 16 bytes in the constant buffer. This is something that could be improved. Though, count_uniform_size needs to be adjusted to not count a sampler (or image) twice. As a side effect, this will probably break the cache if you have one because it will consider sampler/image types as two components. v3: - update the comments Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* glsl: make sampler/image types as 64-bitSamuel Pitoiset2017-05-062-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | The ARB_bindless_texture spec says: "Samplers are represented using 64-bit integer handles." and, "Images are represented using 64-bit integer handles." It seems simpler to always consider sampler and image types as 64-bit unsigned integer. This introduces a temporary workaround in _mesa_get_uniform() because at this point no flag are used to distinguish between bound and bindless samplers. This is going to be removed in a separate series. This avoids breaking arb_shader_image_load_store-state. v3: - update the comment slightly Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* glsl: add ARB_bindless_texture enableSamuel Pitoiset2017-05-063-0/+9
| | | | | | | | | This also adds the extension to the standalone GLSL compiler. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* mesa: add ARB_bindless_texture to the extensions listSamuel Pitoiset2017-05-062-0/+2
| | | | | | | | This is required for the following GLSL bits. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* radv/meta: fix restoring a push descriptor setFredrik Höglund2017-05-062-2/+7
| | | | | | | | | | | radv_bind_descriptor_set cannot be used to bind a push descriptor set since a push descriptor set does not have a buffer list. However, there is no need to add the buffers again when restoring a set, so this fix is also an optimization. Cc: "17.1" <[email protected]> Signed-off-by: Fredrik Höglund <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]>
* anv/allocator: Only write to _vg_ptr if we have valgrindJason Ekstrand2017-05-051-1/+1
| | | | | | | This fixes the build when not building against valgrind headers. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100945 Reviewed-by: Chad Versace <[email protected]>
* i915: Fix build break with empty unreachable()Daniel Stone2017-05-051-4/+2
| | | | | | | | Actually put something in unreachable(), so as not to break the build on a Friday evening. Signed-off-by: Daniel Stone <[email protected]> Reported-by: Mark Janes <[email protected]>
* radeonsi: apply the tess+GS hang workaround to Polaris12 as wellMarek Olšák2017-05-051-1/+2
| | | | | | Cc: 17.1 <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* i965: Set modifier for imported and duplicated imagesDaniel Stone2017-05-051-0/+20
| | | | | | | | | | | | | | | | | When a buffer is being created from FD or GEM flink import, the current API makes no provision for passing modifier information along with this. Set the modifier for such images to DRM_FORMAT_MOD_INVALID. Also preserve the modifier when duplicating an image, as will be done by GBM when importing from a wl_buffer. This doubly tripped up Wayland, as the images would first have been created (as wl_buffers) with a 0 modifier, and then lost what modifier they would've had when being duplicated into gbm_bos. Fixes: d78a36ea624 ("i965/dri: Handle the linear fb modifier") Signed-off-by: Daniel Stone <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* i965: Use helper function for modifier -> tilingDaniel Stone2017-05-051-17/+34
| | | | | | | | Use a helper function and struct to convert between a modifier and tiling mode, so we can use it later for a tiling -> modifier lookup. Signed-off-by: Daniel Stone <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* radeonsi: fix build with GCC 4.8Samuel Pitoiset2017-05-051-1/+1
| | | | | | | Fixes: 7088b655e8 ("radeonsi: constify a bunch of the perfcounter structs.") Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100937 Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
* st/glsl_to_tgsi: fix renumber_registers() in presence of dead codeSamuel Pitoiset2017-05-051-5/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The TGSI DCE pass doesn't eliminate dead assignments like MOV TEMP[0], TEMP[1] in presence of loops because it assumes that the visitor doesn't emit dead code. This assumption is actually wrong and this situation happens. However, it appears that the merge_registers() pass accidentally takes care of this for some weird reasons. But since this pass has been disabled for RadeonSI and Nouveau, the renumber_registers() pass which is called *after*, can't do its job correctly. This is because it assumes that no dead code is present. But if there is still a dead assignment, it might re-use the TEMP register id incorrectly and emits wrong code. This patches fixes the issue by recording writes instead of reads, and this has the advantage to be faster. This should fix Unigine Heaven on RadeonSI and Nouveau. shader-db results with RadeonSI: 47109 shaders in 29632 tests Totals: SGPRS: 1923308 -> 1923316 (0.00 %) VGPRS: 1133843 -> 1133847 (0.00 %) Spilled SGPRs: 2516 -> 2518 (0.08 %) Spilled VGPRs: 65 -> 65 (0.00 %) Private memory VGPRs: 1184 -> 1184 (0.00 %) Scratch size: 1308 -> 1308 (0.00 %) dwords per thread Code Size: 60095968 -> 60096256 (0.00 %) bytes LDS: 1077 -> 1077 (0.00 %) blocks Max Waves: 431889 -> 431889 (0.00 %) Wait states: 0 -> 0 (0.00 %) It's still interesting to disable the merge_registers() pass. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* anv/query: handle more cases of 'out of host memory'Iago Toral Quiroga2017-05-051-0/+10
| | | | Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]>
* egl/android: Set EGLSurface.Lost to EGL_TRUE/EGL_FALSENicolas Boichat2017-05-041-2/+2
| | | | | | | | | Lost is an EGLBoolean, so we should assign it to EGL_TRUE/EGL_FALSE, not true/false. Fixes: e5eace58684 ("egl/android: Mark surface as lost when dequeueBuffer fails") Fixes: 0212db35040 ("egl/android: Cancel any outstanding ANativeBuffer in surface destructor") Reviewed-by: Chad Versace <[email protected]>
* anv/allocator: Improve block pool growing assertsJason Ekstrand2017-05-041-6/+5
| | | | Reviewed-by: Juan A. Suarez Romero <[email protected]>
* anv: Drop the instruction pool block sizeJason Ekstrand2017-05-041-2/+1
| | | | | | | Now that we can allocate states larger than the block size, we no longer need a block size of 1MB which can be rather wasteful. Reviewed-by: Juan A. Suarez Romero <[email protected]>
* anv/allocator: Add support for large stream allocationsJason Ekstrand2017-05-041-4/+7
| | | | Reviewed-by: Juan A. Suarez Romero <[email protected]>
* anv/allocator: Allow state pools to allocate large statesJason Ekstrand2017-05-041-0/+69
| | | | | | | | | | | | | | | | | | | | | | Previously, the maximum size of a state that could be allocated from a state pool was a block. However, this has caused us various issues particularly with shaders which are potentially very large. We've also hit issues with render passes with a large number of attachments when we go to allocate the block of surface state. This effectively removes the restriction on the maximum size of a single state. (There's still a limit of 1MB imposed by a fixed-length bucket array.) For states larger than the block size, we just grab a large block off of the block pool rather than sub-allocating. When we go to allocate some chunk of state and the current bucket does not have state, we try to pull a chunk from some larger bucket and split it up. This should improve memory usage if a client occasionally allocates a large block of state. This commit is inspired by some similar work done by Juan A. Suarez Romero <[email protected]>. Reviewed-by: Juan A. Suarez Romero <[email protected]>
* anv/allocator: Support pushing multiple blocks onto a free list at onceJason Ekstrand2017-05-041-3/+16
| | | | Reviewed-by: Juan A. Suarez Romero <[email protected]>
* anv/allocator: Add helpers for dealing with bucket sizesJason Ekstrand2017-05-041-10/+20
| | | | Reviewed-by: Juan A. Suarez Romero <[email protected]>
* anv/allocator: Add the capability to allocate blocks of different sizesJason Ekstrand2017-05-042-15/+13
| | | | Reviewed-by: Juan A. Suarez Romero <[email protected]>
* anv/allocator: Rework a commentJason Ekstrand2017-05-041-4/+5
| | | | | | This commit just fixes up the English a bit and re-flows the comment. Reviewed-by: Juan A. Suarez Romero <[email protected]>
* anv/allocator: Tweak the block pool growing algorithmJason Ekstrand2017-05-041-10/+18
| | | | | | | | | The old algorithm worked fine assuming a constant block size. We're about to break that assumption so we need an algorithm that's a bit more robust against suddenly growing by a huge amount compared to the currently allocated quantity of memory. Reviewed-by: Juan A. Suarez Romero <[email protected]>
* anv/allocator: Embed the block_pool in the state_poolJason Ekstrand2017-05-0411-86/+66
| | | | | | | Now that the state stream is allocating off of the state pool, there's no reason why we need the block pool to be separate. Reviewed-by: Juan A. Suarez Romero <[email protected]>
* anv/allocator: Get rid of the ability to free blocksJason Ekstrand2017-05-042-34/+2
| | | | | | | Now that everything is going through the state pools, the block pool no longer needs to be able to handle re-use. Reviewed-by: Juan A. Suarez Romero <[email protected]>
* anv: Allocate binding table blocks through the state poolJason Ekstrand2017-05-042-27/+22
| | | | Reviewed-by: Juan A. Suarez Romero <[email protected]>
* anv/allocator: Add support for "back" allocations to state_poolJason Ekstrand2017-05-042-2/+33
| | | | Reviewed-by: Juan A. Suarez Romero <[email protected]>
* anv/allocator: Drop the block_size field from block_poolJason Ekstrand2017-05-049-50/+74
| | | | | | | | | | | | | Since the state_stream is now pulling from a state_pool, the only thing pulling directly off the block pool is the state pool so we can just move the block_size there. The one exception is when we allocate binding tables but we can just reference the state pool there as well. The only functional change here is that we no longer grow the block pool immediately upon creation so no BO gets allocated until our first state allocation. Reviewed-by: Juan A. Suarez Romero <[email protected]>
* anv/allocator: Pull the userptr part of block_pool_grow into a helperJason Ekstrand2017-05-041-91/+104
| | | | Reviewed-by: Juan A. Suarez Romero <[email protected]>
* anv/allocator: Roll fixed_size_state_pool into state_poolJason Ekstrand2017-05-041-50/+35
| | | | | | | The helper functions aren't really gaining us as much as they claim and are actually about to be in the way. Reviewed-by: Juan A. Suarez Romero <[email protected]>