Commit Graph

1388 Commits

Author SHA1 Message Date
Cameron Cawley f2bcfe3dd2
Correct the texture format used for the N-Gage (#13192) 2025-06-08 18:56:24 +02:00
Michael Fitzmayer 685f1720fe Revert "[Nokia N-Gage] Fix alpha transparency in 4K color mode using BitBltMasked"
This reverts commit 2ef7944170 due to unbearable performance issues.
2025-06-07 22:45:54 +02:00
Michael Fitzmayer cbc9d662ea [Nokia N-Gage] Add define to disable FPS counter by default. 2025-06-07 15:40:53 +02:00
Michael Fitzmayer 2ef7944170 [Nokia N-Gage] Fix alpha transparency in 4K color mode using BitBltMasked
Previously, all transparent pixels were rendered as opaque due to the limitations of the 4K color mode. Replaced Gc()->BitBlt() with Gc()->BitBltMasked() and updated the mask during copy operations to correctly respect the alpha channel of textures, while maintaining good performance.
2025-06-04 21:05:29 +02:00
Michael Fitzmayer b61586b492 [Nokia N-Gage] Increase max. texture size from 256 to 1024; the previous setting was chosen at random and does not necessarily make sense in practice. 2025-05-31 14:07:49 +02:00
Michael Fitzmayer 7ae64592c9
Restore support for the Nokia N-Gage (#12148) 2025-05-22 11:07:22 -07:00
Francisco Javier Trujillo Mata c89357bf60 Fix wrong callback type 2025-05-20 11:10:43 -07:00
Sam Lantinga ec685e87fd Clarify logic in UpdateLogicalPresentation() 2025-05-14 10:12:41 -07:00
Frank Praznik 8aa5b97bb5 renderer: Always use the output size when updating the main view
The main view always reflects the size of the output, so don't use the dimensions of the currently bound render target texture when updating it, or it will reflect an incorrect size when the render target texture is unbound.
2025-05-14 09:37:30 -07:00
Petar Popovic 27b256022b SDL_GetRectIntersectionFloat(): Allow rendering zero-sized srcrect 2025-04-23 16:14:52 -07:00
Sam Lantinga f35a2736b7 Don't reset the render target when invalidating GPU renderer cache state
Fixes https://github.com/libsdl-org/SDL/issues/12646
2025-04-11 09:23:02 -07:00
Ozkan Sezer 0fdfa925f2 rename local pointer vars 'pixel' to 'pixels'
Reference issue: https://github.com/libsdl-org/SDL/issues/12749.
2025-04-08 18:20:03 +03:00
Ozkan Sezer 4c1a3ccd45 rename local vars 'pixel' to 'pixelvalue'
Reference issue: https://github.com/libsdl-org/SDL/issues/12749.
2025-04-07 21:10:51 +03:00
Topi-Matti Ritala f7b7188837 Add SDL_CreateGPURenderer 2025-04-07 09:26:03 -07:00
Sam Lantinga 36fc1c2c9c Fixed texture colorspace when creating a texture from a surface
Fixes https://github.com/libsdl-org/SDL/issues/12691
2025-03-31 18:49:58 -07:00
Sam Lantinga 633b9f6fb1 Added SDL_SetRenderTextureAddressMode() and SDL_GetRenderTextureAddressMode()
Fixes https://github.com/libsdl-org/SDL/issues/4820
Fixes https://github.com/libsdl-org/SDL/issues/12610
2025-03-28 13:51:19 -07:00
Carl Åstholm dd9b9d4513 Check if GL_OES_EGL_image_external is supported before trying to use it 2025-03-24 19:52:13 -07:00
Sam Lantinga 758eb256b9 Fixed DebugLogRenderCommands() output 2025-03-20 21:24:39 -07:00
Sam Lantinga 4ceb02434b We need to rebind D3D12 resources after updating them
Fixes https://github.com/libsdl-org/SDL/issues/12544
2025-03-20 20:22:00 -07:00
Sam Lantinga 3538abfb82 Revert "Don't update a texture twice in the same batch on D3D12"
This reverts commit 0681d08817.

There's a simpler fix for this.
2025-03-20 19:56:59 -07:00
Sam Lantinga 0681d08817 Don't update a texture twice in the same batch on D3D12
Fixes https://github.com/libsdl-org/SDL/issues/12544
2025-03-20 19:51:56 -07:00
Sam Lantinga 10fae8c34b Fixed Android build warnings 2025-03-20 11:02:33 -07:00
Sam Lantinga 47b0c75470 Make sure we're getting called for the correct window
Fixes https://github.com/libsdl-org/SDL/issues/12525
2025-03-19 20:20:36 -07:00
Carl Åstholm 14deef997c emscripten: Fix undefined behavior in opengles2 renderer 2025-03-18 19:18:24 -07:00
Sam Lantinga 82335fd0e9 Fixed building with SDL_LEAN_AND_MEAN
Fixes https://github.com/libsdl-org/SDL/issues/12578
2025-03-18 09:55:23 -07:00
JaimeHW 3e5664a5be Fix return type in SDL_CreateGPURenderState 2025-03-17 15:22:49 -07:00
Anonymous Maarten b9504f247c opengl: pixelart fragment shader uses GLSL version 1.30 2025-03-15 21:58:10 -07:00
Sam Lantinga ad9f9af4ed Removed accidentally enabled debug code 2025-03-15 09:17:55 -07:00
Sam Lantinga 02faa8f75c Rename SDL_SetGPURenderStateFragmentUniformData() to SDL_SetGPURenderStateFragmentUniforms() 2025-03-14 09:26:30 -07:00
Sam Lantinga 2aee105b43 Added support for custom shaders with the GPU renderer
Added an example of MSDF font rendering with the SDL 2D renderer
2025-03-14 09:26:30 -07:00
Sam Lantinga 1ae4ef65e6 Fixed incorrect assert 2025-03-13 22:37:08 -07:00
Sam Lantinga 3e9e22f17d Added SDL_SCALEMODE_PIXELART
This is based on the algorithm presented by t3ssel8r:
https://www.youtube.com/watch?v=d6tp43wZqps
2025-03-13 09:48:37 -07:00
Sam Lantinga 853375da61 Removed texture_size from the GPU renderer vertex shader
This isn't used anywhere, and this saves a UV multiply and divide
2025-03-13 09:48:37 -07:00
Sam Lantinga 28ec461ebf Organize the GPU renderer draw code 2025-03-13 09:48:37 -07:00
Sam Lantinga af0420d898 Switched GPU renderer shaders to shadercross and HLSL 2025-03-13 09:48:37 -07:00
Sam Lantinga b99ff00a95 Removed logic forcing vsync on if setting it off fails
The platforms that needed this (Windows Phone and Windows RT) are no longer supported, and if this is needed in the future it should be done at the renderer level, not here.

Fixes https://github.com/libsdl-org/SDL/issues/12475
2025-03-06 16:18:02 -08:00
Sam Lantinga cb099ebd4f Make texture scale mode a part of the 2D renderer draw state
Also added texture addressing mode support to the PSP and Vita renderers (untested)

Fixes https://github.com/libsdl-org/SDL/issues/12461
2025-03-05 21:35:04 -08:00
Sam Lantinga 5d20bbf348 Presenting while drawing to a render target should fail.
People are adding present calls while rendering to render targets, not understanding that this doesn't make sense, and wondering why they get flicker on some systems. If there are programs that relied on the previous behavior we can add a hint to control this.

Fixes https://github.com/libsdl-org/SDL/issues/12432
2025-03-04 08:46:13 -08:00
Sam Lantinga 4bb46e93c8 Fixed clip rect when logical presentation is enabled
We don't need to include the logical offset, it's already included in the viewport.

Fixes https://github.com/libsdl-org/SDL/issues/12454
2025-03-04 08:24:18 -08:00
Arkadiusz Lach 67127afe3f Fix from #12118 2025-03-02 07:52:25 -08:00
Arkadiusz Lach e25ee22469 Added tiled 9-grid texture rendering function
* New function SDL_RenderTexture9GridTiled, borders and center is tiled instead of stretched
2025-03-02 07:52:25 -08:00
Arkadiusz Lach 44bca81fdd Change default texture scale mode per renderer
* SDL_SetDefaultTextureScaleMode(SDL_Renderer *renderer, SDL_ScaleMode scale_mode)
* SDL_GetDefaultTextureScaleMode(SDL_Renderer *renderer, SDL_ScaleMode *scale_mode)
2025-03-02 07:51:17 -08:00
Sam Lantinga b836ad4d4f Fix a root signature mismatch for the D3D12 renderer
The shaders hadn't been rebuilt after c74f273848

Fixes https://github.com/libsdl-org/SDL/issues/12276
2025-03-01 12:02:49 -08:00
Ryan C. Gordon 35e8cf8ee6 render: allow render targets to use logical presentation.
Fixes https://github.com/libsdl-org/sdl2-compat/issues/279
2025-02-27 19:41:11 -05:00
Sam Lantinga 85a302550d Set an error message if the rect passed to SDL_RenderReadPixels() is entirely outside the viewport 2025-02-25 10:28:57 -08:00
Sam Lantinga db4e6c1931 Cocoa metal layers need their size updated before renderer updates
Also refactored event watch code so it can be shared between internal window event dispatch and public event watchers.

Fixes https://github.com/libsdl-org/SDL/issues/12376
2025-02-24 15:37:13 -08:00
Petar Popovic c70f54e28b Remove redundant casts 2025-02-21 10:09:10 -08:00
Sam Lantinga 2e89c53ebc Added support for decoding MJPG into NV12 textures 2025-02-20 12:16:26 -08:00
Sam Lantinga a792434a37 Added initial MJPG support using stb_image 2025-02-20 12:16:26 -08:00
Sam Lantinga 1a38960eee Call SDL_DiscardAllCommands() for the software renderer as well 2025-02-20 09:53:11 -08:00