Commit graph

46 commits

Author SHA1 Message Date
Sam Lantinga
9ba7210778 Date: Fri, 19 Dec 2008 20:17:35 +0100
From: Couriersud
Subject: Re: Aw: Experience using SDL1.3 in sdlmame/Proposal for api additions

> For consistency you'd probably want:
> SDL_SetRenderDrawColor(Uint8 r, Uint8 g, Uint8 b, Uint8 a);
> SDL_SetRenderDrawBlendMode(SDL_BlendMode blendMode);
> SDL_RenderLine(int x1, int y1, int x2, int y2);
> SDL_RenderFill(SDL_Rect *rect);
>
> You probably also want to add API functions query the current state.
>

I have implemented the above api for the opengl, x11, directfb and
software renderers. I have also renamed *TEXTUREBLENDMODE* constants to
BLENDMODE*. The unix build compiles. The windows renderer still needs to
be updated, but I have no windows development machine at hand. Have a
look at the x11 renderer for a sample.

Vector games now run at 90% both on opengl and directfb in comparison to
sdlmame's own opengl renderer. The same applies to raster games.

The diff also includes

a) Changed XDrawRect to XFillRect in x11 renderer
b) A number of changes to fix blending and modulation issues in the
directfb renderer.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403346
2008-12-20 12:00:00 +00:00
Sam Lantinga
6e7ef5d5b1 A little cleanup for SDL snapshot release
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403319
2008-12-08 00:24:15 +00:00
Ryan C. Gordon
546fea4e11 Comment cleanup.
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403309
2008-12-07 07:16:40 +00:00
Ryan C. Gordon
0096fd0e8d Don't hardcode RECT for fragment program texture targets.
Now we can generate what a given system needs when compiling the shader.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403308
2008-12-07 07:06:34 +00:00
Sam Lantinga
8b4a508fb4 Slight optimization of the shader, no need to scale into 0..255
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403307
2008-12-07 04:38:32 +00:00
Sam Lantinga
5908561ee3 Added official support for GL_APPLE_ycbcr_422 and GL_MESA_ycbcr_texture
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403306
2008-12-07 04:02:23 +00:00
Sam Lantinga
0fa8c80ca0 The YCbCr texture extension works now that bytes_per_pixel() returns the
correct value for YUV textures.  Yay!

I'm still cheering for Ryan's pixel shader instead, since once it works
different shaders can handle all the YUV formats.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403305
2008-12-06 18:37:06 +00:00
Sam Lantinga
f03cab2b46 Fixed the shader fragment problems using 2 byte YUV data in a 4 byte RGB
texture.  This is a total hack though.  Maybe we should be using a different
texture format?

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403304
2008-12-06 18:22:28 +00:00
Sam Lantinga
700f822150 The previous checkin fixes the crash, so at least we're not overrunning
the texture pixel data anymore...

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403301
2008-12-06 17:43:10 +00:00
Sam Lantinga
2eb5631950 Progress, maybe. :)
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403300
2008-12-06 17:41:01 +00:00
Sam Lantinga
d929dca890 Rebind the context to the window area and update matrices when the window size changes
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403297
2008-12-06 05:23:35 +00:00
Ryan C. Gordon
b59986d747 Initial pixel shader support for YUV textures in the GL renderer.
This work is not complete yet!

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403296
2008-12-06 00:56:47 +00:00
Sam Lantinga
b19daa445d Whoops, can't call glOrtho() repeatedly
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403294
2008-12-05 07:00:58 +00:00
Sam Lantinga
b1b8c20318 The matrices have already been set, so you don't have to re-set them.
You always need to reset the viewport when activating the renderer in
case the context had been set to a different window previously.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403293
2008-12-05 06:22:19 +00:00
Sam Lantinga
be3717c64e Removed the hacky stuff for YUV OpenGL textures, since Ryan's pixel shader code
will be far superior. :)

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403274
2008-12-01 00:05:31 +00:00
Sam Lantinga
02f6a8797c Finally got the right mojo for Apple's YUV texture format.
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403273
2008-12-01 00:03:51 +00:00
Sam Lantinga
5632821dd0 Temporary fix for Mac OS X crash in textoverlay
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403270
2008-11-29 21:48:14 +00:00
Sam Lantinga
8e1f968f50 Whoops, we need this for subrect updates (testsprite)
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403269
2008-11-29 15:32:14 +00:00
Sam Lantinga
c81d1708ba Fixed crash in glTexSubImage2D() with testoverlay on Mac OS X.
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403265
2008-11-29 06:29:33 +00:00
Sam Lantinga
35c71403d7 Preliminary support for YUV textures
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403239
2008-11-22 06:59:22 +00:00
Bob Pendleton
71656d10c7 re: bug#563. checking in some commented out trace code and a fix so that the in testalpha.c the background only flashes when alpha == 255. The problem that is being
fixed is caused by clearing SDL_COPY_RLE_COLORKEY without setting SDL_COPY_RLE_DESIRED in SDL_UnRELSurface.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%402746
2008-03-14 18:17:49 +00:00
Bob Pendleton
e558eee568 Checking in Christian Walther's patch for x11 keyboard input. Minor code tweaks by Bob.
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%402704
2008-01-08 00:10:46 +00:00
Sam Lantinga
68d2b55278 Split out the SDL_rect and SDL_surface functions into their own headers.
Removed unused count from the dirty rect list.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%402639
2007-09-10 12:20:02 +00:00
Sam Lantinga
92c5ea48ab Added code to enable multi-threaded OpenGL on Mac OS X, pending Ryan's PBO/VBO
changes.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%402608
2007-08-15 04:04:17 +00:00
Sam Lantinga
5fca3f7890 Advertise the most efficient format for the screen. Of course SDL code needs
to be fixed to handle framebuffers with alpha...

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%402599
2007-08-13 02:38:59 +00:00
Sam Lantinga
438f7083d8 This is byte order dependent.
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%402598
2007-08-12 18:53:51 +00:00
Sam Lantinga
cbc3f4b4c4 Test using glTextureRangeAPPLE
This actually ends up being quite a bit slower on my MacBook, but I'm
checking it in to test on a PPC iMac.

