Commit d2b54f7d authored by Sam Lantinga's avatar Sam Lantinga

Made it possible to create a texture of any format, even if not supported by the renderer.

This allows me to reduce the set of formats supported by the renderers to the most optimal set, for a nice speed boost.

--HG--
rename : src/video/SDL_yuv_mmx.c => src/render/SDL_yuv_mmx.c
rename : src/video/SDL_yuv_sw.c => src/render/SDL_yuv_sw.c
rename : src/video/SDL_yuv_sw_c.h => src/render/SDL_yuv_sw_c.h
rename : src/video/mmx.h => src/render/mmx.h
parent 613d92a8
...@@ -607,7 +607,7 @@ ...@@ -607,7 +607,7 @@
> >
</File> </File>
<File <File
RelativePath="..\..\src\video\mmx.h" RelativePath="..\..\src\render\mmx.h"
> >
</File> </File>
<File <File
...@@ -1251,15 +1251,15 @@ ...@@ -1251,15 +1251,15 @@
> >
</File> </File>
<File <File
RelativePath="..\..\src\video\SDL_yuv_mmx.c" RelativePath="..\..\src\render\SDL_yuv_mmx.c"
> >
</File> </File>
<File <File
RelativePath="..\..\src\video\SDL_yuv_sw.c" RelativePath="..\..\src\render\SDL_yuv_sw.c"
> >
</File> </File>
<File <File
RelativePath="..\..\src\video\SDL_yuv_sw_c.h" RelativePath="..\..\src\render\SDL_yuv_sw_c.h"
> >
</File> </File>
<File <File
......
...@@ -282,8 +282,9 @@ echo #define SDL_REVISION "hg-0:baadf00d" &gt;"$(ProjectDir)\..\..\include\SDL_r ...@@ -282,8 +282,9 @@ echo #define SDL_REVISION "hg-0:baadf00d" &gt;"$(ProjectDir)\..\..\include\SDL_r
<ClInclude Include="..\..\src\events\SDL_touch_c.h" /> <ClInclude Include="..\..\src\events\SDL_touch_c.h" />
<ClInclude Include="..\..\src\libm\math.h" /> <ClInclude Include="..\..\src\libm\math.h" />
<ClInclude Include="..\..\src\libm\math_private.h" /> <ClInclude Include="..\..\src\libm\math_private.h" />
<ClInclude Include="..\..\src\render\mmx.h" />
<ClInclude Include="..\..\src\render\SDL_sysrender.h" /> <ClInclude Include="..\..\src\render\SDL_sysrender.h" />
<ClInclude Include="..\..\src\video\mmx.h" /> <ClInclude Include="..\..\src\render\SDL_yuv_sw_c.h" />
<ClInclude Include="..\..\src\video\SDL_alphamult.h" /> <ClInclude Include="..\..\src\video\SDL_alphamult.h" />
<ClInclude Include="..\..\src\audio\SDL_audio_c.h" /> <ClInclude Include="..\..\src\audio\SDL_audio_c.h" />
<ClInclude Include="..\..\src\audio\SDL_audiodev_c.h" /> <ClInclude Include="..\..\src\audio\SDL_audiodev_c.h" />
...@@ -339,7 +340,6 @@ echo #define SDL_REVISION "hg-0:baadf00d" &gt;"$(ProjectDir)\..\..\include\SDL_r ...@@ -339,7 +340,6 @@ echo #define SDL_REVISION "hg-0:baadf00d" &gt;"$(ProjectDir)\..\..\include\SDL_r
<ClInclude Include="..\..\src\video\windows\SDL_windowsvideo.h" /> <ClInclude Include="..\..\src\video\windows\SDL_windowsvideo.h" />
<ClInclude Include="..\..\src\video\windows\SDL_windowswindow.h" /> <ClInclude Include="..\..\src\video\windows\SDL_windowswindow.h" />
<ClInclude Include="..\..\src\events\SDL_windowevents_c.h" /> <ClInclude Include="..\..\src\events\SDL_windowevents_c.h" />
<ClInclude Include="..\..\src\video\SDL_yuv_sw_c.h" />
<ClInclude Include="..\..\src\video\windows\wmmsg.h" /> <ClInclude Include="..\..\src\video\windows\wmmsg.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
...@@ -365,6 +365,8 @@ echo #define SDL_REVISION "hg-0:baadf00d" &gt;"$(ProjectDir)\..\..\include\SDL_r ...@@ -365,6 +365,8 @@ echo #define SDL_REVISION "hg-0:baadf00d" &gt;"$(ProjectDir)\..\..\include\SDL_r
<ClCompile Include="..\..\src\render\direct3d\SDL_d3drender.c" /> <ClCompile Include="..\..\src\render\direct3d\SDL_d3drender.c" />
<ClCompile Include="..\..\src\render\opengl\SDL_renderer_gl.c" /> <ClCompile Include="..\..\src\render\opengl\SDL_renderer_gl.c" />
<ClCompile Include="..\..\src\render\SDL_render.c" /> <ClCompile Include="..\..\src\render\SDL_render.c" />
<ClCompile Include="..\..\src\render\SDL_yuv_mmx.c" />
<ClCompile Include="..\..\src\render\SDL_yuv_sw.c" />
<ClCompile Include="..\..\src\render\software\SDL_renderer_sw.c" /> <ClCompile Include="..\..\src\render\software\SDL_renderer_sw.c" />
<ClCompile Include="..\..\src\SDL.c" /> <ClCompile Include="..\..\src\SDL.c" />
<ClCompile Include="..\..\src\video\SDL_alphamult.c" /> <ClCompile Include="..\..\src\video\SDL_alphamult.c" />
...@@ -452,8 +454,6 @@ echo #define SDL_REVISION "hg-0:baadf00d" &gt;"$(ProjectDir)\..\..\include\SDL_r ...@@ -452,8 +454,6 @@ echo #define SDL_REVISION "hg-0:baadf00d" &gt;"$(ProjectDir)\..\..\include\SDL_r
<ClCompile Include="..\..\src\video\windows\SDL_windowsvideo.c" /> <ClCompile Include="..\..\src\video\windows\SDL_windowsvideo.c" />
<ClCompile Include="..\..\src\video\windows\SDL_windowswindow.c" /> <ClCompile Include="..\..\src\video\windows\SDL_windowswindow.c" />
<ClCompile Include="..\..\src\events\SDL_windowevents.c" /> <ClCompile Include="..\..\src\events\SDL_windowevents.c" />
<ClCompile Include="..\..\src\video\SDL_yuv_mmx.c" />
<ClCompile Include="..\..\src\video\SDL_yuv_sw.c" />
</ItemGroup> </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
......
...@@ -73,6 +73,10 @@ ...@@ -73,6 +73,10 @@
043DD77010FD8A0000DED673 /* SDL_alphamult.h in Headers */ = {isa = PBXBuildFile; fileRef = 043DD76C10FD8A0000DED673 /* SDL_alphamult.h */; }; 043DD77010FD8A0000DED673 /* SDL_alphamult.h in Headers */ = {isa = PBXBuildFile; fileRef = 043DD76C10FD8A0000DED673 /* SDL_alphamult.h */; };
043DD77110FD8A0000DED673 /* SDL_blendfillrect.c in Sources */ = {isa = PBXBuildFile; fileRef = 043DD76D10FD8A0000DED673 /* SDL_blendfillrect.c */; }; 043DD77110FD8A0000DED673 /* SDL_blendfillrect.c in Sources */ = {isa = PBXBuildFile; fileRef = 043DD76D10FD8A0000DED673 /* SDL_blendfillrect.c */; };
043DD77210FD8A0000DED673 /* SDL_drawrect.c in Sources */ = {isa = PBXBuildFile; fileRef = 043DD76E10FD8A0000DED673 /* SDL_drawrect.c */; }; 043DD77210FD8A0000DED673 /* SDL_drawrect.c in Sources */ = {isa = PBXBuildFile; fileRef = 043DD76E10FD8A0000DED673 /* SDL_drawrect.c */; };
04409BA612FA989600FB9AA8 /* mmx.h in Headers */ = {isa = PBXBuildFile; fileRef = 04409BA212FA989600FB9AA8 /* mmx.h */; };
04409BA712FA989600FB9AA8 /* SDL_yuv_mmx.c in Sources */ = {isa = PBXBuildFile; fileRef = 04409BA312FA989600FB9AA8 /* SDL_yuv_mmx.c */; };
04409BA812FA989600FB9AA8 /* SDL_yuv_sw_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04409BA412FA989600FB9AA8 /* SDL_yuv_sw_c.h */; };
04409BA912FA989600FB9AA8 /* SDL_yuv_sw.c in Sources */ = {isa = PBXBuildFile; fileRef = 04409BA512FA989600FB9AA8 /* SDL_yuv_sw.c */; };
04461DEE0EA76BA3006C462D /* SDL_haptic.h in Headers */ = {isa = PBXBuildFile; fileRef = 04461DED0EA76BA3006C462D /* SDL_haptic.h */; settings = {ATTRIBUTES = (Public, ); }; }; 04461DEE0EA76BA3006C462D /* SDL_haptic.h in Headers */ = {isa = PBXBuildFile; fileRef = 04461DED0EA76BA3006C462D /* SDL_haptic.h */; settings = {ATTRIBUTES = (Public, ); }; };
044E5FB511E6069F0076F181 /* SDL_clipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = 044E5FB311E6069F0076F181 /* SDL_clipboard.h */; settings = {ATTRIBUTES = (Public, ); }; }; 044E5FB511E6069F0076F181 /* SDL_clipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = 044E5FB311E6069F0076F181 /* SDL_clipboard.h */; settings = {ATTRIBUTES = (Public, ); }; };
044E5FB611E6069F0076F181 /* SDL_input.h in Headers */ = {isa = PBXBuildFile; fileRef = 044E5FB411E6069F0076F181 /* SDL_input.h */; settings = {ATTRIBUTES = (Public, ); }; }; 044E5FB611E6069F0076F181 /* SDL_input.h in Headers */ = {isa = PBXBuildFile; fileRef = 044E5FB411E6069F0076F181 /* SDL_input.h */; settings = {ATTRIBUTES = (Public, ); }; };
...@@ -223,9 +227,6 @@ ...@@ -223,9 +227,6 @@
FDA684660DF2374E00F98A1A /* SDL_surface.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA683190DF2374E00F98A1A /* SDL_surface.c */; }; FDA684660DF2374E00F98A1A /* SDL_surface.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA683190DF2374E00F98A1A /* SDL_surface.c */; };
FDA684670DF2374E00F98A1A /* SDL_sysvideo.h in Headers */ = {isa = PBXBuildFile; fileRef = FDA6831A0DF2374E00F98A1A /* SDL_sysvideo.h */; }; FDA684670DF2374E00F98A1A /* SDL_sysvideo.h in Headers */ = {isa = PBXBuildFile; fileRef = FDA6831A0DF2374E00F98A1A /* SDL_sysvideo.h */; };
FDA684680DF2374E00F98A1A /* SDL_video.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA6831B0DF2374E00F98A1A /* SDL_video.c */; }; FDA684680DF2374E00F98A1A /* SDL_video.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA6831B0DF2374E00F98A1A /* SDL_video.c */; };
FDA684690DF2374E00F98A1A /* SDL_yuv_mmx.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA6831C0DF2374E00F98A1A /* SDL_yuv_mmx.c */; };
FDA6846A0DF2374E00F98A1A /* SDL_yuv_sw.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA6831D0DF2374E00F98A1A /* SDL_yuv_sw.c */; };
FDA6846B0DF2374E00F98A1A /* SDL_yuv_sw_c.h in Headers */ = {isa = PBXBuildFile; fileRef = FDA6831E0DF2374E00F98A1A /* SDL_yuv_sw_c.h */; };
FDA685FB0DF244C800F98A1A /* SDL_nullevents.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA685F50DF244C800F98A1A /* SDL_nullevents.c */; }; FDA685FB0DF244C800F98A1A /* SDL_nullevents.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA685F50DF244C800F98A1A /* SDL_nullevents.c */; };
FDA685FC0DF244C800F98A1A /* SDL_nullevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = FDA685F60DF244C800F98A1A /* SDL_nullevents_c.h */; }; FDA685FC0DF244C800F98A1A /* SDL_nullevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = FDA685F60DF244C800F98A1A /* SDL_nullevents_c.h */; };
FDA685FF0DF244C800F98A1A /* SDL_nullvideo.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA685F90DF244C800F98A1A /* SDL_nullvideo.c */; }; FDA685FF0DF244C800F98A1A /* SDL_nullvideo.c in Sources */ = {isa = PBXBuildFile; fileRef = FDA685F90DF244C800F98A1A /* SDL_nullvideo.c */; };
...@@ -328,6 +329,10 @@ ...@@ -328,6 +329,10 @@
043DD76C10FD8A0000DED673 /* SDL_alphamult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_alphamult.h; sourceTree = "<group>"; }; 043DD76C10FD8A0000DED673 /* SDL_alphamult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_alphamult.h; sourceTree = "<group>"; };
043DD76D10FD8A0000DED673 /* SDL_blendfillrect.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_blendfillrect.c; sourceTree = "<group>"; }; 043DD76D10FD8A0000DED673 /* SDL_blendfillrect.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_blendfillrect.c; sourceTree = "<group>"; };
043DD76E10FD8A0000DED673 /* SDL_drawrect.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_drawrect.c; sourceTree = "<group>"; }; 043DD76E10FD8A0000DED673 /* SDL_drawrect.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_drawrect.c; sourceTree = "<group>"; };
04409BA212FA989600FB9AA8 /* mmx.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mmx.h; sourceTree = "<group>"; };
04409BA312FA989600FB9AA8 /* SDL_yuv_mmx.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_yuv_mmx.c; sourceTree = "<group>"; };
04409BA412FA989600FB9AA8 /* SDL_yuv_sw_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_yuv_sw_c.h; sourceTree = "<group>"; };
04409BA512FA989600FB9AA8 /* SDL_yuv_sw.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_yuv_sw.c; sourceTree = "<group>"; };
04461DED0EA76BA3006C462D /* SDL_haptic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_haptic.h; path = ../../include/SDL_haptic.h; sourceTree = SOURCE_ROOT; }; 04461DED0EA76BA3006C462D /* SDL_haptic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_haptic.h; path = ../../include/SDL_haptic.h; sourceTree = SOURCE_ROOT; };
044E5FB311E6069F0076F181 /* SDL_clipboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_clipboard.h; path = ../../include/SDL_clipboard.h; sourceTree = SOURCE_ROOT; }; 044E5FB311E6069F0076F181 /* SDL_clipboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_clipboard.h; path = ../../include/SDL_clipboard.h; sourceTree = SOURCE_ROOT; };
044E5FB411E6069F0076F181 /* SDL_input.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_input.h; path = ../../include/SDL_input.h; sourceTree = SOURCE_ROOT; }; 044E5FB411E6069F0076F181 /* SDL_input.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_input.h; path = ../../include/SDL_input.h; sourceTree = SOURCE_ROOT; };
...@@ -505,9 +510,6 @@ ...@@ -505,9 +510,6 @@
FDA683190DF2374E00F98A1A /* SDL_surface.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_surface.c; sourceTree = "<group>"; }; FDA683190DF2374E00F98A1A /* SDL_surface.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_surface.c; sourceTree = "<group>"; };
FDA6831A0DF2374E00F98A1A /* SDL_sysvideo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_sysvideo.h; sourceTree = "<group>"; }; FDA6831A0DF2374E00F98A1A /* SDL_sysvideo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_sysvideo.h; sourceTree = "<group>"; };
FDA6831B0DF2374E00F98A1A /* SDL_video.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_video.c; sourceTree = "<group>"; }; FDA6831B0DF2374E00F98A1A /* SDL_video.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_video.c; sourceTree = "<group>"; };
FDA6831C0DF2374E00F98A1A /* SDL_yuv_mmx.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_yuv_mmx.c; sourceTree = "<group>"; };
FDA6831D0DF2374E00F98A1A /* SDL_yuv_sw.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_yuv_sw.c; sourceTree = "<group>"; };
FDA6831E0DF2374E00F98A1A /* SDL_yuv_sw_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_yuv_sw_c.h; sourceTree = "<group>"; };
FDA685F50DF244C800F98A1A /* SDL_nullevents.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_nullevents.c; sourceTree = "<group>"; }; FDA685F50DF244C800F98A1A /* SDL_nullevents.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_nullevents.c; sourceTree = "<group>"; };
FDA685F60DF244C800F98A1A /* SDL_nullevents_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_nullevents_c.h; sourceTree = "<group>"; }; FDA685F60DF244C800F98A1A /* SDL_nullevents_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_nullevents_c.h; sourceTree = "<group>"; };
FDA685F90DF244C800F98A1A /* SDL_nullvideo.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_nullvideo.c; sourceTree = "<group>"; }; FDA685F90DF244C800F98A1A /* SDL_nullvideo.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_nullvideo.c; sourceTree = "<group>"; };
...@@ -659,9 +661,13 @@ ...@@ -659,9 +661,13 @@
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
041B2CE812FA0F680087D585 /* opengles */, 041B2CE812FA0F680087D585 /* opengles */,
041B2CEC12FA0F680087D585 /* software */,
04409BA212FA989600FB9AA8 /* mmx.h */,
041B2CEA12FA0F680087D585 /* SDL_render.c */, 041B2CEA12FA0F680087D585 /* SDL_render.c */,
041B2CEB12FA0F680087D585 /* SDL_sysrender.h */, 041B2CEB12FA0F680087D585 /* SDL_sysrender.h */,
041B2CEC12FA0F680087D585 /* software */, 04409BA312FA989600FB9AA8 /* SDL_yuv_mmx.c */,
04409BA412FA989600FB9AA8 /* SDL_yuv_sw_c.h */,
04409BA512FA989600FB9AA8 /* SDL_yuv_sw.c */,
); );
name = render; name = render;
path = ../../src/render; path = ../../src/render;
...@@ -1113,9 +1119,6 @@ ...@@ -1113,9 +1119,6 @@
FDA683190DF2374E00F98A1A /* SDL_surface.c */, FDA683190DF2374E00F98A1A /* SDL_surface.c */,
FDA6831A0DF2374E00F98A1A /* SDL_sysvideo.h */, FDA6831A0DF2374E00F98A1A /* SDL_sysvideo.h */,
FDA6831B0DF2374E00F98A1A /* SDL_video.c */, FDA6831B0DF2374E00F98A1A /* SDL_video.c */,
FDA6831C0DF2374E00F98A1A /* SDL_yuv_mmx.c */,
FDA6831D0DF2374E00F98A1A /* SDL_yuv_sw.c */,
FDA6831E0DF2374E00F98A1A /* SDL_yuv_sw_c.h */,
); );
name = video; name = video;
path = ../../src/video; path = ../../src/video;
...@@ -1179,7 +1182,6 @@ ...@@ -1179,7 +1182,6 @@
FDA6845D0DF2374E00F98A1A /* SDL_pixels_c.h in Headers */, FDA6845D0DF2374E00F98A1A /* SDL_pixels_c.h in Headers */,
FDA684630DF2374E00F98A1A /* SDL_RLEaccel_c.h in Headers */, FDA684630DF2374E00F98A1A /* SDL_RLEaccel_c.h in Headers */,
FDA684670DF2374E00F98A1A /* SDL_sysvideo.h in Headers */, FDA684670DF2374E00F98A1A /* SDL_sysvideo.h in Headers */,
FDA6846B0DF2374E00F98A1A /* SDL_yuv_sw_c.h in Headers */,
FDA685FC0DF244C800F98A1A /* SDL_nullevents_c.h in Headers */, FDA685FC0DF244C800F98A1A /* SDL_nullevents_c.h in Headers */,
FDA686000DF244C800F98A1A /* SDL_nullvideo.h in Headers */, FDA686000DF244C800F98A1A /* SDL_nullvideo.h in Headers */,
FD5F9D300E0E08B3008E885B /* SDL_joystick_c.h in Headers */, FD5F9D300E0E08B3008E885B /* SDL_joystick_c.h in Headers */,
...@@ -1220,6 +1222,8 @@ ...@@ -1220,6 +1222,8 @@
04FFAB9812E23BDC00BA343D /* SDL_shape.h in Headers */, 04FFAB9812E23BDC00BA343D /* SDL_shape.h in Headers */,
041B2CD912FA0E9E0087D585 /* SDL_render.h in Headers */, 041B2CD912FA0E9E0087D585 /* SDL_render.h in Headers */,
041B2CF212FA0F680087D585 /* SDL_sysrender.h in Headers */, 041B2CF212FA0F680087D585 /* SDL_sysrender.h in Headers */,
04409BA612FA989600FB9AA8 /* mmx.h in Headers */,
04409BA812FA989600FB9AA8 /* SDL_yuv_sw_c.h in Headers */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
...@@ -1427,8 +1431,6 @@ ...@@ -1427,8 +1431,6 @@
FDA684640DF2374E00F98A1A /* SDL_stretch.c in Sources */, FDA684640DF2374E00F98A1A /* SDL_stretch.c in Sources */,
FDA684660DF2374E00F98A1A /* SDL_surface.c in Sources */, FDA684660DF2374E00F98A1A /* SDL_surface.c in Sources */,
FDA684680DF2374E00F98A1A /* SDL_video.c in Sources */, FDA684680DF2374E00F98A1A /* SDL_video.c in Sources */,
FDA684690DF2374E00F98A1A /* SDL_yuv_mmx.c in Sources */,
FDA6846A0DF2374E00F98A1A /* SDL_yuv_sw.c in Sources */,
FDA685FB0DF244C800F98A1A /* SDL_nullevents.c in Sources */, FDA685FB0DF244C800F98A1A /* SDL_nullevents.c in Sources */,
FDA685FF0DF244C800F98A1A /* SDL_nullvideo.c in Sources */, FDA685FF0DF244C800F98A1A /* SDL_nullvideo.c in Sources */,
FD5F9D2F0E0E08B3008E885B /* SDL_joystick.c in Sources */, FD5F9D2F0E0E08B3008E885B /* SDL_joystick.c in Sources */,
...@@ -1469,6 +1471,8 @@ ...@@ -1469,6 +1471,8 @@
041B2CF012FA0F680087D585 /* SDL_renderer_gles.c in Sources */, 041B2CF012FA0F680087D585 /* SDL_renderer_gles.c in Sources */,
041B2CF112FA0F680087D585 /* SDL_render.c in Sources */, 041B2CF112FA0F680087D585 /* SDL_render.c in Sources */,
041B2CF312FA0F680087D585 /* SDL_renderer_sw.c in Sources */, 041B2CF312FA0F680087D585 /* SDL_renderer_sw.c in Sources */,
04409BA712FA989600FB9AA8 /* SDL_yuv_mmx.c in Sources */,
04409BA912FA989600FB9AA8 /* SDL_yuv_sw.c in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
......
...@@ -131,6 +131,14 @@ ...@@ -131,6 +131,14 @@
041B2CAB12FA0D680087D585 /* SDL_render.c in Sources */ = {isa = PBXBuildFile; fileRef = 041B2C9E12FA0D680087D585 /* SDL_render.c */; }; 041B2CAB12FA0D680087D585 /* SDL_render.c in Sources */ = {isa = PBXBuildFile; fileRef = 041B2C9E12FA0D680087D585 /* SDL_render.c */; };
041B2CAC12FA0D680087D585 /* SDL_sysrender.h in Headers */ = {isa = PBXBuildFile; fileRef = 041B2C9F12FA0D680087D585 /* SDL_sysrender.h */; }; 041B2CAC12FA0D680087D585 /* SDL_sysrender.h in Headers */ = {isa = PBXBuildFile; fileRef = 041B2C9F12FA0D680087D585 /* SDL_sysrender.h */; };
041B2CAD12FA0D680087D585 /* SDL_renderer_sw.c in Sources */ = {isa = PBXBuildFile; fileRef = 041B2CA112FA0D680087D585 /* SDL_renderer_sw.c */; }; 041B2CAD12FA0D680087D585 /* SDL_renderer_sw.c in Sources */ = {isa = PBXBuildFile; fileRef = 041B2CA112FA0D680087D585 /* SDL_renderer_sw.c */; };
04409B9112FA97ED00FB9AA8 /* mmx.h in Headers */ = {isa = PBXBuildFile; fileRef = 04409B8D12FA97ED00FB9AA8 /* mmx.h */; };
04409B9212FA97ED00FB9AA8 /* SDL_yuv_mmx.c in Sources */ = {isa = PBXBuildFile; fileRef = 04409B8E12FA97ED00FB9AA8 /* SDL_yuv_mmx.c */; };
04409B9312FA97ED00FB9AA8 /* SDL_yuv_sw_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04409B8F12FA97ED00FB9AA8 /* SDL_yuv_sw_c.h */; };
04409B9412FA97ED00FB9AA8 /* SDL_yuv_sw.c in Sources */ = {isa = PBXBuildFile; fileRef = 04409B9012FA97ED00FB9AA8 /* SDL_yuv_sw.c */; };
04409B9512FA97ED00FB9AA8 /* mmx.h in Headers */ = {isa = PBXBuildFile; fileRef = 04409B8D12FA97ED00FB9AA8 /* mmx.h */; };
04409B9612FA97ED00FB9AA8 /* SDL_yuv_mmx.c in Sources */ = {isa = PBXBuildFile; fileRef = 04409B8E12FA97ED00FB9AA8 /* SDL_yuv_mmx.c */; };
04409B9712FA97ED00FB9AA8 /* SDL_yuv_sw_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04409B8F12FA97ED00FB9AA8 /* SDL_yuv_sw_c.h */; };
04409B9812FA97ED00FB9AA8 /* SDL_yuv_sw.c in Sources */ = {isa = PBXBuildFile; fileRef = 04409B9012FA97ED00FB9AA8 /* SDL_yuv_sw.c */; };
044E5F8511E6051C0076F181 /* SDL_clipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = 044E5F8411E6051C0076F181 /* SDL_clipboard.h */; settings = {ATTRIBUTES = (Public, ); }; }; 044E5F8511E6051C0076F181 /* SDL_clipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = 044E5F8411E6051C0076F181 /* SDL_clipboard.h */; settings = {ATTRIBUTES = (Public, ); }; };
044E5F8611E6051C0076F181 /* SDL_clipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = 044E5F8411E6051C0076F181 /* SDL_clipboard.h */; }; 044E5F8611E6051C0076F181 /* SDL_clipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = 044E5F8411E6051C0076F181 /* SDL_clipboard.h */; };
0469A10B12EE4BF100B846D6 /* SDL_blendmode.h in Headers */ = {isa = PBXBuildFile; fileRef = 0469A10912EE4BF100B846D6 /* SDL_blendmode.h */; settings = {ATTRIBUTES = (Public, ); }; }; 0469A10B12EE4BF100B846D6 /* SDL_blendmode.h in Headers */ = {isa = PBXBuildFile; fileRef = 0469A10912EE4BF100B846D6 /* SDL_blendmode.h */; settings = {ATTRIBUTES = (Public, ); }; };
...@@ -244,7 +252,6 @@ ...@@ -244,7 +252,6 @@
04BD011812E6671800899322 /* SDL_nullevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFEE912E6671800899322 /* SDL_nullevents_c.h */; }; 04BD011812E6671800899322 /* SDL_nullevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFEE912E6671800899322 /* SDL_nullevents_c.h */; };
04BD011B12E6671800899322 /* SDL_nullvideo.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFEEC12E6671800899322 /* SDL_nullvideo.c */; }; 04BD011B12E6671800899322 /* SDL_nullvideo.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFEEC12E6671800899322 /* SDL_nullvideo.c */; };
04BD011C12E6671800899322 /* SDL_nullvideo.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFEED12E6671800899322 /* SDL_nullvideo.h */; }; 04BD011C12E6671800899322 /* SDL_nullvideo.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFEED12E6671800899322 /* SDL_nullvideo.h */; };
04BD013212E6671800899322 /* mmx.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF0412E6671800899322 /* mmx.h */; };
04BD016F12E6671800899322 /* SDL_alphamult.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF4812E6671800899322 /* SDL_alphamult.c */; }; 04BD016F12E6671800899322 /* SDL_alphamult.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF4812E6671800899322 /* SDL_alphamult.c */; };
04BD017012E6671800899322 /* SDL_alphamult.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF4912E6671800899322 /* SDL_alphamult.h */; }; 04BD017012E6671800899322 /* SDL_alphamult.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF4912E6671800899322 /* SDL_alphamult.h */; };
04BD017112E6671800899322 /* SDL_blendfillrect.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF4A12E6671800899322 /* SDL_blendfillrect.c */; }; 04BD017112E6671800899322 /* SDL_blendfillrect.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF4A12E6671800899322 /* SDL_blendfillrect.c */; };
...@@ -285,9 +292,6 @@ ...@@ -285,9 +292,6 @@
04BD019B12E6671800899322 /* SDL_surface.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF7412E6671800899322 /* SDL_surface.c */; }; 04BD019B12E6671800899322 /* SDL_surface.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF7412E6671800899322 /* SDL_surface.c */; };
04BD019C12E6671800899322 /* SDL_sysvideo.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF7512E6671800899322 /* SDL_sysvideo.h */; }; 04BD019C12E6671800899322 /* SDL_sysvideo.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF7512E6671800899322 /* SDL_sysvideo.h */; };
04BD019D12E6671800899322 /* SDL_video.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF7612E6671800899322 /* SDL_video.c */; }; 04BD019D12E6671800899322 /* SDL_video.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF7612E6671800899322 /* SDL_video.c */; };
04BD019E12E6671800899322 /* SDL_yuv_mmx.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF7712E6671800899322 /* SDL_yuv_mmx.c */; };
04BD019F12E6671800899322 /* SDL_yuv_sw.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF7812E6671800899322 /* SDL_yuv_sw.c */; };
04BD01A012E6671800899322 /* SDL_yuv_sw_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF7912E6671800899322 /* SDL_yuv_sw_c.h */; };
04BD01DB12E6671800899322 /* imKStoUCS.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFB812E6671800899322 /* imKStoUCS.c */; }; 04BD01DB12E6671800899322 /* imKStoUCS.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFB812E6671800899322 /* imKStoUCS.c */; };
04BD01DC12E6671800899322 /* imKStoUCS.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFB912E6671800899322 /* imKStoUCS.h */; }; 04BD01DC12E6671800899322 /* imKStoUCS.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFB912E6671800899322 /* imKStoUCS.h */; };
04BD01DD12E6671800899322 /* SDL_x11clipboard.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFBA12E6671800899322 /* SDL_x11clipboard.c */; }; 04BD01DD12E6671800899322 /* SDL_x11clipboard.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFBA12E6671800899322 /* SDL_x11clipboard.c */; };
...@@ -457,7 +461,6 @@ ...@@ -457,7 +461,6 @@
04BD033212E6671800899322 /* SDL_nullevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFEE912E6671800899322 /* SDL_nullevents_c.h */; }; 04BD033212E6671800899322 /* SDL_nullevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFEE912E6671800899322 /* SDL_nullevents_c.h */; };
04BD033512E6671800899322 /* SDL_nullvideo.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFEEC12E6671800899322 /* SDL_nullvideo.c */; }; 04BD033512E6671800899322 /* SDL_nullvideo.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFEEC12E6671800899322 /* SDL_nullvideo.c */; };
04BD033612E6671800899322 /* SDL_nullvideo.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFEED12E6671800899322 /* SDL_nullvideo.h */; }; 04BD033612E6671800899322 /* SDL_nullvideo.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFEED12E6671800899322 /* SDL_nullvideo.h */; };
04BD034C12E6671800899322 /* mmx.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF0412E6671800899322 /* mmx.h */; };
04BD038912E6671800899322 /* SDL_alphamult.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF4812E6671800899322 /* SDL_alphamult.c */; }; 04BD038912E6671800899322 /* SDL_alphamult.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF4812E6671800899322 /* SDL_alphamult.c */; };
04BD038A12E6671800899322 /* SDL_alphamult.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF4912E6671800899322 /* SDL_alphamult.h */; }; 04BD038A12E6671800899322 /* SDL_alphamult.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF4912E6671800899322 /* SDL_alphamult.h */; };
04BD038B12E6671800899322 /* SDL_blendfillrect.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF4A12E6671800899322 /* SDL_blendfillrect.c */; }; 04BD038B12E6671800899322 /* SDL_blendfillrect.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF4A12E6671800899322 /* SDL_blendfillrect.c */; };
...@@ -498,9 +501,6 @@ ...@@ -498,9 +501,6 @@
04BD03B512E6671800899322 /* SDL_surface.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF7412E6671800899322 /* SDL_surface.c */; }; 04BD03B512E6671800899322 /* SDL_surface.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF7412E6671800899322 /* SDL_surface.c */; };
04BD03B612E6671800899322 /* SDL_sysvideo.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF7512E6671800899322 /* SDL_sysvideo.h */; }; 04BD03B612E6671800899322 /* SDL_sysvideo.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF7512E6671800899322 /* SDL_sysvideo.h */; };
04BD03B712E6671800899322 /* SDL_video.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF7612E6671800899322 /* SDL_video.c */; }; 04BD03B712E6671800899322 /* SDL_video.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF7612E6671800899322 /* SDL_video.c */; };
04BD03B812E6671800899322 /* SDL_yuv_mmx.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF7712E6671800899322 /* SDL_yuv_mmx.c */; };
04BD03B912E6671800899322 /* SDL_yuv_sw.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF7812E6671800899322 /* SDL_yuv_sw.c */; };
04BD03BA12E6671800899322 /* SDL_yuv_sw_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF7912E6671800899322 /* SDL_yuv_sw_c.h */; };
04BD03F312E6671800899322 /* imKStoUCS.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFB812E6671800899322 /* imKStoUCS.c */; }; 04BD03F312E6671800899322 /* imKStoUCS.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFB812E6671800899322 /* imKStoUCS.c */; };
04BD03F412E6671800899322 /* imKStoUCS.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFB912E6671800899322 /* imKStoUCS.h */; }; 04BD03F412E6671800899322 /* imKStoUCS.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFB912E6671800899322 /* imKStoUCS.h */; };
04BD03F512E6671800899322 /* SDL_x11clipboard.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFBA12E6671800899322 /* SDL_x11clipboard.c */; }; 04BD03F512E6671800899322 /* SDL_x11clipboard.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFBA12E6671800899322 /* SDL_x11clipboard.c */; };
...@@ -701,6 +701,10 @@ ...@@ -701,6 +701,10 @@
041B2C9E12FA0D680087D585 /* SDL_render.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_render.c; sourceTree = "<group>"; }; 041B2C9E12FA0D680087D585 /* SDL_render.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_render.c; sourceTree = "<group>"; };
041B2C9F12FA0D680087D585 /* SDL_sysrender.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_sysrender.h; sourceTree = "<group>"; }; 041B2C9F12FA0D680087D585 /* SDL_sysrender.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_sysrender.h; sourceTree = "<group>"; };
041B2CA112FA0D680087D585 /* SDL_renderer_sw.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_renderer_sw.c; sourceTree = "<group>"; }; 041B2CA112FA0D680087D585 /* SDL_renderer_sw.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_renderer_sw.c; sourceTree = "<group>"; };
04409B8D12FA97ED00FB9AA8 /* mmx.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mmx.h; sourceTree = "<group>"; };
04409B8E12FA97ED00FB9AA8 /* SDL_yuv_mmx.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_yuv_mmx.c; sourceTree = "<group>"; };
04409B8F12FA97ED00FB9AA8 /* SDL_yuv_sw_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_yuv_sw_c.h; sourceTree = "<group>"; };
04409B9012FA97ED00FB9AA8 /* SDL_yuv_sw.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_yuv_sw.c; sourceTree = "<group>"; };
044E5F8411E6051C0076F181 /* SDL_clipboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_clipboard.h; path = ../../include/SDL_clipboard.h; sourceTree = SOURCE_ROOT; }; 044E5F8411E6051C0076F181 /* SDL_clipboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_clipboard.h; path = ../../include/SDL_clipboard.h; sourceTree = SOURCE_ROOT; };
0469A10912EE4BF100B846D6 /* SDL_blendmode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_blendmode.h; path = ../../include/SDL_blendmode.h; sourceTree = SOURCE_ROOT; }; 0469A10912EE4BF100B846D6 /* SDL_blendmode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_blendmode.h; path = ../../include/SDL_blendmode.h; sourceTree = SOURCE_ROOT; };
04BDFD7412E6671700899322 /* SDL_atomic.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_atomic.c; sourceTree = "<group>"; }; 04BDFD7412E6671700899322 /* SDL_atomic.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_atomic.c; sourceTree = "<group>"; };
...@@ -814,7 +818,6 @@ ...@@ -814,7 +818,6 @@
04BDFEE912E6671800899322 /* SDL_nullevents_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_nullevents_c.h; sourceTree = "<group>"; }; 04BDFEE912E6671800899322 /* SDL_nullevents_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_nullevents_c.h; sourceTree = "<group>"; };
04BDFEEC12E6671800899322 /* SDL_nullvideo.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_nullvideo.c; sourceTree = "<group>"; }; 04BDFEEC12E6671800899322 /* SDL_nullvideo.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_nullvideo.c; sourceTree = "<group>"; };
04BDFEED12E6671800899322 /* SDL_nullvideo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_nullvideo.h; sourceTree = "<group>"; }; 04BDFEED12E6671800899322 /* SDL_nullvideo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_nullvideo.h; sourceTree = "<group>"; };
04BDFF0412E6671800899322 /* mmx.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mmx.h; sourceTree = "<group>"; };
04BDFF4812E6671800899322 /* SDL_alphamult.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_alphamult.c; sourceTree = "<group>"; }; 04BDFF4812E6671800899322 /* SDL_alphamult.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_alphamult.c; sourceTree = "<group>"; };
04BDFF4912E6671800899322 /* SDL_alphamult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_alphamult.h; sourceTree = "<group>"; }; 04BDFF4912E6671800899322 /* SDL_alphamult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_alphamult.h; sourceTree = "<group>"; };
04BDFF4A12E6671800899322 /* SDL_blendfillrect.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_blendfillrect.c; sourceTree = "<group>"; }; 04BDFF4A12E6671800899322 /* SDL_blendfillrect.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_blendfillrect.c; sourceTree = "<group>"; };
...@@ -855,9 +858,6 @@ ...@@ -855,9 +858,6 @@
04BDFF7412E6671800899322 /* SDL_surface.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_surface.c; sourceTree = "<group>"; }; 04BDFF7412E6671800899322 /* SDL_surface.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_surface.c; sourceTree = "<group>"; };
04BDFF7512E6671800899322 /* SDL_sysvideo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_sysvideo.h; sourceTree = "<group>"; }; 04BDFF7512E6671800899322 /* SDL_sysvideo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_sysvideo.h; sourceTree = "<group>"; };
04BDFF7612E6671800899322 /* SDL_video.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_video.c; sourceTree = "<group>"; }; 04BDFF7612E6671800899322 /* SDL_video.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_video.c; sourceTree = "<group>"; };
04BDFF7712E6671800899322 /* SDL_yuv_mmx.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_yuv_mmx.c; sourceTree = "<group>"; };
04BDFF7812E6671800899322 /* SDL_yuv_sw.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_yuv_sw.c; sourceTree = "<group>"; };
04BDFF7912E6671800899322 /* SDL_yuv_sw_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_yuv_sw_c.h; sourceTree = "<group>"; };
04BDFFB812E6671800899322 /* imKStoUCS.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = imKStoUCS.c; sourceTree = "<group>"; }; 04BDFFB812E6671800899322 /* imKStoUCS.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = imKStoUCS.c; sourceTree = "<group>"; };
04BDFFB912E6671800899322 /* imKStoUCS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = imKStoUCS.h; sourceTree = "<group>"; }; 04BDFFB912E6671800899322 /* imKStoUCS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = imKStoUCS.h; sourceTree = "<group>"; };
04BDFFBA12E6671800899322 /* SDL_x11clipboard.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_x11clipboard.c; sourceTree = "<group>"; }; 04BDFFBA12E6671800899322 /* SDL_x11clipboard.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_x11clipboard.c; sourceTree = "<group>"; };
...@@ -1188,8 +1188,12 @@ ...@@ -1188,8 +1188,12 @@
children = ( children = (
041B2C9A12FA0D680087D585 /* opengl */, 041B2C9A12FA0D680087D585 /* opengl */,
041B2CA012FA0D680087D585 /* software */, 041B2CA012FA0D680087D585 /* software */,
04409B8D12FA97ED00FB9AA8 /* mmx.h */,
041B2C9E12FA0D680087D585 /* SDL_render.c */, 041B2C9E12FA0D680087D585 /* SDL_render.c */,
041B2C9F12FA0D680087D585 /* SDL_sysrender.h */, 041B2C9F12FA0D680087D585 /* SDL_sysrender.h */,
04409B8E12FA97ED00FB9AA8 /* SDL_yuv_mmx.c */,
04409B8F12FA97ED00FB9AA8 /* SDL_yuv_sw_c.h */,
04409B9012FA97ED00FB9AA8 /* SDL_yuv_sw.c */,
); );
name = render; name = render;
path = ../../src/render; path = ../../src/render;
...@@ -1483,7 +1487,6 @@ ...@@ -1483,7 +1487,6 @@
04BDFEE712E6671800899322 /* dummy */, 04BDFEE712E6671800899322 /* dummy */,
04BDFFB712E6671800899322 /* x11 */, 04BDFFB712E6671800899322 /* x11 */,
04BDFFD712E6671800899322 /* Xext */, 04BDFFD712E6671800899322 /* Xext */,
04BDFF0412E6671800899322 /* mmx.h */,
04BDFF4812E6671800899322 /* SDL_alphamult.c */, 04BDFF4812E6671800899322 /* SDL_alphamult.c */,
04BDFF4912E6671800899322 /* SDL_alphamult.h */, 04BDFF4912E6671800899322 /* SDL_alphamult.h */,
04BDFF4A12E6671800899322 /* SDL_blendfillrect.c */, 04BDFF4A12E6671800899322 /* SDL_blendfillrect.c */,
...@@ -1524,9 +1527,6 @@ ...@@ -1524,9 +1527,6 @@
04BDFF7412E6671800899322 /* SDL_surface.c */, 04BDFF7412E6671800899322 /* SDL_surface.c */,
04BDFF7512E6671800899322 /* SDL_sysvideo.h */, 04BDFF7512E6671800899322 /* SDL_sysvideo.h */,
04BDFF7612E6671800899322 /* SDL_video.c */, 04BDFF7612E6671800899322 /* SDL_video.c */,
04BDFF7712E6671800899322 /* SDL_yuv_mmx.c */,
04BDFF7812E6671800899322 /* SDL_yuv_sw.c */,
04BDFF7912E6671800899322 /* SDL_yuv_sw_c.h */,
); );
name = video; name = video;
path = ../../src/video; path = ../../src/video;
...@@ -1893,7 +1893,6 @@ ...@@ -1893,7 +1893,6 @@
04BD010312E6671800899322 /* SDL_cocoawindow.h in Headers */, 04BD010312E6671800899322 /* SDL_cocoawindow.h in Headers */,
04BD011812E6671800899322 /* SDL_nullevents_c.h in Headers */, 04BD011812E6671800899322 /* SDL_nullevents_c.h in Headers */,
04BD011C12E6671800899322 /* SDL_nullvideo.h in Headers */, 04BD011C12E6671800899322 /* SDL_nullvideo.h in Headers */,
04BD013212E6671800899322 /* mmx.h in Headers */,
04BD017012E6671800899322 /* SDL_alphamult.h in Headers */, 04BD017012E6671800899322 /* SDL_alphamult.h in Headers */,
04BD017612E6671800899322 /* SDL_blit.h in Headers */, 04BD017612E6671800899322 /* SDL_blit.h in Headers */,
04BD017B12E6671800899322 /* SDL_blit_auto.h in Headers */, 04BD017B12E6671800899322 /* SDL_blit_auto.h in Headers */,
...@@ -1907,7 +1906,6 @@ ...@@ -1907,7 +1906,6 @@
04BD019712E6671800899322 /* SDL_RLEaccel_c.h in Headers */, 04BD019712E6671800899322 /* SDL_RLEaccel_c.h in Headers */,
04BD019912E6671800899322 /* SDL_shape_internals.h in Headers */, 04BD019912E6671800899322 /* SDL_shape_internals.h in Headers */,
04BD019C12E6671800899322 /* SDL_sysvideo.h in Headers */, 04BD019C12E6671800899322 /* SDL_sysvideo.h in Headers */,
04BD01A012E6671800899322 /* SDL_yuv_sw_c.h in Headers */,
04BD01DC12E6671800899322 /* imKStoUCS.h in Headers */, 04BD01DC12E6671800899322 /* imKStoUCS.h in Headers */,
04BD01DE12E6671800899322 /* SDL_x11clipboard.h in Headers */, 04BD01DE12E6671800899322 /* SDL_x11clipboard.h in Headers */,
04BD01E012E6671800899322 /* SDL_x11dyn.h in Headers */, 04BD01E012E6671800899322 /* SDL_x11dyn.h in Headers */,
...@@ -1942,6 +1940,8 @@ ...@@ -1942,6 +1940,8 @@
0469A10B12EE4BF100B846D6 /* SDL_blendmode.h in Headers */, 0469A10B12EE4BF100B846D6 /* SDL_blendmode.h in Headers */,
041B2C9512FA0D2A0087D585 /* SDL_render.h in Headers */, 041B2C9512FA0D2A0087D585 /* SDL_render.h in Headers */,
041B2CA612FA0D680087D585 /* SDL_sysrender.h in Headers */, 041B2CA612FA0D680087D585 /* SDL_sysrender.h in Headers */,
04409B9112FA97ED00FB9AA8 /* mmx.h in Headers */,
04409B9312FA97ED00FB9AA8 /* SDL_yuv_sw_c.h in Headers */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
...@@ -2016,7 +2016,6 @@ ...@@ -2016,7 +2016,6 @@
04BD031D12E6671800899322 /* SDL_cocoawindow.h in Headers */, 04BD031D12E6671800899322 /* SDL_cocoawindow.h in Headers */,
04BD033212E6671800899322 /* SDL_nullevents_c.h in Headers */, 04BD033212E6671800899322 /* SDL_nullevents_c.h in Headers */,
04BD033612E6671800899322 /* SDL_nullvideo.h in Headers */, 04BD033612E6671800899322 /* SDL_nullvideo.h in Headers */,
04BD034C12E6671800899322 /* mmx.h in Headers */,
04BD038A12E6671800899322 /* SDL_alphamult.h in Headers */, 04BD038A12E6671800899322 /* SDL_alphamult.h in Headers */,
04BD039012E6671800899322 /* SDL_blit.h in Headers */, 04BD039012E6671800899322 /* SDL_blit.h in Headers */,
04BD039512E6671800899322 /* SDL_blit_auto.h in Headers */, 04BD039512E6671800899322 /* SDL_blit_auto.h in Headers */,
...@@ -2030,7 +2029,6 @@ ...@@ -2030,7 +2029,6 @@
04BD03B112E6671800899322 /* SDL_RLEaccel_c.h in Headers */, 04BD03B112E6671800899322 /* SDL_RLEaccel_c.h in Headers */,
04BD03B312E6671800899322 /* SDL_shape_internals.h in Headers */, 04BD03B312E6671800899322 /* SDL_shape_internals.h in Headers */,
04BD03B612E6671800899322 /* SDL_sysvideo.h in Headers */, 04BD03B612E6671800899322 /* SDL_sysvideo.h in Headers */,
04BD03BA12E6671800899322 /* SDL_yuv_sw_c.h in Headers */,
04BD03F412E6671800899322 /* imKStoUCS.h in Headers */, 04BD03F412E6671800899322 /* imKStoUCS.h in Headers */,
04BD03F612E6671800899322 /* SDL_x11clipboard.h in Headers */, 04BD03F612E6671800899322 /* SDL_x11clipboard.h in Headers */,
04BD03F812E6671800899322 /* SDL_x11dyn.h in Headers */, 04BD03F812E6671800899322 /* SDL_x11dyn.h in Headers */,
...@@ -2065,6 +2063,8 @@ ...@@ -2065,6 +2063,8 @@
0469A10D12EE4BF100B846D6 /* SDL_blendmode.h in Headers */, 0469A10D12EE4BF100B846D6 /* SDL_blendmode.h in Headers */,
041B2C9612FA0D2A0087D585 /* SDL_render.h in Headers */, 041B2C9612FA0D2A0087D585 /* SDL_render.h in Headers */,
041B2CAC12FA0D680087D585 /* SDL_sysrender.h in Headers */, 041B2CAC12FA0D680087D585 /* SDL_sysrender.h in Headers */,
04409B9512FA97ED00FB9AA8 /* mmx.h in Headers */,
04409B9712FA97ED00FB9AA8 /* SDL_yuv_sw_c.h in Headers */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
...@@ -2412,8 +2412,6 @@ ...@@ -2412,8 +2412,6 @@
04BD019A12E6671800899322 /* SDL_stretch.c in Sources */, 04BD019A12E6671800899322 /* SDL_stretch.c in Sources */,
04BD019B12E6671800899322 /* SDL_surface.c in Sources */, 04BD019B12E6671800899322 /* SDL_surface.c in Sources */,
04BD019D12E6671800899322 /* SDL_video.c in Sources */, 04BD019D12E6671800899322 /* SDL_video.c in Sources */,
04BD019E12E6671800899322 /* SDL_yuv_mmx.c in Sources */,
04BD019F12E6671800899322 /* SDL_yuv_sw.c in Sources */,
04BD01DB12E6671800899322 /* imKStoUCS.c in Sources */, 04BD01DB12E6671800899322 /* imKStoUCS.c in Sources */,
04BD01DD12E6671800899322 /* SDL_x11clipboard.c in Sources */, 04BD01DD12E6671800899322 /* SDL_x11clipboard.c in Sources */,
04BD01DF12E6671800899322 /* SDL_x11dyn.c in Sources */, 04BD01DF12E6671800899322 /* SDL_x11dyn.c in Sources */,
...@@ -2443,6 +2441,8 @@ ...@@ -2443,6 +2441,8 @@
041B2CA312FA0D680087D585 /* SDL_renderer_gl.c in Sources */, 041B2CA312FA0D680087D585 /* SDL_renderer_gl.c in Sources */,
041B2CA512FA0D680087D585 /* SDL_render.c in Sources */, 041B2CA512FA0D680087D585 /* SDL_render.c in Sources */,
041B2CA712FA0D680087D585 /* SDL_renderer_sw.c in Sources */, 041B2CA712FA0D680087D585 /* SDL_renderer_sw.c in Sources */,
04409B9212FA97ED00FB9AA8 /* SDL_yuv_mmx.c in Sources */,
04409B9412FA97ED00FB9AA8 /* SDL_yuv_sw.c in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
...@@ -2539,8 +2539,6 @@ ...@@ -2539,8 +2539,6 @@
04BD03B412E6671800899322 /* SDL_stretch.c in Sources */, 04BD03B412E6671800899322 /* SDL_stretch.c in Sources */,
04BD03B512E6671800899322 /* SDL_surface.c in Sources */, 04BD03B512E6671800899322 /* SDL_surface.c in Sources */,
04BD03B712E6671800899322 /* SDL_video.c in Sources */, 04BD03B712E6671800899322 /* SDL_video.c in Sources */,
04BD03B812E6671800899322 /* SDL_yuv_mmx.c in Sources */,
04BD03B912E6671800899322 /* SDL_yuv_sw.c in Sources */,
04BD03F312E6671800899322 /* imKStoUCS.c in Sources */, 04BD03F312E6671800899322 /* imKStoUCS.c in Sources */,
04BD03F512E6671800899322 /* SDL_x11clipboard.c in Sources */, 04BD03F512E6671800899322 /* SDL_x11clipboard.c in Sources */,
04BD03F712E6671800899322 /* SDL_x11dyn.c in Sources */, 04BD03F712E6671800899322 /* SDL_x11dyn.c in Sources */,
...@@ -2570,6 +2568,8 @@ ...@@ -2570,6 +2568,8 @@
041B2CA912FA0D680087D585 /* SDL_renderer_gl.c in Sources */, 041B2CA912FA0D680087D585 /* SDL_renderer_gl.c in Sources */,
041B2CAB12FA0D680087D585 /* SDL_render.c in Sources */, 041B2CAB12FA0D680087D585 /* SDL_render.c in Sources */,
041B2CAD12FA0D680087D585 /* SDL_renderer_sw.c in Sources */, 041B2CAD12FA0D680087D585 /* SDL_renderer_sw.c in Sources */,
04409B9612FA97ED00FB9AA8 /* SDL_yuv_mmx.c in Sources */,
04409B9812FA97ED00FB9AA8 /* SDL_yuv_sw.c in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
......
...@@ -122,18 +122,26 @@ enum ...@@ -122,18 +122,26 @@ enum
#define SDL_PIXELORDER(X) (((X) >> 20) & 0x0F) #define SDL_PIXELORDER(X) (((X) >> 20) & 0x0F)
#define SDL_PIXELLAYOUT(X) (((X) >> 16) & 0x0F) #define SDL_PIXELLAYOUT(X) (((X) >> 16) & 0x0F)
#define SDL_BITSPERPIXEL(X) (((X) >> 8) & 0xFF) #define SDL_BITSPERPIXEL(X) (((X) >> 8) & 0xFF)
#define SDL_BYTESPERPIXEL(X) (((X) >> 0) & 0xFF) #define SDL_BYTESPERPIXEL(X) \
(SDL_ISPIXELFORMAT_FOURCC(X) ? \
((((X) == SDL_PIXELFORMAT_YV12) || \
((X) == SDL_PIXELFORMAT_IYUV) || \
((X) == SDL_PIXELFORMAT_YUY2) || \
((X) == SDL_PIXELFORMAT_UYVY) || \
((X) == SDL_PIXELFORMAT_YVYU)) ? 2 : 1) : (((X) >> 0) & 0xFF))
#define SDL_ISPIXELFORMAT_INDEXED(format) \ #define SDL_ISPIXELFORMAT_INDEXED(format) \
(!SDL_ISPIXELFORMAT_FOURCC(format) && \
((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX1) || \ ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX1) || \
(SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX4) || \ (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX4) || \
(SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX8)) (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX8)))
#define SDL_ISPIXELFORMAT_ALPHA(format) \ #define SDL_ISPIXELFORMAT_ALPHA(format) \
(!SDL_ISPIXELFORMAT_FOURCC(format) && \
((SDL_PIXELORDER(format) == SDL_PACKEDORDER_ARGB) || \ ((SDL_PIXELORDER(format) == SDL_PACKEDORDER_ARGB) || \
(SDL_PIXELORDER(format) == SDL_PACKEDORDER_RGBA) || \ (SDL_PIXELORDER(format) == SDL_PACKEDORDER_RGBA) || \
(SDL_PIXELORDER(format) == SDL_PACKEDORDER_ABGR) || \ (SDL_PIXELORDER(format) == SDL_PACKEDORDER_ABGR) || \
(SDL_PIXELORDER(format) == SDL_PACKEDORDER_BGRA)) (SDL_PIXELORDER(format) == SDL_PACKEDORDER_BGRA)))
#define SDL_ISPIXELFORMAT_FOURCC(format) \ #define SDL_ISPIXELFORMAT_FOURCC(format) \
((format) && !((format) & 0x80000000)) ((format) && !((format) & 0x80000000))
......
...@@ -69,25 +69,6 @@ typedef struct SDL_Rect ...@@ -69,25 +69,6 @@ typedef struct SDL_Rect
int w, h; int w, h;
} SDL_Rect; } SDL_Rect;
/**
* \brief A structure used to track dirty rectangles
*
* \sa SDL_AddDirtyRect
* \sa SDL_ClearDirtyRects
* \sa SDL_FreeDirtyRects
*/
typedef struct SDL_DirtyRect
{
SDL_Rect rect;
struct SDL_DirtyRect *next;
} SDL_DirtyRect;
typedef struct SDL_DirtyRectList
{
SDL_DirtyRect *list;
SDL_DirtyRect *free;
} SDL_DirtyRectList;
/** /**
* \brief Returns true if the rectangle has no area. * \brief Returns true if the rectangle has no area.
*/ */
...@@ -143,22 +124,6 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRectAndLine(const SDL_Rect * ...@@ -143,22 +124,6 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRectAndLine(const SDL_Rect *
int *Y1, int *X2, int *Y1, int *X2,
int *Y2); int *Y2);
/**
* \brief Add a rectangle to a dirty rectangle list
*/
extern DECLSPEC void SDLCALL SDL_AddDirtyRect(SDL_DirtyRectList * list, const SDL_Rect * rect);
/**
* \brief Remove all rectangles associated with a dirty rectangle list
*/
extern DECLSPEC void SDLCALL SDL_ClearDirtyRects(SDL_DirtyRectList * list);
/**
* \brief Free memory associated with a dirty rectangle list
*/
extern DECLSPEC void SDLCALL SDL_FreeDirtyRects(SDL_DirtyRectList * list);
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
/* *INDENT-OFF* */ /* *INDENT-OFF* */
......
...@@ -61,7 +61,7 @@ typedef struct SDL_RendererInfo ...@@ -61,7 +61,7 @@ typedef struct SDL_RendererInfo
const char *name; /**< The name of the renderer */ const char *name; /**< The name of the renderer */
Uint32 flags; /**< Supported ::SDL_RendererFlags */ Uint32 flags; /**< Supported ::SDL_RendererFlags */
Uint32 num_texture_formats; /**< The number of available texture formats */ Uint32 num_texture_formats; /**< The number of available texture formats */
Uint32 texture_formats[50]; /**< The available texture formats */ Uint32 texture_formats[16]; /**< The available texture formats */
int max_texture_width; /**< The maximimum texture width */ int max_texture_width; /**< The maximimum texture width */
int max_texture_height; /**< The maximimum texture height */ int max_texture_height; /**< The maximimum texture height */
} SDL_RendererInfo; } SDL_RendererInfo;
...@@ -203,22 +203,6 @@ extern DECLSPEC int SDLCALL SDL_QueryTexture(SDL_Texture * texture, ...@@ -203,22 +203,6 @@ extern DECLSPEC int SDLCALL SDL_QueryTexture(SDL_Texture * texture,
Uint32 * format, int *access, Uint32 * format, int *access,
int *w, int *h); int *w, int *h);
/**
* \brief Query the pixels of a texture, if the texture does not need to be
* locked for pixel access.
*
* \param texture A texture to be queried, which was created with
* ::SDL_TEXTUREACCESS_STREAMING.
* \param pixels A pointer filled with a pointer to the pixels for the
* texture.
* \param pitch A pointer filled in with the pitch of the pixel data.
*
* \return 0 on success, or -1 if the texture is not valid, or must be locked
* for pixel access.
*/
extern DECLSPEC int SDLCALL SDL_QueryTexturePixels(SDL_Texture * texture,
void **pixels, int *pitch);
/** /**
* \brief Set an additional color value used in render copy operations. * \brief Set an additional color value used in render copy operations.
* *
...@@ -333,46 +317,25 @@ extern DECLSPEC int SDLCALL SDL_UpdateTexture(SDL_Texture * texture, ...@@ -333,46 +317,25 @@ extern DECLSPEC int SDLCALL SDL_UpdateTexture(SDL_Texture * texture,
* ::SDL_TEXTUREACCESS_STREAMING. * ::SDL_TEXTUREACCESS_STREAMING.
* \param rect A pointer to the rectangle to lock for access. If the rect * \param rect A pointer to the rectangle to lock for access. If the rect
* is NULL, the entire texture will be locked. * is NULL, the entire texture will be locked.
* \param markDirty If this is nonzero, the locked area will be marked dirty
* when the texture is unlocked.
* \param pixels This is filled in with a pointer to the locked pixels, * \param pixels This is filled in with a pointer to the locked pixels,
* appropriately offset by the locked area. * appropriately offset by the locked area.
* \param pitch This is filled in with the pitch of the locked pixels. * \param pitch This is filled in with the pitch of the locked pixels.
* *
* \return 0 on success, or -1 if the texture is not valid or was created with * \return 0 on success, or -1 if the texture is not valid or was not created with ::SDL_TEXTUREACCESS_STREAMING.
* ::SDL_TEXTUREACCESS_STATIC.
* *
* \sa SDL_DirtyTexture()
* \sa SDL_UnlockTexture() * \sa SDL_UnlockTexture()
*/ */
extern DECLSPEC int SDLCALL SDL_LockTexture(SDL_Texture * texture, extern DECLSPEC int SDLCALL SDL_LockTexture(SDL_Texture * texture,
const SDL_Rect * rect, const SDL_Rect * rect,
int markDirty, void **pixels, void **pixels, int *pitch);
int *pitch);
/** /**
* \brief Unlock a texture, uploading the changes to renderer memory, if needed. * \brief Unlock a texture, uploading the changes to video memory, if needed.
* *
* \sa SDL_LockTexture() * \sa SDL_LockTexture()
* \sa SDL_DirtyTexture()
*/ */
extern DECLSPEC void SDLCALL SDL_UnlockTexture(SDL_Texture * texture); extern DECLSPEC void SDLCALL SDL_UnlockTexture(SDL_Texture * texture);
/**
* \brief Mark the specified rectangles of the texture as dirty.
*
* \param texture The texture to mark dirty, which was created with
* ::SDL_TEXTUREACCESS_STREAMING.
* \param numrects The number of rectangles pointed to by rects.
* \param rects The pointer to an array of dirty rectangles.
*
* \sa SDL_LockTexture()
* \sa SDL_UnlockTexture()
*/
extern DECLSPEC void SDLCALL SDL_DirtyTexture(SDL_Texture * texture,
int numrects,
const SDL_Rect * rects);
/** /**
* \brief Set the color used for drawing operations (Fill and Line). * \brief Set the color used for drawing operations (Fill and Line).
* *
......
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
#include "video/SDL_sysvideo.h" #include "video/SDL_sysvideo.h"
#include "video/SDL_pixels_c.h" #include "video/SDL_pixels_c.h"
#include "video/SDL_yuv_sw_c.h"
static SDL_Window *SDL_VideoWindow = NULL; static SDL_Window *SDL_VideoWindow = NULL;
static SDL_Renderer *SDL_VideoRenderer = NULL; static SDL_Renderer *SDL_VideoRenderer = NULL;
...@@ -344,13 +343,10 @@ GetEnvironmentWindowPosition(int w, int h, int *x, int *y) ...@@ -344,13 +343,10 @@ GetEnvironmentWindowPosition(int w, int h, int *x, int *y)
static SDL_Surface * static SDL_Surface *
CreateVideoSurface(SDL_Texture * texture) CreateVideoSurface(SDL_Texture * texture)
{ {
SDL_Surface *surface;
Uint32 format; Uint32 format;
int w, h; int w, h;
int bpp; int bpp;
Uint32 Rmask, Gmask, Bmask, Amask; Uint32 Rmask, Gmask, Bmask, Amask;
void *pixels;
int pitch;
if (SDL_QueryTexture(texture, &format, NULL, &w, &h) < 0) { if (SDL_QueryTexture(texture, &format, NULL, &w, &h) < 0) {
return NULL; return NULL;
...@@ -362,15 +358,7 @@ CreateVideoSurface(SDL_Texture * texture) ...@@ -362,15 +358,7 @@ CreateVideoSurface(SDL_Texture * texture)
return NULL; return NULL;
} }
if (SDL_QueryTexturePixels(texture, &pixels, &pitch) == 0) { return SDL_CreateRGBSurface(0, w, h, bpp, Rmask, Gmask, Bmask, Amask);
surface =
SDL_CreateRGBSurfaceFrom(pixels, w, h, bpp, pitch, Rmask, Gmask,
Bmask, Amask);
} else {
surface =
SDL_CreateRGBSurface(0, w, h, bpp, Rmask, Gmask, Bmask, Amask);
}
return surface;
} }
static void static void
...@@ -412,8 +400,6 @@ SDL_ResizeVideoMode(int width, int height, int bpp, Uint32 flags) ...@@ -412,8 +400,6 @@ SDL_ResizeVideoMode(int width, int height, int bpp, Uint32 flags)
int w, h; int w, h;
Uint32 format; Uint32 format;
int access; int access;
void *pixels;
int pitch;
/* We can't resize something we don't have... */ /* We can't resize something we don't have... */
if (!SDL_VideoWindow) { if (!SDL_VideoWindow) {
...@@ -454,15 +440,10 @@ SDL_ResizeVideoMode(int width, int height, int bpp, Uint32 flags) ...@@ -454,15 +440,10 @@ SDL_ResizeVideoMode(int width, int height, int bpp, Uint32 flags)
SDL_VideoSurface->w = width; SDL_VideoSurface->w = width;
SDL_VideoSurface->h = height; SDL_VideoSurface->h = height;
if (SDL_QueryTexturePixels(SDL_VideoTexture, &pixels, &pitch) == 0) {
SDL_VideoSurface->pixels = pixels;
SDL_VideoSurface->pitch = pitch;
} else {
SDL_CalculatePitch(SDL_VideoSurface); SDL_CalculatePitch(SDL_VideoSurface);
SDL_VideoSurface->pixels = SDL_VideoSurface->pixels =
SDL_realloc(SDL_VideoSurface->pixels, SDL_realloc(SDL_VideoSurface->pixels,
SDL_VideoSurface->h * SDL_VideoSurface->pitch); SDL_VideoSurface->h * SDL_VideoSurface->pitch);
}
SDL_SetClipRect(SDL_VideoSurface, NULL); SDL_SetClipRect(SDL_VideoSurface, NULL);
SDL_InvalidateMap(SDL_VideoSurface->map); SDL_InvalidateMap(SDL_VideoSurface->map);
...@@ -830,10 +811,6 @@ SDL_UpdateRects(SDL_Surface * screen, int numrects, SDL_Rect * rects) ...@@ -830,10 +811,6 @@ SDL_UpdateRects(SDL_Surface * screen, int numrects, SDL_Rect * rects)
screen = SDL_VideoSurface; screen = SDL_VideoSurface;
} }
if (screen == SDL_VideoSurface) { if (screen == SDL_VideoSurface) {
if (screen->flags & SDL_PREALLOC) {
/* The surface memory is maintained by the renderer */
SDL_DirtyTexture(SDL_VideoTexture, numrects, rects);
} else {
/* The surface memory needs to be copied to texture */ /* The surface memory needs to be copied to texture */
int pitch = screen->pitch; int pitch = screen->pitch;
int psize = screen->format->BytesPerPixel; int psize = screen->format->BytesPerPixel;
...@@ -844,7 +821,6 @@ SDL_UpdateRects(SDL_Surface * screen, int numrects, SDL_Rect * rects) ...@@ -844,7 +821,6 @@ SDL_UpdateRects(SDL_Surface * screen, int numrects, SDL_Rect * rects)
rect->x * psize; rect->x * psize;
SDL_UpdateTexture(SDL_VideoTexture, rect, pixels, pitch); SDL_UpdateTexture(SDL_VideoTexture, rect, pixels, pitch);
} }
}
rect.x = 0; rect.x = 0;
rect.y = 0; rect.y = 0;
rect.w = screen->w; rect.w = screen->w;
...@@ -1459,8 +1435,6 @@ struct private_yuvhwdata ...@@ -1459,8 +1435,6 @@ struct private_yuvhwdata
Uint16 pitches[3]; Uint16 pitches[3];
Uint8 *planes[3]; Uint8 *planes[3];
SDL_SW_YUVTexture *sw;
SDL_Texture *texture; SDL_Texture *texture;
Uint32 texture_format; Uint32 texture_format;
}; };
...@@ -1545,24 +1519,6 @@ SDL_CreateYUVOverlay(int w, int h, Uint32 format, SDL_Surface * display) ...@@ -1545,24 +1519,6 @@ SDL_CreateYUVOverlay(int w, int h, Uint32 format, SDL_Surface * display)
overlay->hwdata->texture = overlay->hwdata->texture =
SDL_CreateTexture(SDL_VideoRenderer, texture_format, SDL_CreateTexture(SDL_VideoRenderer, texture_format,
SDL_TEXTUREACCESS_STREAMING, w, h); SDL_TEXTUREACCESS_STREAMING, w, h);
if (overlay->hwdata->texture) {
overlay->hwdata->sw = NULL;
} else {
SDL_DisplayMode current_mode;
overlay->hwdata->sw = SDL_SW_CreateYUVTexture(texture_format, w, h);
if (!overlay->hwdata->sw) {
SDL_FreeYUVOverlay(overlay);
return NULL;
}
/* Create a supported RGB format texture for display */
SDL_GetCurrentDisplayMode(&current_mode);
texture_format = current_mode.format;
overlay->hwdata->texture =
SDL_CreateTexture(SDL_VideoRenderer, texture_format,
SDL_TEXTUREACCESS_STREAMING, w, h);
}
if (!overlay->hwdata->texture) { if (!overlay->hwdata->texture) {
SDL_FreeYUVOverlay(overlay); SDL_FreeYUVOverlay(overlay);
return NULL; return NULL;
...@@ -1582,18 +1538,9 @@ SDL_LockYUVOverlay(SDL_Overlay * overlay) ...@@ -1582,18 +1538,9 @@ SDL_LockYUVOverlay(SDL_Overlay * overlay)
SDL_SetError("Passed a NULL overlay"); SDL_SetError("Passed a NULL overlay");
return -1; return -1;
} }
if (overlay->hwdata->sw) { if (SDL_LockTexture(overlay->hwdata->texture, NULL, &pixels, &pitch) < 0) {
if (SDL_SW_QueryYUVTexturePixels(overlay->hwdata->sw, &pixels, &pitch)
< 0) {
return -1;
}
} else {
if (SDL_LockTexture
(overlay->hwdata->texture, NULL, 1, &pixels, &pitch)
< 0) {
return -1; return -1;
} }
}
overlay->pixels[0] = (Uint8 *) pixels; overlay->pixels[0] = (Uint8 *) pixels;
overlay->pitches[0] = pitch; overlay->pitches[0] = pitch;
switch (overlay->format) { switch (overlay->format) {
...@@ -1620,25 +1567,7 @@ SDL_UnlockYUVOverlay(SDL_Overlay * overlay) ...@@ -1620,25 +1567,7 @@ SDL_UnlockYUVOverlay(SDL_Overlay * overlay)
if (!overlay) { if (!overlay) {
return; return;
} }
if (overlay->hwdata->sw) {
void *pixels;
int pitch;
if (SDL_LockTexture
(overlay->hwdata->texture, NULL, 1, &pixels, &pitch) == 0) {
SDL_Rect srcrect;
srcrect.x = 0;
srcrect.y = 0;
srcrect.w = overlay->w;
srcrect.h = overlay->h;
SDL_SW_CopyYUVToRGB(overlay->hwdata->sw, &srcrect,
overlay->hwdata->texture_format,
overlay->w, overlay->h, pixels, pitch);
SDL_UnlockTexture(overlay->hwdata->texture);
}
} else {
SDL_UnlockTexture(overlay->hwdata->texture); SDL_UnlockTexture(overlay->hwdata->texture);
}
} }
int int
......
...@@ -152,6 +152,34 @@ SDL_GetRendererInfo(SDL_Renderer * renderer, SDL_RendererInfo * info) ...@@ -152,6 +152,34 @@ SDL_GetRendererInfo(SDL_Renderer * renderer, SDL_RendererInfo * info)
return 0; return 0;
} }
static SDL_bool
IsSupportedFormat(SDL_Renderer * renderer, Uint32 format)
{
Uint32 i;
for (i = 0; i < renderer->info.num_texture_formats; ++i) {
if (renderer->info.texture_formats[i] == format) {
return SDL_TRUE;
}
}
return SDL_FALSE;
}
static Uint32
GetClosestSupportedFormat(SDL_Renderer * renderer, Uint32 format)
{
Uint32 i;
SDL_bool hasAlpha = SDL_ISPIXELFORMAT_ALPHA(format);
/* We just want to match the first format that has the same channels */
for (i = 0; i < renderer->info.num_texture_formats; ++i) {
if (SDL_ISPIXELFORMAT_ALPHA(renderer->info.texture_formats[i]) == hasAlpha) {
return renderer->info.texture_formats[i];
}
}
return renderer->info.texture_formats[0];
}
SDL_Texture * SDL_Texture *
SDL_CreateTexture(SDL_Renderer * renderer, Uint32 format, int access, int w, int h) SDL_CreateTexture(SDL_Renderer * renderer, Uint32 format, int access, int w, int h)
{ {
...@@ -159,14 +187,18 @@ SDL_CreateTexture(SDL_Renderer * renderer, Uint32 format, int access, int w, int ...@@ -159,14 +187,18 @@ SDL_CreateTexture(SDL_Renderer * renderer, Uint32 format, int access, int w, int
CHECK_RENDERER_MAGIC(renderer, NULL); CHECK_RENDERER_MAGIC(renderer, NULL);
if (SDL_ISPIXELFORMAT_INDEXED(format)) {
SDL_SetError("Palettized textures are not supported");
return NULL;
}
if (w <= 0 || h <= 0) { if (w <= 0 || h <= 0) {
SDL_SetError("Texture dimensions can't be 0"); SDL_SetError("Texture dimensions can't be 0");
return 0; return NULL;
} }
texture = (SDL_Texture *) SDL_calloc(1, sizeof(*texture)); texture = (SDL_Texture *) SDL_calloc(1, sizeof(*texture));
if (!texture) { if (!texture) {
SDL_OutOfMemory(); SDL_OutOfMemory();
return 0; return NULL;
} }
texture->magic = &texture_magic; texture->magic = &texture_magic;
texture->format = format; texture->format = format;
...@@ -184,10 +216,36 @@ SDL_CreateTexture(SDL_Renderer * renderer, Uint32 format, int access, int w, int ...@@ -184,10 +216,36 @@ SDL_CreateTexture(SDL_Renderer * renderer, Uint32 format, int access, int w, int
} }
renderer->textures = texture; renderer->textures = texture;
if (IsSupportedFormat(renderer, format)) {
if (renderer->CreateTexture(renderer, texture) < 0) { if (renderer->CreateTexture(renderer, texture) < 0) {
SDL_DestroyTexture(texture); SDL_DestroyTexture(texture);
return 0; return 0;
} }
} else {
texture->native = SDL_CreateTexture(renderer,
GetClosestSupportedFormat(renderer, format),
access, w, h);
if (!texture->native) {
SDL_DestroyTexture(texture);
return NULL;
}
if (SDL_ISPIXELFORMAT_FOURCC(texture->format)) {
texture->yuv = SDL_SW_CreateYUVTexture(format, w, h);
if (!texture->yuv) {
SDL_DestroyTexture(texture);
return NULL;
}
} else if (access == SDL_TEXTUREACCESS_STREAMING) {
/* The pitch is 4 byte aligned */
texture->pitch = (((w * SDL_BYTESPERPIXEL(format)) + 3) & ~3);
texture->pixels = SDL_malloc(texture->pitch * h);
if (!texture->pixels) {
SDL_DestroyTexture(texture);
return NULL;
}
}
}
return texture; return texture;
} }
...@@ -500,21 +558,6 @@ SDL_QueryTexture(SDL_Texture * texture, Uint32 * format, int *access, ...@@ -500,21 +558,6 @@ SDL_QueryTexture(SDL_Texture * texture, Uint32 * format, int *access,
return 0; return 0;
} }
int
SDL_QueryTexturePixels(SDL_Texture * texture, void **pixels, int *pitch)
{
SDL_Renderer *renderer;
CHECK_TEXTURE_MAGIC(texture, -1);
renderer = texture->renderer;
if (!renderer->QueryTexturePixels) {
SDL_Unsupported();
return -1;
}
return renderer->QueryTexturePixels(renderer, texture, pixels, pitch);
}
int int
SDL_SetTextureColorMod(SDL_Texture * texture, Uint8 r, Uint8 g, Uint8 b) SDL_SetTextureColorMod(SDL_Texture * texture, Uint8 r, Uint8 g, Uint8 b)
{ {
...@@ -531,7 +574,9 @@ SDL_SetTextureColorMod(SDL_Texture * texture, Uint8 r, Uint8 g, Uint8 b) ...@@ -531,7 +574,9 @@ SDL_SetTextureColorMod(SDL_Texture * texture, Uint8 r, Uint8 g, Uint8 b)
texture->r = r; texture->r = r;
texture->g = g; texture->g = g;
texture->b = b; texture->b = b;
if (renderer->SetTextureColorMod) { if (texture->native) {
return SDL_SetTextureColorMod(texture->native, r, g, b);
} else if (renderer->SetTextureColorMod) {
return renderer->SetTextureColorMod(renderer, texture); return renderer->SetTextureColorMod(renderer, texture);
} else { } else {
return 0; return 0;
...@@ -573,7 +618,9 @@ SDL_SetTextureAlphaMod(SDL_Texture * texture, Uint8 alpha) ...@@ -573,7 +618,9 @@ SDL_SetTextureAlphaMod(SDL_Texture * texture, Uint8 alpha)
texture->modMode &= ~SDL_TEXTUREMODULATE_ALPHA; texture->modMode &= ~SDL_TEXTUREMODULATE_ALPHA;
} }
texture->a = alpha; texture->a = alpha;
if (renderer->SetTextureAlphaMod) { if (texture->native) {
return SDL_SetTextureAlphaMod(texture->native, alpha);
} else if (renderer->SetTextureAlphaMod) {
return renderer->SetTextureAlphaMod(renderer, texture); return renderer->SetTextureAlphaMod(renderer, texture);
} else { } else {
return 0; return 0;
...@@ -600,7 +647,9 @@ SDL_SetTextureBlendMode(SDL_Texture * texture, SDL_BlendMode blendMode) ...@@ -600,7 +647,9 @@ SDL_SetTextureBlendMode(SDL_Texture * texture, SDL_BlendMode blendMode)
renderer = texture->renderer; renderer = texture->renderer;
texture->blendMode = blendMode; texture->blendMode = blendMode;
if (renderer->SetTextureBlendMode) { if (texture->native) {
return SDL_SetTextureBlendMode(texture, blendMode);
} else if (renderer->SetTextureBlendMode) {
return renderer->SetTextureBlendMode(renderer, texture); return renderer->SetTextureBlendMode(renderer, texture);
} else { } else {
return 0; return 0;
...@@ -618,6 +667,91 @@ SDL_GetTextureBlendMode(SDL_Texture * texture, SDL_BlendMode *blendMode) ...@@ -618,6 +667,91 @@ SDL_GetTextureBlendMode(SDL_Texture * texture, SDL_BlendMode *blendMode)
return 0; return 0;
} }
static int
SDL_UpdateTextureYUV(SDL_Texture * texture, const SDL_Rect * rect,
const void *pixels, int pitch)
{
SDL_Texture *native = texture->native;
SDL_Rect full_rect;
if (SDL_SW_UpdateYUVTexture(texture->yuv, rect, pixels, pitch) < 0) {
return -1;
}
full_rect.x = 0;
full_rect.y = 0;
full_rect.w = texture->w;
full_rect.h = texture->h;
rect = &full_rect;
if (texture->access == SDL_TEXTUREACCESS_STREAMING) {
/* We can lock the texture and copy to it */
void *native_pixels;
int native_pitch;
if (SDL_LockTexture(native, rect, &native_pixels, &native_pitch) < 0) {
return -1;
}
SDL_SW_CopyYUVToRGB(texture->yuv, rect, native->format,
rect->w, rect->h, native_pixels, native_pitch);
SDL_UnlockTexture(native);
} else {
/* Use a temporary buffer for updating */
void *temp_pixels;
int temp_pitch;
temp_pitch = (((rect->w * SDL_BYTESPERPIXEL(native->format)) + 3) & ~3);
temp_pixels = SDL_malloc(rect->h * temp_pitch);
if (!temp_pixels) {
SDL_OutOfMemory();
return -1;
}
SDL_SW_CopyYUVToRGB(texture->yuv, rect, native->format,
rect->w, rect->h, temp_pixels, temp_pitch);
SDL_UpdateTexture(native, rect, temp_pixels, temp_pitch);
SDL_free(temp_pixels);
}
return 0;
}
static int
SDL_UpdateTextureNative(SDL_Texture * texture, const SDL_Rect * rect,
const void *pixels, int pitch)
{
SDL_Texture *native = texture->native;
if (texture->access == SDL_TEXTUREACCESS_STREAMING) {
/* We can lock the texture and copy to it */
void *native_pixels;
int native_pitch;
if (SDL_LockTexture(native, rect, &native_pixels, &native_pitch) < 0) {
return -1;
}
SDL_ConvertPixels(rect->w, rect->h,
texture->format, pixels, pitch,
native->format, native_pixels, native_pitch);
SDL_UnlockTexture(native);
} else {
/* Use a temporary buffer for updating */
void *temp_pixels;
int temp_pitch;
temp_pitch = (((rect->w * SDL_BYTESPERPIXEL(native->format)) + 3) & ~3);
temp_pixels = SDL_malloc(rect->h * temp_pitch);
if (!temp_pixels) {
SDL_OutOfMemory();
return -1;
}
SDL_ConvertPixels(rect->w, rect->h,
texture->format, pixels, pitch,
native->format, temp_pixels, temp_pitch);
SDL_UpdateTexture(native, rect, temp_pixels, temp_pitch);
SDL_free(temp_pixels);
}
return 0;
}
int int
SDL_UpdateTexture(SDL_Texture * texture, const SDL_Rect * rect, SDL_UpdateTexture(SDL_Texture * texture, const SDL_Rect * rect,
const void *pixels, int pitch) const void *pixels, int pitch)
...@@ -627,11 +761,6 @@ SDL_UpdateTexture(SDL_Texture * texture, const SDL_Rect * rect, ...@@ -627,11 +761,6 @@ SDL_UpdateTexture(SDL_Texture * texture, const SDL_Rect * rect,
CHECK_TEXTURE_MAGIC(texture, -1); CHECK_TEXTURE_MAGIC(texture, -1);
renderer = texture->renderer;
if (!renderer->UpdateTexture) {
SDL_Unsupported();
return -1;
}
if (!rect) { if (!rect) {
full_rect.x = 0; full_rect.x = 0;
full_rect.y = 0; full_rect.y = 0;
...@@ -639,11 +768,38 @@ SDL_UpdateTexture(SDL_Texture * texture, const SDL_Rect * rect, ...@@ -639,11 +768,38 @@ SDL_UpdateTexture(SDL_Texture * texture, const SDL_Rect * rect,
full_rect.h = texture->h; full_rect.h = texture->h;
rect = &full_rect; rect = &full_rect;
} }
if (texture->yuv) {
return SDL_UpdateTextureYUV(texture, rect, pixels, pitch);
} else if (texture->native) {
return SDL_UpdateTextureNative(texture, rect, pixels, pitch);
} else {
renderer = texture->renderer;
return renderer->UpdateTexture(renderer, texture, rect, pixels, pitch); return renderer->UpdateTexture(renderer, texture, rect, pixels, pitch);
}
}
static int
SDL_LockTextureYUV(SDL_Texture * texture, const SDL_Rect * rect,
void **pixels, int *pitch)
{
return SDL_SW_LockYUVTexture(texture->yuv, rect, pixels, pitch);
}
static int
SDL_LockTextureNative(SDL_Texture * texture, const SDL_Rect * rect,
void **pixels, int *pitch)
{
texture->locked_rect = *rect;
*pixels = (void *) ((Uint8 *) texture->pixels +
rect->y * texture->pitch +
rect->x * SDL_BYTESPERPIXEL(texture->format));
*pitch = texture->pitch;
return 0;
} }
int int
SDL_LockTexture(SDL_Texture * texture, const SDL_Rect * rect, int markDirty, SDL_LockTexture(SDL_Texture * texture, const SDL_Rect * rect,
void **pixels, int *pitch) void **pixels, int *pitch)
{ {
SDL_Renderer *renderer; SDL_Renderer *renderer;
...@@ -655,11 +811,7 @@ SDL_LockTexture(SDL_Texture * texture, const SDL_Rect * rect, int markDirty, ...@@ -655,11 +811,7 @@ SDL_LockTexture(SDL_Texture * texture, const SDL_Rect * rect, int markDirty,
SDL_SetError("SDL_LockTexture(): texture must be streaming"); SDL_SetError("SDL_LockTexture(): texture must be streaming");
return -1; return -1;
} }
renderer = texture->renderer;
if (!renderer->LockTexture) {
SDL_Unsupported();
return -1;
}
if (!rect) { if (!rect) {
full_rect.x = 0; full_rect.x = 0;
full_rect.y = 0; full_rect.y = 0;
...@@ -667,30 +819,61 @@ SDL_LockTexture(SDL_Texture * texture, const SDL_Rect * rect, int markDirty, ...@@ -667,30 +819,61 @@ SDL_LockTexture(SDL_Texture * texture, const SDL_Rect * rect, int markDirty,
full_rect.h = texture->h; full_rect.h = texture->h;
rect = &full_rect; rect = &full_rect;
} }
return renderer->LockTexture(renderer, texture, rect, markDirty, pixels,
pitch); if (texture->yuv) {
return SDL_LockTextureYUV(texture, rect, pixels, pitch);
} else if (texture->native) {
return SDL_LockTextureNative(texture, rect, pixels, pitch);
} else {
renderer = texture->renderer;
return renderer->LockTexture(renderer, texture, rect, pixels, pitch);
}
} }
void static void
SDL_UnlockTexture(SDL_Texture * texture) SDL_UnlockTextureYUV(SDL_Texture * texture)
{ {
SDL_Renderer *renderer; SDL_Texture *native = texture->native;
void *native_pixels;
int native_pitch;
SDL_Rect rect;
CHECK_TEXTURE_MAGIC(texture, ); rect.x = 0;
rect.y = 0;
rect.w = texture->w;
rect.h = texture->h;
if (texture->access != SDL_TEXTUREACCESS_STREAMING) { if (SDL_LockTexture(native, &rect, &native_pixels, &native_pitch) < 0) {
return; return;
} }
renderer = texture->renderer; SDL_SW_CopyYUVToRGB(texture->yuv, &rect, native->format,
if (!renderer->UnlockTexture) { rect.w, rect.h, native_pixels, native_pitch);
SDL_UnlockTexture(native);
}
void
SDL_UnlockTextureNative(SDL_Texture * texture)
{
SDL_Texture *native = texture->native;
void *native_pixels;
int native_pitch;
const SDL_Rect *rect = &texture->locked_rect;
const void* pixels = (void *) ((Uint8 *) texture->pixels +
rect->y * texture->pitch +
rect->x * SDL_BYTESPERPIXEL(texture->format));
int pitch = texture->pitch;
if (SDL_LockTexture(native, rect, &native_pixels, &native_pitch) < 0) {
return; return;
} }
renderer->UnlockTexture(renderer, texture); SDL_ConvertPixels(rect->w, rect->h,
texture->format, pixels, pitch,
native->format, native_pixels, native_pitch);
SDL_UnlockTexture(native);
} }
void void
SDL_DirtyTexture(SDL_Texture * texture, int numrects, SDL_UnlockTexture(SDL_Texture * texture)
const SDL_Rect * rects)
{ {
SDL_Renderer *renderer; SDL_Renderer *renderer;
...@@ -699,11 +882,14 @@ SDL_DirtyTexture(SDL_Texture * texture, int numrects, ...@@ -699,11 +882,14 @@ SDL_DirtyTexture(SDL_Texture * texture, int numrects,
if (texture->access != SDL_TEXTUREACCESS_STREAMING) { if (texture->access != SDL_TEXTUREACCESS_STREAMING) {
return; return;
} }
if (texture->yuv) {
SDL_UnlockTextureYUV(texture);
} else if (texture->native) {
SDL_UnlockTextureNative(texture);
} else {
renderer = texture->renderer; renderer = texture->renderer;
if (!renderer->DirtyTexture) { renderer->UnlockTexture(renderer, texture);
return;
} }
renderer->DirtyTexture(renderer, texture, numrects, rects);
} }
int int
...@@ -979,6 +1165,10 @@ SDL_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, ...@@ -979,6 +1165,10 @@ SDL_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
} }
} }
if (texture->native) {
texture = texture->native;
}
return renderer->RenderCopy(renderer, texture, &real_srcrect, return renderer->RenderCopy(renderer, texture, &real_srcrect,
&real_dstrect); &real_dstrect);
} }
...@@ -1087,6 +1277,16 @@ SDL_DestroyTexture(SDL_Texture * texture) ...@@ -1087,6 +1277,16 @@ SDL_DestroyTexture(SDL_Texture * texture)
renderer->textures = texture->next; renderer->textures = texture->next;
} }
if (texture->native) {
SDL_DestroyTexture(texture->native);
}
if (texture->yuv) {
SDL_SW_DestroyYUVTexture(texture->yuv);
}
if (texture->pixels) {
SDL_free(texture->pixels);
}
renderer->DestroyTexture(renderer, texture); renderer->DestroyTexture(renderer, texture);
SDL_free(texture); SDL_free(texture);
} }
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include "SDL_render.h" #include "SDL_render.h"
#include "SDL_events.h" #include "SDL_events.h"
#include "SDL_yuv_sw_c.h"
/* The SDL 2D rendering system */ /* The SDL 2D rendering system */
...@@ -45,6 +46,13 @@ struct SDL_Texture ...@@ -45,6 +46,13 @@ struct SDL_Texture
SDL_Renderer *renderer; SDL_Renderer *renderer;
/* Support for formats not supported directly by the renderer */
SDL_Texture *native;
SDL_SW_YUVTexture *yuv;
void *pixels;
int pitch;
SDL_Rect locked_rect;
void *driverdata; /**< Driver specific texture representation */ void *driverdata; /**< Driver specific texture representation */
SDL_Texture *prev; SDL_Texture *prev;
...@@ -58,8 +66,6 @@ struct SDL_Renderer ...@@ -58,8 +66,6 @@ struct SDL_Renderer
void (*WindowEvent) (SDL_Renderer * renderer, const SDL_WindowEvent *event); void (*WindowEvent) (SDL_Renderer * renderer, const SDL_WindowEvent *event);
int (*CreateTexture) (SDL_Renderer * renderer, SDL_Texture * texture); int (*CreateTexture) (SDL_Renderer * renderer, SDL_Texture * texture);
int (*QueryTexturePixels) (SDL_Renderer * renderer, SDL_Texture * texture,
void **pixels, int *pitch);
int (*SetTextureColorMod) (SDL_Renderer * renderer, int (*SetTextureColorMod) (SDL_Renderer * renderer,
SDL_Texture * texture); SDL_Texture * texture);
int (*SetTextureAlphaMod) (SDL_Renderer * renderer, int (*SetTextureAlphaMod) (SDL_Renderer * renderer,
...@@ -70,11 +76,8 @@ struct SDL_Renderer ...@@ -70,11 +76,8 @@ struct SDL_Renderer
const SDL_Rect * rect, const void *pixels, const SDL_Rect * rect, const void *pixels,
int pitch); int pitch);
int (*LockTexture) (SDL_Renderer * renderer, SDL_Texture * texture, int (*LockTexture) (SDL_Renderer * renderer, SDL_Texture * texture,
const SDL_Rect * rect, int markDirty, void **pixels, const SDL_Rect * rect, void **pixels, int *pitch);
int *pitch);
void (*UnlockTexture) (SDL_Renderer * renderer, SDL_Texture * texture); void (*UnlockTexture) (SDL_Renderer * renderer, SDL_Texture * texture);
void (*DirtyTexture) (SDL_Renderer * renderer, SDL_Texture * texture,
int numrects, const SDL_Rect * rects);
int (*RenderClear) (SDL_Renderer * renderer); int (*RenderClear) (SDL_Renderer * renderer);
int (*RenderDrawPoints) (SDL_Renderer * renderer, const SDL_Point * points, int (*RenderDrawPoints) (SDL_Renderer * renderer, const SDL_Point * points,
int count); int count);
......
...@@ -1155,7 +1155,7 @@ SDL_SW_UpdateYUVTexture(SDL_SW_YUVTexture * swdata, const SDL_Rect * rect, ...@@ -1155,7 +1155,7 @@ SDL_SW_UpdateYUVTexture(SDL_SW_YUVTexture * swdata, const SDL_Rect * rect,
int int
SDL_SW_LockYUVTexture(SDL_SW_YUVTexture * swdata, const SDL_Rect * rect, SDL_SW_LockYUVTexture(SDL_SW_YUVTexture * swdata, const SDL_Rect * rect,
int markDirty, void **pixels, int *pitch) void **pixels, int *pitch)
{ {
switch (swdata->format) { switch (swdata->format) {
case SDL_PIXELFORMAT_YV12: case SDL_PIXELFORMAT_YV12:
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#include "SDL_config.h" #include "SDL_config.h"
#include "SDL_video.h" #include "SDL_video.h"
#include "SDL_sysvideo.h"
/* This is the software implementation of the YUV texture support */ /* This is the software implementation of the YUV texture support */
...@@ -60,7 +59,7 @@ int SDL_SW_QueryYUVTexturePixels(SDL_SW_YUVTexture * swdata, void **pixels, ...@@ -60,7 +59,7 @@ int SDL_SW_QueryYUVTexturePixels(SDL_SW_YUVTexture * swdata, void **pixels,
int SDL_SW_UpdateYUVTexture(SDL_SW_YUVTexture * swdata, const SDL_Rect * rect, int SDL_SW_UpdateYUVTexture(SDL_SW_YUVTexture * swdata, const SDL_Rect * rect,
const void *pixels, int pitch); const void *pixels, int pitch);
int SDL_SW_LockYUVTexture(SDL_SW_YUVTexture * swdata, const SDL_Rect * rect, int SDL_SW_LockYUVTexture(SDL_SW_YUVTexture * swdata, const SDL_Rect * rect,
int markDirty, void **pixels, int *pitch); void **pixels, int *pitch);
void SDL_SW_UnlockYUVTexture(SDL_SW_YUVTexture * swdata); void SDL_SW_UnlockYUVTexture(SDL_SW_YUVTexture * swdata);
int SDL_SW_CopyYUVToRGB(SDL_SW_YUVTexture * swdata, const SDL_Rect * srcrect, int SDL_SW_CopyYUVToRGB(SDL_SW_YUVTexture * swdata, const SDL_Rect * srcrect,
Uint32 target_format, int w, int h, void *pixels, Uint32 target_format, int w, int h, void *pixels,
......
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
#include "SDL_loadso.h" #include "SDL_loadso.h"
#include "SDL_syswm.h" #include "SDL_syswm.h"
#include "../SDL_sysrender.h" #include "../SDL_sysrender.h"
#include "../../video/SDL_yuv_sw_c.h"
#if SDL_VIDEO_RENDER_D3D #if SDL_VIDEO_RENDER_D3D
#define D3D_DEBUG_INFO #define D3D_DEBUG_INFO
...@@ -89,7 +88,8 @@ HRESULT WINAPI ...@@ -89,7 +88,8 @@ HRESULT WINAPI
/* Direct3D renderer implementation */ /* Direct3D renderer implementation */
#if 1 /* This takes more memory but you won't lose your texture data */ #if 1
/* This takes more memory but you won't lose your texture data */
#define D3DPOOL_SDL D3DPOOL_MANAGED #define D3DPOOL_SDL D3DPOOL_MANAGED
#define SDL_MEMORY_POOL_MANAGED #define SDL_MEMORY_POOL_MANAGED
#else #else
...@@ -99,18 +99,12 @@ HRESULT WINAPI ...@@ -99,18 +99,12 @@ HRESULT WINAPI
static SDL_Renderer *D3D_CreateRenderer(SDL_Window * window, Uint32 flags); static SDL_Renderer *D3D_CreateRenderer(SDL_Window * window, Uint32 flags);
static int D3D_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture); static int D3D_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture);
static int D3D_QueryTexturePixels(SDL_Renderer * renderer,
SDL_Texture * texture, void **pixels,
int *pitch);
static int D3D_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, static int D3D_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
const SDL_Rect * rect, const void *pixels, const SDL_Rect * rect, const void *pixels,
int pitch); int pitch);
static int D3D_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, static int D3D_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
const SDL_Rect * rect, int markDirty, const SDL_Rect * rect, void **pixels, int *pitch);
void **pixels, int *pitch);
static void D3D_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture); static void D3D_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture);
static void D3D_DirtyTexture(SDL_Renderer * renderer, SDL_Texture * texture,
int numrects, const SDL_Rect * rects);
static int D3D_RenderDrawPoints(SDL_Renderer * renderer, static int D3D_RenderDrawPoints(SDL_Renderer * renderer,
const SDL_Point * points, int count); const SDL_Point * points, int count);
static int D3D_RenderDrawLines(SDL_Renderer * renderer, static int D3D_RenderDrawLines(SDL_Renderer * renderer,
...@@ -134,8 +128,8 @@ SDL_RenderDriver D3D_RenderDriver = { ...@@ -134,8 +128,8 @@ SDL_RenderDriver D3D_RenderDriver = {
{ {
"d3d", "d3d",
(SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_ACCELERATED), (SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_ACCELERATED),
0, 1,
{0}, {SDL_PIXELFORMAT_ARGB8888},
0, 0,
0} 0}
}; };
...@@ -152,7 +146,6 @@ typedef struct ...@@ -152,7 +146,6 @@ typedef struct
typedef struct typedef struct
{ {
SDL_SW_YUVTexture *yuv;
Uint32 format; Uint32 format;
IDirect3DTexture9 *texture; IDirect3DTexture9 *texture;
} D3D_TextureData; } D3D_TextureData;
...@@ -248,113 +241,30 @@ static D3DFORMAT ...@@ -248,113 +241,30 @@ static D3DFORMAT
PixelFormatToD3DFMT(Uint32 format) PixelFormatToD3DFMT(Uint32 format)
{ {
switch (format) { switch (format) {
case SDL_PIXELFORMAT_INDEX8:
return D3DFMT_P8;
case SDL_PIXELFORMAT_RGB332:
return D3DFMT_R3G3B2;
case SDL_PIXELFORMAT_RGB444:
return D3DFMT_X4R4G4B4;
case SDL_PIXELFORMAT_RGB555:
return D3DFMT_X1R5G5B5;
case SDL_PIXELFORMAT_ARGB4444:
return D3DFMT_A4R4G4B4;
case SDL_PIXELFORMAT_ARGB1555:
return D3DFMT_A1R5G5B5;
case SDL_PIXELFORMAT_RGB565: case SDL_PIXELFORMAT_RGB565:
return D3DFMT_R5G6B5; return D3DFMT_R5G6B5;
case SDL_PIXELFORMAT_RGB888: case SDL_PIXELFORMAT_RGB888:
return D3DFMT_X8R8G8B8; return D3DFMT_X8R8G8B8;
case SDL_PIXELFORMAT_ARGB8888: case SDL_PIXELFORMAT_ARGB8888:
return D3DFMT_A8R8G8B8; return D3DFMT_A8R8G8B8;
case SDL_PIXELFORMAT_ARGB2101010:
return D3DFMT_A2R10G10B10;
case SDL_PIXELFORMAT_YV12:
return MAKEFOURCC('Y','V','1','2');
case SDL_PIXELFORMAT_IYUV:
return MAKEFOURCC('I','4','2','0');
case SDL_PIXELFORMAT_UYVY:
return D3DFMT_UYVY;
case SDL_PIXELFORMAT_YUY2:
return D3DFMT_YUY2;
default: default:
return D3DFMT_UNKNOWN; return D3DFMT_UNKNOWN;
} }
} }
static SDL_bool static Uint32
D3D_IsTextureFormatAvailable(IDirect3D9 * d3d, UINT adapter, D3DFMTToPixelFormat(D3DFORMAT format)
D3DFORMAT display_format,
D3DFORMAT texture_format)
{
HRESULT result;
result = IDirect3D9_CheckDeviceFormat(d3d, adapter,
D3DDEVTYPE_HAL,
display_format,
0,
D3DRTYPE_TEXTURE,
texture_format);
return FAILED(result) ? SDL_FALSE : SDL_TRUE;
}
static void
UpdateYUVTextureData(SDL_Texture * texture)
{ {
D3D_TextureData *data = (D3D_TextureData *) texture->driverdata; switch (format) {
SDL_Rect rect; case D3DFMT_R5G6B5:
RECT d3drect; return SDL_PIXELFORMAT_RGB565;
D3DLOCKED_RECT locked; case D3DFMT_X8R8G8B8:
HRESULT result; return SDL_PIXELFORMAT_RGB888;
case D3DFMT_A8R8G8B8:
d3drect.left = 0; return SDL_PIXELFORMAT_ARGB8888;
d3drect.right = texture->w; default:
d3drect.top = 0; return SDL_PIXELFORMAT_UNKNOWN;
d3drect.bottom = texture->h;
result =
IDirect3DTexture9_LockRect(data->texture, 0, &locked, &d3drect, 0);
if (FAILED(result)) {
return;
}
rect.x = 0;
rect.y = 0;
rect.w = texture->w;
rect.h = texture->h;
SDL_SW_CopyYUVToRGB(data->yuv, &rect, data->format, texture->w,
texture->h, locked.pBits, locked.Pitch);
IDirect3DTexture9_UnlockRect(data->texture, 0);
}
static void
D3D_AddTextureFormats(D3D_RenderData *data, SDL_RendererInfo *info)
{
int i;
int formats[] = {
SDL_PIXELFORMAT_RGB332,
SDL_PIXELFORMAT_RGB444,
SDL_PIXELFORMAT_RGB555,
SDL_PIXELFORMAT_ARGB4444,
SDL_PIXELFORMAT_ARGB1555,
SDL_PIXELFORMAT_RGB565,
SDL_PIXELFORMAT_RGB888,
SDL_PIXELFORMAT_ARGB8888,
SDL_PIXELFORMAT_ARGB2101010,
};
info->num_texture_formats = 0;
for (i = 0; i < SDL_arraysize(formats); ++i) {
if (D3D_IsTextureFormatAvailable
(data->d3d, data->adapter, data->pparams.BackBufferFormat, PixelFormatToD3DFMT(formats[i]))) {
info->texture_formats[info->num_texture_formats++] = formats[i];
}
} }
info->texture_formats[info->num_texture_formats++] = SDL_PIXELFORMAT_YV12;
info->texture_formats[info->num_texture_formats++] = SDL_PIXELFORMAT_IYUV;
info->texture_formats[info->num_texture_formats++] = SDL_PIXELFORMAT_YUY2;
info->texture_formats[info->num_texture_formats++] = SDL_PIXELFORMAT_UYVY;
info->texture_formats[info->num_texture_formats++] = SDL_PIXELFORMAT_YVYU;
} }
SDL_Renderer * SDL_Renderer *
...@@ -367,6 +277,9 @@ D3D_CreateRenderer(SDL_Window * window, Uint32 flags) ...@@ -367,6 +277,9 @@ D3D_CreateRenderer(SDL_Window * window, Uint32 flags)
D3DPRESENT_PARAMETERS pparams; D3DPRESENT_PARAMETERS pparams;
IDirect3DSwapChain9 *chain; IDirect3DSwapChain9 *chain;
D3DCAPS9 caps; D3DCAPS9 caps;
Uint32 window_flags;
int w, h;
SDL_DisplayMode fullscreen_mode;
renderer = (SDL_Renderer *) SDL_calloc(1, sizeof(*renderer)); renderer = (SDL_Renderer *) SDL_calloc(1, sizeof(*renderer));
if (!renderer) { if (!renderer) {
...@@ -404,11 +317,9 @@ D3D_CreateRenderer(SDL_Window * window, Uint32 flags) ...@@ -404,11 +317,9 @@ D3D_CreateRenderer(SDL_Window * window, Uint32 flags)
} }
renderer->CreateTexture = D3D_CreateTexture; renderer->CreateTexture = D3D_CreateTexture;
renderer->QueryTexturePixels = D3D_QueryTexturePixels;
renderer->UpdateTexture = D3D_UpdateTexture; renderer->UpdateTexture = D3D_UpdateTexture;
renderer->LockTexture = D3D_LockTexture; renderer->LockTexture = D3D_LockTexture;
renderer->UnlockTexture = D3D_UnlockTexture; renderer->UnlockTexture = D3D_UnlockTexture;
renderer->DirtyTexture = D3D_DirtyTexture;
renderer->RenderDrawPoints = D3D_RenderDrawPoints; renderer->RenderDrawPoints = D3D_RenderDrawPoints;
renderer->RenderDrawLines = D3D_RenderDrawLines; renderer->RenderDrawLines = D3D_RenderDrawLines;
renderer->RenderFillRects = D3D_RenderFillRects; renderer->RenderFillRects = D3D_RenderFillRects;
...@@ -427,23 +338,27 @@ D3D_CreateRenderer(SDL_Window * window, Uint32 flags) ...@@ -427,23 +338,27 @@ D3D_CreateRenderer(SDL_Window * window, Uint32 flags)
SDL_VERSION(&windowinfo.version); SDL_VERSION(&windowinfo.version);
SDL_GetWindowWMInfo(window, &windowinfo); SDL_GetWindowWMInfo(window, &windowinfo);
window_flags = SDL_GetWindowFlags(window);
SDL_GetWindowSize(window, &w, &h);
SDL_GetWindowDisplayMode(window, &fullscreen_mode);
SDL_zero(pparams); SDL_zero(pparams);
pparams.hDeviceWindow = windowinfo.info.win.window; pparams.hDeviceWindow = windowinfo.info.win.window;
pparams.BackBufferWidth = window->w; pparams.BackBufferWidth = w;
pparams.BackBufferHeight = window->h; pparams.BackBufferHeight = h;
if (window->flags & SDL_WINDOW_FULLSCREEN) { if (window_flags & SDL_WINDOW_FULLSCREEN) {
pparams.BackBufferFormat = pparams.BackBufferFormat =
PixelFormatToD3DFMT(window->fullscreen_mode.format); PixelFormatToD3DFMT(fullscreen_mode.format);
} else { } else {
pparams.BackBufferFormat = D3DFMT_UNKNOWN; pparams.BackBufferFormat = D3DFMT_UNKNOWN;
} }
pparams.BackBufferCount = 1; pparams.BackBufferCount = 1;
pparams.SwapEffect = D3DSWAPEFFECT_DISCARD; pparams.SwapEffect = D3DSWAPEFFECT_DISCARD;
if (window->flags & SDL_WINDOW_FULLSCREEN) { if (window_flags & SDL_WINDOW_FULLSCREEN) {
pparams.Windowed = FALSE; pparams.Windowed = FALSE;
pparams.FullScreen_RefreshRateInHz = pparams.FullScreen_RefreshRateInHz =
window->fullscreen_mode.refresh_rate; fullscreen_mode.refresh_rate;
} else { } else {
pparams.Windowed = TRUE; pparams.Windowed = TRUE;
pparams.FullScreen_RefreshRateInHz = 0; pparams.FullScreen_RefreshRateInHz = 0;
...@@ -494,8 +409,6 @@ D3D_CreateRenderer(SDL_Window * window, Uint32 flags) ...@@ -494,8 +409,6 @@ D3D_CreateRenderer(SDL_Window * window, Uint32 flags)
} }
data->pparams = pparams; data->pparams = pparams;
D3D_AddTextureFormats(data, &renderer->info);
IDirect3DDevice9_GetDeviceCaps(data->device, &caps); IDirect3DDevice9_GetDeviceCaps(data->device, &caps);
renderer->info.max_texture_width = caps.MaxTextureWidth; renderer->info.max_texture_width = caps.MaxTextureWidth;
renderer->info.max_texture_height = caps.MaxTextureHeight; renderer->info.max_texture_height = caps.MaxTextureHeight;
...@@ -594,22 +507,7 @@ D3D_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) ...@@ -594,22 +507,7 @@ D3D_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
texture->driverdata = data; texture->driverdata = data;
if (SDL_ISPIXELFORMAT_FOURCC(texture->format) &&
(texture->format != SDL_PIXELFORMAT_YUY2 ||
!D3D_IsTextureFormatAvailable(renderdata->d3d, renderdata->adapter,
display_format, PixelFormatToD3DFMT(texture->format)))
&& (texture->format != SDL_PIXELFORMAT_YVYU
|| !D3D_IsTextureFormatAvailable(renderdata->d3d, renderdata->adapter,
display_format, PixelFormatToD3DFMT(texture->format)))) {
data->yuv =
SDL_SW_CreateYUVTexture(texture->format, texture->w, texture->h);
if (!data->yuv) {
return -1;
}
data->format = SDL_GetWindowPixelFormat(window);
} else {
data->format = texture->format; data->format = texture->format;
}
result = result =
IDirect3DDevice9_CreateTexture(renderdata->device, texture->w, IDirect3DDevice9_CreateTexture(renderdata->device, texture->w,
...@@ -624,20 +522,6 @@ D3D_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) ...@@ -624,20 +522,6 @@ D3D_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
return 0; return 0;
} }
static int
D3D_QueryTexturePixels(SDL_Renderer * renderer, SDL_Texture * texture,
void **pixels, int *pitch)
{
D3D_TextureData *data = (D3D_TextureData *) texture->driverdata;
if (data->yuv) {
return SDL_SW_QueryYUVTexturePixels(data->yuv, pixels, pitch);
} else {
/* D3D textures don't have their pixels hanging out */
return -1;
}
}
static int static int
D3D_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, D3D_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
const SDL_Rect * rect, const void *pixels, int pitch) const SDL_Rect * rect, const void *pixels, int pitch)
...@@ -645,13 +529,6 @@ D3D_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, ...@@ -645,13 +529,6 @@ D3D_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
D3D_TextureData *data = (D3D_TextureData *) texture->driverdata; D3D_TextureData *data = (D3D_TextureData *) texture->driverdata;
D3D_RenderData *renderdata = (D3D_RenderData *) renderer->driverdata; D3D_RenderData *renderdata = (D3D_RenderData *) renderer->driverdata;
if (data->yuv) {
if (SDL_SW_UpdateYUVTexture(data->yuv, rect, pixels, pitch) < 0) {
return -1;
}
UpdateYUVTextureData(texture);
return 0;
} else {
#ifdef SDL_MEMORY_POOL_DEFAULT #ifdef SDL_MEMORY_POOL_DEFAULT
IDirect3DTexture9 *temp; IDirect3DTexture9 *temp;
RECT d3drect; RECT d3drect;
...@@ -664,8 +541,7 @@ D3D_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, ...@@ -664,8 +541,7 @@ D3D_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
result = result =
IDirect3DDevice9_CreateTexture(renderdata->device, texture->w, IDirect3DDevice9_CreateTexture(renderdata->device, texture->w,
texture->h, 1, 0, texture->h, 1, 0,
PixelFormatToD3DFMT(texture-> PixelFormatToD3DFMT(texture-> format),
format),
D3DPOOL_SYSTEMMEM, &temp, NULL); D3DPOOL_SYSTEMMEM, &temp, NULL);
if (FAILED(result)) { if (FAILED(result)) {
D3D_SetError("CreateTexture()", result); D3D_SetError("CreateTexture()", result);
...@@ -717,9 +593,7 @@ D3D_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, ...@@ -717,9 +593,7 @@ D3D_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
d3drect.top = rect->y; d3drect.top = rect->y;
d3drect.bottom = rect->y + rect->h; d3drect.bottom = rect->y + rect->h;
result = result = IDirect3DTexture9_LockRect(data->texture, 0, &locked, &d3drect, 0);
IDirect3DTexture9_LockRect(data->texture, 0, &locked, &d3drect,
0);
if (FAILED(result)) { if (FAILED(result)) {
D3D_SetError("LockRect()", result); D3D_SetError("LockRect()", result);
return -1; return -1;
...@@ -737,20 +611,13 @@ D3D_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, ...@@ -737,20 +611,13 @@ D3D_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
#endif // SDL_MEMORY_POOL_DEFAULT #endif // SDL_MEMORY_POOL_DEFAULT
return 0; return 0;
}
} }
static int static int
D3D_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, D3D_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
const SDL_Rect * rect, int markDirty, void **pixels, const SDL_Rect * rect, void **pixels, int *pitch)
int *pitch)
{ {
D3D_TextureData *data = (D3D_TextureData *) texture->driverdata; D3D_TextureData *data = (D3D_TextureData *) texture->driverdata;
if (data->yuv) {
return SDL_SW_LockYUVTexture(data->yuv, rect, markDirty, pixels,
pitch);
} else {
RECT d3drect; RECT d3drect;
D3DLOCKED_RECT locked; D3DLOCKED_RECT locked;
HRESULT result; HRESULT result;
...@@ -760,10 +627,7 @@ D3D_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, ...@@ -760,10 +627,7 @@ D3D_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
d3drect.top = rect->y; d3drect.top = rect->y;
d3drect.bottom = rect->y + rect->h; d3drect.bottom = rect->y + rect->h;
result = result = IDirect3DTexture9_LockRect(data->texture, 0, &locked, &d3drect, 0);
IDirect3DTexture9_LockRect(data->texture, 0, &locked, &d3drect,
markDirty ? 0 :
D3DLOCK_NO_DIRTY_UPDATE);
if (FAILED(result)) { if (FAILED(result)) {
D3D_SetError("LockRect()", result); D3D_SetError("LockRect()", result);
return -1; return -1;
...@@ -771,7 +635,6 @@ D3D_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, ...@@ -771,7 +635,6 @@ D3D_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
*pixels = locked.pBits; *pixels = locked.pBits;
*pitch = locked.Pitch; *pitch = locked.Pitch;
return 0; return 0;
}
} }
static void static void
...@@ -779,32 +642,7 @@ D3D_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture) ...@@ -779,32 +642,7 @@ D3D_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture)
{ {
D3D_TextureData *data = (D3D_TextureData *) texture->driverdata; D3D_TextureData *data = (D3D_TextureData *) texture->driverdata;
if (data->yuv) {
SDL_SW_UnlockYUVTexture(data->yuv);
UpdateYUVTextureData(texture);
} else {
IDirect3DTexture9_UnlockRect(data->texture, 0); IDirect3DTexture9_UnlockRect(data->texture, 0);
}
}
static void
D3D_DirtyTexture(SDL_Renderer * renderer, SDL_Texture * texture, int numrects,
const SDL_Rect * rects)
{
D3D_TextureData *data = (D3D_TextureData *) texture->driverdata;
RECT d3drect;
int i;
for (i = 0; i < numrects; ++i) {
const SDL_Rect *rect = &rects[i];
d3drect.left = rect->x;
d3drect.right = rect->x + rect->w;
d3drect.top = rect->y;
d3drect.bottom = rect->y + rect->h;
IDirect3DTexture9_AddDirtyRect(data->texture, &d3drect);
}
} }
static void static void
...@@ -1123,8 +961,6 @@ D3D_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, ...@@ -1123,8 +961,6 @@ D3D_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
Uint32 format, void * pixels, int pitch) Uint32 format, void * pixels, int pitch)
{ {
D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata; D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata;
SDL_Window *window = renderer->window;
SDL_VideoDisplay *display = window->display;
D3DSURFACE_DESC desc; D3DSURFACE_DESC desc;
LPDIRECT3DSURFACE9 backBuffer; LPDIRECT3DSURFACE9 backBuffer;
LPDIRECT3DSURFACE9 surface; LPDIRECT3DSURFACE9 surface;
...@@ -1174,7 +1010,7 @@ D3D_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, ...@@ -1174,7 +1010,7 @@ D3D_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
} }
SDL_ConvertPixels(rect->w, rect->h, SDL_ConvertPixels(rect->w, rect->h,
display->current_mode.format, locked.pBits, locked.Pitch, D3DFMTToPixelFormat(desc.Format), locked.pBits, locked.Pitch,
format, pixels, pitch); format, pixels, pitch);
IDirect3DSurface9_UnlockRect(surface); IDirect3DSurface9_UnlockRect(surface);
...@@ -1227,9 +1063,6 @@ D3D_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture) ...@@ -1227,9 +1063,6 @@ D3D_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture)
if (!data) { if (!data) {
return; return;
} }
if (data->yuv) {
SDL_SW_DestroyYUVTexture(data->yuv);
}
if (data->texture) { if (data->texture) {
IDirect3DTexture9_Release(data->texture); IDirect3DTexture9_Release(data->texture);
} }
......
...@@ -37,27 +37,6 @@ ...@@ -37,27 +37,6 @@
http://developer.apple.com/documentation/GraphicsImaging/Conceptual/OpenGL-MacProgGuide/opengl_texturedata/chapter_10_section_2.html http://developer.apple.com/documentation/GraphicsImaging/Conceptual/OpenGL-MacProgGuide/opengl_texturedata/chapter_10_section_2.html
*/ */
/* !!! FIXME: this should go in a higher level than the GL renderer. */
static __inline__ int
bytes_per_pixel(const Uint32 format)
{
if (!SDL_ISPIXELFORMAT_FOURCC(format)) {
return SDL_BYTESPERPIXEL(format);
}
/* FOURCC format */
switch (format) {
case SDL_PIXELFORMAT_YV12:
case SDL_PIXELFORMAT_IYUV:
case SDL_PIXELFORMAT_YUY2:
case SDL_PIXELFORMAT_UYVY:
case SDL_PIXELFORMAT_YVYU:
return 2;
default:
return 1; /* shouldn't ever hit this. */
}
}
/* Used to re-create the window with OpenGL capability */ /* Used to re-create the window with OpenGL capability */
extern int SDL_RecreateWindow(SDL_Window * window, Uint32 flags); extern int SDL_RecreateWindow(SDL_Window * window, Uint32 flags);
...@@ -67,18 +46,12 @@ static SDL_Renderer *GL_CreateRenderer(SDL_Window * window, Uint32 flags); ...@@ -67,18 +46,12 @@ static SDL_Renderer *GL_CreateRenderer(SDL_Window * window, Uint32 flags);
static void GL_WindowEvent(SDL_Renderer * renderer, static void GL_WindowEvent(SDL_Renderer * renderer,
const SDL_WindowEvent *event); const SDL_WindowEvent *event);
static int GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture); static int GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture);
static int GL_QueryTexturePixels(SDL_Renderer * renderer,
SDL_Texture * texture, void **pixels,
int *pitch);
static int GL_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, static int GL_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
const SDL_Rect * rect, const void *pixels, const SDL_Rect * rect, const void *pixels,
int pitch); int pitch);
static int GL_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, static int GL_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
const SDL_Rect * rect, int markDirty, void **pixels, const SDL_Rect * rect, void **pixels, int *pitch);
int *pitch);
static void GL_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture); static void GL_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture);
static void GL_DirtyTexture(SDL_Renderer * renderer, SDL_Texture * texture,
int numrects, const SDL_Rect * rects);
static int GL_RenderClear(SDL_Renderer * renderer); static int GL_RenderClear(SDL_Renderer * renderer);
static int GL_RenderDrawPoints(SDL_Renderer * renderer, static int GL_RenderDrawPoints(SDL_Renderer * renderer,
const SDL_Point * points, int count); const SDL_Point * points, int count);
...@@ -102,21 +75,8 @@ SDL_RenderDriver GL_RenderDriver = { ...@@ -102,21 +75,8 @@ SDL_RenderDriver GL_RenderDriver = {
{ {
"opengl", "opengl",
(SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_ACCELERATED), (SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_ACCELERATED),
13, 1,
{ {SDL_PIXELFORMAT_ARGB8888},
SDL_PIXELFORMAT_RGB332,
SDL_PIXELFORMAT_RGB444,
SDL_PIXELFORMAT_RGB555,
SDL_PIXELFORMAT_ARGB4444,
SDL_PIXELFORMAT_ARGB1555,
SDL_PIXELFORMAT_RGB565,
SDL_PIXELFORMAT_RGB24,
SDL_PIXELFORMAT_BGR24,
SDL_PIXELFORMAT_RGB888,
SDL_PIXELFORMAT_BGR888,
SDL_PIXELFORMAT_ARGB8888,
SDL_PIXELFORMAT_ABGR8888,
SDL_PIXELFORMAT_ARGB2101010},
0, 0,
0} 0}
}; };
...@@ -126,10 +86,6 @@ typedef struct ...@@ -126,10 +86,6 @@ typedef struct
SDL_GLContext context; SDL_GLContext context;
SDL_bool updateSize; SDL_bool updateSize;
SDL_bool GL_ARB_texture_rectangle_supported; SDL_bool GL_ARB_texture_rectangle_supported;
SDL_bool GL_EXT_paletted_texture_supported;
SDL_bool GL_APPLE_ycbcr_422_supported;
SDL_bool GL_MESA_ycbcr_texture_supported;
SDL_bool GL_ARB_fragment_program_supported;
int blendMode; int blendMode;
/* OpenGL functions */ /* OpenGL functions */
...@@ -139,33 +95,18 @@ typedef struct ...@@ -139,33 +95,18 @@ typedef struct
void (*glTextureRangeAPPLE) (GLenum target, GLsizei length, void (*glTextureRangeAPPLE) (GLenum target, GLsizei length,
const GLvoid * pointer); const GLvoid * pointer);
PFNGLGETPROGRAMIVARBPROC glGetProgramivARB;
PFNGLGETPROGRAMSTRINGARBPROC glGetProgramStringARB;
PFNGLPROGRAMLOCALPARAMETER4FVARBPROC glProgramLocalParameter4fvARB;
PFNGLDELETEPROGRAMSARBPROC glDeleteProgramsARB;
PFNGLGENPROGRAMSARBPROC glGenProgramsARB;
PFNGLBINDPROGRAMARBPROC glBindProgramARB;
PFNGLPROGRAMSTRINGARBPROC glProgramStringARB;
/* (optional) fragment programs */
GLuint fragment_program_UYVY;
} GL_RenderData; } GL_RenderData;
typedef struct typedef struct
{ {
GLuint texture; GLuint texture;
GLuint shader;
GLenum type; GLenum type;
GLfloat texw; GLfloat texw;
GLfloat texh; GLfloat texh;
GLenum format; GLenum format;
GLenum formattype; GLenum formattype;
Uint8 *palette;
void *pixels; void *pixels;
int pitch; int pitch;
SDL_DirtyRectList dirty;
int HACK_RYAN_FIXME;
} GL_TextureData; } GL_TextureData;
...@@ -257,11 +198,9 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags) ...@@ -257,11 +198,9 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags)
renderer->WindowEvent = GL_WindowEvent; renderer->WindowEvent = GL_WindowEvent;
renderer->CreateTexture = GL_CreateTexture; renderer->CreateTexture = GL_CreateTexture;
renderer->QueryTexturePixels = GL_QueryTexturePixels;
renderer->UpdateTexture = GL_UpdateTexture; renderer->UpdateTexture = GL_UpdateTexture;
renderer->LockTexture = GL_LockTexture; renderer->LockTexture = GL_LockTexture;
renderer->UnlockTexture = GL_UnlockTexture; renderer->UnlockTexture = GL_UnlockTexture;
renderer->DirtyTexture = GL_DirtyTexture;
renderer->RenderClear = GL_RenderClear; renderer->RenderClear = GL_RenderClear;
renderer->RenderDrawPoints = GL_RenderDrawPoints; renderer->RenderDrawPoints = GL_RenderDrawPoints;
renderer->RenderDrawLines = GL_RenderDrawLines; renderer->RenderDrawLines = GL_RenderDrawLines;
...@@ -317,40 +256,12 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags) ...@@ -317,40 +256,12 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags)
|| SDL_GL_ExtensionSupported("GL_EXT_texture_rectangle")) { || SDL_GL_ExtensionSupported("GL_EXT_texture_rectangle")) {
data->GL_ARB_texture_rectangle_supported = SDL_TRUE; data->GL_ARB_texture_rectangle_supported = SDL_TRUE;
} }
if (SDL_GL_ExtensionSupported("GL_APPLE_ycbcr_422")) {
data->GL_APPLE_ycbcr_422_supported = SDL_TRUE;
}
if (SDL_GL_ExtensionSupported("GL_MESA_ycbcr_texture")) {
data->GL_MESA_ycbcr_texture_supported = SDL_TRUE;
}
if (SDL_GL_ExtensionSupported("GL_APPLE_texture_range")) { if (SDL_GL_ExtensionSupported("GL_APPLE_texture_range")) {
data->glTextureRangeAPPLE = data->glTextureRangeAPPLE =
(void (*)(GLenum, GLsizei, const GLvoid *)) (void (*)(GLenum, GLsizei, const GLvoid *))
SDL_GL_GetProcAddress("glTextureRangeAPPLE"); SDL_GL_GetProcAddress("glTextureRangeAPPLE");
} }
/* we might use fragment programs for YUV data, etc. */
if (SDL_GL_ExtensionSupported("GL_ARB_fragment_program")) {
/* !!! FIXME: this doesn't check for errors. */
/* !!! FIXME: this should really reuse the glfuncs.h stuff. */
data->glGetProgramivARB = (PFNGLGETPROGRAMIVARBPROC)
SDL_GL_GetProcAddress("glGetProgramivARB");
data->glGetProgramStringARB = (PFNGLGETPROGRAMSTRINGARBPROC)
SDL_GL_GetProcAddress("glGetProgramStringARB");
data->glProgramLocalParameter4fvARB =
(PFNGLPROGRAMLOCALPARAMETER4FVARBPROC)
SDL_GL_GetProcAddress("glProgramLocalParameter4fvARB");
data->glDeleteProgramsARB = (PFNGLDELETEPROGRAMSARBPROC)
SDL_GL_GetProcAddress("glDeleteProgramsARB");
data->glGenProgramsARB = (PFNGLGENPROGRAMSARBPROC)
SDL_GL_GetProcAddress("glGenProgramsARB");
data->glBindProgramARB = (PFNGLBINDPROGRAMARBPROC)
SDL_GL_GetProcAddress("glBindProgramARB");
data->glProgramStringARB = (PFNGLPROGRAMSTRINGARBPROC)
SDL_GL_GetProcAddress("glProgramStringARB");
data->GL_ARB_fragment_program_supported = SDL_TRUE;
}
/* Set up parameters for rendering */ /* Set up parameters for rendering */
data->blendMode = -1; data->blendMode = -1;
data->glDisable(GL_DEPTH_TEST); data->glDisable(GL_DEPTH_TEST);
...@@ -419,240 +330,16 @@ power_of_2(int input) ...@@ -419,240 +330,16 @@ power_of_2(int input)
return value; return value;
} }
//#define DEBUG_PROGRAM_COMPILE 1
static void
set_shader_error(GL_RenderData * data, const char *prefix)
{
GLint pos = 0;
const GLubyte *errstr;
data->glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &pos);
errstr = data->glGetString(GL_PROGRAM_ERROR_STRING_ARB);
SDL_SetError("%s: shader compile error at position %d: %s",
prefix, (int) pos, (const char *) errstr);
}
static GLuint
compile_shader(GL_RenderData * data, GLenum shader_type, const char *_code)
{
const int have_texture_rects = data->GL_ARB_texture_rectangle_supported;
const char *replacement = have_texture_rects ? "RECT" : "2D";
const size_t replacementlen = SDL_strlen(replacement);
const char *token = "%TEXTURETARGET%";
const size_t tokenlen = SDL_strlen(token);
char *code = NULL;
char *ptr = NULL;
GLuint program = 0;
/*
* The TEX instruction needs a different target depending on what we use.
* To handle this, we use "%TEXTURETARGET%" and replace the string before
* compiling the shader.
*/
code = SDL_strdup(_code);
if (code == NULL)
return 0;
for (ptr = SDL_strstr(code, token); ptr; ptr = SDL_strstr(ptr + 1, token)) {
SDL_memcpy(ptr, replacement, replacementlen);
SDL_memmove(ptr + replacementlen, ptr + tokenlen,
SDL_strlen(ptr + tokenlen) + 1);
}
#if DEBUG_PROGRAM_COMPILE
printf("compiling shader:\n%s\n\n", code);
#endif
data->glGetError(); /* flush any existing error state. */
data->glGenProgramsARB(1, &program);
data->glBindProgramARB(shader_type, program);
data->glProgramStringARB(shader_type, GL_PROGRAM_FORMAT_ASCII_ARB,
(GLsizei)SDL_strlen(code), code);
SDL_free(code);
if (data->glGetError() == GL_INVALID_OPERATION) {
#if DEBUG_PROGRAM_COMPILE
GLint pos = 0;
const GLubyte *errstr;
data->glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &pos);
errstr = data->glGetString(GL_PROGRAM_ERROR_STRING_ARB);
printf("program compile error at position %d: %s\n\n",
(int) pos, (const char *) errstr);
#endif
data->glBindProgramARB(shader_type, 0);
data->glDeleteProgramsARB(1, &program);
return 0;
}
return program;
}
/*
* Fragment program that renders from UYVY textures.
* The UYVY to RGB equasion is:
* R = 1.164(Y-16) + 1.596(Cr-128)
* G = 1.164(Y-16) - 0.813(Cr-128) - 0.391(Cb-128)
* B = 1.164(Y-16) + 2.018(Cb-128)
* Byte layout is Cb, Y1, Cr, Y2, stored in the R, G, B, A channels.
* 4 bytes == 2 pixels: Y1/Cb/Cr, Y2/Cb/Cr
*
* !!! FIXME: this ignores blendmodes, etc.
* !!! FIXME: this could be more efficient...use a dot product for green, etc.
*/
static const char *fragment_program_UYVY_source_code = "!!ARBfp1.0\n"
/* outputs... */
"OUTPUT outcolor = result.color;\n"
/* scratch registers... */
"TEMP uyvy;\n" "TEMP luminance;\n" "TEMP work;\n"
/* Halve the coordinates to grab the correct 32 bits for the fragment. */
"MUL work, fragment.texcoord, { 0.5, 1.0, 1.0, 1.0 };\n"
/* Sample the YUV texture. Cb, Y1, Cr, Y2, are stored in x, y, z, w. */
"TEX uyvy, work, texture[0], %TEXTURETARGET%;\n"
/* Do subtractions (128/255, 16/255, 128/255, 16/255) */
"SUB uyvy, uyvy, { 0.501960784313726, 0.06274509803922, 0.501960784313726, 0.06274509803922 };\n"
/* Choose the luminance component by texcoord. */
/* !!! FIXME: laziness wins out for now... just average Y1 and Y2. */
"ADD luminance, uyvy.yyyy, uyvy.wwww;\n"
"MUL luminance, luminance, { 0.5, 0.5, 0.5, 0.5 };\n"
/* Multiply luminance by its magic value. */
"MUL luminance, luminance, { 1.164, 1.164, 1.164, 1.164 };\n"
/* uyvy.xyzw becomes Cr/Cr/Cb/Cb, with multiplications. */
"MUL uyvy, uyvy.zzxx, { 1.596, -0.813, 2.018, -0.391 };\n"
/* Add luminance to Cr and Cb, store to RGB channels. */
"ADD work.rgb, luminance, uyvy;\n"
/* Do final addition for Green channel. (!!! FIXME: this should be a DPH?) */
"ADD work.g, work.g, uyvy.w;\n"
/* Make sure alpha channel is fully opaque. (!!! FIXME: blend modes!) */
"MOV work.a, { 1.0 };\n"
/* Store out the final fragment color... */
"MOV outcolor, work;\n"
/* ...and we're done! */
"END\n";
static __inline__ SDL_bool static __inline__ SDL_bool
convert_format(GL_RenderData *renderdata, Uint32 pixel_format, convert_format(GL_RenderData *renderdata, Uint32 pixel_format,
GLint* internalFormat, GLenum* format, GLenum* type) GLint* internalFormat, GLenum* format, GLenum* type)
{ {
switch (pixel_format) { switch (pixel_format) {
case SDL_PIXELFORMAT_RGB332:
*internalFormat = GL_R3_G3_B2;
*format = GL_RGB;
*type = GL_UNSIGNED_BYTE_3_3_2;
break;
case SDL_PIXELFORMAT_RGB444:
*internalFormat = GL_RGB4;
*format = GL_RGB;
*type = GL_UNSIGNED_SHORT_4_4_4_4;
break;
case SDL_PIXELFORMAT_RGB555:
*internalFormat = GL_RGB5;
*format = GL_RGB;
*type = GL_UNSIGNED_SHORT_5_5_5_1;
break;
case SDL_PIXELFORMAT_ARGB4444:
*internalFormat = GL_RGBA4;
*format = GL_BGRA;
*type = GL_UNSIGNED_SHORT_4_4_4_4_REV;
break;
case SDL_PIXELFORMAT_ARGB1555:
*internalFormat = GL_RGB5_A1;
*format = GL_BGRA;
*type = GL_UNSIGNED_SHORT_1_5_5_5_REV;
break;
case SDL_PIXELFORMAT_RGB565:
*internalFormat = GL_RGB8;
*format = GL_RGB;
*type = GL_UNSIGNED_SHORT_5_6_5;
break;
case SDL_PIXELFORMAT_RGB24:
*internalFormat = GL_RGB8;
*format = GL_RGB;
*type = GL_UNSIGNED_BYTE;
break;
case SDL_PIXELFORMAT_RGB888: case SDL_PIXELFORMAT_RGB888:
*internalFormat = GL_RGB8;
*format = GL_BGRA;
*type = GL_UNSIGNED_BYTE;
break;
case SDL_PIXELFORMAT_BGR24:
*internalFormat = GL_RGB8;
*format = GL_BGR;
*type = GL_UNSIGNED_BYTE;
break;
case SDL_PIXELFORMAT_BGR888:
*internalFormat = GL_RGB8;
*format = GL_RGBA;
*type = GL_UNSIGNED_BYTE;
break;
case SDL_PIXELFORMAT_ARGB8888: case SDL_PIXELFORMAT_ARGB8888:
#ifdef __MACOSX__
*internalFormat = GL_RGBA;
*format = GL_BGRA;
*type = GL_UNSIGNED_INT_8_8_8_8_REV;
#else
*internalFormat = GL_RGBA8; *internalFormat = GL_RGBA8;
*format = GL_BGRA; *format = GL_BGRA;
*type = GL_UNSIGNED_BYTE; *type = GL_UNSIGNED_INT_8_8_8_8_REV;
#endif
break;
case SDL_PIXELFORMAT_ABGR8888:
*internalFormat = GL_RGBA8;
*format = GL_RGBA;
*type = GL_UNSIGNED_BYTE;
break;
case SDL_PIXELFORMAT_ARGB2101010:
*internalFormat = GL_RGB10_A2;
*format = GL_BGRA;
*type = GL_UNSIGNED_INT_2_10_10_10_REV;
break;
case SDL_PIXELFORMAT_UYVY:
if (renderdata->GL_APPLE_ycbcr_422_supported) {
*internalFormat = GL_RGB;
*format = GL_YCBCR_422_APPLE;
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
*type = GL_UNSIGNED_SHORT_8_8_APPLE;
#else
*type = GL_UNSIGNED_SHORT_8_8_REV_APPLE;
#endif
} else if (renderdata->GL_MESA_ycbcr_texture_supported) {
*internalFormat = GL_YCBCR_MESA;
*format = GL_YCBCR_MESA;
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
*type = GL_UNSIGNED_SHORT_8_8_MESA;
#else
*type = GL_UNSIGNED_SHORT_8_8_REV_MESA;
#endif
} else if (renderdata->GL_ARB_fragment_program_supported) {
*internalFormat = GL_RGBA;
*format = GL_RGBA;
*type = GL_UNSIGNED_BYTE;
} else {
return SDL_FALSE;
}
break;
case SDL_PIXELFORMAT_YUY2:
if (renderdata->GL_APPLE_ycbcr_422_supported) {
*internalFormat = GL_RGB;
*format = GL_YCBCR_422_APPLE;
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
*type = GL_UNSIGNED_SHORT_8_8_REV_APPLE;
#else
*type = GL_UNSIGNED_SHORT_8_8_APPLE;
#endif
} else if (renderdata->GL_MESA_ycbcr_texture_supported) {
*internalFormat = GL_YCBCR_MESA;
*format = GL_YCBCR_MESA;
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
*type = GL_UNSIGNED_SHORT_8_8_REV_MESA;
#else
*type = GL_UNSIGNED_SHORT_8_8_MESA;
#endif
} else {
return SDL_FALSE;
}
break; break;
default: default:
return SDL_FALSE; return SDL_FALSE;
...@@ -668,7 +355,6 @@ GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) ...@@ -668,7 +355,6 @@ GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
GLint internalFormat; GLint internalFormat;
GLenum format, type; GLenum format, type;
int texture_w, texture_h; int texture_w, texture_h;
GLuint shader = 0;
GLenum result; GLenum result;
GL_ActivateRenderer(renderer); GL_ActivateRenderer(renderer);
...@@ -679,21 +365,6 @@ GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) ...@@ -679,21 +365,6 @@ GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
SDL_GetPixelFormatName(texture->format)); SDL_GetPixelFormatName(texture->format));
return -1; return -1;
} }
if (texture->format == SDL_PIXELFORMAT_UYVY &&
!renderdata->GL_APPLE_ycbcr_422_supported &&
!renderdata->GL_MESA_ycbcr_texture_supported &&
renderdata->GL_ARB_fragment_program_supported) {
if (renderdata->fragment_program_UYVY == 0) {
renderdata->fragment_program_UYVY =
compile_shader(renderdata, GL_FRAGMENT_PROGRAM_ARB,
fragment_program_UYVY_source_code);
if (renderdata->fragment_program_UYVY == 0) {
set_shader_error(renderdata, "UYVY");
return -1;
}
}
shader = renderdata->fragment_program_UYVY;
}
data = (GL_TextureData *) SDL_calloc(1, sizeof(*data)); data = (GL_TextureData *) SDL_calloc(1, sizeof(*data));
if (!data) { if (!data) {
...@@ -701,10 +372,8 @@ GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) ...@@ -701,10 +372,8 @@ GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
return -1; return -1;
} }
data->shader = shader;
if (texture->access == SDL_TEXTUREACCESS_STREAMING) { if (texture->access == SDL_TEXTUREACCESS_STREAMING) {
data->pitch = texture->w * bytes_per_pixel(texture->format); data->pitch = texture->w * SDL_BYTESPERPIXEL(texture->format);
data->pixels = SDL_malloc(texture->h * data->pitch); data->pixels = SDL_malloc(texture->h * data->pitch);
if (!data->pixels) { if (!data->pixels) {
SDL_OutOfMemory(); SDL_OutOfMemory();
...@@ -731,17 +400,6 @@ GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) ...@@ -731,17 +400,6 @@ GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
data->texh = (GLfloat) texture->h / texture_h; data->texh = (GLfloat) texture->h / texture_h;
} }
/* YUV formats use RGBA but are really two bytes per pixel */
if (internalFormat == GL_RGBA && bytes_per_pixel(texture->format) < 4) {
texture_w /= 2;
if (data->type == GL_TEXTURE_2D) {
data->texw *= 2.0f;
}
data->HACK_RYAN_FIXME = 2;
} else {
data->HACK_RYAN_FIXME = 1;
}
data->format = format; data->format = format;
data->formattype = type; data->formattype = type;
renderdata->glEnable(data->type); renderdata->glEnable(data->type);
...@@ -771,22 +429,13 @@ GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) ...@@ -771,22 +429,13 @@ GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
renderdata->glTexParameteri(data->type, GL_TEXTURE_STORAGE_HINT_APPLE, renderdata->glTexParameteri(data->type, GL_TEXTURE_STORAGE_HINT_APPLE,
GL_STORAGE_CACHED_APPLE); GL_STORAGE_CACHED_APPLE);
} }
/* This causes a crash in testoverlay for some reason. Apple bug? */
#if 0
if (texture->access == SDL_TEXTUREACCESS_STREAMING if (texture->access == SDL_TEXTUREACCESS_STREAMING
&& texture->format == SDL_PIXELFORMAT_ARGB8888) { && texture->format == SDL_PIXELFORMAT_ARGB8888) {
/*
if (renderdata->glTextureRangeAPPLE) {
renderdata->glTextureRangeAPPLE(data->type,
texture->h * data->pitch,
data->pixels);
}
*/
renderdata->glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE); renderdata->glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE);
renderdata->glTexImage2D(data->type, 0, internalFormat, texture_w, renderdata->glTexImage2D(data->type, 0, internalFormat, texture_w,
texture_h, 0, format, type, data->pixels); texture_h, 0, format, type, data->pixels);
} else }
#endif else
#endif #endif
{ {
renderdata->glTexImage2D(data->type, 0, internalFormat, texture_w, renderdata->glTexImage2D(data->type, 0, internalFormat, texture_w,
...@@ -801,26 +450,13 @@ GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) ...@@ -801,26 +450,13 @@ GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
return 0; return 0;
} }
static int
GL_QueryTexturePixels(SDL_Renderer * renderer, SDL_Texture * texture,
void **pixels, int *pitch)
{
GL_TextureData *data = (GL_TextureData *) texture->driverdata;
*pixels = data->pixels;
*pitch = data->pitch;
return 0;
}
static void static void
SetupTextureUpdate(GL_RenderData * renderdata, SDL_Texture * texture, SetupTextureUpdate(GL_RenderData * renderdata, SDL_Texture * texture,
int pitch) int pitch)
{ {
renderdata->glPixelStorei(GL_UNPACK_ALIGNMENT, 1); renderdata->glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
renderdata->glPixelStorei(GL_UNPACK_ROW_LENGTH, renderdata->glPixelStorei(GL_UNPACK_ROW_LENGTH,
(pitch / bytes_per_pixel(texture->format)) / (pitch / SDL_BYTESPERPIXEL(texture->format)));
((GL_TextureData *) texture->driverdata)->
HACK_RYAN_FIXME);
} }
static int static int
...@@ -851,18 +487,13 @@ GL_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, ...@@ -851,18 +487,13 @@ GL_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
static int static int
GL_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, GL_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
const SDL_Rect * rect, int markDirty, void **pixels, const SDL_Rect * rect, void **pixels, int *pitch)
int *pitch)
{ {
GL_TextureData *data = (GL_TextureData *) texture->driverdata; GL_TextureData *data = (GL_TextureData *) texture->driverdata;
if (markDirty) {
SDL_AddDirtyRect(&data->dirty, rect);
}
*pixels = *pixels =
(void *) ((Uint8 *) data->pixels + rect->y * data->pitch + (void *) ((Uint8 *) data->pixels + rect->y * data->pitch +
rect->x * bytes_per_pixel(texture->format)); rect->x * SDL_BYTESPERPIXEL(texture->format));
*pitch = data->pitch; *pitch = data->pitch;
return 0; return 0;
} }
...@@ -870,18 +501,17 @@ GL_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, ...@@ -870,18 +501,17 @@ GL_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
static void static void
GL_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture) GL_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture)
{ {
} GL_RenderData *renderdata = (GL_RenderData *) renderer->driverdata;
static void
GL_DirtyTexture(SDL_Renderer * renderer, SDL_Texture * texture, int numrects,
const SDL_Rect * rects)
{
GL_TextureData *data = (GL_TextureData *) texture->driverdata; GL_TextureData *data = (GL_TextureData *) texture->driverdata;
int i;
for (i = 0; i < numrects; ++i) { GL_ActivateRenderer(renderer);
SDL_AddDirtyRect(&data->dirty, &rects[i]);
} SetupTextureUpdate(renderdata, texture, data->pitch);
renderdata->glEnable(data->type);
renderdata->glBindTexture(data->type, data->texture);
renderdata->glTexSubImage2D(data->type, 0, 0, 0, texture->w, texture->h,
data->format, data->formattype, data->pixels);
renderdata->glDisable(data->type);
} }
static void static void
...@@ -1056,28 +686,6 @@ GL_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, ...@@ -1056,28 +686,6 @@ GL_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
GL_ActivateRenderer(renderer); GL_ActivateRenderer(renderer);
if (texturedata->dirty.list) {
SDL_DirtyRect *dirty;
void *pixels;
int bpp = bytes_per_pixel(texture->format);
int pitch = texturedata->pitch;
SetupTextureUpdate(data, texture, pitch);
data->glEnable(texturedata->type);
data->glBindTexture(texturedata->type, texturedata->texture);
for (dirty = texturedata->dirty.list; dirty; dirty = dirty->next) {
SDL_Rect *rect = &dirty->rect;
pixels =
(void *) ((Uint8 *) texturedata->pixels + rect->y * pitch +
rect->x * bpp);
data->glTexSubImage2D(texturedata->type, 0, rect->x, rect->y,
rect->w / texturedata->HACK_RYAN_FIXME,
rect->h, texturedata->format,
texturedata->formattype, pixels);
}
SDL_ClearDirtyRects(&texturedata->dirty);
}
minx = dstrect->x; minx = dstrect->x;
miny = dstrect->y; miny = dstrect->y;
maxx = dstrect->x + dstrect->w; maxx = dstrect->x + dstrect->w;
...@@ -1106,12 +714,6 @@ GL_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, ...@@ -1106,12 +714,6 @@ GL_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
GL_SetBlendMode(data, texture->blendMode); GL_SetBlendMode(data, texture->blendMode);
/* Set up the shader for the copy, if any */
if (texturedata->shader) {
data->glEnable(GL_FRAGMENT_PROGRAM_ARB);
data->glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, texturedata->shader);
}
data->glBegin(GL_TRIANGLE_STRIP); data->glBegin(GL_TRIANGLE_STRIP);
data->glTexCoord2f(minu, minv); data->glTexCoord2f(minu, minv);
data->glVertex2f((GLfloat) minx, (GLfloat) miny); data->glVertex2f((GLfloat) minx, (GLfloat) miny);
...@@ -1123,10 +725,6 @@ GL_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, ...@@ -1123,10 +725,6 @@ GL_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
data->glVertex2f((GLfloat) maxx, (GLfloat) maxy); data->glVertex2f((GLfloat) maxx, (GLfloat) maxy);
data->glEnd(); data->glEnd();
if (texturedata->shader) {
data->glDisable(GL_FRAGMENT_PROGRAM_ARB);
}
data->glDisable(texturedata->type); data->glDisable(texturedata->type);
return 0; return 0;
...@@ -1155,13 +753,13 @@ GL_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, ...@@ -1155,13 +753,13 @@ GL_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
data->glPixelStorei(GL_PACK_ALIGNMENT, 1); data->glPixelStorei(GL_PACK_ALIGNMENT, 1);
data->glPixelStorei(GL_PACK_ROW_LENGTH, data->glPixelStorei(GL_PACK_ROW_LENGTH,
(pitch / bytes_per_pixel(pixel_format))); (pitch / SDL_BYTESPERPIXEL(pixel_format)));
data->glReadPixels(rect->x, (h-rect->y)-rect->h, rect->w, rect->h, data->glReadPixels(rect->x, (h-rect->y)-rect->h, rect->w, rect->h,
format, type, pixels); format, type, pixels);
/* Flip the rows to be top-down */ /* Flip the rows to be top-down */
length = rect->w * bytes_per_pixel(pixel_format); length = rect->w * SDL_BYTESPERPIXEL(pixel_format);
src = (Uint8*)pixels + (rect->h-1)*pitch; src = (Uint8*)pixels + (rect->h-1)*pitch;
dst = (Uint8*)pixels; dst = (Uint8*)pixels;
tmp = SDL_stack_alloc(Uint8, length); tmp = SDL_stack_alloc(Uint8, length);
...@@ -1201,7 +799,7 @@ GL_RenderWritePixels(SDL_Renderer * renderer, const SDL_Rect * rect, ...@@ -1201,7 +799,7 @@ GL_RenderWritePixels(SDL_Renderer * renderer, const SDL_Rect * rect,
data->glPixelStorei(GL_UNPACK_ALIGNMENT, 1); data->glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
data->glPixelStorei(GL_UNPACK_ROW_LENGTH, data->glPixelStorei(GL_UNPACK_ROW_LENGTH,
(pitch / bytes_per_pixel(pixel_format))); (pitch / SDL_BYTESPERPIXEL(pixel_format)));
/* Flip the rows to be bottom-up */ /* Flip the rows to be bottom-up */
length = rect->h * rect->w * pitch; length = rect->h * rect->w * pitch;
...@@ -1244,13 +842,9 @@ GL_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture) ...@@ -1244,13 +842,9 @@ GL_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture)
if (data->texture) { if (data->texture) {
renderdata->glDeleteTextures(1, &data->texture); renderdata->glDeleteTextures(1, &data->texture);
} }
if (data->palette) {
SDL_free(data->palette);
}
if (data->pixels) { if (data->pixels) {
SDL_free(data->pixels); SDL_free(data->pixels);
} }
SDL_FreeDirtyRects(&data->dirty);
SDL_free(data); SDL_free(data);
texture->driverdata = NULL; texture->driverdata = NULL;
} }
...@@ -1262,16 +856,6 @@ GL_DestroyRenderer(SDL_Renderer * renderer) ...@@ -1262,16 +856,6 @@ GL_DestroyRenderer(SDL_Renderer * renderer)
if (data) { if (data) {
if (data->context) { if (data->context) {
if (data->GL_ARB_fragment_program_supported) {
data->glDisable(GL_FRAGMENT_PROGRAM_ARB);
data->glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, 0);
if (data->fragment_program_UYVY &&
data->fragment_program_UYVY != ~0) {
data->glDeleteProgramsARB(1,
&data->fragment_program_UYVY);
}
}
/* SDL_GL_MakeCurrent(0, NULL); *//* doesn't do anything */ /* SDL_GL_MakeCurrent(0, NULL); *//* doesn't do anything */
SDL_GL_DeleteContext(data->context); SDL_GL_DeleteContext(data->context);
} }
......
...@@ -49,19 +49,13 @@ static SDL_Renderer *GLES_CreateRenderer(SDL_Window * window, Uint32 flags); ...@@ -49,19 +49,13 @@ static SDL_Renderer *GLES_CreateRenderer(SDL_Window * window, Uint32 flags);
static void GLES_WindowEvent(SDL_Renderer * renderer, static void GLES_WindowEvent(SDL_Renderer * renderer,
const SDL_WindowEvent *event); const SDL_WindowEvent *event);
static int GLES_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture); static int GLES_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture);
static int GLES_QueryTexturePixels(SDL_Renderer * renderer,
SDL_Texture * texture, void **pixels,
int *pitch);
static int GLES_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, static int GLES_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
const SDL_Rect * rect, const void *pixels, const SDL_Rect * rect, const void *pixels,
int pitch); int pitch);
static int GLES_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, static int GLES_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
const SDL_Rect * rect, int markDirty, const SDL_Rect * rect, void **pixels, int *pitch);
void **pixels, int *pitch);
static void GLES_UnlockTexture(SDL_Renderer * renderer, static void GLES_UnlockTexture(SDL_Renderer * renderer,
SDL_Texture * texture); SDL_Texture * texture);
static void GLES_DirtyTexture(SDL_Renderer * renderer, SDL_Texture * texture,
int numrects, const SDL_Rect * rects);
static int GLES_RenderDrawPoints(SDL_Renderer * renderer, static int GLES_RenderDrawPoints(SDL_Renderer * renderer,
const SDL_Point * points, int count); const SDL_Point * points, int count);
static int GLES_RenderDrawLines(SDL_Renderer * renderer, static int GLES_RenderDrawLines(SDL_Renderer * renderer,
...@@ -82,15 +76,8 @@ SDL_RenderDriver GL_ES_RenderDriver = { ...@@ -82,15 +76,8 @@ SDL_RenderDriver GL_ES_RenderDriver = {
{ {
"opengl_es", "opengl_es",
(SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_ACCELERATED), (SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_ACCELERATED),
6, 1,
{ {SDL_PIXELFORMAT_ABGR8888},
/* OpenGL ES 1.x supported formats list */
SDL_PIXELFORMAT_RGBA4444,
SDL_PIXELFORMAT_RGBA5551,
SDL_PIXELFORMAT_RGB565,
SDL_PIXELFORMAT_RGB24,
SDL_PIXELFORMAT_BGR888,
SDL_PIXELFORMAT_ABGR8888},
0, 0,
0} 0}
}; };
...@@ -125,7 +112,6 @@ typedef struct ...@@ -125,7 +112,6 @@ typedef struct
GLenum formattype; GLenum formattype;
void *pixels; void *pixels;
int pitch; int pitch;
SDL_DirtyRectList dirty;
} GLES_TextureData; } GLES_TextureData;
static void static void
...@@ -205,11 +191,9 @@ GLES_CreateRenderer(SDL_Window * window, Uint32 flags) ...@@ -205,11 +191,9 @@ GLES_CreateRenderer(SDL_Window * window, Uint32 flags)
renderer->WindowEvent = GLES_WindowEvent; renderer->WindowEvent = GLES_WindowEvent;
renderer->CreateTexture = GLES_CreateTexture; renderer->CreateTexture = GLES_CreateTexture;
renderer->QueryTexturePixels = GLES_QueryTexturePixels;
renderer->UpdateTexture = GLES_UpdateTexture; renderer->UpdateTexture = GLES_UpdateTexture;
renderer->LockTexture = GLES_LockTexture; renderer->LockTexture = GLES_LockTexture;
renderer->UnlockTexture = GLES_UnlockTexture; renderer->UnlockTexture = GLES_UnlockTexture;
renderer->DirtyTexture = GLES_DirtyTexture;
renderer->RenderDrawPoints = GLES_RenderDrawPoints; renderer->RenderDrawPoints = GLES_RenderDrawPoints;
renderer->RenderDrawLines = GLES_RenderDrawLines; renderer->RenderDrawLines = GLES_RenderDrawLines;
renderer->RenderFillRects = GLES_RenderFillRects; renderer->RenderFillRects = GLES_RenderFillRects;
...@@ -343,32 +327,11 @@ GLES_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) ...@@ -343,32 +327,11 @@ GLES_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
GLES_ActivateRenderer(renderer); GLES_ActivateRenderer(renderer);
switch (texture->format) { switch (texture->format) {
case SDL_PIXELFORMAT_RGB24:
internalFormat = GL_RGB;
format = GL_RGB;
type = GL_UNSIGNED_BYTE;
break;
case SDL_PIXELFORMAT_BGR888:
case SDL_PIXELFORMAT_ABGR8888: case SDL_PIXELFORMAT_ABGR8888:
internalFormat = GL_RGBA; internalFormat = GL_RGBA;
format = GL_RGBA; format = GL_RGBA;
type = GL_UNSIGNED_BYTE; type = GL_UNSIGNED_BYTE;
break; break;
case SDL_PIXELFORMAT_RGB565:
internalFormat = GL_RGB;
format = GL_RGB;
type = GL_UNSIGNED_SHORT_5_6_5;
break;
case SDL_PIXELFORMAT_RGBA5551:
internalFormat = GL_RGBA;
format = GL_RGBA;
type = GL_UNSIGNED_SHORT_5_5_5_1;
break;
case SDL_PIXELFORMAT_RGBA4444:
internalFormat = GL_RGBA;
format = GL_RGBA;
type = GL_UNSIGNED_SHORT_4_4_4_4;
break;
default: default:
SDL_SetError("Texture format %s not supported by OpenGL ES", SDL_SetError("Texture format %s not supported by OpenGL ES",
SDL_GetPixelFormatName(texture->format)); SDL_GetPixelFormatName(texture->format));
...@@ -428,23 +391,10 @@ GLES_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) ...@@ -428,23 +391,10 @@ GLES_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
return 0; return 0;
} }
static int
GLES_QueryTexturePixels(SDL_Renderer * renderer, SDL_Texture * texture,
void **pixels, int *pitch)
{
GLES_TextureData *data = (GLES_TextureData *) texture->driverdata;
*pixels = data->pixels;
*pitch = data->pitch;
return 0;
}
static void static void
SetupTextureUpdate(GLES_RenderData * renderdata, SDL_Texture * texture, SetupTextureUpdate(GLES_RenderData * renderdata, SDL_Texture * texture,
int pitch) int pitch)
{ {
GLES_TextureData *data = (GLES_TextureData *) texture->driverdata;
renderdata->glBindTexture(data->type, data->texture);
renderdata->glPixelStorei(GL_UNPACK_ALIGNMENT, 1); renderdata->glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
} }
...@@ -463,8 +413,9 @@ GLES_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, ...@@ -463,8 +413,9 @@ GLES_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
GLES_ActivateRenderer(renderer); GLES_ActivateRenderer(renderer);
renderdata->glGetError(); renderdata->glGetError();
renderdata->glEnable(data->type);
SetupTextureUpdate(renderdata, texture, pitch); SetupTextureUpdate(renderdata, texture, pitch);
renderdata->glEnable(data->type);
renderdata->glBindTexture(data->type, data->texture);
if( rect->w * bpp == pitch ) { if( rect->w * bpp == pitch ) {
temp_buffer = (void *)pixels; /* No need to reformat */ temp_buffer = (void *)pixels; /* No need to reformat */
...@@ -498,15 +449,10 @@ GLES_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, ...@@ -498,15 +449,10 @@ GLES_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
static int static int
GLES_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, GLES_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
const SDL_Rect * rect, int markDirty, void **pixels, const SDL_Rect * rect, void **pixels, int *pitch)
int *pitch)
{ {
GLES_TextureData *data = (GLES_TextureData *) texture->driverdata; GLES_TextureData *data = (GLES_TextureData *) texture->driverdata;
if (markDirty) {
SDL_AddDirtyRect(&data->dirty, rect);
}
*pixels = *pixels =
(void *) ((Uint8 *) data->pixels + rect->y * data->pitch + (void *) ((Uint8 *) data->pixels + rect->y * data->pitch +
rect->x * SDL_BYTESPERPIXEL(texture->format)); rect->x * SDL_BYTESPERPIXEL(texture->format));
...@@ -517,18 +463,18 @@ GLES_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, ...@@ -517,18 +463,18 @@ GLES_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
static void static void
GLES_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture) GLES_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture)
{ {
} GLES_RenderData *renderdata = (GLES_RenderData *) renderer->driverdata;
static void
GLES_DirtyTexture(SDL_Renderer * renderer, SDL_Texture * texture,
int numrects, const SDL_Rect * rects)
{
GLES_TextureData *data = (GLES_TextureData *) texture->driverdata; GLES_TextureData *data = (GLES_TextureData *) texture->driverdata;
int i;
for (i = 0; i < numrects; ++i) { GLES_ActivateRenderer(renderer);
SDL_AddDirtyRect(&data->dirty, &rects[i]);
} SetupTextureUpdate(renderdata, texture, data->pitch);
renderdata->glEnable(data->type);
renderdata->glBindTexture(data->type, data->texture);
renderdata->glTexSubImage2D(data->type, 0, 0, 0, texture->w,
texture->h, data->format, data->formattype,
data->pixels);
renderdata->glDisable(data->type);
} }
static void static void
...@@ -676,49 +622,6 @@ GLES_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, ...@@ -676,49 +622,6 @@ GLES_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
data->glEnable(GL_TEXTURE_2D); data->glEnable(GL_TEXTURE_2D);
if (texturedata->dirty.list) {
SDL_DirtyRect *dirty;
void *pixels;
int bpp = SDL_BYTESPERPIXEL(texture->format);
int pitch = texturedata->pitch;
SetupTextureUpdate(data, texture, pitch);
data->glBindTexture(texturedata->type, texturedata->texture);
for (dirty = texturedata->dirty.list; dirty; dirty = dirty->next) {
SDL_Rect *rect = &dirty->rect;
pixels =
(void *) ((Uint8 *) texturedata->pixels + rect->y * pitch +
rect->x * bpp);
/* There is no GL_UNPACK_ROW_LENGTH in OpenGLES
we must do this reformatting ourselves(!)
maybe it'd be a good idea to keep a temp buffer around
for this purpose rather than allocating it each time
*/
if( rect->x == 0 && rect->w * bpp == pitch ) {
temp_buffer = pixels; /* Updating whole texture, no need to reformat */
} else {
temp_buffer = SDL_malloc(rect->w * rect->h * bpp);
temp_ptr = temp_buffer;
for (i = 0; i < rect->h; i++) {
SDL_memcpy(temp_ptr, pixels, rect->w * bpp);
temp_ptr += rect->w * bpp;
pixels += pitch;
}
}
data->glTexSubImage2D(texturedata->type, 0, rect->x, rect->y,
rect->w, rect->h, texturedata->format,
texturedata->formattype, temp_buffer);
if( temp_buffer != pixels ) {
SDL_free(temp_buffer);
}
}
SDL_ClearDirtyRects(&texturedata->dirty);
}
data->glBindTexture(texturedata->type, texturedata->texture); data->glBindTexture(texturedata->type, texturedata->texture);
if (texture->modMode) { if (texture->modMode) {
...@@ -818,7 +721,6 @@ GLES_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture) ...@@ -818,7 +721,6 @@ GLES_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture)
if (data->pixels) { if (data->pixels) {
SDL_free(data->pixels); SDL_free(data->pixels);
} }
SDL_FreeDirtyRects(&data->dirty);
SDL_free(data); SDL_free(data);
texture->driverdata = NULL; texture->driverdata = NULL;
} }
......
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#include "../SDL_sysrender.h" #include "../SDL_sysrender.h"
#include "../../video/SDL_pixels_c.h" #include "../../video/SDL_pixels_c.h"
#include "../../video/SDL_yuv_sw_c.h"
/* SDL surface based renderer implementation */ /* SDL surface based renderer implementation */
...@@ -32,9 +31,6 @@ static SDL_Renderer *SW_CreateRenderer(SDL_Window * window, Uint32 flags); ...@@ -32,9 +31,6 @@ static SDL_Renderer *SW_CreateRenderer(SDL_Window * window, Uint32 flags);
static void SW_WindowEvent(SDL_Renderer * renderer, static void SW_WindowEvent(SDL_Renderer * renderer,
const SDL_WindowEvent *event); const SDL_WindowEvent *event);
static int SW_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture); static int SW_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture);
static int SW_QueryTexturePixels(SDL_Renderer * renderer,
SDL_Texture * texture, void **pixels,
int *pitch);
static int SW_SetTextureColorMod(SDL_Renderer * renderer, static int SW_SetTextureColorMod(SDL_Renderer * renderer,
SDL_Texture * texture); SDL_Texture * texture);
static int SW_SetTextureAlphaMod(SDL_Renderer * renderer, static int SW_SetTextureAlphaMod(SDL_Renderer * renderer,
...@@ -45,8 +41,7 @@ static int SW_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, ...@@ -45,8 +41,7 @@ static int SW_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
const SDL_Rect * rect, const void *pixels, const SDL_Rect * rect, const void *pixels,
int pitch); int pitch);
static int SW_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, static int SW_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
const SDL_Rect * rect, int markDirty, void **pixels, const SDL_Rect * rect, void **pixels, int *pitch);
int *pitch);
static void SW_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture); static void SW_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture);
static int SW_RenderDrawPoints(SDL_Renderer * renderer, static int SW_RenderDrawPoints(SDL_Renderer * renderer,
const SDL_Point * points, int count); const SDL_Point * points, int count);
...@@ -70,7 +65,7 @@ SDL_RenderDriver SW_RenderDriver = { ...@@ -70,7 +65,7 @@ SDL_RenderDriver SW_RenderDriver = {
{ {
"software", "software",
(SDL_RENDERER_PRESENTVSYNC), (SDL_RENDERER_PRESENTVSYNC),
13, 8,
{ {
SDL_PIXELFORMAT_RGB555, SDL_PIXELFORMAT_RGB555,
SDL_PIXELFORMAT_RGB565, SDL_PIXELFORMAT_RGB565,
...@@ -79,12 +74,8 @@ SDL_RenderDriver SW_RenderDriver = { ...@@ -79,12 +74,8 @@ SDL_RenderDriver SW_RenderDriver = {
SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ARGB8888,
SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGBA8888,
SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ABGR8888,
SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGRA8888
SDL_PIXELFORMAT_YV12, },
SDL_PIXELFORMAT_IYUV,
SDL_PIXELFORMAT_YUY2,
SDL_PIXELFORMAT_UYVY,
SDL_PIXELFORMAT_YVYU},
0, 0,
0} 0}
}; };
...@@ -96,7 +87,6 @@ typedef struct ...@@ -96,7 +87,6 @@ typedef struct
SDL_Texture *texture; SDL_Texture *texture;
SDL_Surface surface; SDL_Surface surface;
SDL_Renderer *renderer; SDL_Renderer *renderer;
SDL_DirtyRectList dirty;
} SW_RenderData; } SW_RenderData;
static SDL_Texture * static SDL_Texture *
...@@ -136,6 +126,7 @@ SW_CreateRenderer(SDL_Window * window, Uint32 flags) ...@@ -136,6 +126,7 @@ SW_CreateRenderer(SDL_Window * window, Uint32 flags)
SDL_Renderer *renderer; SDL_Renderer *renderer;
SW_RenderData *data; SW_RenderData *data;
int i; int i;
int w, h;
Uint32 format; Uint32 format;
int bpp; int bpp;
Uint32 Rmask, Gmask, Bmask, Amask; Uint32 Rmask, Gmask, Bmask, Amask;
...@@ -163,7 +154,6 @@ SW_CreateRenderer(SDL_Window * window, Uint32 flags) ...@@ -163,7 +154,6 @@ SW_CreateRenderer(SDL_Window * window, Uint32 flags)
} }
renderer->WindowEvent = SW_WindowEvent; renderer->WindowEvent = SW_WindowEvent;
renderer->CreateTexture = SW_CreateTexture; renderer->CreateTexture = SW_CreateTexture;
renderer->QueryTexturePixels = SW_QueryTexturePixels;
renderer->SetTextureColorMod = SW_SetTextureColorMod; renderer->SetTextureColorMod = SW_SetTextureColorMod;
renderer->SetTextureAlphaMod = SW_SetTextureAlphaMod; renderer->SetTextureAlphaMod = SW_SetTextureAlphaMod;
renderer->SetTextureBlendMode = SW_SetTextureBlendMode; renderer->SetTextureBlendMode = SW_SetTextureBlendMode;
...@@ -217,8 +207,8 @@ SW_CreateRenderer(SDL_Window * window, Uint32 flags) ...@@ -217,8 +207,8 @@ SW_CreateRenderer(SDL_Window * window, Uint32 flags)
} }
/* Create the textures we'll use for display */ /* Create the textures we'll use for display */
data->texture = SDL_GetWindowSize(window, &w, &h);
CreateTexture(data->renderer, data->format, window->w, window->h); data->texture = CreateTexture(data->renderer, data->format, w, h);
if (!data->texture) { if (!data->texture) {
SW_DestroyRenderer(renderer); SW_DestroyRenderer(renderer);
return NULL; return NULL;
...@@ -243,11 +233,12 @@ SW_ActivateRenderer(SDL_Renderer * renderer) ...@@ -243,11 +233,12 @@ SW_ActivateRenderer(SDL_Renderer * renderer)
if (data->updateSize) { if (data->updateSize) {
/* Recreate the textures for the new window size */ /* Recreate the textures for the new window size */
int w, h;
if (data->texture) { if (data->texture) {
DestroyTexture(data->renderer, data->texture); DestroyTexture(data->renderer, data->texture);
} }
data->texture = CreateTexture(data->renderer, data->format, SDL_GetWindowSize(window, &w, &h);
window->w, window->h); data->texture = CreateTexture(data->renderer, data->format, w, h);
if (data->texture) { if (data->texture) {
data->updateSize = SDL_FALSE; data->updateSize = SDL_FALSE;
} }
...@@ -268,10 +259,6 @@ SW_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event) ...@@ -268,10 +259,6 @@ SW_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event)
static int static int
SW_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) SW_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
{ {
if (SDL_ISPIXELFORMAT_FOURCC(texture->format)) {
texture->driverdata =
SDL_SW_CreateYUVTexture(texture->format, texture->w, texture->h);
} else {
int bpp; int bpp;
Uint32 Rmask, Gmask, Bmask, Amask; Uint32 Rmask, Gmask, Bmask, Amask;
...@@ -292,7 +279,6 @@ SW_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) ...@@ -292,7 +279,6 @@ SW_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
if (texture->access == SDL_TEXTUREACCESS_STATIC) { if (texture->access == SDL_TEXTUREACCESS_STATIC) {
SDL_SetSurfaceRLE(texture->driverdata, 1); SDL_SetSurfaceRLE(texture->driverdata, 1);
} }
}
if (!texture->driverdata) { if (!texture->driverdata) {
return -1; return -1;
...@@ -300,23 +286,6 @@ SW_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) ...@@ -300,23 +286,6 @@ SW_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
return 0; return 0;
} }
static int
SW_QueryTexturePixels(SDL_Renderer * renderer, SDL_Texture * texture,
void **pixels, int *pitch)
{
if (SDL_ISPIXELFORMAT_FOURCC(texture->format)) {
return SDL_SW_QueryYUVTexturePixels((SDL_SW_YUVTexture *)
texture->driverdata, pixels,
pitch);
} else {
SDL_Surface *surface = (SDL_Surface *) texture->driverdata;
*pixels = surface->pixels;
*pitch = surface->pitch;
return 0;
}
}
static int static int
SW_SetTextureColorMod(SDL_Renderer * renderer, SDL_Texture * texture) SW_SetTextureColorMod(SDL_Renderer * renderer, SDL_Texture * texture)
{ {
...@@ -343,19 +312,14 @@ static int ...@@ -343,19 +312,14 @@ static int
SW_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, SW_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
const SDL_Rect * rect, const void *pixels, int pitch) const SDL_Rect * rect, const void *pixels, int pitch)
{ {
if (SDL_ISPIXELFORMAT_FOURCC(texture->format)) {
return SDL_SW_UpdateYUVTexture((SDL_SW_YUVTexture *)
texture->driverdata, rect, pixels,
pitch);
} else {
SDL_Surface *surface = (SDL_Surface *) texture->driverdata; SDL_Surface *surface = (SDL_Surface *) texture->driverdata;
Uint8 *src, *dst; Uint8 *src, *dst;
int row; int row;
size_t length; size_t length;
src = (Uint8 *) pixels; src = (Uint8 *) pixels;
dst = dst = (Uint8 *) surface->pixels +
(Uint8 *) surface->pixels + rect->y * surface->pitch + rect->y * surface->pitch +
rect->x * surface->format->BytesPerPixel; rect->x * surface->format->BytesPerPixel;
length = rect->w * surface->format->BytesPerPixel; length = rect->w * surface->format->BytesPerPixel;
for (row = 0; row < rect->h; ++row) { for (row = 0; row < rect->h; ++row) {
...@@ -364,19 +328,12 @@ SW_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, ...@@ -364,19 +328,12 @@ SW_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
dst += surface->pitch; dst += surface->pitch;
} }
return 0; return 0;
}
} }
static int static int
SW_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, SW_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
const SDL_Rect * rect, int markDirty, void **pixels, const SDL_Rect * rect, void **pixels, int *pitch)
int *pitch)
{ {
if (SDL_ISPIXELFORMAT_FOURCC(texture->format)) {
return SDL_SW_LockYUVTexture((SDL_SW_YUVTexture *)
texture->driverdata, rect, markDirty,
pixels, pitch);
} else {
SDL_Surface *surface = (SDL_Surface *) texture->driverdata; SDL_Surface *surface = (SDL_Surface *) texture->driverdata;
*pixels = *pixels =
...@@ -384,15 +341,11 @@ SW_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, ...@@ -384,15 +341,11 @@ SW_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
rect->x * surface->format->BytesPerPixel); rect->x * surface->format->BytesPerPixel);
*pitch = surface->pitch; *pitch = surface->pitch;
return 0; return 0;
}
} }
static void static void
SW_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture) SW_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture)
{ {
if (SDL_ISPIXELFORMAT_FOURCC(texture->format)) {
SDL_SW_UnlockYUVTexture((SDL_SW_YUVTexture *) texture->driverdata);
}
} }
static int static int
...@@ -420,7 +373,7 @@ SW_RenderDrawPoints(SDL_Renderer * renderer, const SDL_Point * points, ...@@ -420,7 +373,7 @@ SW_RenderDrawPoints(SDL_Renderer * renderer, const SDL_Point * points,
return 0; return 0;
} }
if (data->renderer->LockTexture(data->renderer, texture, &rect, 1, if (data->renderer->LockTexture(data->renderer, texture, &rect,
&data->surface.pixels, &data->surface.pixels,
&data->surface.pitch) < 0) { &data->surface.pitch) < 0) {
return -1; return -1;
...@@ -484,7 +437,7 @@ SW_RenderDrawLines(SDL_Renderer * renderer, const SDL_Point * points, ...@@ -484,7 +437,7 @@ SW_RenderDrawLines(SDL_Renderer * renderer, const SDL_Point * points,
return 0; return 0;
} }
if (data->renderer->LockTexture(data->renderer, texture, &rect, 1, if (data->renderer->LockTexture(data->renderer, texture, &rect,
&data->surface.pixels, &data->surface.pixels,
&data->surface.pitch) < 0) { &data->surface.pitch) < 0) {
return -1; return -1;
...@@ -558,7 +511,7 @@ SW_RenderFillRects(SDL_Renderer * renderer, const SDL_Rect ** rects, ...@@ -558,7 +511,7 @@ SW_RenderFillRects(SDL_Renderer * renderer, const SDL_Rect ** rects,
continue; continue;
} }
if (data->renderer->LockTexture(data->renderer, texture, &rect, 1, if (data->renderer->LockTexture(data->renderer, texture, &rect,
&data->surface.pixels, &data->surface.pixels,
&data->surface.pitch) < 0) { &data->surface.pitch) < 0) {
return -1; return -1;
...@@ -586,27 +539,23 @@ SW_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, ...@@ -586,27 +539,23 @@ SW_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
const SDL_Rect * srcrect, const SDL_Rect * dstrect) const SDL_Rect * srcrect, const SDL_Rect * dstrect)
{ {
SW_RenderData *data = (SW_RenderData *) renderer->driverdata; SW_RenderData *data = (SW_RenderData *) renderer->driverdata;
SDL_Surface *surface;
SDL_Rect real_srcrect;
SDL_Rect real_dstrect;
int status; int status;
if (!SW_ActivateRenderer(renderer)) { if (!SW_ActivateRenderer(renderer)) {
return -1; return -1;
} }
if (data->renderer->LockTexture(data->renderer, data->texture, if (data->renderer->LockTexture(data->renderer, data->texture, dstrect,
dstrect, 1, &data->surface.pixels, &data->surface.pixels,
&data->surface.pitch) < 0) { &data->surface.pitch) < 0) {
return -1; return -1;
} }
if (SDL_ISPIXELFORMAT_FOURCC(texture->format)) { surface = (SDL_Surface *) texture->driverdata;
status = real_srcrect = *srcrect;
SDL_SW_CopyYUVToRGB((SDL_SW_YUVTexture *) texture->driverdata,
srcrect, data->format, dstrect->w, dstrect->h,
data->surface.pixels, data->surface.pitch);
} else {
SDL_Surface *surface = (SDL_Surface *) texture->driverdata;
SDL_Rect real_srcrect = *srcrect;
SDL_Rect real_dstrect;
data->surface.w = dstrect->w; data->surface.w = dstrect->w;
data->surface.h = dstrect->h; data->surface.h = dstrect->h;
...@@ -614,10 +563,7 @@ SW_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, ...@@ -614,10 +563,7 @@ SW_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
data->surface.clip_rect.h = dstrect->h; data->surface.clip_rect.h = dstrect->h;
real_dstrect = data->surface.clip_rect; real_dstrect = data->surface.clip_rect;
status = status = SDL_LowerBlit(surface, &real_srcrect, &data->surface, &real_dstrect);
SDL_LowerBlit(surface, &real_srcrect, &data->surface,
&real_dstrect);
}
data->renderer->UnlockTexture(data->renderer, data->texture); data->renderer->UnlockTexture(data->renderer, data->texture);
return status; return status;
} }
...@@ -632,8 +578,8 @@ SW_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, ...@@ -632,8 +578,8 @@ SW_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
return -1; return -1;
} }
if (data->renderer->LockTexture(data->renderer, data->texture, if (data->renderer->LockTexture(data->renderer, data->texture, rect,
rect, 0, &data->surface.pixels, &data->surface.pixels,
&data->surface.pitch) < 0) { &data->surface.pitch) < 0) {
return -1; return -1;
} }
...@@ -656,8 +602,8 @@ SW_RenderWritePixels(SDL_Renderer * renderer, const SDL_Rect * rect, ...@@ -656,8 +602,8 @@ SW_RenderWritePixels(SDL_Renderer * renderer, const SDL_Rect * rect,
return -1; return -1;
} }
if (data->renderer->LockTexture(data->renderer, data->texture, if (data->renderer->LockTexture(data->renderer, data->texture, rect,
rect, 1, &data->surface.pixels, &data->surface.pixels,
&data->surface.pitch) < 0) { &data->surface.pitch) < 0) {
return -1; return -1;
} }
...@@ -692,13 +638,9 @@ SW_RenderPresent(SDL_Renderer * renderer) ...@@ -692,13 +638,9 @@ SW_RenderPresent(SDL_Renderer * renderer)
static void static void
SW_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture) SW_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture)
{ {
if (SDL_ISPIXELFORMAT_FOURCC(texture->format)) {
SDL_SW_DestroyYUVTexture((SDL_SW_YUVTexture *) texture->driverdata);
} else {
SDL_Surface *surface = (SDL_Surface *) texture->driverdata; SDL_Surface *surface = (SDL_Surface *) texture->driverdata;
SDL_FreeSurface(surface); SDL_FreeSurface(surface);
}
} }
static void static void
...@@ -717,7 +659,6 @@ SW_DestroyRenderer(SDL_Renderer * renderer) ...@@ -717,7 +659,6 @@ SW_DestroyRenderer(SDL_Renderer * renderer)
if (data->renderer) { if (data->renderer) {
data->renderer->DestroyRenderer(data->renderer); data->renderer->DestroyRenderer(data->renderer);
} }
SDL_FreeDirtyRects(&data->dirty);
SDL_free(data); SDL_free(data);
} }
SDL_free(renderer); SDL_free(renderer);
......
...@@ -29,4 +29,5 @@ ...@@ -29,4 +29,5 @@
#ifdef CHECK_LEAKS #ifdef CHECK_LEAKS
extern int surfaces_allocated; extern int surfaces_allocated;
#endif #endif
/* vi: set ts=4 sw=4 expandtab: */ /* vi: set ts=4 sw=4 expandtab: */
...@@ -339,66 +339,4 @@ SDL_IntersectRectAndLine(const SDL_Rect * rect, int *X1, int *Y1, int *X2, ...@@ -339,66 +339,4 @@ SDL_IntersectRectAndLine(const SDL_Rect * rect, int *X1, int *Y1, int *X2,
return SDL_TRUE; return SDL_TRUE;
} }
void
SDL_AddDirtyRect(SDL_DirtyRectList * list, const SDL_Rect * rect)
{
SDL_DirtyRect *dirty;
/* FIXME: At what point is this optimization too expensive? */
for (dirty = list->list; dirty; dirty = dirty->next) {
if (SDL_HasIntersection(&dirty->rect, rect)) {
SDL_UnionRect(&dirty->rect, rect, &dirty->rect);
return;
}
}
if (list->free) {
dirty = list->free;
list->free = dirty->next;
} else {
dirty = (SDL_DirtyRect *) SDL_malloc(sizeof(*dirty));
if (!dirty) {
return;
}
}
dirty->rect = *rect;
dirty->next = list->list;
list->list = dirty;
}
void
SDL_ClearDirtyRects(SDL_DirtyRectList * list)
{
SDL_DirtyRect *prev, *curr;
/* Skip to the end of the free list */
prev = NULL;
for (curr = list->free; curr; curr = curr->next) {
prev = curr;
}
/* Add the list entries to the end */
if (prev) {
prev->next = list->list;
} else {
list->free = list->list;
}
list->list = NULL;
}
void
SDL_FreeDirtyRects(SDL_DirtyRectList * list)
{
while (list->list) {
SDL_DirtyRect *elem = list->list;
list->list = elem->next;
SDL_free(elem);
}
while (list->free) {
SDL_DirtyRect *elem = list->free;
list->free = elem->next;
SDL_free(elem);
}
}
/* vi: set ts=4 sw=4 expandtab: */ /* vi: set ts=4 sw=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment