summaryrefslogtreecommitdiffstats
path: root/src/gallium
Commit message (Collapse)AuthorAgeFilesLines
* r600g,radeonsi: Fix calculation of IR target cap string buffer sizeMichel Dänzer2015-01-271-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes writing beyond the allocated buffer: ==31855== Invalid write of size 1 ==31855== at 0x50AB2A9: vsprintf (iovsprintf.c:43) ==31855== by 0x508F6F6: sprintf (sprintf.c:32) ==31855== by 0xB59C7EC: r600_get_compute_param (r600_pipe_common.c:526) ==31855== by 0x5B2B7DE: get_compute_param<char> (device.cpp:37) ==31855== by 0x5B2B7DE: clover::device::ir_target() const (device.cpp:201) ==31855== by 0x5B398E0: clover::program::build(clover::ref_vector<clover::device> const&, char const*, clover::compat::vector<clover::compat::pair<clover::compat::string, clover::compat::string> > const&) (program.cpp:63) ==31855== by 0x5B20152: clBuildProgram (program.cpp:182) ==31855== by 0x400F41: main (hello_world.c:109) ==31855== Address 0x56fed5f is 0 bytes after a block of size 15 alloc'd ==31855== at 0x4C29180: operator new(unsigned long) (vg_replace_malloc.c:324) ==31855== by 0x5B2B7C2: allocate (new_allocator.h:104) ==31855== by 0x5B2B7C2: allocate (alloc_traits.h:357) ==31855== by 0x5B2B7C2: _M_allocate (stl_vector.h:170) ==31855== by 0x5B2B7C2: _M_create_storage (stl_vector.h:185) ==31855== by 0x5B2B7C2: _Vector_base (stl_vector.h:136) ==31855== by 0x5B2B7C2: vector (stl_vector.h:278) ==31855== by 0x5B2B7C2: get_compute_param<char> (device.cpp:35) ==31855== by 0x5B2B7C2: clover::device::ir_target() const (device.cpp:201) ==31855== by 0x5B398E0: clover::program::build(clover::ref_vector<clover::device> const&, char const*, clover::compat::vector<clover::compat::pair<clover::compat::string, clover::compat::string> > const&) (program.cpp:63) ==31855== by 0x5B20152: clBuildProgram (program.cpp:182) ==31855== by 0x400F41: main (hello_world.c:109) Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Tom Stellard <[email protected]>
* clover: Fix build with llvm after r226981Jan Vesely2015-01-261-0/+4
| | | | | Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=88783 Signed-off-by: Jan Vesely <[email protected]>
* st/nine: Correctly handle when ff vs should have no texture coord input/outputAxel Davy2015-01-221-11/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previous code semantic was: . if ff ps will not run a ff stage, then do not output texture coords for this stage for vs . if XYZRHW is used (position_t), use only the mode where input coordinates are copied to the outputs. Problem is when apps don't give texture inputs. When apps precise PASSTHRU, it means copy texture coord input to texture coord output if there is such input. The case where there is no texture coord input wasn't handled correctly. Drivers like r300 dislike when vs has inputs that are not fed. Moreover if the app uses ff vs with a programmable ps, we shouldn't look at what are the parameters of the ff ps to decide to output or not texture coordinates. The new code semantic is: . if XYZRHW is used, restrict to PASSTHRU . if PASSTHRU is used and no texture input is declared, then do not output texture coords for this stage The case where ff ps needs a texture coord input and ff vs doesn't output it is not handled, and should probably be a runtime error. This fixes 3Dmark05, which uses ff vs with programmable ps. Reviewed-by: Tiziano Bacocco <[email protected]> Signed-off-by: Axel Davy <[email protected]>
* st/nine: Change comment relating to vertex shader inputs not matching ↵Axel Davy2015-01-221-5/+6
| | | | | | | declaration Reviewed-by: Tiziano Bacocco <[email protected]> Signed-off-by: Axel Davy <[email protected]>
* st/nine: Allocate vs constbuf buffer for indirect addressing once.Axel Davy2015-01-223-5/+6
| | | | | | | | | | | | | | | When the shader does indirect addressing on the constants, we allocate a temporary constant buffer to which we copy the constants from the app given user constants and the constants filled in the shader. This patch makes this buffer be allocated once. Reviewed-by: Ilia Mirkin <[email protected]> Signed-off-by: Axel Davy <[email protected]> Signed-off-by: Tiziano Bacocco <[email protected]> Cc: "10.4" <[email protected]>
* st/nine: Allocate the correct size for the user constant bufferAxel Davy2015-01-223-7/+8
| | | | | | Reviewed-by: Ilia Mirkin <[email protected]> Signed-off-by: Axel Davy <[email protected]> Cc: "10.4" <[email protected]>
* st/nine: Add variables containing the size of the constant buffersAxel Davy2015-01-223-6/+10
| | | | | | Reviewed-by: Tiziano Bacocco <[email protected]> Signed-off-by: Axel Davy <[email protected]> Cc: "10.4" <[email protected]>
* st/nine: Fix sm3 relative addressing for non-debug buildAxel Davy2015-01-221-4/+0
| | | | | | | | | | | | | Relative addressing needs the constant buffer to get all the correct constants, even those defined by the shader. The code to copy the shader constants to the constant buffer was enabled only for debug build. Enable it always. Cc: "10.4" <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]> Reviewed-by: David Heidelberg <[email protected]> Signed-off-by: Axel Davy <[email protected]>
* st/nine: Remove unused code for psAxel Davy2015-01-223-40/+15
| | | | | | | | | Since constant indirect adressing is not allowed for ps, we can remove our code to handle that. Reviewed-by: Ilia Mirkin <[email protected]> Signed-off-by: Axel Davy <[email protected]> Cc: "10.4" <[email protected]>
* st/nine: Correct rules for relative adressing and constants.Axel Davy2015-01-221-6/+8
| | | | | | | | | relative adressing for constants is possible only for vs float constants. Reviewed-by: Ilia Mirkin <[email protected]> Signed-off-by: Axel Davy <[email protected]> Cc: "10.4" <[email protected]>
* st/nine: Implement TEXREG2AR, TEXREG2GB and TEXREG2RGBAxel Davy2015-01-221-3/+36
| | | | | | Reviewed-by: Ilia Mirkin <[email protected]> Signed-off-by: Axel Davy <[email protected]> Cc: "10.4" <[email protected]>
* st/nine: Implement TEXDP3TEXAxel Davy2015-01-221-1/+19
| | | | | | Reviewed-by: Ilia Mirkin <[email protected]> Signed-off-by: Axel Davy <[email protected]> Cc: "10.4" <[email protected]>
* st/nine: Implement TEXDP3Axel Davy2015-01-221-1/+11
| | | | | | Reviewed-by: Ilia Mirkin <[email protected]> Signed-off-by: Axel Davy <[email protected]> Cc: "10.4" <[email protected]>
* st/nine: Implement TEXDEPTHAxel Davy2015-01-221-1/+22
| | | | | | | Reviewed-by: Ilia Mirkin <[email protected]> Reviewed-by: David Heidelberg <[email protected]> Signed-off-by: Axel Davy <[email protected]> Cc: "10.4" <[email protected]>
* st/nine: Implement TEXM3x3SPECAxel Davy2015-01-221-1/+38
| | | | | | Reviewed-by: Ilia Mirkin <[email protected]> Signed-off-by: Axel Davy <[email protected]> Cc: "10.4" <[email protected]>
* st/nine: Implement TEXM3x2TEXAxel Davy2015-01-221-1/+19
| | | | | | | Reviewed-by: Ilia Mirkin <[email protected]> Reviewed-by: David Heidelberg <[email protected]> Signed-off-by: Axel Davy <[email protected]> Cc: "10.4" <[email protected]>
* st/nine: implement TEXM3x2DEPTHAxel Davy2015-01-221-1/+26
| | | | | | Reviewed-by: Ilia Mirkin <[email protected]> Signed-off-by: Axel Davy <[email protected]> Cc: "10.4" <[email protected]>
* st/nine: Fix TEXM3x3 and implement TEXM3x3VSPECAxel Davy2015-01-221-17/+36
| | | | | | | | | | The fix is that this line: "src[s] = tx->regs.vT[s];" is wrong if s doesn't start from 0. Instead access tx->regs.vT directly when needed. Reviewed-by: Ilia Mirkin <[email protected]> Signed-off-by: Axel Davy <[email protected]> Cc: "10.4" <[email protected]>
* st/nine: Fill missing dst and src number for some instructions.Axel Davy2015-01-221-23/+23
| | | | | | | | | | Not filling them correctly results in bad padding and later crash. Reviewed-by: David Heidelberg <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]> Signed-off-by: Axel Davy <[email protected]> Cc: "10.4" <[email protected]>
* st/nine: Implement TEXCOORD special behavioursAxel Davy2015-01-221-5/+26
| | | | | | | | | | | | | | | | | | texcoord for ps < 1_4 should clamp between 0 and 1 the values. texcrd (texcoord ps 1_4) does not clamp and can be used with two modifiers _dw and _dz that means the channels are divided by w or z. Implement those in shared code, since the same modifiers can be used for texld ps 1_4. v2: replace DIV by RCP + MUL v3: Remove an useless MOV Reviewed-by: Tiziano Bacocco <[email protected]> Signed-off-by: Axel Davy <[email protected]> Cc: "10.4" <[email protected]>
* st/nine: Fix CALLNZ implementationAxel Davy2015-01-221-9/+4
| | | | | | | | | | | | | | | | | Nothing seems to indicates the negation modifier would be stored in the instruction flags instead of the source modifier. tx_src_param has already handled it if it is in the source modifier. In addition, when the card supports native integers, the boolean are stored in 32 bits int and are equal to 0 or 0xFFFFFFFF. Given 0xFFFFFFFF is NaN if it was a float, better use UIF than IF. Reviewed-by: Ilia Mirkin <[email protected]> Signed-off-by: Axel Davy <[email protected]>
* st/nine: Fix some fixed function pipeline operationAxel Davy2015-01-221-2/+4
| | | | | | | Reviewed-by: Ilia Mirkin <[email protected]> Signed-off-by: Axel Davy <[email protected]> Cc: "10.4" <[email protected]>
* st/nine: Clamp ps 1.X constantsAxel Davy2015-01-221-0/+7
| | | | | | | | | This is wine (and windows) behaviour. Reviewed-by: Ilia Mirkin <[email protected]> Signed-off-by: Axel Davy <[email protected]> Cc: "10.4" <[email protected]>
* st/nine: Remove duplicated code for ps texcoord input declarationAxel Davy2015-01-221-8/+4
| | | | | | Reviewed-by: Ilia Mirkin <[email protected]> Reviewed-by: David Heidelberg <[email protected]> Signed-off-by: Axel Davy <[email protected]>
* st/nine: Fix CND implementationAxel Davy2015-01-221-9/+13
| | | | | | | Signed-off-by: Axel Davy <[email protected]> Signed-off-by: Tiziano Bacocco <[email protected]> Cc: "10.4" <[email protected]>
* st/nine: Match REP implementation to LOOPAxel Davy2015-01-221-19/+30
| | | | | | | | | | | Previous implementation was behaving fine, but improve it by: . Improved documentation . Decreasing counter (comparing to 0 is likely to be faster than to constant) . Move the counter update at the end for better performance for shaders that break the loop earlier than when the count is done. Reviewed-by: Tiziano Bacocco <[email protected]> Signed-off-by: Axel Davy <[email protected]>
* st/nine: Rewrite LOOP implementation, and a0 aL handlingAxel Davy2015-01-221-63/+100
| | | | | | | | | | | | | | | | | | | Previous implementation didn't work well with nested loops. Instead of using several address registers, put a0 and aL into normal registers, and copy them to one address register when we need to use them. Wine tests loop_index_test() and nested_loop_test() now pass correctly. Fixes r600g crash while loading Bioshock - bug https://bugs.freedesktop.org/show_bug.cgi?id=85696 Tested-by: David Heidelberg <[email protected]> Reviewed-by: Tiziano Bacocco <[email protected]> Signed-off-by: Axel Davy <[email protected]> Cc: "10.4" <[email protected]>
* st/nine: Correct LOG on negative valuesAxel Davy2015-01-221-2/+13
| | | | | | | | | | | | We should take the absolute value of the input. Also return -FLT_MAX instead of -Inf for an input of 0. Reviewed-by: Ilia Mirkin <[email protected]> Reviewed-by: David Heidelberg <[email protected]> Signed-off-by: Axel Davy <[email protected]> Cc: "10.4" <[email protected]>
* st/nine: Handle NRM with input of null normAxel Davy2015-01-221-1/+3
| | | | | | | | | | | | | When the input's xyz are 0.0, the output should be 0.0. This is due to the fact that Inf * 0 = 0 for dx9. To handle this case, cap the result of RSQ to FLT_MAX. We have FLT_MAX * 0 = 0. Reviewed-by: David Heidelberg <[email protected]> Signed-off-by: Axel Davy <[email protected]> Cc: "10.4" <[email protected]>
* st/nine: Handle RSQ special casesAxel Davy2015-01-221-1/+12
| | | | | | | | | | | We should use the absolute value of the input as input to ureg_RSQ. Moreover, an input of 0.0 should return FLT_MAX. Reviewed-by: David Heidelberg <[email protected]> Signed-off-by: Axel Davy <[email protected]> Cc: "10.4" <[email protected]>
* st/nine: Fix POW implementationAxel Davy2015-01-221-1/+12
| | | | | | | | | | | | | POW doesn't match directly TGSI, since we should take the absolute value of src0. Fixes black textures in some games Reviewed-by: Ilia Mirkin <[email protected]> Reviewed-by: David Heidelberg <[email protected]> Signed-off-by: Axel Davy <[email protected]> Cc: "10.4" <[email protected]>
* st/nine: Fix typo for M4x4Axel Davy2015-01-221-1/+1
| | | | | | | Cc: "10.4" <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]> Reviewed-by: David Heidelberg <[email protected]> Signed-off-by: Axel Davy <[email protected]>
* st/nine: Correctly declare NineTranslateInstruction_Mkxn inputsAxel Davy2015-01-221-2/+5
| | | | | | | | | | | | | Let's say we have c1 and c2 declared in the shader and c0 given by the app Then here we would have read c0, c1 and c2 given by the app, instead of the correct c0, c1, c2. This correction fixes several issues in some games. Reviewed-by: Ilia Mirkin <[email protected]> Signed-off-by: Axel Davy <[email protected]> Cc: "10.4" <[email protected]>
* st/nine: Saturate oFog and oPts vs outputsAxel Davy2015-01-221-2/+2
| | | | | | | | | | | According to docs and Wine, these two vs outputs have to be saturated. Reviewed-by: Ilia Mirkin <[email protected]> Reviewed-by: David Heidelberg <[email protected]> Signed-off-by: Axel Davy <[email protected]> Cc: "10.4" <[email protected]>
* st/nine: Remove some shader unused codeAxel Davy2015-01-221-22/+1
| | | | | | Reviewed-by: Ilia Mirkin <[email protected]> Signed-off-by: Axel Davy <[email protected]> Cc: "10.4" <[email protected]>
* st/nine: Convert integer constants to floats before storing them when cards ↵Axel Davy2015-01-221-13/+52
| | | | | | | | | | | don't support integers The shader code is already behaving as if they are floats when the the card doesn't support integers Reviewed-by: Ilia Mirkin <[email protected]> Signed-off-by: Axel Davy <[email protected]> Cc: "10.4" <[email protected]>
* st/nine: Rework of boolean constantsAxel Davy2015-01-223-35/+24
| | | | | | | | | | | | Convert them to shader booleans at earlier stage. Previous code is fine, but later patch will make integers being converted at earlier stage, so do the same for booleans Reviewed-by: Tiziano Bacocco <[email protected]> Signed-off-by: Axel Davy <[email protected]> Cc: "10.4" <[email protected]>
* st/nine: Add ATI1 and ATI2 supportAxel Davy2015-01-226-7/+34
| | | | | | | | | | | | | Adds ATI1 and ATI2 support to nine. They map to PIPE_FORMAT_RGTC1_UNORM and PIPE_FORMAT_RGTC2_UNORM, but need special handling. Reviewed-by: David Heidelberg <[email protected]> Signed-off-by: Axel Davy <[email protected]> Signed-off-by: Xavier Bouchoux <[email protected]> Cc: "10.4" <[email protected]>
* st/nine: Check if srgb format is supported before trying to use it.Axel Davy2015-01-222-2/+19
| | | | | | | | | | | According to msdn, we must act as if user didn't ask srgb if we don't support it. Reviewed-by: Ilia Mirkin <[email protected]> Reviewed-by: David Heidelberg <[email protected]> Signed-off-by: Axel Davy <[email protected]> Cc: "10.4" <[email protected]>
* st/nine: Hack to generate resource if it doesn't exist when getting viewStanislaw Halik2015-01-221-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | Buffers in the MANAGED pool are supposed to have the content in a ram buffer, a copy in VRAM if there is enough memory (driver manages memory and decide when to delete the buffer in VRAM). This is not implemented properly in nine, and a VRAM copy is going to be created when the RAM memory is filled, and the VRAM copy will get synced with the RAM memory updates. Due to some issues (in the implementation or in app logic), it can happen we try to create a sampler view of the resource while we haven't created the VRAM resource. This hack creates the resource when we hit this case, which prevents crashing, but doesn't help with the resource content. This fixes several games crashing at launch. Acked-by: Axel Davy <[email protected]> Acked-by: David Heidelberg <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]> Signed-off-by: Stanislaw Halik <[email protected]> Cc: "10.4" <[email protected]>
* st/nine: NineBaseTexture9: update sampler view creationAxel Davy2015-01-221-13/+32
| | | | | | | | | | | While previous code was having the correct behaviour in general, this new code is more readable (without checking all gallium formats manually) and has a more defined behaviour for depth stencil resources. Reviewed-by: Tiziano Bacocco <[email protected]> Reviewed-by: David Heidelberg <[email protected]> Signed-off-by: Axel Davy <[email protected]> Cc: "10.4" <[email protected]>
* st/nine: Return D3DERR_INVALIDCALL when trying to create a texture of bad formatAxel Davy2015-01-223-3/+26
| | | | | | Reviewed-by: Ilia Mirkin <[email protected]> Reviewed-by: David Heidelberg <[email protected]> Signed-off-by: Axel Davy <[email protected]>
* st/nine: Fix crash when deleting non-implicit swapchainAxel Davy2015-01-221-1/+1
| | | | | | | | | | | | | | | The implicit swapchains are destroyed when the device instance is destroyed. However for non-implicit swapchains, it is not the case, and the application can have kept an reference on the swapchain buffers to reuse them. Fixes problems with battle.net launcher. Cc: "10.4" <[email protected]> Tested-by: Nick Sarnie <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]> Reviewed-by: David Heidelberg <[email protected]> Signed-off-by: Axel Davy <[email protected]>
* st/nine: CubeTexture: fix GetLevelDescAxel Davy2015-01-221-1/+1
| | | | | | | | | | | | | This->surfaces contains the surfaces associated to the levels and faces. This->surfaces[6*Level] is what we want here, since it gives us a face descriptor for the level 'Level'. Reviewed-by: Ilia Mirkin <[email protected]> Reviewed-by: David Heidelberg <[email protected]> Signed-off-by: Axel Davy <[email protected]> Signed-off-by: Xavier Bouchoux <[email protected]> Cc: "10.4" <[email protected]>
* st/nine: NineBaseTexture9: fix setting of last_layerAxel Davy2015-01-221-2/+2
| | | | | | | | | | Use same similar settings as u_sampler_view_default_template Reviewed-by: Ilia Mirkin <[email protected]> Reviewed-by: David Heidelberg <[email protected]> Signed-off-by: Axel Davy <[email protected]> Cc: "10.4" <[email protected]>
* st/nine: Correctly advertise D3DPMISCCAPS_CLIPTLVERTSAxel Davy2015-01-221-1/+3
| | | | | | | | | | | | The cap means D3DFVF_XYZRHW vertices will see clipping. This is not the case when PIPE_CAP_TGSI_VS_WINDOW_SPACE_POSITION is supported, since it'll disable clipping. Reviewed-by: Tiziano Bacocco <[email protected]> Signed-off-by: Axel Davy <[email protected]> Cc: "10.4" <[email protected]>
* st/nine: Fix D3DRS_POINTSPRITE supportXavier Bouchoux2015-01-221-3/+3
| | | | | | | | | | | It's done by testing the existence of the point sprite output register *after* parsing the vertex shader. Reviewed-by: Ilia Mirkin <[email protected]> Reviewed-by: David Heidelberg <[email protected]> Reviewed-by: Axel Davy <[email protected]> Signed-off-by: Xavier Bouchoux <[email protected]> Cc: "10.4" <[email protected]>
* st/nine: Add new texture format stringsAxel Davy2015-01-221-0/+3
| | | | | | | | Reviewed-by: Ilia Mirkin <[email protected]> Reviewed-by: David Heidelberg <[email protected]> Signed-off-by: Axel Davy <[email protected]> Cc: "10.4" <[email protected]>
* st/nine: Fix clip state logicAxel Davy2015-01-221-1/+3
| | | | | | | | The clip state was reset everytime, incurring an overhead. Reviewed-by: Ilia Mirkin <[email protected]> Reviewed-by: David Heidelberg <[email protected]> Signed-off-by: Axel Davy <[email protected]>
* st/nine: query: remove unused variable (trivial)David Heidelberger2015-01-221-1/+0
| | | | | Reviewed-by: Ilia Mirkin <[email protected]> Signed-off-by: David Heidelberg <[email protected]>