Commit Graph

373 Commits

Author SHA1 Message Date
Sam Lantinga
4d9fee966f It turns out that GL_ARB_debug_output is really only useful on debug contexts, so for consistency and performance we'll only check and report errors on debug contexts.
I added a --gldebug command line option for the test programs to easily test this, and we may want a hint as well to enable OpenGL error checking.
2013-05-20 12:01:31 -07:00
Sam Lantinga
35f178cd7f Fixed declaration of GL_HandleDebugMessage 2013-05-19 22:57:01 -07:00
Sam Lantinga
a08ccfa9f8 Fixed windows build 2013-05-19 22:45:52 -07:00
Sam Lantinga
1063a72829 Fixed bug 1837 - Use error extension instead of glGetError()
Implemented support for GL_ARB_debug_output, but was unable to test it on Mac OS X.
2013-05-19 22:28:10 -07:00
Sam Lantinga
0d9b661db8 File style cleanup for the SDL 2.0 release 2013-05-18 14:17:52 -07:00
Sam Lantinga
d6adde2adb Fixed bug 1838 - [Patch] Direct3D resource leak on SDL_DestroyRenderer() 2013-05-16 00:56:19 -07:00
Philipp Wiesemann
a19135fd1a Inlined expression for consistency in render source. 2013-05-13 22:45:06 +02:00
Philipp Wiesemann
08e8e38c86 Fixed building on Visual Studio.
Buildbot
2013-05-12 14:25:38 +02:00
Philipp Wiesemann
de43af1b54 Fixed bug 1844 - glScissor calls are wrong - Patch attached
Martin Gerhardy

the coordinate system from sdl is not correctly transformed to the coordinate system of opengl. glScissor expects them to be a little bit different. Attached is a patch that fixes this
2013-05-12 13:40:02 +02:00
Philipp Wiesemann
539f60a57d Corrected spelling in internal include file. 2013-05-12 13:02:07 +02:00
Gabriel Jacobo
d36f97eb89 Fixed typo in GL_UpdateClipRect 2013-05-10 10:33:15 -03:00
Gabriel Jacobo
d4c2a87a5b Fixes OpenGL* Clip Rect functions (by Emmanuel Gil Peyrot) 2013-05-10 10:31:01 -03:00
Philipp Wiesemann
49b3851430 Fixed SDL_RenderSetClipRect() returning undefined instead of -1 on error. 2013-05-04 22:44:03 +02:00
Sam Lantinga
7253832be1 First pass on SDL render clip rect functionality 2013-05-04 04:46:00 -07:00
Sam Lantinga
c1bfee0f2d Fixed bug 1583 - Fix build for disabled SDL render subsystem
Marcus von Appen

