Commit Graph

327 Commits

Author SHA1 Message Date
David Ludwig
b2af020432 WinRT: added a TODO note regarding texture-[un]locking in the d3d11 renderer 2013-12-25 14:20:40 -05:00
David Ludwig
053ce13c58 WinRT: renamed d3d11-internal struct, SDL_VertexShaderConstants, to just VertexShaderConstants
This is primarily to keep naming consistent with other shader-bound structs.
2013-12-25 14:17:49 -05:00
David Ludwig
75b6ebed62 WinRT: moved contents of the d3d11 renderer's header file into its implementation file 2013-12-25 13:13:15 -05:00
David Ludwig
c0f5f2e58f WinRT: simplified a potentially-common error message from D3D11_SetRenderTarget 2013-12-25 13:00:41 -05:00
David Ludwig
a11653b075 WinRT: removed an unnecessary use of std::string in the d3d11 renderer 2013-12-25 12:58:37 -05:00
David Ludwig
333c827831 WinRT: utilized SDL_SetError's return value in the d3d11 renderer 2013-12-25 12:52:16 -05:00
David Ludwig
48c72ea3c7 WinRT: minor d3d11 code cleanups 2013-12-25 12:48:47 -05:00
David Ludwig
6d89d46b02 WinRT: made d3d11-spawned error messages trickle down
Some error messages had the potential to be overwritten/obscured.
2013-12-25 12:47:39 -05:00
David Ludwig
4e3a952407 WinRT: made d3d11-spawned error messages include the function name of failed calls 2013-12-25 12:43:26 -05:00
David Ludwig
e7fd02d52b WinRT: better rendering performance via D3D11_USAGE_DYNAMIC 2013-12-22 21:13:35 -05:00
David Ludwig
805683ec95 WinRT: fixed bug: SDL_RenderReadPixels didn't work with certain orientations of the physical display 2013-12-10 22:34:08 -05:00
David Ludwig
b13b8b6290 WinRT: enable the OpenGL ES 2 SDL_Renderer backend, if and when OpenGL ES 2 support is compiled in 2013-11-29 00:19:46 -05:00
David Ludwig
c96c4f3dc4 WinRT: merged with latest SDL 2.x/HG code
SDL 2.x recently accepted patches to enable OpenGL ES 2 support via Google's ANGLE library.  The thought is to try to eventually merge SDL/WinRT's OpenGL code with SDL-official's.
2013-11-28 22:09:21 -05:00
Gabriel Jacobo
3fcc35f5bb OpenGL ES support for Windows 2013-11-22 13:24:53 -03:00
Sam Lantinga
4b7f04ae7e Better fix for bug 2207 - SDL_RenderSetViewport behavior is different/incorrect on OpenGL renderer vs DirectX renderer
At least, it works better here on my Mac. :)
2013-11-15 22:07:35 -08:00
Ryan C. Gordon
7958ad08cc Fix viewport being upside down in OpenGL renderer.
Fixes Bugzilla #2207.
2013-11-15 23:20:50 -05:00
Sam Lantinga
d42623edab Backed out changeset e8f93c2ebda3 - it didn't actually do anything useful 2013-11-14 21:39:54 -08:00
Sam Lantinga
0e55f65eda Diagonal flipping with RenderCopyEx
Ivan Rubinson

As it turns out, it was impossible to render a texture flipped diagonally (both vertically and horizontally) with one RenderCopyEx call.
With help from #SDL @ freenode, we came up with a fix.
2013-11-13 21:50:59 -08:00
Sam Lantinga
a5ebac21ae Fixed performance regression caused by the fix for bug 2158 2013-11-05 21:01:25 -08:00
Philipp Wiesemann
7ff0d83715 Changed function to return -1 through SDL_Error() instead of plain -1. 2013-11-02 11:46:43 +01:00
David Ludwig
40358f5b27 WinRT: added support for SDL_HINT_RENDER_SCALE_QUALITY 2013-11-01 22:54:39 -04:00
David Ludwig
529fcd3ee3 WinRT: merged with SDL 2.0.1 codebase 2013-10-27 21:26:46 -04:00
David Ludwig
be91d7d487 WinRT: made the Direct3D 11.x 'Debug Layer' be enable-able in any app via a hint
To enable the Debug Layer, set the hint, SDL_HINT_RENDER_DIRECT3D11_DEBUG to '1'.

