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;
}; };
......
This diff is collapsed.
...@@ -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_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX1) || \ (!SDL_ISPIXELFORMAT_FOURCC(format) && \
(SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX4) || \ ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX1) || \
(SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX8)) (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX4) || \
(SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX8)))
#define SDL_ISPIXELFORMAT_ALPHA(format) \ #define SDL_ISPIXELFORMAT_ALPHA(format) \
((SDL_PIXELORDER(format) == SDL_PACKEDORDER_ARGB) || \ (!SDL_ISPIXELFORMAT_FOURCC(format) && \
(SDL_PIXELORDER(format) == SDL_PACKEDORDER_RGBA) || \ ((SDL_PIXELORDER(format) == SDL_PACKEDORDER_ARGB) || \
(SDL_PIXELORDER(format) == SDL_PACKEDORDER_ABGR) || \ (SDL_PIXELORDER(format) == SDL_PACKEDORDER_RGBA) || \
(SDL_PIXELORDER(format) == SDL_PACKEDORDER_BGRA)) (SDL_PIXELORDER(format) == SDL_PACKEDORDER_ABGR) || \
(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.
* *
...@@ -299,7 +283,7 @@ extern DECLSPEC int SDLCALL SDL_SetTextureBlendMode(SDL_Texture * texture, ...@@ -299,7 +283,7 @@ extern DECLSPEC int SDLCALL SDL_SetTextureBlendMode(SDL_Texture * texture,
/** /**
* \brief Get the blend mode used for texture copy operations. * \brief Get the blend mode used for texture copy operations.
* *
* \param texture The texture to query. * \param texture The texture to query.
* \param blendMode A pointer filled in with the current blend mode. * \param blendMode A pointer filled in with the current blend mode.
* *
* \return 0 on success, or -1 if the texture is not valid. * \return 0 on success, or -1 if the texture is not valid.
...@@ -312,7 +296,7 @@ extern DECLSPEC int SDLCALL SDL_GetTextureBlendMode(SDL_Texture * texture, ...@@ -312,7 +296,7 @@ extern DECLSPEC int SDLCALL SDL_GetTextureBlendMode(SDL_Texture * texture,
/** /**
* \brief Update the given texture rectangle with new pixel data. * \brief Update the given texture rectangle with new pixel data.
* *
* \param texture The texture to update * \param texture The texture to update
* \param rect A pointer to the rectangle of pixels to update, or NULL to * \param rect A pointer to the rectangle of pixels to update, or NULL to
* update the entire texture. * update the entire texture.
* \param pixels The raw pixel data. * \param pixels The raw pixel data.
...@@ -329,50 +313,29 @@ extern DECLSPEC int SDLCALL SDL_UpdateTexture(SDL_Texture * texture, ...@@ -329,50 +313,29 @@ extern DECLSPEC int SDLCALL SDL_UpdateTexture(SDL_Texture * texture,
/** /**
* \brief Lock a portion of the texture for pixel access. * \brief Lock a portion of the texture for pixel access.
* *
* \param texture The texture to lock for access, which was created with * \param texture The texture to lock for access, which was created with
* ::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_CalculatePitch(SDL_VideoSurface);
SDL_VideoSurface->pixels = pixels; SDL_VideoSurface->pixels =
SDL_VideoSurface->pitch = pitch; SDL_realloc(SDL_VideoSurface->pixels,
} else { SDL_VideoSurface->h * SDL_VideoSurface->pitch);
SDL_CalculatePitch(SDL_VideoSurface);
SDL_VideoSurface->pixels =
SDL_realloc(SDL_VideoSurface->pixels,
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,20 +811,15 @@ SDL_UpdateRects(SDL_Surface * screen, int numrects, SDL_Rect * rects) ...@@ -830,20 +811,15 @@ 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 needs to be copied to texture */
/* The surface memory is maintained by the renderer */ int pitch = screen->pitch;
SDL_DirtyTexture(SDL_VideoTexture, numrects, rects); int psize = screen->format->BytesPerPixel;
} else { for (i = 0; i < numrects; ++i) {
/* The surface memory needs to be copied to texture */ const SDL_Rect *rect = &rects[i];
int pitch = screen->pitch; void *pixels =
int psize = screen->format->BytesPerPixel; (Uint8 *) screen->pixels + rect->y * pitch +
for (i = 0; i < numrects; ++i) { rect->x * psize;
const SDL_Rect *rect = &rects[i]; SDL_UpdateTexture(SDL_VideoTexture, rect, pixels, pitch);
void *pixels =
(Uint8 *) screen->pixels + rect->y * pitch +
rect->x * psize;
SDL_UpdateTexture(SDL_VideoTexture, rect, pixels, pitch);
}
} }
rect.x = 0; rect.x = 0;
rect.y = 0; rect.y = 0;
...@@ -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,17 +1538,8 @@ SDL_LockYUVOverlay(SDL_Overlay * overlay) ...@@ -1582,17 +1538,8 @@ 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) return -1;
< 0) {
return -1;
}
} else {
if (SDL_LockTexture
(overlay->hwdata->texture, NULL, 1, &pixels, &pitch)
< 0) {
return -1;
}
} }
overlay->pixels[0] = (Uint8 *) pixels; overlay->pixels[0] = (Uint8 *) pixels;
overlay->pitches[0] = pitch; overlay->pitches[0] = pitch;
...@@ -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) { SDL_UnlockTexture(overlay->hwdata->texture);
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);
}
} }
int int
......
This diff is collapsed.
...@@ -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,
......
This diff is collapsed.
This diff is collapsed.
...@@ -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;
} }
......
This diff is collapsed.
...@@ -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