summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers
Commit message (Collapse)AuthorAgeFilesLines
* clover: fix build failure since bfd695eSerge Martin2016-02-141-3/+3
| | | | | | Reviewed-by: Ilia Mirkin <[email protected]> Reviewed-by: Edward O'Callaghan <[email protected]> Reviewed-by: Francisco Jerez <[email protected]>
* gallium: add a new interface for pipe_context::launch_grid()Samuel Pitoiset2016-02-131-5/+8
| | | | | | | | | | | | | This introduces pipe_grid_info which contains all information to describe a launch_grid call. This will be used to implement indirect compute in the same fashion as indirect draw. Changes from v2: - correctly initialize pipe_grid_info for nv50/nvc0 Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]>
* st/nine: Implement Managed vertex/index buffersAxel Davy2016-02-125-9/+121
| | | | | | | | | | | | | | | | | We were implementing those the same way than the default pool, which is sub-optimal. The buffer is supposed to return pointer to a ram copy when user locks, and automatically update the vram copy when needed. v2: Rename NineBuffer9_Validate to NineBuffer9_Upload Rename validate_buffers to update_managed_buffers Initialize NineBuffer9 managed fields after the resource is allocated. In case of allocation failure, when the dtor is executed, This->base.pool is then rightfully set. Signed-off-by: Axel Davy <[email protected]>
* st/nine: Align stack for entry pointsAxel Davy2016-02-1253-687/+703
| | | | | | | | | | For 32 bits, incoming stack is 4-byte aligned. We need to realign the stack to 16-byte at some point, or there are issues later (crash with SSE, llvm, etc). This patch chooses to align the stack at API entry points. Signed-off-by: Axel Davy <[email protected]>
* st/nine: Drop path for ureg_NRM and ureg_CLAMPAxel Davy2016-02-121-24/+4
| | | | | | | | using MIN/MAX is fine instead of CLAMP. NRM doesn't exist anymore. Signed-off-by: Axel Davy <[email protected]> Reviewed-by: Patrick Rudolph <[email protected]>
* st/nine: Remove usage of SQRT in ff codeAxel Davy2016-02-121-1/+3
| | | | | | | SQRT is not supported everywhere, so replace it by RSQ + MUL and handle case <= 0. Signed-off-by: Axel Davy <[email protected]>
* st/nine: Fix stateblocks crashes with lightsAxel Davy2016-02-121-8/+32
| | | | | | | | We had several issues of crashes with it. This should fix it. Signed-off-by: Axel Davy <[email protected]> Reviewed-by: Patrick Rudolph <[email protected]>
* st/nine: SCRATCH does support all formatsAxel Davy2016-02-129-22/+35
| | | | | | | | | Add new argument to d3d9_to_pipe_format_checked to be able to bypass format support checks. This argument is set to TRUE when the requested Pool is SCRATCH. Signed-off-by: Axel Davy <[email protected]> Reviewed-by: Patrick Rudolph <[email protected]>
* st/nine: Add format checks to create_zs_or_rt_surfaceAxel Davy2016-02-121-0/+3
| | | | | | | | | | | | | | Returns INVALIDCALL when trying to create a surface of unsupported format. In practice, apps are supposed to check for format support before trying to create a render target of that format. However some bad behaving apps could just try to create the surface and deduce if it failed that it wasn't supported. Signed-off-by: Axel Davy <[email protected]> Reviewed-by: Patrick Rudolph <[email protected]>
* st/nine: Support ATI1/ATI2 for CubeTextureAxel Davy2016-02-123-7/+4
| | | | | | | | | Texture and CubeTexture use common code, and thus ATI1/ATI2 is already implemented for CubeTexture. Signed-off-by: Axel Davy <[email protected]> Reviewed-by: Patrick Rudolph <[email protected]>
* st/nine: Clean pSharedHandle Texture ctors checksAxel Davy2016-02-123-18/+21
| | | | | | | Clarify the behaviour and clean the checks Signed-off-by: Axel Davy <[email protected]> Reviewed-by: Patrick Rudolph <[email protected]>
* st/nine: Move texture creation checksAxel Davy2016-02-124-13/+13
| | | | | | | | | | We were having checks at both Create*Texture functions and in ctors. Move all Create*Texture checks to ctors. Signed-off-by: Axel Davy <[email protected]> Reviewed-by: Patrick Rudolph <[email protected]>
* st/nine: Clean useless code in texture9.cAxel Davy2016-02-121-7/+1
| | | | | | | | This->base.base.resource is worth NULL for SYSTEMMEM textures. Signed-off-by: Axel Davy <[email protected]> Reviewed-by: Patrick Rudolph <[email protected]>
* st/nine: Do not set SHARED flag for shared textures.Axel Davy2016-02-121-3/+0
| | | | | | | | We do not support shared textures, thus no need to set the shared flag. Signed-off-by: Axel Davy <[email protected]> Reviewed-by: Patrick Rudolph <[email protected]>
* st/nine: Do not set resource usage for SYSTEMMEMAxel Davy2016-02-123-13/+4
| | | | | | | | | | | We do not create a resource for SYSTEMMEM textures, thus we do not need to set resource usage. The only exception is vertexbuffer SYSTEMMEM, since we do use a pipe resource for them. Signed-off-by: Axel Davy <[email protected]> Reviewed-by: Patrick Rudolph <[email protected]>
* st/nine: Use align_free when neededAxel Davy2016-02-044-4/+4
| | | | | | | | Use align_free to free memory allocated with align_malloc. Signed-off-by: Axel Davy <[email protected]> Reviewed-by: Patrick Rudolph <[email protected]>
* st/nine: Disallow non-argb8888 cursorsAxel Davy2016-02-041-0/+1
| | | | | | | Only argb8888 cursors are allowed. Signed-off-by: Axel Davy <[email protected]> Reviewed-by: Patrick Rudolph <[email protected]>
* st/nine: Enforce centroid for color input when multisampling is onAxel Davy2016-02-044-4/+15
| | | | | | | | The color inputs must automatically use centroid whether multisampling is used or not. Signed-off-by: Axel Davy <[email protected]> Reviewed-by: Patrick Rudolph <[email protected]>
* st/nine: Fix centroid flagAxel Davy2016-02-041-1/+4
| | | | | | | | sem.reg.mod & NINED3DSPDM_CENTROID is worth 4 when centroid is requested, whereas TGSI_INTERPOLATE_LOC_CENTROID is worth 1. Signed-off-by: Axel Davy <[email protected]>
* st/nine: Use fast clears more often for MRTsAxel Davy2016-02-044-12/+11
| | | | | | | | | | | | | | | | | | This enables to use fast clears in the following case: pixel shader renders to 1 RT 4 RT bound clear new pixel shader bound that renders to 4 RTs Previously the fast clear path wouldn't be hit, because when trying the fast clear path, the framebuffer state would be configured for 1 RT, instead of 4. Signed-off-by: Axel Davy <[email protected]> Reviewed-by: Patrick Rudolph <[email protected]>
* st/nine: Use linear filtering for shadow mappingAxel Davy2016-02-041-2/+3
| | | | | | | | Some docs say linear filtering is always used when app does shadow mapping. Signed-off-by: Axel Davy <[email protected]> Reviewed-by: Patrick Rudolph <[email protected]>
* st/nine: Respect block alignment on surface lockPatrick Rudolph2016-02-041-1/+1
| | | | | | | | | Respect block alignment for ATI1/ATI2 format when trying to lock a surface using LockRect(). Fixes failing WINE tests device.c test_surface_blocks() tests. Signed-off-by: Patrick Rudolph <[email protected]> Reviewed-by: Axel Davy <[email protected]>
* st/nine: Add Render state validation layerAxel Davy2016-02-045-13/+236
| | | | | | | | | | | | | | | | | | Testing Win behaviour seems to show wrong states are accepted, but then depending on the states some specific 'good' behaviours happen. This adds some validation to catch invalid states and have these 'good' behaviours when it happens. Also reorders SetRenderState to match the expected optimisation: (Value == previous Value) => return immediately, which affects D3D9 hacks too. Signed-off-by: Axel Davy <[email protected]> Signed-off-by: Patrick Rudolph <[email protected]>
* st/nine: Implement NineDevice9_GetAvailableTextureMemPatrick Rudolph2016-02-044-5/+50
| | | | | | | | | | | | | | | Implement a device private memory counter similar to Win 7. Only textures and surfaces increment vidmem and may return ERR_OUTOFVIDEOMEMORY. Vertexbuffers and indexbuffers creation always succeedes, even when out of video memory. Fixes "Vampire: The Masquerade - Bloodlines" allocating resources until crash. Fixes "Age of Conan" allocating resources until crash. Fixes failing WINE test device.c test_vidmem_accounting(). Signed-off-by: Patrick Rudolph <[email protected]> Reviewed-by: Axel Davy <[email protected]>
* st/nine: Handle Window OcclusionPatrick Rudolph2016-02-046-6/+104
| | | | | | | | | | | | | | Apps can know if the window is occluded by checking for specific error messages. The behaviour is different for Device9 and Device9Ex. This allow games to release the mouse and stop rendering until the focus is restored. In case of multiple swapchain we do care only of the device one. Signed-off-by: Patrick Rudolph <[email protected]> Reviewed-by: Axel Davy <[email protected]>
* st/nine: Store minor version numPatrick Rudolph2016-02-045-12/+24
| | | | | | | | | To keep compatible with older ID3DPresent interfaces (used to talk with Wine), store the minor version num accessible to all statetracker functions (in the NineDevice9 structure). Signed-off-by: Patrick Rudolph <[email protected]> Reviewed-by: Axel Davy <[email protected]>
* st/nine: Call flush_resource before flushAxel Davy2016-02-041-6/+4
| | | | | | | | | | | flush_resource needs to be called before flush (for fast clear resolve, etc). Removes useless computation of resource (it is already set correctly). Signed-off-by: Axel Davy <[email protected]> Reviewed-by: Patrick Rudolph <[email protected]>
* st/nine: Fix remaining swapchain testsPatrick Rudolph2016-02-042-1/+5
| | | | | | | | | | | | | | | | Return D3DERR_INVALIDCALL instead of E_POINTER. On error set ppBackBuffer to NULL. Multiple swapchains can only be created in windowed mode as windowed swapchain. Set backbuffer to NULL in NineDevice9_GetBackBuffer, but not in NineSwapChain9_GetBackBuffer. This fixes all WINE's device.c test_swapchain() tests. Signed-off-by: Patrick Rudolph <[email protected]> Reviewed-by: Axel Davy <[email protected]>
* st/nine: Fix crash NineDevice9_CreateAdditionalSwapChainAxel Davy2016-02-041-0/+4
| | | | | | | | | | | | When no window is specified, we should revert to the focus window. This deserves more tests however (what if the device swapchain is already using the focus window ?) Fixes crash for FFXIV Signed-off-by: Axel Davy <[email protected]> Reviewed-by: Patrick Rudolph <[email protected]>
* st/nine: Fix possible crash on errorPatrick Rudolph2016-02-041-1/+2
| | | | | | | | In case swapchain creation fails This->swapchains[i] might be NULL and causes a crash. Signed-off-by: Patrick Rudolph <[email protected]> Reviewed-by: Axel Davy <[email protected]>
* st/nine: Test more presentation paramsPatrick Rudolph2016-02-041-5/+8
| | | | | | | | Return errors in case of invalid presentation parameters. Fixes failing WINE tests device.c test_swapchain_parameters(). Signed-off-by: Patrick Rudolph <[email protected]> Reviewed-by: Axel Davy <[email protected]>
* st/nine: Fix resource9 private dataPatrick Rudolph2016-02-042-1/+3
| | | | | | | | | | | Store a copy of GUID in the header that is under our control and use it as key for the hashtable instead of using the application provided pointer. The application might change the memory after leaving the function. Fixes a crash for issue https://github.com/iXit/Mesa-3D/issues/130 Signed-off-by: Patrick Rudolph <[email protected]> Reviewed-by: Axel Davy <[email protected]>
* st/nine: Print GUID instead of pointerPatrick Rudolph2016-02-043-6/+30
| | | | | | | To ease debugging print the GUID instead of the pointer to it. Signed-off-by: Patrick Rudolph <[email protected]> Reviewed-by: Axel Davy <[email protected]>
* st/nine: Fix use of uninitialized memoryPatrick Rudolph2016-02-041-1/+1
| | | | | | | The values of box.z and box.depth weren't set and lead to a crash. Signed-off-by: Patrick Rudolph <[email protected]> Reviewed-by: Axel Davy <[email protected]>
* st/nine: Fix clear for multisample mismatch depth-stencilPatrick Rudolph2016-02-041-5/+7
| | | | | | | | | | Tests show in case of multisample mismatch between the depth-stencil buffer and the render target, then it is not cleared. Fixes failing WINE test visual.c test_multisample_mismatch(). Signed-off-by: Patrick Rudolph <[email protected]> Reviewed-by: Axel Davy <[email protected]>
* st/nine: Fix Volumetexture9_LockBoxPatrick Rudolph2016-02-041-0/+7
| | | | | | | | | Check for valid locked box dimensions. Fixes failing wine tests device.c test_lockbox_invalid. Signed-off-by: Patrick Rudolph <[email protected]> Reviewed-by: Axel Davy <[email protected]>
* st/nine: Fix ATI2 pitch for non-squareAxel Davy2016-02-041-2/+2
| | | | | | | | | Fixes crash for non-square textures. We were using the height instead of the width for some calculations. Signed-off-by: Axel Davy <[email protected]> Reviewed-by: Patrick Rudolph <[email protected]>
* st/nine: Support D3DFMT_R8G8B8Patrick Rudolph2016-02-041-3/+3
| | | | | | | | | | | | | | | | Add support for D3DFMT_R8G8B8. It allows format conversion for surfaces of pool scratch. Usually gallium formats equivalents for d3d9 formats have their names reversed. The gallium format PIPE_FORMAT_R8G8B8_UNORM is the right equivalent here, and its name is likely wrong (reversed). Fixes a crash in TmNationsForever. Signed-off-by: Patrick Rudolph <[email protected]> Reviewed-by: Axel Davy <[email protected]>
* st/nine: Use cso for viewportPatrick Rudolph2016-02-041-2/+1
| | | | | | | Use CSO to catch redundant viewport changes. Signed-off-by: Patrick Rudolph <[email protected]> Reviewed-by: Axel Davy <[email protected]>
* st/nine: Fix shade mode flatPatrick Rudolph2016-02-042-7/+8
| | | | | | | | | | Shade mode flat is only working if pixelshaders have interpolate set to TGSI_INTERPOLATE_COLOR on color inputs. Fixes failing WINE tests visual.c test_shademode(). Signed-off-by: Patrick Rudolph <[email protected]> Reviewed-by: Axel Davy <[email protected]>
* st/nine: Clear rendertarget on creationPatrick Rudolph2016-02-041-0/+9
| | | | | | | | Clear every rendertarget on creation. Fixes https://github.com/iXit/Mesa-3D/issues/139 Signed-off-by: Patrick Rudolph <[email protected]> Reviewed-by: Axel Davy <[email protected]>
* st/nine: Allow ColorFill on D3DFMT_NULL surfacesPatrick Rudolph2016-02-041-0/+2
| | | | | | | | Report success instead of failing as there's no resource for those surfaces. Fixes a crash in Crysis: Warhead. Signed-off-by: Patrick Rudolph <[email protected]> Reviewed-by: Axel Davy <[email protected]>
* st/nine: Introduce STREAMFREQ stateAxel Davy2016-02-043-21/+24
| | | | | | | | | | | | | | | | | | | | Previous vertex elements code update was protected by 'if ((group & (NINE_STATE_VDECL | NINE_STATE_VS)) || state->changed.stream_freq & ~1)' itself protected by 'if (group & (NINE_STATE_COMMON | NINE_STATE_VS))' If no state is changed except the stream frequency, no update would happen. This patch solves the problem by adding a new NINE_STATE_STREAMFREQ state. Another way would be to add state->changed.stream_freq & ~1 check to the main test. Signed-off-by: Axel Davy <[email protected]> Reviewed-by: Patrick Rudolph <[email protected]>
* st/nine: Catch redundant SetStreamSourceFreq callsAxel Davy2016-02-041-0/+3
| | | | | | | | Some apps do redundant SetStreamSourceFreq calls. Catch them to improve performance. Signed-off-by: Axel Davy <[email protected]> Reviewed-by: Patrick Rudolph <[email protected]>
* st/nine: Squash indexbuffer9 and vertexbuffer9Patrick Rudolph2016-02-048-215/+305
| | | | | | | | | The indexbuffer9 codebase was lagging behind the one of vertexbuffer9. Add buffer9 as common code base for indexbuffer9 and vertexbuffer9. Signed-off-by: Patrick Rudolph <[email protected]> Reviewed-by: Axel Davy <[email protected]>
* st/nine: Unset vtxbuf on resetAxel Davy2016-02-041-1/+3
| | | | | | | | We forgot to reset vtxbuf. This fixes some crashes. Signed-off-by: Axel Davy <[email protected]> Reviewed-by: Patrick Rudolph <[email protected]>
* st/nine: Use pipe_resource_reference for vtxbufAxel Davy2016-02-042-3/+4
| | | | | | | This seems cleaner to actually reference the resources for vtxbuf, rather than relying on the fact the bound d3d streams do. Signed-off-by: Axel Davy <[email protected]>
* st/nine: Use ff vertex shader when position_t is usedAxel Davy2016-02-047-14/+35
| | | | | | | | | | | | | | | | | | | | When an application sets a vertex shader, we are supposed to use it, and when no vertex shader are set, we are supposed to revert to fixed function vertex shader. It seems there is an exception: when the vertex declaration has a position_t index, we should revert to fixed function vertex shader. Up to know we were checking if device->state.vs is set to know whether to use programmable shader or not. With this commit we determine whether we use programmable shader or not when vertex shader/declaration are set, but stateblocks do complicate things a bit. Signed-off-by: Axel Davy <[email protected]> Reviewed-by: Patrick Rudolph <[email protected]>
* st/nine: Don't increment refcount on VertexDeclaration creation failurePatrick Rudolph2016-02-041-12/+12
| | | | | | | | | NineUnknown_ctor increments the refcount even in case of an error. Restructure the code to prevent refcount increments. Fixes a couple of wine tests. Signed-off-by: Patrick Rudolph <[email protected]> Reviewed-by: Axel Davy <[email protected]>
* st/nine: Change StretchRect check orderAxel Davy2016-02-041-3/+4
| | | | | | | | | | Textures in SYSTEMMEM don't have resources attached. Instead of returning an error for them, StretchRect was crashing. This changes the check order to fix that case. Signed-off-by: Axel Davy <[email protected]> Reviewed-by: Patrick Rudolph <[email protected]>