The Debug Layer will be turned off by default, both in Release and Debug builds (of SDL).
2013-10-25 20:31:43 -04:00
Sam Lantinga
4f0394ef7d Fixed whitespace 2013-10-21 22:08:56 -07:00
Sam Lantinga
e7b498cf26 Fixed bug 2129 - fix for bug 2121 breaks linking for mingw and throws multiple warnings
Andreas Ertelt

The problem in question is caused by changeset 7771 (http://hg.libsdl.org/SDL/rev/4434498bf4b9 / https://bugzilla.libsdl.org/show_bug.cgi?id=2121)

The redefinition of __inline__ (introduced by the addition of begin_code.h:128's "|| __STRICT_ANSI__") results in mingw's gcc throwing multiple

   warning: always_inline function might not be inlinable [-Wattributes]

as well as a whole bunch of redefinitions of mingw internals which break linking of projects including the SDL2 headers.
2013-10-20 21:56:15 -07:00
Sam Lantinga
2ff88d48c7 Prevent conflicts when linking both SDL2 and SDL2_gfx 2013-10-20 21:34:38 -07:00
Sam Lantinga
22810a9476 Use vertex arrays for drawing points in addition to lines 2013-10-20 10:35:51 -07:00
Sam Lantinga
3a96110d57 Fixed bug 2158 - Pixel missing in SDL_RenderDrawLines
Sean McKean

I am running Ubuntu 12.04 (GL version 1.4 Mesa 8.0.4) , and on drawing a set of lines through the renderer through SDL_RenderDrawLines() (looped or not) or SDL_RenderDrawRect() I notice a pixel missing. For RenderDrawLines() it seems to be the second point in the sequence; for RenderDrawRect() it is the lower-right. This can be fixed by specifying SDL_RenderDrawPoint(s), but wouldn't it be easier to specify each pixel in a GL_POINTS glBegin/End loop in the OpenGL code, just to make sure?

I also ran the same program on Android; the rendering seemed to be correct, which uses glDrawArrays.
2013-10-20 10:10:14 -07:00
Sam Lantinga
94d66457c3 Fixed bug 2162 - SDL_RenderClear not clearing entire render target
Kevin Wells

Overview:
SDL_RenderClear is only clearing part of a texture when it is the render target and a different size than the screen.

Steps to Reproduce:
1) This only occurs with the render driver set to direct3d, so: SDL_SetHint(SDL_HINT_RENDER_DRIVER,"direct3d")
Also, my window was 1280x720.

2) Create a texture for a render target with a resolution of 1024x1024:
texture=SDL_CreateTexture(main_window.renderer,SDL_PIXELFORMAT_RGBA8888,SDL_TEXTUREACCESS_TARGET,1024,1024);
SDL_SetTextureBlendMode(texture,SDL_BLENDMODE_BLEND);

3) Target the texture for rendering: SDL_SetRenderTarget(main_window.renderer,texture);

4) Set the draw color to whatever you want (problem occurs with both 0,0,0,0 and 0,0,0,255 among others) and then clear the render target:
SDL_SetRenderDrawColor(main_window.renderer,0,0,0,0);
SDL_RenderClear(main_window.renderer);

Actual Results:
Only about the top 3/4s of the texture gets cleared on calling SDL_RenderClear. The bottom 1/4 or so does not clear.

Expected Results:
Entire render target should be cleared.
2013-10-19 01:29:23 -07:00
Sam Lantinga
2451a67018 Fixed building using MinGW
Our SDL_windows.h needed to be included before anything else so UNICODE is defined.
2013-10-17 23:02:29 -07:00
Sam Lantinga
027a8b8275 Added support for SDL_PIXELFORMAT_UYVY surfaces on Mac OS X 2013-10-14 08:56:37 -07:00
Sam Lantinga
e2a6bbf232 Do a 32-bit compare on RGBA values. Thsi should be inlined in optimized builds. 2013-10-05 12:29:05 -07:00
Ryan C. Gordon
775abe1296 Avoid redundant state changes in the GLES2 renderer. 2013-10-05 00:29:57 -04:00
Ryan C. Gordon
43d69defbc Removed "u_colorTable" uniform from the GLES2 renderer. It's not used anywhere. 2013-10-04 11:25:14 -04:00
Sam Lantinga
0d0380db84 Added optional error checking for OpenGL ES 2.0 in the same style as the OpenGL renderer.
You can enable it like this: SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_DEBUG_FLAG);
2013-10-03 20:48:52 -07:00
Sam Lantinga
3f8a1dd1c3 Fixed a potential double-free bug if glGenTextures() failed. 2013-10-03 20:42:43 -07:00
Sam Lantinga
beb9e10e46 Fixed const/non-const warning 2013-10-03 03:31:05 -07:00
David Ludwig
6610782740 WinRT: fixed a line-rendering bug in the D3D 11.1 backend 2013-09-16 00:31:01 -04:00
David Ludwig
59362ee702 WinRT: made rendering work with orientation changes on Windows Phone
Pointer event geometry still needs to be adjusted on Windows Phone, to note.
2013-08-28 15:27:01 -04:00
David Ludwig
46a76134a3 WinRT: removed a comment regarding a dealt-with TODO 2013-08-28 12:45:43 -04:00
David Ludwig
9523f29d5c WinRT: rendering orientation fixes for Windows Phone, part 1
This change should allow apps to render correctly in Portrait mode, at minimum,

