This one should hopefully be very obvious. I have been wanting to clean up some of the graphics texture copying functions because they duplicate a lot of logic. The obvious idea here is to just create a new set of abstractions that are even lower level and then rewrite the duplicate graphics texture functions with them. This will ensure that all of the graphics backends have more consistent and predictable behavior when it comes to the user functions that use these abstractions.
An important distinction I should make here is that this new API is based on the semantics of OpenGL and not Direct3D. Direct3D is actually lower level, allowing you to map the texture directly to system memory while you operate on its data in situ. So the Direct3D systems will implement the new API by performing an extra copy to system memory. This means the client is responsible for deleting the allocated memory regardless of the backend. The end result should be that Direct3D and OpenGL will have pretty similar performance when calling these functions.
These new functions are now mandatory for each backend to implement.
unsigned char* graphics_copy_texture_pixels(int texture, unsigned* fullwidth, unsigned* fullheight); unsigned char* graphics_copy_texture_pixels(int texture, int x, int y, int width, int height); void graphics_push_texture_pixels(int texture, int x, int y, int width, int height, unsigned char* pxdata); void graphics_push_texture_pixels(int texture, int width, int height, unsigned char* pxdata);
These old mandatory functions were moved to
General/ and reimplemented with the new abstract ones.
int graphics_duplicate_texture(int tex, bool mipmap=false); void graphics_replace_texture_alpha_from_texture(int tex, int copy_tex); void graphics_copy_texture(int source, int destination, int x, int y); void graphics_copy_texture_part(int source, int destination, int xoff, int yoff, int w, int h, int x, int y);
@@ Coverage Diff @@ ## master #1648 +/- ## ========================================== - Coverage 18.82% 18.77% -0.05% ========================================== Files 169 169 Lines 16782 16757 -25 ========================================== - Hits 3159 3146 -13 + Misses 13623 13611 -12
|Impacted Files||Coverage Δ|