Alex Szpakowski
e8278d0d5b
metal renderer: use vertex attributes instead of indexing into a buffer with the vertex id in the shader. Allows for more flexibility with vertex setup in the future.
...
Also optimize vertex buffer binding slightly.
2019-08-17 16:53:08 -03:00
Alex Szpakowski
55a46abf0a
metal renderer: more closely match buffer data alignment requirements from the metal specification.
2019-08-17 01:09:30 -03:00
Alex Szpakowski
e5acccc7c3
metal renderer: use the device address space instead of the constant address space for colors.
...
It doesn't negatively impact GPU performance in my tests, and it removes the need for 256 byte memory alignment of color data on macOS.
2019-08-17 00:37:22 -03:00
Alex Szpakowski
3fb5cabe5e
metal: Update compiled shaders based on compilation script changes
2019-08-16 22:13:30 -03:00
Alex Szpakowski
aebaa316c7
Add public APIs for creating a Metal view attached to an SDL window. Add SDL_metal.h.
2019-08-05 12:35:32 -03:00
Sam Lantinga
1213fe79d8
Worked around "Undefined symbol: ___isPlatformVersionAtLeast()" link error on Xcode 11 beta
2019-06-14 13:56:42 -07:00
Sam Lantinga
5e13087b0f
Updated copyright for 2019
2019-01-04 22:01:14 -08:00
Alex Szpakowski
c7db6ade7d
metal: Implement SDL_LockTexture for YUV formats.
2018-12-19 18:27:21 -04:00
Alex Szpakowski
ce8c716ada
metal: Implement SDL_LockTexture for non-YUV textures.
2018-12-18 14:23:05 -04:00
Alex Szpakowski
37b1f989ce
metal: use a staging texture in SDL_UpdateTexture, to make sure it doesn't stomp texture data being drawn in a previous frame on the GPU.
2018-11-25 22:13:09 -04:00
Alex Szpakowski
872936a485
metal: Fix an incorrect division.
2018-11-21 23:46:37 -04:00
Alex Szpakowski
4a58722b9f
metal: SDL_RenderFillRects uses one draw call per 16k rectangles (within the given FillRects call), instead of one draw call per rectangle. Reduces CPU usage when drawing many rectangles.
2018-11-21 23:37:23 -04:00
Alex Szpakowski
244b79e194
metal: SDL_RenderReadPixels on macOS synchronizes the render target's texture data if it's managed, before reading from it.
2018-11-04 14:31:56 -04:00
Alex Szpakowski
c9fed27289
metal: fix the SDL_RENDERER_PRESENTVSYNC flag not being set on the renderer info on macOS, when vsync is used.
2018-11-04 12:31:02 -04:00
Alex Szpakowski
c2bba9e448
metal: fix the size of the buffer used for constant data.
2018-11-04 12:24:05 -04:00
Alex Szpakowski
457390fcf8
metal: avoid an extra buffer allocation and GPU data copy in RunCommandQueue, it's not needed. Improves overall performance.
2018-11-01 20:24:21 -03:00
Alex Szpakowski
4e86dfd8d1
metal: remove an obsolete section of a constant buffer.
2018-11-01 19:49:01 -03:00
Ryan C. Gordon
4659e73892
merge fallout: Patched to compile, fixed some compiler warnings, etc.
2018-11-01 12:31:45 -04:00
Ryan C. Gordon
62494a2e27
Merge SDL-ryan-batching-renderer branch to default.
2018-10-31 15:03:41 -04:00
Ryan C. Gordon
208c4b0361
metal: CopyEx transform matrix must be aligned for constant buffer access.
2018-10-04 20:21:58 -04:00
Ryan C. Gordon
638d624f5a
metal: Don't try to create a zero-byte vertex buffer.
...
(Which will cause a crash in Metal, or an assert in the validation layer.)
2018-10-04 20:21:23 -04:00
Ryan C. Gordon
c01da21756
render: get rid of the predeclared functions in the GL and Metal renderers.
...
(others to come as I continue to update render backends!)
2018-09-24 12:30:47 -04:00
Ryan C. Gordon
2241b33f55
render: Update Metal and GL backends to use new high-level features, etc.
...
Now nothing is uploaded as dynamic data with Metal's setVertexBytes, etc; it's
all in the one big vertex buffer, now.
2018-09-23 23:22:56 -04:00
Ryan C. Gordon
8955fb9b31
render: First shot at moving metal backend over to new batching system.
2018-09-20 16:40:04 -04:00
Ryan C. Gordon
264b81b481
metal: Make sure layer drawableSize is adjusted on resize.
...
Fixes Bugzilla #4250 .
2018-09-06 00:56:13 -04:00
Ryan C. Gordon
3634e563c4
metal: SDL_UpdateYUVTexture shouldn't swap planes based on format.
2018-09-01 20:47:12 -04:00
Alex Szpakowski
8c41e2624e
metal: Fix SDL_RenderReadPixels to wait for the GPU to finish rendering to the active texture before reading its pixels.
2018-10-13 03:36:42 -03:00
Alex Szpakowski
d9094421e1
metal: Fix high dpi and resizing on macOS, and clean up iOS code. Fixes bug #4250 .
2018-10-12 17:55:42 -03:00
Sam Lantinga
eb14b635cd
Fixed bug 4134 - Render targets lose scale quality after minimizing a fullscreen window
...
Olli-Samuli Lehmus
If one creates a window with the SDL_WINDOW_FULLSCREEN_DESKTOP flag, and creates a render target with SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear"), and afterwards sets SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "nearest"), after minimizing the window, the scale quality hint is lost on the render target. Textures however do keep their interpolation modes.
2018-05-07 19:52:25 -07:00
Sam Lantinga
72d4507918
Added availability check to fix compiler warning for symbol only available on tvOS 11.0 and newer
2018-01-10 10:42:40 -08:00
Alex Szpakowski
7d5437bb31
metal: set max texture size based on device capability.
2018-01-07 22:00:37 -04:00
Alex Szpakowski
a8c0532c08
metal: Fix pipeline states to use the pixel format of the current render target, instead of a hard-coded format.
2018-01-07 16:57:32 -04:00
Alex Szpakowski
740a90af37
metal: Add support for YUV/NV12 texture formats.
2018-01-06 18:54:12 -04:00
Alex Szpakowski
9a8683b275
metal: use a private instead of managed buffer for the renderer's non-changing constant data.
...
Recommended by Xcode's Metal frame capture analysis.
2018-01-04 22:16:42 -04:00
Alex Szpakowski
990ebba55a
metal: Implement fast hardware clearing when possible, by deferring the start of a render pass until a clear or draw operation happens.
2018-01-04 19:29:33 -04:00
Sam Lantinga
e3cc5b2c6b
Updated copyright for 2018
2018-01-03 10:03:25 -08:00
Alex Szpakowski
888198ee31
metal: Misc. improvements.
...
- Use a single buffer for various non-changing constants accessed by the GPU, instead of multiple buffers.
- Do the half-pixel offset for points and lines using a transform matrix so we don't need a malloc when rendering.
- Don't add a half-pixel offset for other primitives and textures. This matches D3D and GL render behaviour.
- Remove the half-texel texture coordinate offset since it's not needed now that there's no more half-pixel position offset when rendering a texture.
- Don't try to set texture usage on iOS 8 since it doesn't exist there.
2018-01-03 00:43:01 -04:00
Alex Szpakowski
f9cd765020
metal and moltenvk: fix highdpi.
2018-01-02 21:44:28 -04:00
Sam Lantinga
b3b5c47366
Fixed direction of y adjustment for new orthographic projection in the metal renderer
2018-01-02 14:32:15 -08:00
Sam Lantinga
fa86807ceb
Fixed metal renderer pixel centers when drawing
2018-01-02 14:11:10 -08:00
Alex Szpakowski
07f08b47ff
metal: Fix a typo preventing iOS compilation...
2018-01-01 23:06:08 -04:00
Alex Szpakowski
1cc6603378
metal: Clean up manual reference counting. Fixes some memory leaks.
2018-01-01 23:03:50 -04:00
Alex Szpakowski
a452a08458
iOS: fix build
2018-01-01 19:40:29 -04:00
Alex Szpakowski
639ea9fdbc
metal: Use sampler state objects instead of shader-declared samplers for linear vs nearest filtering.
...
This avoids a ton of shader duplication once multiple shaders that use samplers are added (e.g. the currently missing YUV shaders).
2018-01-01 19:37:16 -04:00
Alex Szpakowski
cf45cf70e5
metal: Add support for custom blend modes.
2018-01-01 18:06:27 -04:00
Alex Szpakowski
85470a2f95
metal: implement SDL_RenderCopyEx, and fix a memory leak in SDL_CreateTexture.
2017-12-31 21:06:16 -04:00
Alex Szpakowski
047d387b2e
metal: Use the existing cocoa code for creating a Metal view on macOS. Fixes the renderer size when the window is resized.
2017-12-31 15:30:08 -04:00
Alex Szpakowski
42b19c9749
metal: Respect the vsync flag on macOS 10.13+.
2017-12-30 22:39:55 -04:00
Alex Szpakowski
e24dc9053b
metal: use a projection matrix instead of manually transforming vertices into clip space on the CPU.
2017-12-30 20:32:22 -04:00
Alex Szpakowski
49df65c25a
metal: only 4 (instead of 5) vertices are needed to draw rectangles and textures, and only 3 (instead of 5) vertices are needed to cover the screen for the 'full-screen quad' when clearing.
2017-12-30 18:48:07 -04:00