Maybe someone knows why it's slower?

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%402595
2007-08-12 16:53:58 +00:00
Sam Lantinga
a2f5eab988 Optimized OpenGL renderer for Mac OS X.
The SDL 1.2 API version of testsprite went from 120 FPS to 320 FPS. :)

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%402592
2007-08-12 07:02:28 +00:00
Sam Lantinga
6b348f07c7 Emphasized the separation between SDL_Surface and SDL_Texture
- SDL_Surface is a system memory representation of pixel data
 - SDL_Texture is a video memory representation of pixel data

The concept of SDL_Surface with SDL_HWSURFACE is no longer used.

Separated SDL_Texture types by usage rather than memory type
 - SDL_TEXTUREACCESS_STATIC is for rarely changed pixel data,
   can be placed in video memory.
 - SDL_TEXTUREACCESS_STREAMING is for frequently changing pixel
   data, usually placed in system memory or AGP memory.

Optimized the SDL_compat usage of the OpenGL renderer by only
using one copy of the framebuffer instead of two.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%402584
2007-08-11 20:54:31 +00:00
Sam Lantinga
2dc5a97f17 Cleanup for the last checkin
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%402033
2006-08-28 03:27:59 +00:00
Sam Lantinga
fdafca64b3 Added source color and alpha modulation support.
Added perl script to generate optimized render copy functions.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%402032
2006-08-28 03:17:39 +00:00
Sam Lantinga
3e23ac57e2 Added resize support for GDI and Direct3D renderers
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%402022
2006-08-07 05:24:13 +00:00
Sam Lantinga
e16c932a5c Added paletted OpenGL texture support.
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%402021
2006-08-06 23:34:59 +00:00
Sam Lantinga
a1ced0d971 Allow the render context to do necessary work when the video mode changes.
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%402017
2006-08-06 04:39:13 +00:00
Sam Lantinga
bfe4f31c0e SDL constants are all uppercase.
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%402012
2006-08-05 17:09:42 +00:00
Sam Lantinga
931e1c106d Implemented X11 OpenGL support.
Added support for the SDL_VIDEO_OPENGL environment variable.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401998
2006-07-28 08:43:17 +00:00
Sam Lantinga
1d8a5a2349 Fixed crash with multiple windows
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401973
2006-07-23 00:19:12 +00:00
Sam Lantinga
e06b514882 OpenGL renderer is feature complete!
Dynamically load GL functions in the OpenGL renderer.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401972
2006-07-22 23:04:41 +00:00
Sam Lantinga
c05ca3687f Added SDL_GL_ExtensionSupported()
Use GL_ARB_texture_rectangle in the OpenGL renderer, if supported.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401971
2006-07-22 21:58:17 +00:00
Sam Lantinga
75ff5f31f2 If the OpenGL renderer is selected for a non-OpenGL window, recreate the window with OpenGL enabled.
Added OpenGL renderer error checking.
Use fast-path texture formats in the OpenGL renderer.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401969
2006-07-22 21:02:57 +00:00
Sam Lantinga
68df2209ba Switch OpenGL contexts when switching render contexts.
Query the maximum texture size and show the current render parameters.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401968
2006-07-22 19:51:48 +00:00
Sam Lantinga
5c1901a93d Fixed OpenGL blend modes, added power of 2 texture code
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401967
2006-07-22 19:03:31 +00:00
Sam Lantinga
46ad1ad5d6 Bug fixes to the OpenGL renderer
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401966
2006-07-22 18:01:56 +00:00
Sam Lantinga
2fe561616a Convert SDL_malloc to SDL_calloc if appropriate, slightly faster on operating systems which map the zero page for memory allocations.
OpenGL renderer in progress

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401965
2006-07-22 08:33:18 +00:00
Sam Lantinga
2b538200ba Fixed to compile while the OpenGL renderer is under construction
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401964
2006-07-19 08:46:57 +00:00
Sam Lantinga
397be19fd2 Starting on the OpenGL renderer...
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401963
2006-07-19 07:18:45 +00:00