If one wants to disable the SDL render subsystem, the build breaks on several platforms due to an empty render_drivers array in SDL_render.c.
2013-04-25 00:15:09 -07:00
Gabriel Jacobo
de33c6164e Fixes PSP_DestroyTexture release of data (don't release the SDL_Texture pointer) 2013-04-23 16:54:52 -03:00
Jørgen P. Tjernø
a228e5242a SDL_GL_DeleteContext would leave an invalid current_glctx.
Calling SDL_GL_DeleteContext wouldn't update current_glctx, so you could
end up with use-after-free and other goodies when you deleted a context.
2013-04-22 18:15:08 -07:00
David Ludwig
6bf31495f9 WinRT: merged with latest, official, SDL 2.x sources 2013-04-21 12:38:44 -04:00
David Ludwig
48c5ee264e WinRT: made SDL's inner WinRT CoreWindow be accessible to non-C++/CX code, in theory 2013-04-16 23:40:03 -04:00
Ryan C. Gordon
295c17e99b Don't use glDisable(GL_TEXTURE_2D) in GLES2 renderer.
Fixes Bugzilla #1799.
2013-04-17 11:45:50 -04:00
Andreas Schiffler
fc589bd617 Fix bug 1764: incorrect variable assignment in RenderDrawLinesWithRects 2013-04-17 07:35:30 -07:00
David Ludwig
49820874a9 WinRT: merged with latest, official, SDL 2.x sources (at rev. bea100d73d13) 2013-04-14 11:42:55 -04:00
David Ludwig
a46b1c6663 WinRT: added render-to-texture support for D3D 11.1, via SDL_SetRenderTarget 2013-04-13 23:03:46 -04:00
David Ludwig
922323a1cd WinRT: added texture channel color-modulation support for D3D 11.1 2013-04-07 22:35:58 -04:00
David Ludwig
50a881d724 WinRT: removed a bit of unused code from the D3D 11.1 renderer 2013-04-02 00:21:01 -04:00
David Ludwig
0c6e5ad1a9 WinRT: added rotation support to SDL_RenderCopyEx via D3D 11.1 2013-04-02 00:09:49 -04:00
David Ludwig
c2e89ec462 WinRT: implemented SDL_RenderCopyEx, w/ SDL_RendererFlip support, in D3D 11.1 2013-04-01 22:33:37 -04:00
David Ludwig
3ca7578363 WinRT: implemented SDL_RenderReadPixels in Direct3D 11.1 2013-04-01 21:34:47 -04:00
Ryan C. Gordon
16cdc59bab Make SDL_SetError and friends unconditionally return -1.
This lets us change things like this...

    if (Failed) {
        SDL_SetError("We failed");
        return -1;
    }

...into this...

    if (Failed) {
        return SDL_SetError("We failed");
    }


 Fixes Bugzilla #1778.
2013-03-31 12:48:50 -04:00
David Ludwig
2a3066f606 WinRT: removed code that unnecessarily set a blank D3D 11.1 texture's contents 2013-03-31 11:44:50 -04:00
David Ludwig
b80d430b5c WinRT: added SDL_LockTexture and SDL_UnlockTexture support to the D3D 11.1 renderer 2013-03-31 11:16:31 -04:00
David Ludwig
f6c8097c65 WinRT: added point drawing support to the Direct3D 11.1 rendering backend 2013-03-24 21:57:40 -04:00
David Ludwig
2fef732bf6 WinRT: added line drawing support to the Direct3D 11.1 rendering backend 2013-03-24 21:19:26 -04:00
Sam Lantinga
f0af9a3e70 Removed Nintendo DS support since nobody has volunteered to maintain it for over a year. 2013-03-17 09:44:58 -07:00
Captain Lex
a18bccd5f3 Add PSP support 2013-03-17 20:07:02 +08:00
Sam Lantinga
d71696b7f5 Fixed compile errors on Windows 2013-03-06 09:45:53 -08:00
Sam Lantinga
86ff46800f Fixed warning messages when loading Direct3D DLL
kmx

I have investigated the warning "Failed loading D3DX9_*.dll" and come up with the enclosed patch (please forward it to relevant SDL2 mailing list/bugtracker).
2013-03-05 18:52:25 -08:00
Sam Lantinga
aba5889732 Don't specify the texture unit when binding a texture, instead use whatever has been set up by the application.
This matches behavior in the OpenGL and OpenGL ES 1.1 renderers.
2013-03-03 11:25:43 -08:00
Sam Lantinga
e6bf874eff Fixed formatting 2013-03-03 11:25:09 -08:00
Sam Lantinga
d76c7254dd Fixed bug 1728 - fixed compiler warnings 2013-02-26 03:34:34 -08:00
David Ludwig
3f580c9f17 WinRT: made the D3D 11.1 renderer respect the 'srcrect' parameter of SDL_RenderCopy 2013-02-24 12:27:28 -05:00
David Ludwig
583a3e4aee WinRT: allowed for querying of max texture size (via Direct3D 11.1) 2013-02-24 10:30:12 -05:00
David Ludwig
4e1f3a92f0 WinRT: made the Direct3D 11.1 renderer correctly report its status regarding render-to-texture (not supported, yet) 2013-02-24 10:14:23 -05:00
David Ludwig
cacc6d9d92 WinRT: moved the default vertex shader into the Direct3D 11.1 renderer's folder 2013-02-24 10:11:58 -05:00
David Ludwig
08b886ae9d WinRT: added support for alpha-blended texture rendering 2013-02-23 22:58:09 -05:00
David Ludwig
db53df0697 WinRT: merged with latest, official, SDL 2.x code 2013-02-23 20:01:46 -05:00
David Ludwig
4c4c4093c2 WinRT: another device-rotation and rendering fix 2013-02-19 22:07:07 -05:00
Sam Lantinga
509366e2ca Fixed bug 1474 - OpenGL renderer can't to display YV12 texture. 2013-02-19 07:05:15 -08:00
Sam Lantinga
6b574f11e2 Fixed bug 1722 - An attempt to release NULL Direct3d surface
Evgeny

static void
D3D_DestroyRenderer(SDL_Renderer * renderer)

has a critical problem. It may try to release IDirect3DSurface9 surface pointed
by NULL pointer. That leads to really wierd consequences on my system.

It happens when the previous call to IDirect3D9_CreateDevice() fails leaving
D3D_RenderData::defaultRenderTarget uninitialized.
2013-02-17 23:30:47 -08:00
David Ludwig
97ff4f43d7 WinRT: bug fixes for device orientation + Direct3D 11.1 rendering 2013-02-17 23:23:59 -05:00
David Ludwig
367c968fc2 WinRT: made SDL_RenderSetViewport work with the D3D 11.1 renderer 2013-02-17 11:09:07 -05:00
David Ludwig
2e34488cc1 WinRT: D3D 11.1 blending mode support added; FillRects coloring bug-fix 2013-02-16 16:53:06 -05:00
David Ludwig
fdd12e1d1a WinRT: took out an unneeded depth stencil view from the D3D 11.1 renderer 2013-02-16 16:13:48 -05:00
David Ludwig
b7dcf7fac4 WinRT: implemented SDL_RenderFillRect and SDL_RenderFillRects for the D3D 11.1 renderer 2013-02-16 09:10:43 -05:00
Sam Lantinga
019c60c1e8 Happy New Year! 2013-02-15 08:47:44 -08:00
David Ludwig
a20666df47 WinRT: made SDL_CreateRenderer default to using the SW renderer, for now 2013-02-12 21:26:04 -05:00
David Ludwig
f5cedaa6a9 WinRT: fixed one scaling bug (more remain) in the Direct3D 11.1 renderer 2013-02-12 21:25:26 -05:00
David Ludwig
0372a69347 WinRT: fixed bug: SDL_RenderCopy was always filling the entire screen 2013-02-12 20:49:26 -05:00
David Ludwig
d2b0f4d278 WinRT: made d3d 11.1 vertex buffers get created, and updated, when a render op is invoked 2013-02-12 19:08:35 -05:00
Sam Lantinga
972b2abc34 Fixed bug 1491 - Directx3d Crash on resize
Spinduluz

RenderTarget has to be released before a device reset is done. It's a
D3DPOOL_DEFAULT surface (resides in video memory and have to be recreated).
2013-02-11 21:12:14 -08:00
David Ludwig
41ed032ebf WinRT: made SDL_RenderClear display the correct color via Direct3D 11.1 2013-02-10 17:35:38 -05:00
David Ludwig
e73e2ca8d9 WinRT: consolidated all WinRT path-retrieval functions into one function 2013-02-09 22:48:19 -05:00
David Ludwig
5e09208ba1 WinRT: fixed a crash that occurred after rotating the host device 2013-02-09 20:30:53 -05:00
David Ludwig
f771aa94fd WinRT: made sure the device orientation transform gets applied (by the D3D 11.1 renderer) when drawing 2013-02-09 20:26:39 -05:00
David Ludwig
0230dbac69 WinRT: moved texture management code from SDL_winrtrenderer to the D3D 11.1 SDL_Renderer backend 2013-02-09 18:58:13 -05:00
David Ludwig
f97e0c55e1 WinRT: added SDL_WINDOWEVENT_RESIZED support, and moved window-resize-handling code from WinRT rendering code to D3D 11.1 code 2013-02-09 16:00:55 -05:00
David Ludwig
44ce12c509 WinRT: more code-moving from WinRT code to Direct3D 11.1 code 2013-02-09 15:43:13 -05:00
David Ludwig
b29972705a WinRT: made the Direct3D 11.1 renderer directly initialize more of itself, rather than deferring to code in the WinRT video driver 2013-02-09 15:22:49 -05:00
David Ludwig
12f2c72309 WinRT: more work on moving rendering code from SDL_winrtrenderer.* to SDL_render_d3d11* 2013-02-09 14:56:32 -05:00
David Ludwig
a89b0d79a9 WinRT: more code-moving from SDL_winrtrenderer* to SDL_render_d3d11* 2013-02-09 11:42:17 -05:00
David Ludwig
d839eb5eb2 WinRT: moved a bit more Direct3D 11.1 code into the SDL_Renderer backend 2013-02-02 21:05:32 -05:00
David Ludwig
4f6ffdc590 WinRT: started refactoring Direct3D 11.1 code into a new SDL_Renderer backend 2013-02-02 19:32:44 -05:00
Sam Lantinga
6c353b0768 Fixed direction of rotation with OpenGL ES 2 2013-01-27 15:52:56 -08:00
Sam Lantinga
f425fe1358 Improvements from Alfred:
- Added new SDL_HINT_ALLOW_TOPMOST hint, when set to "0" then never set the topmost bit on a window. Useful when debugging fullscreen issues.
- fixed crash in windows joystick scanning if we failed to load the xinput dll
- added support for SDL_WINDOW_FULLSCREEN_DESKTOP under windows
- synthesize relative mouse movements if directinput fails to send relative moves, happens under virtual box.
2012-12-31 09:30:15 -08:00
Sam Lantinga
e3c79c3a45 The logical size set for a render target is temporary and shouldn't conflict with the logical size set for a window. 2012-10-12 02:56:41 -07:00
Sam Lantinga
0ec818f3c0 Fixed a bug resetting the viewport with a render target. 2012-10-12 02:30:03 -07:00
Sam Lantinga
9a6b1c641a Added SDL_GetRenderTarget() API function
Also fixed a bug with setting logical size for a render target.
2012-10-12 02:20:10 -07:00
Ryan C. Gordon
6812b2e9cf Helps to initialize variables in the right function. :) 2012-10-03 20:02:13 -04:00
Ryan C. Gordon
f4c5703d8f Fixed compiler warning. 2012-10-03 19:20:53 -04:00
Sam Lantinga
04275d9bfb Fixed texture list when swapping textures (thanks Drake Wilson!) 2012-10-02 00:28:23 -07:00
Sam Lantinga
873ecde0ad Initialized default scale for software renderer (thanks Marcus von Appen!) 2012-10-01 23:28:19 -07:00
Sam Lantinga
a7dc767823 Fixed a compiler warning 2012-10-01 23:23:04 -07:00
Sam Lantinga
aab04f8c71 Added SDL_RenderSetLogicalSize() and SDL_RenderGetLogicalSize() 2012-10-01 22:30:07 -07:00
Sam Lantinga
f4bf4989ce The viewport is already scaled to the output coordinates 2012-10-01 21:57:09 -07:00
Sam Lantinga
8e121270fa Added SDL_RenderSetScale() and SDL_RenderGetScale() 2012-10-01 20:59:33 -07:00
Ryan C. Gordon
729074f469 Patched to compile on Visual Studio. 2012-09-28 14:17:30 -04:00
Sam Lantinga
e3d46eeb0a Fixed bug 1579 - Creating a texture with unsupported format may cause double-destruction
Alexander Hirsch 2012-08-25 20:01:29 PDT

