aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/nine
Commit message (Collapse)AuthorAgeFilesLines
* util: remove LIST_IS_EMPTY macroTimothy Arceri2019-10-284-6/+6
| | | | | | | Just use the inlined function directly. The new function was introduced in addcf410. Reviewed-by: Eric Engestrom <[email protected]>
* st/nine: Fix unused variable warnings in release build.Timur Kristóf2019-10-251-9/+9
| | | | | Signed-off-by: Timur Kristóf <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* st/nine: Fix build with -Werror=empty-bodyTimur Kristóf2019-10-251-3/+3
| | | | | | | | Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/1995 Fixes: 8d43e2b2ded0fe3c82d4 ("meson: add -Werror=empty-body to disallow `if(x);`") Signed-off-by: Timur Kristóf <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* st/nine: Ignore D3DSIO_RET if it is the last instruction in a shaderDanylo Piliaiev2019-09-251-1/+7
| | | | | | | | | | | | | | RET as a last instruction could be safely ignored. Remove it to prevent crashes/warnings in case underlying driver doesn't implement arbitrary returns. A better way would be to remove the RET after the whole shader is parsed which will handle a possible case when the last RET is followed by a comment. CC: <[email protected]> Signed-off-by: Danylo Piliaiev <[email protected]> Reviewed-by: Axel Davy <[email protected]>
* st/nine: Properly initialize GLSL types for NIR shaders.Timur Kristóf2019-08-281-0/+5
| | | | | | | | NIR shaders use GLSL types (note: these live outside libglsl), and nine needs to properly initialize these just like the other state trackers. This fixes an assertion failure when TTN is used. Signed-off-by: Timur Kristóf <[email protected]>
* st/nine: Drop preprocessor guards for glibc-2.12Matt Turner2019-07-301-3/+0
| | | | | | | | Same rationale as the previous patch, but additionally these checks just seem entirely unnecessary. pthread_self() has been used in Mesa since at least 1999. Acked-by: Eric Engestrom <[email protected]>
* gallium: get rid of PIPE_CAP_SM3Erik Faye-Lund2019-07-101-1/+9
| | | | | | | | | | | | | | | | | | | | | PIPE_CAP_SM3 has always been an odd one out of all our caps. While most other caps are fine-grained and single-purpose, this cap encode several features in one. And since OpenGL cares more about single features, it'd be nice to get rid of this one. As it turns, this is now relatively simple. We only really care about three features using this cap, and those already got their own caps. So we can remove it, and make sure all current drivers just give the same response to all of them. The only place we *really* care about SM3 is in nine, and there we can instead just re-construct the information based on the finer-grained caps. This avoids DX9 semantics from needlessly leaking into all of the drivers, most of who doesn't care a whole lot about DX9 specifically. Signed-off-by: Erik Faye-Lund <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Acked-by: Alyssa Rosenzweig <[email protected]>
* st/nine: Use tgsi_to_nir when preferred IR is NIR.Timur Kristóf2019-06-054-6/+135
| | | | | | | | | This patch allows nine to read the preferred IR from pipe caps and use NIR when that is preferred by the driver, by calling tgsi_to_nir. Also adds some debug options that allow overriding it. Signed-off-by: Timur Kristóf <[email protected]> Reviewed-by: Axel Davy <[email protected]>
* gallium: Redefine the max texture 2d cap from _LEVELS to _SIZE.Eric Anholt2019-05-131-3/+3
| | | | | | | | The _LEVELS assumes that the max is always power of two. For V3D 4.2, we can support up to 7680 non-power-of-two MSAA textures, which will let X11 support dual 4k displays on newer hardware. Reviewed-by: Marek Olšák <[email protected]>
* st/nine: Check discard_delayed_release is set before allocating moreAxel Davy2019-04-301-0/+2
| | | | | | | | | | When discard_delayed_release is set (default), we allocate more buffers and use a different buffer wait path. Check if it is set, and use the old paths if not (the alternative buffer wait path could still be used, but there is no advantage to using it in this case). Signed-off-by: Axel Davy <[email protected]>
* st/nine: Throttle rendering similarly for thread_submitAxel Davy2019-04-301-15/+22
| | | | | | | | | thread_submit's throttling depending on the number of internal back buffers, and wasn't affected by the driver requested throttling value. Now it is. Signed-off-by: Axel Davy <[email protected]>
* st/nine: Optimize a bit writeonly buffersAxel Davy2019-04-301-1/+6
| | | | | | | | | | | Optimize writeonly by passing PIPE_TRANSFER_WRITE for these buffers instead of the safer PIPE_TRANSFER_READ_WRITE. This seems to improve the performance of d3d8 games using d3d8to9. Signed-off-by: Axel Davy <[email protected]>
* st/nine: Use TGSI_SEMANTIC_GENERIC for fogAxel Davy2019-04-302-28/+29
| | | | | | | | | | | | | | We used TGSI_SEMANTIC_FOG for fog, however on vs/ps 3, fog is allowed to have 4 components (even on the ff pipeline according to a wine test). Since gallium's TGSI_SEMANTIC_FOG has only one component, use TGSI_SEMANTIC_GENERIC instead. Fixes: https://github.com/iXit/Mesa-3D/issues/346 Signed-off-by: Axel Davy <[email protected]>
* st/nine: Enable computing const_rangesAxel Davy2019-04-301-1/+1
| | | | | | | All the pieces for constant compact are ready, thus enable the path. Signed-off-by: Axel Davy <[email protected]>
* st/nine: Handle const_ranges in nine_stateAxel Davy2019-04-301-2/+26
| | | | | | Handle slot mapping if there is one. Signed-off-by: Axel Davy <[email protected]>
* st/nine: Cache constant buffer sizeAxel Davy2019-04-307-23/+52
| | | | | | | | | | | | The shader constant buffer size with the constant compaction code can vary depending on the shader variant compiled (for example if fog constants are required, etc). Thus instead of using fixed size for the shader, add in the variant cache the size required, pass it to the context, and use this value. Signed-off-by: Axel Davy <[email protected]>
* st/nine: Propagate const_range to contextAxel Davy2019-04-307-15/+37
| | | | | | | | | As with the constant compaction we map the constant slots to new slots, we need to pass that information to the context which is in charge of uploading the constants. Signed-off-by: Axel Davy <[email protected]>
* st/nine: Prepare constant compaction in nine_shaderAxel Davy2019-04-302-28/+118
| | | | | | | | | | | | | | When indirect addressing is not used, we know exactly which constants are accessed, and thus can have them located in consecutive slots. We thus parse again the shader with a slot map for compaction. The path contains the work inside nine_shader.c for this path, but it needs some other commits to work, and thus is not enabled yet by this commit. Signed-off-by: Axel Davy <[email protected]>
* st/nine: Refactor counting of constantsAxel Davy2019-04-301-25/+21
| | | | | | Track the number of slots used Signed-off-by: Axel Davy <[email protected]>
* st/nine: Track constant slots usedAxel Davy2019-04-301-2/+11
| | | | | | This tracking will be useful for constant compaction Signed-off-by: Axel Davy <[email protected]>
* st/nine: Refactor ct_ctorAxel Davy2019-04-301-89/+95
| | | | | | | The refactoring will make it easier to parse the shader twice for the constant compaction path. Signed-off-by: Axel Davy <[email protected]>
* st/nine: Make swvp_on imply IS_VSAxel Davy2019-04-302-6/+10
| | | | | | | swvp cannot happen with ps, thus it makes sense to force it to false with ps. Signed-off-by: Axel Davy <[email protected]>
* st/nine: Refactor shader constants ureg_src computationAxel Davy2019-04-302-95/+99
| | | | | | | Put the shader constant code in one place to better change that code in future commits. Signed-off-by: Axel Davy <[email protected]>
* st/nine: Manually upload vs and ps constantsAxel Davy2019-04-301-0/+46
| | | | | | | In future commits we will introduce more fine-grained uploads Signed-off-by: Axel Davy <[email protected]>
* st/nine: use helper ureg_DECL_sampler everywhereAxel Davy2019-04-301-1/+1
| | | | Signed-off-by: Axel Davy <[email protected]>
* st/nine: Compact pixel shader keyAxel Davy2019-04-302-15/+31
| | | | | | | Compact the shader key to make room for new elements. Signed-off-by: Axel Davy <[email protected]>
* st/nine: Compact nine_ff_get_projected_keyAxel Davy2019-04-304-8/+24
| | | | | | | | Only the first four sampler slots can be used by ff ps < 0x14, thus the size of the key can be reduced. Signed-off-by: Axel Davy <[email protected]>
* st/nine: Refactor param->relAxel Davy2019-04-301-4/+6
| | | | | | | Refactor param->rel to enable different paths for constants and inputs relative addressing. Signed-off-by: Axel Davy <[email protected]>
* st/nine: Regroup param->rel testsAxel Davy2019-04-301-8/+3
| | | | | | | | | Regroup all the param->rel assertions into one assertion for better clarity and better covering. param->rel on an input can only happen with float constants for vs, or with inputs on vs/ps 3.0. Signed-off-by: Axel Davy <[email protected]>
* st/nine: Control shader constant inlining with drircAxel Davy2019-04-302-1/+3
| | | | | | | Until we use async shader compilation for constant inlining, don't enable it unless user asks for it. Signed-off-by: Axel Davy <[email protected]>
* st/nine: Recompile optimized shaders based on b/i constsAxel Davy2019-04-309-5/+211
| | | | | | | | | | | | | | | | | | | | | | | | | Boolean and Integer constants are used in d3d9 for flow control. Boolean are used for if/then/else and Integer constants for loops. The compilers can generate better code if these values are known at compilation. I haven't met so far a game that would change the values of these constants frequently (and when they do, they set to the values used for the previous draw call, and thus the changes get filtered out). Thus it makes sense to inline these constants and recompile the shaders. The commit sets a bound to the number of variants for a given shader to avoid too many shaders to be generated. One drawback is it means more shader compilations. It would probably make sense to compile these shaders asynchronously or let the user control the behaviour with an env var, but this is not done here. The games I tested hit very few shader variants, and the performance impact was negligible, but it could help for games with uber shaders. Signed-off-by: Axel Davy <[email protected]>
* st/nine: Add drirc option to use data_internal for dynamic texturesAxel Davy2019-04-305-2/+17
| | | | | | | | | | | | | | dynamic textures seem to have predictable stride. This stride should be the same as for a ram buffer. It seems some game don't check the actual stride value, assuming it to be the expected one. Thus this workaround (protected by drirc option) is to use an intermediate ram buffer. Fixes Rayman Legends texture issues when enabled. Signed-off-by: Axel Davy <[email protected]>
* st/nine: Support internal compressed format for volumesAxel Davy2019-04-301-13/+16
| | | | | | Reuse the generic path to support compressed formats. Signed-off-by: Axel Davy <[email protected]>
* st/nine: Support internal compressed format for surfacesAxel Davy2019-04-301-12/+15
| | | | | | Reuse the generic path to support compressed formats. Signed-off-by: Axel Davy <[email protected]>
* st/nine: Refactor volume GetSystemMemPointerAxel Davy2019-04-301-8/+11
| | | | | | It will make it easier to reuse in another place. Signed-off-by: Axel Davy <[email protected]>
* st/nine: Refactor surface GetSystemMemPointerAxel Davy2019-04-301-10/+12
| | | | | | It will make it easier to reuse in another place. Signed-off-by: Axel Davy <[email protected]>
* st/nine: rename *_conversion to *_internalAxel Davy2019-04-304-59/+59
| | | | | | | Rename these variables to a new name which will fit new usages introduced in later commits. Signed-off-by: Axel Davy <[email protected]>
* st/nine: Optimize volume upload with conversionAxel Davy2019-04-301-27/+25
| | | | | | | | | Use nine_context_box_upload instead of locking the pipe for volume upload with format conversion. nine_context_box_upload already handles format conversion. Signed-off-by: Axel Davy <[email protected]>
* st/nine: Optimize surface upload with conversionAxel Davy2019-04-301-28/+27
| | | | | | | | | Use nine_context_box_upload instead of locking the pipe for surface upload with format conversion. nine_context_box_upload already handles format conversion. Signed-off-by: Axel Davy <[email protected]>
* st/nine: Fix SINCOS inputAxel Davy2019-04-301-2/+7
| | | | | | | | | | | | | SINCOS takes an input with replicated swizzle. the swizzle can be on any component, not just x. Enable it to read from any component, but also use a temporary register to avoid dst/src aliasing. No known game is fixed by this change as it seems the input swizzle is commonly on x for this instruction, and src and dst don't alias. Signed-off-by: Axel Davy <[email protected]>
* st/nine: Ignore nooverwrite for systemmemAxel Davy2019-04-301-1/+1
| | | | | | | | | | | | | Systemmem has a specific behaviour we don't mimick exactly. That makes Halo feel free to use nooverwrite with it all the time, even when reading again at the same location. Ignore nooverwrite to have proper synchronization. Fixes: https://github.com/iXit/Mesa-3D/issues/348 Signed-off-by: Axel Davy <[email protected]>
* st/nine: Enable modifiers on ps 1.X texcoordsAxel Davy2019-04-301-21/+30
| | | | | | | | | | | For many ps 1.X instructions, we were reading the texcoords directly, instead of through tx_src_param, resulting in modifiers getting ignored. Use tx_src_param for all these instructions. Fixes: https://github.com/iXit/Mesa-3D/issues/337 Signed-off-by: Axel Davy <[email protected]>
* st/nine: Always return OK on SetSoftwareVertexProcessingAxel Davy2019-04-301-1/+1
| | | | | | | | | | | | | | This would need more tests to know exactly if INVALIDCALL can be returned in some situations. It seems some games expect D3D_OK, even when noop and illegal. Fixes: https://github.com/iXit/Mesa-3D/issues/302 https://github.com/iXit/Mesa-3D/issues/338 Signed-off-by: Axel Davy <[email protected]>
* st/nine: Finish if nooverwrite after normal mappingAxel Davy2019-04-302-0/+18
| | | | | | | | | | | | | | | | | d3d's nooverwrite and gallium's unsynchronized have different semantics. Indeed nooverwrite says the applications won't write to locations needed by previous draws, which is less strong than unsynchronized which won't synchronize previous writes. Thus in case app is locking without discard/nooverwrite, then using nooverwrite, we need to add a synchronization. Fixes: https://github.com/iXit/wine-nine-standalone/issues/29 Signed-off-by: Axel Davy <[email protected]>
* st/nine: Fix buffer/texture unbinding in nine_state_clearAxel Davy2019-04-305-16/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | Previously nine_state_clear was not using NineBindBufferToDevice and NineBindTextureToDevice to unbind buffers and textures (but used nine_bind) This was resulting in an uncorrect bind count for these resources. Combined with 0ec4e5f630ed68ece3f176b174cfd66eff023904 Some buffers were scheduled to be uploaded directly after they were locked (because the bind count incorrectly assumed they were needed for the next draw call), which resulted in uploads before the data was written. To simplify a bit the code (and because I needed to add a pointer to device), remove the stateblock usage from nine_state_clear and rename to nine_device_state_clear. Fixes: https://github.com/iXit/Mesa-3D/issues/345 Signed-off-by: Axel Davy <[email protected]>
* st/nine: Upload managed buffers only at draw using themAxel Davy2019-04-301-1/+4
| | | | | | | | | | | | | When a draw call is emited, buffers in the device->update_buffers list are uploaded. This patch removes buffers from the list if they are not bound anymore. Behaviour found studying: https://github.com/iXit/Mesa-3D/issues/345 Signed-off-by: Axel Davy <[email protected]>
* st/nine: Upload managed textures only at draw using themAxel Davy2019-04-301-1/+4
| | | | | | | | | | When a draw call is emited, textures in the device->update_textures list are uploaded. This patch removes textures from the list if they are not bound anymore. Signed-off-by: Axel Davy <[email protected]>
* st/nine: Use FLT_MAX/2 for RCP clampingAxel Davy2019-04-301-2/+3
| | | | | | | | This seems to fix Rayman (which adds things to the RCP result, and thus gets an Inf), while not having regressions. Signed-off-by: Axel Davy <[email protected]>
* st/nine: Fix D3DWindowBuffer_release for old wine nine supportAxel Davy2019-04-301-2/+12
| | | | | | | | | | | | | | No-one reported bugs for that, but is seems c442dd789066104e5e84cc90d98a7ff5cd6296cf and previous commits used APIs not defined until nine minor version 3. This patch should prevent crash in this case. Also turn off the resize feature in this case, as we won't prevent a buffer leak anymore. Cc: "19.0" [email protected] Signed-off-by: Axel Davy <[email protected]>
* st/nine: skip position checks in SetCursorPosition()Andre Heider2019-04-201-3/+5
| | | | | | | | | | | For HW cursors, "cursor.pos" doesn't hold the current position of the pointer, just the position of the last call to SetCursorPosition(). Skip the check against stale values and bump the d3dadapter9 drm version to expose this change of behaviour. Signed-off-by: Andre Heider <[email protected]> Reviewed-by: Axel Davy <[email protected]>