Commit Graph

74 Commits

Author SHA1 Message Date
Cameron Cawley 9dfa000bc0 Initial support for building for Windows with OpenWatcom 2022-05-19 20:11:10 +03:00
Cameron Cawley c8eea02071 Fix C89 build errors in Windows builds 2022-05-18 15:03:15 -07:00
Ryan C. Gordon 7bc498d325
direct3d: Implement missing blend operations.
This is only for Direct3D 9; Direct3D 11 already had this implemented.

Fixes #5375.
2022-03-27 09:14:07 -04:00
Ozkan Sezer bf69868924 reduced a few ifdefs, fixed an unused warning if built w/o SDL_HAVE_YUV. 2022-03-10 01:55:04 +03:00
Sam Lantinga c6eef542ab Removed dead code 2022-03-09 13:48:31 -08:00
pionere 911ba8d343
hide impossible branch in D3D_UnlockTexture 2022-03-09 20:17:55 +01:00
pionere 3f8b450de2
extend the code hidden by SDL_HAVE_YUV 2022-03-09 15:03:30 +01:00
pionere 2cfc83eab7
sync D3D_RenderReadPixels with D3D11_RenderReadPixels
- use the result of SDL_ConvertPixels to propagate error
- get rid of the verbose error message of D3D11_RenderReadPixels in case SDL_ConvertPixels failed
2022-02-02 14:56:38 -05:00
pionere 60deadba59 re-use return value of SDL_SetError/WIN_SetErrorFromHRESULT/SDL_OutOfMemory 2022-01-28 20:40:19 -05:00
Sam Lantinga 18e4d9fed1 Re-enable line drawing path in render drivers
This is still used for scaled line drawing in RenderDrawLinesWithRects()
2022-01-08 09:02:25 -08:00
Sylvain 9cb2c549fa Remove QueueDrawLines from D3D, D3D11 2022-01-07 14:10:23 -08:00
Sam Lantinga 120c76c84b Updated copyright for 2022 2022-01-03 09:40:21 -08:00
Alex Szpakowski 3a5e148b13 Renderer backends use SDL_Color instead of int for geometry colors. 2021-12-14 12:19:16 -08:00
Sam Lantinga b08e57e926 Don't try to create a vbo if we aren't using any vertices 2021-12-14 09:32:05 -08:00
Sam Lantinga 3a31a45028 End the scene before resetting the D3D device, since we'll start with BeginScene after that.
If we don't do this, we'll end up with unbalanced Begin/End scene pairs which causes D3DERR_INVALIDCALL in the present.

Fixes https://github.com/libsdl-org/SDL/issues/4933
2021-11-10 05:24:31 -08:00
Ozkan Sezer b3f9d8f38d remove unused local vars after the latest commits. 2021-10-25 07:05:50 +03:00
Sylvain f02ad2820f Remove FillRects from back-end, where RenderGeometry can be used 2021-10-24 22:27:56 -04:00
Sylvain ab758398af Direct3D: remove RenderCopy and RenderCopyEx from back-end 2021-10-24 22:27:56 -04:00
Ryan C. Gordon 114d1d46ac
direct3d: Remove unnecessary render target support check.
Direct3D 9 dictates that caps.NumSimultaneousRTs must always be at least 1,
which is to say that Direct3D 9 level hardware must always support render
targets.

(caps.NumSimultaneousRTs is meant to show if you can draw to multiple render
targets in a single draw call.)

We had already hardcoded SDL_RENDERER_TARGETTEXTURE as available earlier in
the function anyhow.

Fixes #4781.
2021-09-27 23:18:25 -04:00
Misa 4549769d7d Add `SDL_RenderSetVSync()`
Currently, if an application wants to toggle VSync, they'd have to tear
down the renderer and recreate it. This patch fixes that by letting
applications call SDL_RenderSetVSync().

This is the same as the patch in #3673, except it applies to all
renderers (including PSP, even thought it seems that the VSync flag is
disabled for that renderer). Furthermore, the renderer flags also change
as well, which #3673 didn't do. It is also an API instead of using hint
callbacks (which could be potentially dangerous).