Support for orientation changes is pending.

Thanks to Pierre-Yves for assistance!
2013-08-28 12:38:30 -04:00
David Ludwig
2c2aedbcdb WinRT: fixed a potential memory-related crash in SDL_Renderer on Windows Phone 2013-08-28 11:46:02 -04:00
David Ludwig
93507125de WinRT: experimental and preliminary support for XAML-based overlays on Windows 8/RT
The XAML support here is still rudimentary.  Bugs do exist.  You've been warned.

XAML support in Windows Phone 8 is not yet available (in SDL/WinRT).
2013-08-27 21:21:09 -04:00
David Ludwig
df865dd615 WinRT: made all WinRT-related TODO comments use the same prefix, "TODO, WinRT" 2013-08-27 13:03:43 -04:00
David Ludwig
669aa12b7e WinRT: renamed SDL_SYSWM_WINDOWSRT to SDL_SYSWM_WINRT
This is part of an overall effort to use the name, "WinRT", rather than "WindowsRT" (or "Windows RT"), as the shorthand name often seems to mean something different than the longhand name.  (WinRT is an API, Windows RT is a product name)
2013-08-27 11:44:43 -04:00
David Ludwig
51cd30d786 WinRT: added a stub implementation of UpdateClipRect to the D3D 11.1 renderer 2013-08-13 20:33:15 -04:00
David Ludwig
1ae5d8dea3 WinRT: build fixes and additional WinRT-related integrations with SDL 2.0.0 2013-08-13 20:09:52 -04:00
David Ludwig
373ffd0dac WinRT: merged with SDL 2.0.0 codebase (aka. SDL hg rev d6a8fa507a45) 2013-08-12 22:29:55 -04:00
Sam Lantinga
53a86d45bd Check the return value of glGenTextures() 2013-08-10 10:49:26 -07:00
Sam Lantinga
dfac4af69a Reset the viewport when we reset the other D3D state.
From Sythical:

Hello, I've created a simple SDL2 application which draws a texture on the screen. The problem I'm having is that if I launch another program which loads the UAC popup or if I lock my PC and then login again, the application stops drawing the texture. I tried adding SDL_Delay(10000) after SDL_RenderPresent(renderer). This made the texture stay on the screen for a little bit but the texture wasn't drawn again after the delay. Here's my code:

#include "SDL.h"

int main(int argc, char *argv[])
{
    SDL_Renderer *renderer;
    SDL_Window *window;
    SDL_Surface *surface;
    SDL_Texture *rect_texture;
    SDL_Event main_event;
    SDL_Rect rect_data;
    int enable_vsync = 1;

    if(SDL_Init(SDL_INIT_VIDEO) < 0) return 1;

    window = SDL_CreateWindow("SDL2 Application", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 600, 600, SDL_WINDOW_RESIZABLE);

    renderer = SDL_CreateRenderer(window, -1, enable_vsync ? SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC : SDL_RENDERER_ACCELERATED);
    SDL_SetRenderDrawColor(renderer, 20, 20, 30, 255);

    surface = SDL_LoadBMP("icon.bmp");
    rect_texture = SDL_CreateTextureFromSurface(renderer, surface);

    rect_data.w = 32; rect_data.h = 32;
    rect_data.x = 300; rect_data.y = 300;

    while(main_event.type != SDL_QUIT)
    {
        SDL_PollEvent(&main_event);

        SDL_RenderClear(renderer);
        SDL_RenderCopy(renderer, rect_texture, NULL, &rect_data);
        SDL_RenderPresent(renderer);
    }

    SDL_DestroyTexture(rect_texture);
    SDL_DestroyRenderer(renderer);
    SDL_DestroyWindow(window);
    SDL_Quit();

    return 0;
}
2013-08-07 01:14:04 -07:00