When creating a SDL_Texture with unsupported format (I'll now refer to it as
texture A), SDL_CreateTexture will call SDL_CreateTexture again with
GetClosestSupportedFormat to set texture->native (which I will now refer to as
texture B).
This causes texture B to be put before A in renderer->textures.

If texture A is explicitly destroyed, everything is fine. Otherwise, upon
SDL_DestroyRenderer, the loop will first encounter texture B, destroy it, then
texture A, destroy that which will want to destroy texture->native and since it
is already destroyed set an error.

The solution could be as simple as swapping texture A with B after
texture->native gets set in SDL_CreateTextures.
2012-09-28 04:09:06 -07:00
Sam Lantinga
22025f3ce7 Fixed bug 1584 - Improved glError checks in the opengl renderer
Martin Gerhardy 2012-08-27 02:42:25 PDT

I've extended the gl error checks.

This is needed because on my system there are errors in the renderer that are
hard to find.

Also glError can return multiple errors. Even if SDL_SetError would only
contain the last one of course, the SDL log facilities are able to get the
output for each error.
2012-09-28 03:49:27 -07:00
Sam Lantinga
f02003f0ba Fixed memory leak in an error case 2012-09-28 02:43:13 -07:00
Sam Lantinga
b3d60cfcbb Removed executable bit from source files 2012-09-27 14:35:28 -07:00
Sam Lantinga
327faf465a Fixed bug 1591 - Renderer maximum texture size is incorrect when GL_ARB_texture_rectangle is active 2012-09-23 01:50:35 -07:00
Sam Lantinga
c76bdd4882 Fixed error message when destroying a software renderer, thanks to wahono for the patch. 2012-09-06 21:34:52 -07:00
Gabriel Jacobo
c576bf10be Return a valid error in SDL_GL_Bind/UnbindTexture, thank you buildbot! 2012-09-03 11:54:48 -03:00
Gabriel Jacobo
ceaf031283 Implements SDL_GL_BindTexture and SDL_GL_UnbindTexture (#1576) 2012-09-03 11:16:12 -03:00
Ryan C. Gordon
aa78574da8 Whoops, removed wrong variable. 2012-08-24 19:39:51 -04:00
Ryan C. Gordon
b9790162f5 Fixed a bunch of compiler warnings with Cygwin/MingW. 2012-08-24 19:34:28 -04:00
Gabriel Jacobo
5a63b930fa Fix for #1577, SDL_RenderCopyEx - Runtime check fails when dstrect == NULL and center == NULL
Thanks Michael Ehrmann.
2012-08-24 11:56:21 -03:00
Ryan C. Gordon
c71bcb5678 Removed some unused variables that gcc 4.6.1 complains about. 2012-08-09 14:14:41 -04:00
Ryan C. Gordon
7d67b05181 Fixed some minor compiler warnings. 2012-07-20 13:33:15 -04:00
Sam Lantinga
1d7093bd80 Switch the OpenGL ES renderers to request EGL OpenGL contexts 2012-07-18 15:20:32 -07:00
Sam Lantinga
32a20bfc64 Fixed orientation and color when rendering to texture 2012-06-22 11:38:49 -04:00
Gabriel Jacobo
a1de587006 Fixes #1523 by removing inconsistent use of texture->access 2012-06-21 11:16:14 -03:00
Sam Lantinga
e3179ba01b Fixed compiling with Visual Studio 2012-06-19 13:50:14 -04:00
Sam Lantinga
9a96b99516 Fixed SDL_config.h build include path 2012-06-01 20:31:50 -04:00
Gabriel Jacobo
2e96488df0 RenderCopyEx,rotation and flipping for all hardware/software backends (#1308) 2012-06-01 19:51:08 -03:00
Sam Lantinga
f7b34c87f6 Fixed bug 1419 - SDL_libgl2D.c breaks ndk-build
Philip Taylor 2012-02-15 10:43:47 PST

render/nds/SDL_libgl2D.c unconditionally includes NDS-only code. SDL's
Android.mk compiles source files matching

  $(wildcard $(LOCAL_PATH)/src/render/*/*.c)

which includes that file, causing build errors when running ndk-build.
2012-02-15 21:11:21 -05:00
Sam Lantinga
41dcf2a16e Updated Nintendo DS support
Frank Zago

This patch updates the DS port:
- do not use the now removed compat layer.
- integrate parts of libgl2D since I got permission from the author, and thus
removed an external dependancy,
- a few bugs fixes.

Now, the textures should be completely supported, except reading from them
which doesn't makes sense to have on the DS. Sound is still not supported.

If someone else wants to work on the missing pieces, feel free.
2012-02-12 21:04:01 -05:00
Sam Lantinga
333943e556 Fixed bug 1412 - Patch - Software renderer crash
Dimitris Zenios Date: 2012-02-06 15:12:37 GMT

Hi gus there is a bug when using software renderer and the window
surface gets destroyed (Fullscreen and back).The solution is easy
2012-02-07 19:34:24 -05:00
Sam Lantinga
c7588fa928 Fixed OpenGL ES 1.1 on Android
From Gabriel Jacobo:
What I did notice is that calling
data->glGetIntegerv(GL_FRAMEBUFFER_BINDING_OES, &value); doesn't produce any
result in Android GLES1.1 if the active framebuffer is the default one, ie,
whatever is in value stays unmodified.
2012-01-31 21:03:35 -05:00
Sam Lantinga
9470893698 Fixed magenta texture on iOS with OpenGL ES 2.0 2012-01-30 20:56:25 -05:00
Sam Lantinga
00da0cd57c Added glGenFramebuffers() to the function pointer list 2012-01-28 14:53:23 -05:00
Sam Lantinga
55ea8bdfd4 Fixed setting the orthographic projection when the viewport changes. 2012-01-28 14:05:48 -05:00
Sam Lantinga
f14f70bc64 Fixed loading textures when the window starts hidden.
The viewport automatically resets to the window size when you programmatically resize the window.
2012-01-22 21:46:06 -05:00
Sam Lantinga
b5844a1c07 Added a convenience function SDL_CreateWindowAndRenderer() 2012-01-22 19:22:53 -05:00
Sam Lantinga
b291116502 Renamed SetTargetTexture() to SetRenderTarget() 2012-01-22 01:26:28 -05:00
Sam Lantinga
dba1ccf43b Reorganized the render target code, moving the viewport handling to the general code and adding software implementation. 2012-01-21 22:22:30 -05:00
Sam Lantinga
7f8f4956c3 We've already crashed by this point if we don't have a renderer. The calling code should check this. 2012-01-21 18:30:50 -05:00
Sam Lantinga
1af7c2fe96 Added a renderer flag to expose whether a renderer supports render to texture. 2012-01-19 21:06:47 -05:00
Sam Lantinga
096d218036 Fix for building with Visual Studio 2012-01-19 20:25:09 -05:00
Sam Lantinga
9e37906060 Implementation of render targets, by Mason Wheeler and Gabriel Jacobo
Thanks guys!
2012-01-18 22:45:49 -05:00
Sam Lantinga
d06d970095 Fixed bug 1331 - SDL_CreateTextureFromSurface fails for OpenGL + Win XP 64 NVidia 285.58 with GL_INVALID_ENUM
I think this fixes the bug.  I'm not sure why it would fail, and it may have something to do with the version of OpenGL that we initialize and use by default. Regardless, this should take care of the problem.
2012-01-10 21:00:47 -05:00
Sam Lantinga
e56031aa50 X11 OpenGL ES minor corrections
Scott Percival 2012-01-08 04:21:22 PST

I tested the new build on my two ARM machines, and fixed a few bugs:
- if SDL_VIDEO_DRIVER_UIKIT, SDL_VIDEO_DRIVER_ANDROID or
SDL_VIDEO_DRIVER_PANDORA are specified, function pointers are grabbed from the
compile-linked library instead of through SDL_GL_GetProcAddress. (not sure if
this is the best way to go about it)
- removing "/usr/lib/" from all the library names (hey, with multiarch you
can't be too sure anymore)
- added glFinish to glesfuncs.h
- changed the eglGetProcAddress arg type to "const char *" as per the EGL spec
- filled in the stubs for X11_GLES_SetSwapInterval and X11_GLES_GetSwapInterval
2012-01-08 13:31:22 -05:00
Sam Lantinga
07f8710f47 Fixed bug 1242 - PATCH: Improve support for OpenGL ES under X11
Scott Percival 2011-07-03 06:41:51 PDT

This submission is aimed at making life easier for OpenGL ES capable devices
running a X11 stack (e.g. Maemo, Meego, TrimSlice, other ARM SoC boards not
running Android). SDL's Pandora support already has the neccesary GLES-to-X11
glue code, however it's all ghetto'd off in Makefile.pandora and not very
flexible.

The patch:
- adds an awesome --enable-video-opengles option to configure
- re-modifies the opengles and opengles2 SDL_renderers to use function pointers
- no idea why this was removed?
- for SDL_Renderers, links in libGLESv1_CM, libGLES_CM (for PowerVR fans) or
libGLESv2 at runtime
- links in libEGL.so at runtime - the old code made an assumption that
eglFunctions could be pulled from the active GLES library, PowerVR for one
doesn't let you do that with their libGLESv2
- allows you to pick which of GLES v1 or v2 to load via
SDL_GL_CONTEXT_MAJOR_VERSION

So far I've tested this on a Nokia N900 (OMAP 3430/SGX 530 running Maemo 5) and
a Toshiba AC100 (Tegra 2 running Ubuntu 10.10). I haven't tested it on... well,
everything that isn't those two, such as a Pandora, iOS or Android device. The
Pandora specific code should be kept intact (fingers crossed), and nothing
painfully drastic has been added to the SDL_renderers. The library loading
sequence in SDL_x11opengles has been updated to accomodate both NVIDIA's
propensity to let developers get away with murder and PowerVR's alternative of
punishing every missed step.

The test apps work okay with GLES or GLES2 as the renderer. For some reason
alpha blending doesn't seem to work on the Tegra 2; last week NVIDIA pushed out
a new set of X11 GLES drivers, so I'll try and investigate once I upgrade
those. Also, this patch adds things to configure.in, include/SDL_config.h.in
and test/configure.in. I didn't know what the policy was re. committing
generated spaghetti from autotools, so ./autogen.sh has to be run again. Sorry.

I think that's about everything, let me know if there's anything I've
overlooked.
2012-01-08 02:23:37 -05:00
Sam Lantinga
ccc2bea519 Fixed crash if the rendering system couldn't create an OpenGL window. 2012-01-07 21:01:33 -08:00
Sam Lantinga
da31e3d3e3 Fixed tab spacing 2012-01-07 22:33:58 -05:00
Sam Lantinga
af8d572022 Better error messaging when SDL can't create a window surface. 2012-01-07 14:21:22 -05:00
Sam Lantinga
f4231277fb Fixed bug 1256 - Invalid window warning in GL_CreateRenderer
Martin Gerhardy 2011-07-27 02:26:06 PDT
the window reference is lost in the GL_CreateRenderer function. The attached
patch should fix this error.

#0  SDLSystem_LogOutputFunction (userdata=0x63b010, category=1,
priority=SDL_LOG_PRIORITY_ERROR, message=0x7fffffffcd00 "Invalid window") at
src/system/sdl/SDLSystem.cpp:8
#1  0x00007ffff7b1ddb3 in SDL_LogMessageV (category=1,
priority=SDL_LOG_PRIORITY_ERROR, fmt=<value optimized out>, ap=<value optimized
out>) at src/SDL_log.c:275
#2  0x00007ffff7b1df7c in SDL_LogError (category=<value optimized out>,
fmt=<value optimized out>) at src/SDL_log.c:212
#3  0x00007ffff7b1d582 in SDL_SetError (fmt=0x7ffff7baaff0 "") at
src/SDL_error.c:111
#4  0x00007ffff7b96f9e in SDL_GL_MakeCurrent (window=0x0, ctx=0xa62ce0) at
src/video/SDL_video.c:2484
#5  0x00007ffff7b4ba0c in GL_ActivateRenderer (renderer=0xa8f680) at
src/render/opengl/SDL_render_gl.c:195
#6  0x00007ffff7b4c59a in GL_ResetState (window=0x918010, flags=<value
optimized out>) at src/render/opengl/SDL_render_gl.c:214
#7  GL_CreateRenderer (window=0x918010, flags=<value optimized out>) at
src/render/opengl/SDL_render_gl.c:343
#8  0x00007ffff7b48053 in SDL_CreateRenderer (window=0x918010, index=<value
optimized out>, flags=2) at src/render/SDL_render.c:166
2012-01-07 02:32:08 -05:00
Sam Lantinga
caf36db44a Fixed bug 1344 - No OpenGL headers when compiling -> no working Software renderer at runtime neither
Make sure we have at least one render driver.
2012-01-07 01:13:15 -05:00
Sam Lantinga
e256711bb9 Happy New Year! 2011-12-31 09:28:07 -05:00
Sam Lantinga
41ea58b0ef Added the ability to update a subrect of a YV12/IYUV texture. 2011-12-30 18:19:35 -05:00
Sam Lantinga
e60d18d093 Fixed bug 1315 - Greenish video when video size smaller than texture
The incoming pixels are contiguous for the update rectangle.
2011-12-30 18:18:42 -05:00
Sam Lantinga
6b53a98d93 Fixed bug 1338 - Direct3D renderer should set D3DCREATE_FPU_PRESERVE for not behaving vastly different on doubles (causes 3rd party lib crashes!)
Jonas Thiem 2011-11-29 12:28:02 PST
Direct3D renderer should set D3DCREATE_FPU_PRESERVE for not behaving vastly
different to OpenGL/software rendering on doubles and break some libraries
really badly.

Most notable affected example: Lua, which does the most unpredictable things
which are really almost impossible to debug/find out for beginners who never
heard this culprit exists.

Since I believe all renderers should behave the same on that doubles simply
work as expected in a program, this should really be changed! (also this wasted
a few days of my life wondering why everything in my program was so broken)
2011-12-29 05:18:16 -05:00
Sam Lantinga
604270e214 Fixed bug 1335 - Added support for different pixel formats in OpenGL ES 2 renderer
Gueniffey 2011-11-23 04:06:31 PST

The attached patch adds native support for
SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888
2011-12-29 05:11:33 -05:00
Sam Lantinga
a59d3e6f2f Fixed issues closing lines with the OpenGL ES renderer. 2011-11-10 00:22:44 -05:00
Sam Lantinga
1bb72d783a Fixed an offset issue with glDrawTexiOES() when the viewport is set. 2011-11-10 00:22:01 -05:00
Sam Lantinga
e30ec4d8ce Fixed list loop caused when there are two entries in the list and the one being returned is already at the head. 2011-11-07 23:10:49 -05:00
Sam Lantinga
4305c920da Fixed SDL applications being killed immediately after being backgrounded, because they were trying to draw while minimized. 2011-11-07 23:07:00 -05:00
Sam Lantinga
6a5a074397 Fixed double-free in the shader cache at shutdown 2011-11-07 00:45:13 -05:00
Sam Lantinga
6371c44a9e Lots of fixes importing SDL source wholesale into a new iOS project 2011-10-31 05:56:58 -04:00
Sam Lantinga
04ce234fd4 This code works for OpenGL ES 1.1 as well! :) 2011-10-31 03:06:32 -04:00
Sam Lantinga
462a6474ac Implemented RenderReadPixels for the OpenGL ES 2.0 renderer. 2011-10-31 02:55:21 -04:00
Ryan C. Gordon
bebad17430 Fixed a whole slew of compiler warnings that -Wall exposed. 2011-10-13 01:08:30 -04:00
Ryan C. Gordon
043d6961da Fixed wrong datatype for shaders and programs.
This is a pointer on Mac OS X, so it risked losing data in 64-bit builds.
2011-08-23 06:27:04 -04:00
Dimitris Zenios
316ae21313 Fixes a bug in SDL_UpdateTexture when using SDL_RENDERER_SOFTWARE and texture access is SDL_TEXTUREACCESS_STATIC 2011-06-10 12:13:06 +03:00
Ryan C. Gordon
41447caf1c Fixed memory leak in SDL_DestroyRenderer.
Fixes Bugzilla #1219.

Thanks to Dimitris Zenios for the patch!
2011-07-16 14:59:12 -07:00
Sam Lantinga
6196aa221e SDL 1.3 is now under the zlib license. 2011-04-08 13:03:26 -07:00
Sam Lantinga
a46d9b6758 Added SDL_GetRenderer() 2011-04-04 09:29:13 -07:00
Sam Lantinga
791472902d NDS update
Frank Zago to SDL

I've cleaned up a few bugs in the nds code. A few more tests now pass.
There's still a few things to do, but overall I think it's starting to be in a
good shape.

The patch also includes a bug fix for SDL_ConvertSurfaceFormat() (gcc warning).
2011-03-26 21:26:05 -07:00
Sam Lantinga
9fbcbeff40 The scale mode is per texture, not per texture unit. 2011-03-21 17:15:49 -07:00
Sam Lantinga
4fd91c5eed Added the SDL_HINT_RENDER_SCALE_QUALITY hint, which defaults to nearest pixel sampling. 2011-03-13 11:18:35 -07:00
Sam Lantinga
ac080d02da Fixed permissions for C source files 2011-03-11 11:52:41 -08:00
Sam Lantinga
9f5b3c27ae Fixed bug 1162 (Error calling SDL_RenderReadPixels() with format=0) 2011-03-10 01:03:43 -08:00
Sam Lantinga
cd9a0cf8a6 SDL_RenderReadPixels() is restricted to the viewport area. 2011-03-10 01:00:43 -08:00
Sam Lantinga
8687086b1d Only compile the NDS renderer if specified in the config file. 2011-03-06 21:19:02 -08:00
Sam Lantinga
2a60f966cb a Nintendo ds update
Frank Zago to SDL

For those interested, here's a snapshot of the current port. I did away with
most of the previous attempt which was based of the sprite engine, because the
support is limited to 128 64x64 sprites. Instead I'm using the gl engine.
The drawback is that either the frame buffer or the gl engine can be used
because there's not that much video memory on a DS.

With minimal changes to their code, it can now run the following tests: ,
testspriteminimal, testscale and testsprite2. The last 2 only run under the
emulator for some reason. The tests are not included in this patch for size
reason.

In 16 bits mode, the 16th bit indicated transparency/opacity. If 0, the color
is not displayed. So I had to patch a few core file to set that bit to 1. See
patch for src/video/SDL_RLEaccel.c and src/video/SDL_blit.h. Is that ok, or is
there a better way ?

The nds also doesn't support windowed mode, so I force the fullscreen in
src/video/SDL_video.c.  Is that ok, or is there a better way ?

To get a smaller library, I also tried to not compile the software renderer
when the hardware renderer is compiled in, and define SDL_NO_COMPAT; however
the compilation eventually fails in SDL_surface.c because SDL_SRCCOLORKEY is
defined in SDL_compat.h. Is SDL_NO_COMPAT only for application and not SDL
itself ?
2011-03-06 21:12:19 -08:00
Sam Lantinga
8708e59683 If you pass in texture format 0, it'll use the first supported texture format. 2011-02-28 14:47:39 -08:00
Sam Lantinga
663afa2ec2 Zero streaming textures at the driver level 2011-02-26 21:39:34 -08:00
Sam Lantinga
1dbb371545 Hopefully fixed crashes when creating multiple streaming textures of different sizes. 2011-02-24 23:42:58 -08:00
Sam Lantinga
79f564f37a Fixed compiler warnings 2011-02-21 22:26:59 -08:00
Sam Lantinga
0bdae7b3a1 Reverted the experiment, it didn't work. 2011-02-20 23:51:31 -08:00
Sam Lantinga
575ff5fa0d Experiment to try to account for source clipping 2011-02-20 23:16:58 -08:00
Sam Lantinga
13c5239a36 Added OpenGL state caching for decent speed improvement. 2011-02-19 21:51:21 -08:00
Sam Lantinga
dda4a8e368 Fixed warning on Mac OS X 10.4 2011-02-19 14:27:16 -08:00
Sam Lantinga
147196ba05 Zero streaming textures to reduce confusion.
(See mailing list message with subject "Streaming textures not properly initialized?")
2011-02-17 18:58:43 -08:00
Sam Lantinga
b807895313 Allow the application to explicitly request a software renderer. 2011-02-17 12:03:48 -08:00
Sam Lantinga
2f91270700 Implemented OpenGL ES RenderClear() 2011-02-17 02:23:48 -08:00
Sam Lantinga
834553b492 Fixed warnings about unused variables and so forth. 2011-02-17 02:18:41 -08:00
Sam Lantinga
dc6b8539ff Fixed SDL_RenderClear() if the render driver doesn't implement it. 2011-02-17 02:17:38 -08:00
Sam Lantinga
4aaf8a6795 Fixed crash when drawing non-textured primitives 2011-02-17 02:16:30 -08:00
Sam Lantinga
e5780896f6 Don't accidentally pick a YV12 format as the closest format. 2011-02-15 15:50:21 -08:00
Sam Lantinga
2e54bfdc19 Don't reset the viewport unless you have to. 2011-02-15 14:17:42 -08:00
Sam Lantinga
83c480de5c Whoops, need to actually clip to the viewport in the software renderer. 2011-02-15 14:10:50 -08:00
Sam Lantinga
b59da3ffdc Changed the concept of a render clip rect to a render viewport.
The render viewport is automatically re-centered when the window changes size, so applications that don't care will not have to handle recalculating their rendering coordinates.

Fixed API for drawing and filling multiple rectangles - the parameter should be an array of rects, not an array of pointers to rects.

Fixed API for updating window rects for consistency with other APIs - the order is pointer to array followed by count in array.
2011-02-15 13:59:59 -08:00
Ken Rogoway
8c8191deef Software scaling support. Not very fast, but it seems to work. 2011-02-14 11:50:18 -06:00
Sam Lantinga
789241249f Removed renderer definition, removed extra -I statements since no other platform has them (files should be explicit in their include paths). 2011-02-13 14:02:37 -08:00
Sam Lantinga
35db143abf Frank Zago to SDL
On 02/12/2011 01:44 PM, Sam Lantinga wrote:
> BTW, you probably want to nuke the NDS renderer and just implement these three
> functions instead:
>     int (*CreateWindowFramebuffer) (_THIS, SDL_Window * window, Uint32 *
> format, void ** pixels, int *pitch);
>     int (*UpdateWindowFramebuffer) (_THIS, SDL_Window * window, int numrects,
> SDL_Rect * rects);
>     void (*DestroyWindowFramebuffer) (_THIS, SDL_Window * window);

Patch attached. The renderer for the DS is not used anymore, but I left the
file in place if someone wants to finish it.

I've also added a README.ds and fixed the spinlocks.
2011-02-13 14:01:02 -08:00
Sam Lantinga
c7b5cc946d A few fixes:
Fixed creating render texture framebuffer.
Removed the need for palette watch, added surface format caching.
Added an SDL_DONTFREE flag so you can't free the window and 1.2 shadow surfaces.
2011-02-13 13:46:10 -08:00
Sam Lantinga
e6ec7f6b28 Fixed bug #1117
There's a new event that's always sent when the window changes size, and that event is what the renderers listen for to determine if they need to rebind their context.
2011-02-12 19:02:14 -08:00
Sam Lantinga
362639036a Frank Zago to sdl
The following patch fixes some of the bitrot for the Nintendo DS port.
The support is still basic at the moment, but it allows to run the "general"
test under the current head of tree (parent: 5269:11bd1585efb5 tip).
Most of the patch is mine, but I integrated a couple changes that John
Magnotti posted on Feb 1st.
2011-02-12 11:36:56 -08:00
Sam Lantinga
52f11a9f4f The YV12 image isn't w*h*2, it's actually w*h + w*h/4 + w*h/4 2011-02-12 10:13:53 -08:00
Sam Lantinga
8fed295309 Fixed a crash caused by the 1.2 code path getting a YV12 texture. :) 2011-02-12 08:17:58 -08:00
Sam Lantinga
acd458dad9 Ah there, that fixed it. :) 2011-02-12 00:42:39 -08:00
Sam Lantinga
5e1535525c Initial pass at shader YV12 support - doesn't quite work yet. 2011-02-12 00:25:02 -08:00
Sam Lantinga
a2cdcf5486 Happy 2011! :) 2011-02-11 22:37:15 -08:00
Sam Lantinga
97ef063646 itsnotabigtruck has given me permission to replace the license for his contribution. 2011-02-11 19:11:27 -08:00
Sam Lantinga
3482e0aa2f Mostly fixed fullscreen mode on Mac OS X, and you can toggle it on and off.
There are still some problems with the ConvertNSRect() calculations when switching video modes, which causes wierd window positioning issues, and the fullscreen window is still minimized on exit.
2011-02-11 00:25:44 -08:00
Sam Lantinga
efc19178c7 Fixed compiling on Windows
Added an untested shader for YV12 textures
2011-02-09 10:31:12 -08:00
Sam Lantinga
385e9bba2e Fixed crash when shaders aren't available. 2011-02-09 10:13:26 -08:00
Sam Lantinga
ca8ed0c39d Added a hint to control whether the OpenGL driver uses shaders. 2011-02-08 22:40:19 -08:00
Sam Lantinga
61d595f2a8 Made the shaders easier to debug when they don't compile 2011-02-08 20:31:39 -08:00
Sam Lantinga
8c85fcf224 Fixed the shaders (needed to use texture2DRect) - thanks Ryan! 2011-02-08 20:23:52 -08:00
Sam Lantinga
fa76d28021 Fixed setting the texture unit, still doesn't work. 2011-02-08 16:50:51 -08:00
Sam Lantinga
e27e8c5cb6 Beginning of a framework for OpenGL shaders 2011-02-08 16:27:52 -08:00
Sam Lantinga
1543672ced Reduce duplicated code in the texture update code paths 2011-02-08 10:38:12 -08:00
Sam Lantinga
5069986bff Made it possible to disable the rendering subsystem with configure --disable-render 2011-02-08 10:04:09 -08:00
Sam Lantinga
da46bc3be3 Added function SDL_RenderSetClipRect() 2011-02-07 20:06:26 -08:00
Sam Lantinga
1f86c7c17d Try to create an OpenGL ES 2.0 context on Android and successfully fall back to OpenGL ES 1.1 if that fails. 2011-02-07 17:44:07 -08:00
Sam Lantinga
47818cfba9 Added a simple log message API 2011-02-07 16:45:40 -08:00
Sam Lantinga
cbc7e8a0b1 You don't need to copy the pixels into the streaming texture's pixel data. This behavior is defined specifically to optimize the UpdateTexture path. 2011-02-06 20:56:21 -08:00
Sam Lantinga
8668130e2d OpenGL ES 2.0 rendering LIVES! 2011-02-06 19:12:55 -08:00