Closes #3673.
2021-09-14 09:56:29 -07:00
Sylvain 54ca1d190e
SW_RenderGeometry: add a redundant check to clear static analysis (see bug #4600) 2021-08-27 07:44:03 +02:00
Sylvain e426bb80cb
Fixed bug #4671 - D3D_QueueGeometry: use "count / 3" (Thanks alittlesail!) 2021-08-20 07:50:30 +02:00
Sylvain ae5336a3d2
Fixed bug #4669: D3D_QueueGeometry: -0.5f offset position of vertexs
This similar to D3D_QueueCopy positions
2021-08-19 14:03:10 +02:00
Sylvain a8f89a01aa Change 'size_indice' to 'size_indices' 2021-08-19 00:10:59 +02:00
Sylvain 47db47c1cc Add SDL_HAVE_RENDER_GEOMETRY to compile or not with RenderGeometry support 2021-08-19 00:10:59 +02:00
Sylvain 32e7910135 Fix warnings 2021-08-19 00:10:59 +02:00
Sylvain 4869a3d294 Add Direct3D9 implementation (not tested) 2021-08-19 00:10:59 +02:00
Ryan C. Gordon 5fc13fcb21 direct3d: Commit viewport state before clearing, attempt 2.
This reintroduces the fix from 0e16ee8330, but just marks
the viewport state as dirty after a clear that needs to expand the
viewport to fill the render target, as we'll need to also reset
the orthographic projection state elsewhere, and that won't
happen if we clear the dirty flag here.

Fixes #4210.
(again.)
(...sorry...!)
2021-08-04 07:00:17 -04:00
Sam Lantinga 9d64e6b442 Revert "direct3d: Commit dirty viewport state before clearing."
This reverts commit 0e16ee8330.
2021-08-03 00:29:33 -07:00
Ryan C. Gordon 0e16ee8330 direct3d: Commit dirty viewport state before clearing.
Otherwise you might have set the viewport to the full size of
the render target in SDL's API but this change hasn't been
transmitted to Direct3D yet by the time we attempt to clear.

Fixes #4210.
2021-08-03 02:32:56 -04:00
Ryan C. Gordon 585c11c5ae
direct3d: Fix possibly-incorrect scissor test when clearing.
Thanks to @JayFoxRox who did the detective work on this!

Fixes #3357.
2021-07-30 00:33:15 -04:00
Ozkan Sezer f2a2d0c696 SDL_render_d3d.c: fix build with SDL_LEAN_AND_MEAN 2021-02-15 22:56:20 +03:00
Sam Lantinga 9130f7c377 Updated copyright for 2021 2021-01-02 10:25:38 -08:00
Sam Lantinga cb36189692 Fixed bug 5235 - All internal sources should include SDL_assert.h
Ryan C. Gordon

We should really stick this in SDL_internal.h or something so it's always available.
2020-12-09 07:16:22 -08:00
Sam Lantinga b6afbe6317 Added SDL_log.h to SDL_internal.h so logging is available everywhere 2020-04-07 09:38:57 -07:00
Sam Lantinga c8c05a9fc3 Fixed bug 4991 - Pixel shader problem when recreating a texture for direct3d renderer
cmediaplayer

Hi, i already mentioned in the SDL discourse a bug that recreating of a texture occours pixel shader problem on direct3d renderer. There is no problem for direct3d11. You can see the issue by using my app named C Media Player which is available for Windows for free using my web site www.cmediaplayer.com. Just follow the steps:

*Open a media file
*When playing the file change the scale quality under the video menu.
*You will see the problem.
2020-03-08 19:23:21 -07:00
Sam Lantinga 367a356132 Don't release the backbuffer on error, we didn't acquire it. 2020-03-08 18:56:07 -07:00
Cameron Gutman e152a3cedb direct3d: Don't attempt to create zero sized vertex buffer 2020-03-07 13:59:42 -08:00
Sam Lantinga a8780c6a28 Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
Sam Lantinga 5e19e66c73 Fixed bug 4914 - Expose SDL_ScaleMode and add SDL_SetTextureScaleMode/SDL_GetTextureScaleMode
Konrad

This was something rather trivial to add, but asked at least several times before (I did google about it as well).

It should be possible to dynamically change scaling mode of the texture. It is actually trivial task, but until now it was only possible with a hint before creating a texture.

I needed it for my game as well, so I took the liberty of writing it myself.

This patch adds following functions:

SDL_SetTextureScaleMode(SDL_Texture * texture, SDL_ScaleMode scaleMode);
SDL_GetTextureScaleMode(SDL_Texture * texture, SDL_ScaleMode *scaleMode);

That way you can change texture scaling on the fly.
2019-12-22 13:39:44 -08:00
Ryan C. Gordon 847bd8d983 direct3d: Be more aggressive about resetting state when textures go away.
Fixes Bugzilla #4768.
2019-09-02 00:11:58 -04:00
Ryan C. Gordon 31bb95f11f direct3d: Use D3DPOOL_DEFAULT for vertex buffers after all, release correctly.
Fixes Bugzilla #4679.
Fixes Bugzilla #4537.
2019-06-21 15:07:39 -04:00
Cameron Gutman e681623cb2 direct3d: Fix dirty textures failing to update
Even if the texture itself has not changed since last time, the data may have
so we must call UpdateDirtyTexture() to handle that possibility.
2019-06-20 19:51:00 -07:00
Ryan C. Gordon a2f2b73554 direct3d: Use D3DPOOL_MANAGED for vertex buffers.
Fixes Bugzilla #4537.
2019-06-11 13:02:56 -04:00
Ryan C. Gordon f7b7a9727b direct3d: Fixed SDL_RenderSetClipRect usage.
Fixes Bugzilla #4459.
2019-06-11 10:12:47 -04:00
Ryan C. Gordon 4f59d372f8 direct3d: don't dereference bogus pointer if current texture was destroyed.
Fixes Bugzilla #4460.
2019-06-11 09:29:48 -04:00
Ryan C. Gordon a6af0b8291 direct3d: Fixed more compiler warnings on Visual Studio 64-bit builds. 2019-06-11 02:31:57 -04:00
Sam Lantinga b2e76d860f Fixed Windows RT build 2019-03-19 16:52:09 -07:00
Sam Lantinga 5e13087b0f Updated copyright for 2019 2019-01-04 22:01:14 -08:00
Ryan C. Gordon cca9d24cde direct3d: be more aggressive about resetting invalidated cached state.
Fixes Bugzilla #4402.
2018-12-03 09:26:05 -05:00