summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* glsl: Eliminate the open-coded version of process_block_array_leafIan Romanick2016-12-211-31/+9
| | | | | Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* ttn: handle GLSL_SAMPLER_DIM_SUBPASS_MS caseJuan A. Suarez Romero2016-12-211-0/+1
| | | | | | Fixes a warning. Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]>
* i965: allow unsourced enabled VAOJuan A. Suarez Romero2016-12-211-7/+16
| | | | | | | | | | | | The GL 4.5 spec says: "If any enabled array’s buffer binding is zero when DrawArrays or one of the other drawing commands defined in section 10.4 is called, the result is undefined." This commits avoids crashing the code, which is not a very good "undefined result". This fixes spec/!opengl 3.1/vao-broken-attrib piglit test.
* svga: Fix a strict-aliasing violation in shader dumperEdward O'Callaghan2016-12-211-1/+9
| | | | | | | | | | | | | | | As per the C spec, it is illegal to alias pointers to different types. This results in undefined behaviour after optimization passes, resulting in very subtle bugs that happen only on a full moon.. Use a memcpy() as a well defined coercion between the isomorphic bit-field interpretations of memory. V.2: Use C99 compat STATIC_ASSERT() over C11 static_assert(). Signed-off-by: Edward O'Callaghan <[email protected]> Reviewed-by: Charmaine Lee <[email protected]>
* draw: use SoA fetch, not AoS oneRoland Scheidegger2016-12-211-48/+23
| | | | | | | | | | | | | | | | | | | Now that there's some SoA fetch which never falls back, we should always get results which are better or at least not worse (something like rgba32f will stay the same). For cases which get way better, think something like R16_UNORM with 8-wide vectors: this was 8 sign-extend fetches, 8 cvt, 8 muls, followed by a couple of shuffles to stitch things together (if it is smart enough, 6 unpacks) and then a (8-wide) transpose (not sure if llvm could even optimize the shuffles + transpose, since the 16bit values were actually sign-extended to 128bit before being cast to a float vec, so that would be another 8 unpacks). Now that is just 8 fetches (directly inserted into vector, albeit there's one 128bit insert needed), 1 cvt, 1 mul. v2: ditch the old AoS code instead of just disabling it. Reviewed-by: Jose Fonseca <[email protected]>
* gallivm: generalize the compressed format soa fetch a bitRoland Scheidegger2016-12-211-37/+49
| | | | | | | | | This can now handle rgtc (unorm) too - this path no longer handles plain formats, but that's unnecessary they now all have their proper SoA unpack (this will still be dog-slow though due to the actual fetch being per-pixel util fallbacks). Reviewed-by: Jose Fonseca <[email protected]>
* gallivm: provide soa fetch path handling formats with more than 32bitRoland Scheidegger2016-12-211-154/+375
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This previously always fell back to AoS conversion. Even for 4-float formats (which is the optimal case by far for that fallback case) this was suboptimal, since it meant the conversion couldn't be done with 256bit vectors. While this may still only be partly possible for some formats, (unless there's AVX2 support) at least the transpose can be done with half the unpacks (and before using the transpose for AoS fallbacks, it was worse still). With less than 4 channels, things got way worse with the AoS fallback quickly even with 128bit vectors. The strategy is pretty much the same as the existing one for formats which fit into 32 bits, except there's now multiple vectors to be fetched (2 or 4 to be exact), which need to be shuffled first (if it's 4 vectors, this amounts to a transpose, for 2 it's a bit different), then the unpack is done the same (with the exception that the shift of the channels is now modulo 32, and we need to select the right vector). In fact the most complex part about it is to get the shuffles right for separating into lo/hi parts for AVX/AVX2... This also makes use of the new ability of gather to use provided type information, which we abuse to outsmart llvm so we get decent shuffles, and to fetch 3x32bit vectors without having to ZExt the scalar. And just because we can, we handle double formats too, albeit they are a bit different (draw sometimes needs to handle that). v2: fix typo float/int bug (generating inefficient code). Reviewed-by: Jose Fonseca <[email protected]>
* gallivm: optimize gather a bit, by using supplied destination typeRoland Scheidegger2016-12-218-79/+333
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | By using a dst_type in the the gather interface, gather has some more knowledge about how values should be fetched. E.g. if this is a 3x32bit fetch and dst_type is 4x32bit vector gather will no longer do a ZExt with a 96bit scalar value to 128bit, but just fetch the 96bit as 3x32bit vector (this is still going to be 2 loads of course, but the loads can be done directly to simd vector that way). Also, we can now do some try to use the right int/float type. This should make no difference really since there's typically no domain transition penalties for such simd loads, however it actually makes a difference since llvm will use different shuffle lowering afterwards so the caller can use this to trick llvm into using sane shuffle afterwards (and yes llvm is really stupid there - nothing against using the shuffle instruction from the correct domain, but not at the cost of doing 3 times more shuffles, the case which actually matters is refusal to use shufps for integer values). Also do some attempt to avoid things which look great on paper but llvm doesn't really handle (e.g. fetching 3-element 8 bit and 16 bit vectors which is simply disastrous - I suspect type legalizer is to blame trying to extend these vectors to 128bit types somehow, so fetching these with scalars like before which is suboptimal due to the ZExt). Remove the ability for truncation (no point, this is gather, not conversion) as it is complex enough already. While here also implement not just the float, but also the 64bit avx2 gathers (disabled though since based on the theoretical numbers the benefit just isn't there at all until Skylake at least). Reviewed-by: Jose Fonseca <[email protected]>
* gallivm: optimize SoA AoS fallback fetch path a littleRoland Scheidegger2016-12-211-22/+46
| | | | | | | | | | We should do transpose, not extract/insert, at least with "sufficient" amount of channels (for 4 channels, extract/insert shuffles generated otherwise look truly terrifying). Albeit we shouldn't fallback to that so often in any case. v2: ditch the extract/insert path, not worth keeping (we're going to avoid hitting the fallback that often with future patches). Reviewed-by: Jose Fonseca <[email protected]>
* gallivm: (trivial) handle non-aligned fetch for lp_build_fetch_rgba_soaRoland Scheidegger2016-12-213-8/+12
| | | | | | | | | | soa fetch so far always assumed that data was aligned. However, we want to use this for vertex fetch, and data might not be aligned there, so handle it in this path too (basically just pass through alignment through to other functions). (It looks like it wouldn't work for for cached s3tc but this is no different than with AoS fetch.) Reviewed-by: Jose Fonseca <[email protected]>
* st/nine: Upload on secondary context for Draw*UpAxel Davy2016-12-201-8/+15
| | | | | | | | | | Avoid synchronization by using the secondary context for uploading the vertex data for Draw*Up. v2: Rely on u_upload_mgr to use persistent coherent buffers. Do not flush. Signed-off-by: Axel Davy <[email protected]>
* st/nine: Dirty MANAGED buffers at Lock timeAxel Davy2016-12-201-2/+3
| | | | | | | Tests suggest MANAGED buffers are made dirty at Lock time, not at Unlock time. Signed-off-by: Axel Davy <[email protected]>
* st/nine: Implement new buffer upload pathAxel Davy2016-12-2010-24/+461
| | | | | | | | | | | | | | | | | | | | This new buffer upload path enables to lock faster than the normal path when using DISCARD/NOOVERWRITE. v2: Diverse cleanups and fixes. v3: Fix allocation size for 'lone' buffers and add more debug info. v4: Rewrite of the path to handle when DISCARD/NOOVERWRITE is not used anymore. The resource content is copied to the new resource used. v5: flush for safety after unmap (not sure it is really required here, but safer to flush). v6: Do not use the path if persistent coherent mapping is unavailable. Fix buffer creation flags. v7: Do not flush since it is not needed. Signed-off-by: Axel Davy <[email protected]>
* st/nine: Allow non-zero resource offset for vertex buffersAxel Davy2016-12-203-8/+12
| | | | | | Next patches will introduce an offset. Signed-off-by: Axel Davy <[email protected]>
* st/nine: Do not wait for DEFAULT lock for volumes when we canAxel Davy2016-12-201-1/+8
| | | | | | | If the volumes (and the texture container) are not referenced, then they are no pending operations on them. We can lock directly. Signed-off-by: Axel Davy <[email protected]>
* st/nine: Do not wait for DEFAULT lock for surfaces when we canAxel Davy2016-12-201-1/+11
| | | | | | | If the surfaces (and the texture container) are not referenced, then they are no pending operations on them. We can lock directly. Signed-off-by: Axel Davy <[email protected]>
* st/nine: Add arguments to context's blit and copy_regionAxel Davy2016-12-203-6/+22
| | | | | | | The new arguments enable to reference the objects while the function hasn't run. Signed-off-by: Axel Davy <[email protected]>
* st/nine: Idem for nine_context_gen_mipmapAxel Davy2016-12-203-1/+7
| | | | | | | Will enable to use the bind count as an information for whether the surface/volume is used in the worker thread. Signed-off-by: Axel Davy <[email protected]>
* st/nine: Bind destination for surface/volume uploadsAxel Davy2016-12-204-0/+9
| | | | | | | Will enable to use the bind count as an information for whether the surface/volume is used in the worker thread. Signed-off-by: Axel Davy <[email protected]>
* st/nine: Use nine_context_box_upload for volumesAxel Davy2016-12-202-36/+26
| | | | | | | | | | | | Use nine_context_box_upload for uploads: . systemmem volume to default volume . managed volume internal content to its resource. Check the uploads are executed before any action that can alter the data, that is LockBox and volume destruction. Signed-off-by: Axel Davy <[email protected]>
* st/nine: Fix leak with volume dtorAxel Davy2016-12-201-1/+1
| | | | | | The last level was not released. Signed-off-by: Axel Davy <[email protected]>
* st/nine: Fix leak with cubetexture dtorAxel Davy2016-12-201-1/+1
| | | | | | The last level was not released. Signed-off-by: Axel Davy <[email protected]>
* st/nine: Use nine_context_box_upload for surfacesAxel Davy2016-12-202-32/+33
| | | | | | | | | | | | Use nine_context_box_upload for uploads: . systemmem surface to default surface . managed surface internal content to its resource. Check the uploads are executed before any action that can alter the data, that is LockRect, NineSurface9_CopyDefaultToMem and surface destruction. Signed-off-by: Axel Davy <[email protected]>
* st/nine: Implement nine_context_box_uploadAxel Davy2016-12-202-0/+50
| | | | | | This function will be used for surface and volume uploads Signed-off-by: Axel Davy <[email protected]>
* st/nine: Use nine_context_gen_mipmap in BaseTexture9Axel Davy2016-12-201-9/+3
| | | | | | Generate mipmaps in the worker thread. Signed-off-by: Axel Davy <[email protected]>
* st/nine: Implement nine_context_gen_mipmapAxel Davy2016-12-202-0/+22
| | | | | | To offload mipmap generation as well. Signed-off-by: Axel Davy <[email protected]>
* st/nine: Optimize managed buffer uploadAxel Davy2016-12-202-5/+10
| | | | | | | | | | Do the upload in the other thread. Usually managed buffers are used once per frame. It is then very likely pending_upload is 0 at Lock time. Signed-off-by: Axel Davy <[email protected]>
* st/nine: Implement nine_context_range_uploadAxel Davy2016-12-202-0/+19
| | | | | | Will be used to upload buffers. Signed-off-by: Axel Davy <[email protected]>
* st/nine: Do not bind the container if forward is falseAxel Davy2016-12-201-7/+5
| | | | | | This doesn't make sense to bind the container in that specific case. Signed-off-by: Axel Davy <[email protected]>
* st/nine: Comment and simplify iunknownAxel Davy2016-12-202-21/+18
| | | | | | The behaviour is a bit less obscure now. Signed-off-by: Axel Davy <[email protected]>
* st/nine: Detach buffers in swapchain dtor.Axel Davy2016-12-201-1/+1
| | | | | | | | | BackBuffers can survive swapchain dtor if the user has a reference on them. The swapchain itself has no reference on the buffer. Signed-off-by: Axel Davy <[email protected]>
* st/nine: Fix NineUnknown_DetachAxel Davy2016-12-201-2/+1
| | | | | | We don't bind the container in AddRef. Signed-off-by: Axel Davy <[email protected]>
* st/nine: Simplify ARG_BIND_REFAxel Davy2016-12-201-7/+3
| | | | | | Remove some noop operations. Signed-off-by: Axel Davy <[email protected]>
* st/nine: Avoid flushing the queue for queries GetDataAxel Davy2016-12-204-19/+33
| | | | | | | Use the newly introduced counter to know when we don't need synchronization. Signed-off-by: Axel Davy <[email protected]>
* st/nine: Add CSMT_NO_WAIT_WITH_COUNTERPatrick Rudolph2016-12-201-0/+54
| | | | | | | | Similar to the other macros, but introduces a counter, which enables to know when the instructions has been executed. Signed-off-by: Patrick Rudolph <[email protected]>
* st/nine: Use nine_context_clear_render_targetAxel Davy2016-12-204-15/+29
| | | | | | Enables to not wait for the worker thread for ColorFill. Signed-off-by: Axel Davy <[email protected]>
* st/nine: Optimize ColorFillAxel Davy2016-12-201-1/+1
| | | | | | When we lock the whole surface to overwrite it, we can use DISCARD. Signed-off-by: Axel Davy <[email protected]>
* st/nine: Simplify ColorFillAxel Davy2016-12-201-9/+1
| | | | | | | For render targets, NineSurface9_GetSurface is not expected to fail. Signed-off-by: Axel Davy <[email protected]>
* st/nine: use get_pipe_acquire/release when possibleAxel Davy2016-12-208-16/+34
| | | | | | | Use the acquire/release semantic when we don't need to wait for any pending command. Signed-off-by: Axel Davy <[email protected]>
* st/nine: Implement Fast path for dynamic buffers and csmtAxel Davy2016-12-203-10/+64
| | | | | | | | | | | | Use the secondary pipe for DISCARD/NOOVERWRITE, which avoids stalling to get the pipe from the worker thread. v2: flush at unmap. This is required for example if the driver does hidden draw calls or copies. In the case of unsynchronized it is probably not required, but it is more safe. Signed-off-by: Axel Davy <[email protected]>
* st/nine: Add secondary pipe for deviceAxel Davy2016-12-202-1/+5
| | | | | | | The secondary pipe will be used for operations that don't need synchronization. Signed-off-by: Axel Davy <[email protected]>
* st/nine: Add nine_context_get_pipe_acquire/releaseAxel Davy2016-12-204-0/+91
| | | | | | See commit for description. Signed-off-by: Axel Davy <[email protected]>
* st/nine: SYSTEMMEM ignores DISCARD.Axel Davy2016-12-201-1/+5
| | | | | | | | | Tests show SYSTEMMEM should ignore DISCARD. Prevents game bugs with following patches reimplementing DISCARD. Halo is affected. Signed-off-by: Axel Davy <[email protected]>
* st/nine: Upload Managed buffers just before draw call using themAxel Davy2016-12-202-17/+14
| | | | | | | | | Previously we were uploading Managed buffers at the next draw call after they were set dirty. This is not the expected behaviour. Instead upload just before draw call needing the content. Signed-off-by: Axel Davy <[email protected]>
* st/nine: Track bindings for buffersAxel Davy2016-12-203-6/+55
| | | | | | Similar code than for textures. Signed-off-by: Axel Davy <[email protected]>
* st/nine: Fix BASETEX_REGISTER_UPDATEAxel Davy2016-12-201-1/+1
| | | | | | | | | | BASETEX_REGISTER_UPDATE was adding the texture to the list of textures to upload in too many cases. tex->base.base.bind will be set to true if the texture is in a stateblock, whereas we want to upload only if bound to the device, which is what bind_count is for. Signed-off-by: Axel Davy <[email protected]>
* st/nine: Simplify the logic to bind texturesAxel Davy2016-12-203-39/+47
| | | | | | This makes the code more readable. Signed-off-by: Axel Davy <[email protected]>
* st/nine: Use nine_context for resource_copy_regionPatrick Rudolph2016-12-203-4/+28
| | | | | | | Use nine_context wrapper for resource_copy_region. Enables to offload it with CSMT. Signed-off-by: Patrick Rudolph <[email protected]>
* st/nine: Use nine_context for blitPatrick Rudolph2016-12-203-2/+15
| | | | | | Enables to offload it with CSMT. Signed-off-by: Patrick Rudolph <[email protected]>
* st/nine: Add NINE_DEBUG=tid to turn threadid on or offPatrick Rudolph2016-12-202-5/+10
| | | | | | To ease debugging. Signed-off-by: Patrick Rudolph <[email protected]>