mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-11 14:44:36 +00:00
* Adjustment: Update libsdl to address a bug in compilation on MacOS devices.
This commit is contained in:
parent
516163fd5d
commit
eab544c8f3
270 changed files with 9531 additions and 3704 deletions
|
|
@ -2670,11 +2670,16 @@ static int
|
|||
RenderDrawPointsWithRects(SDL_Renderer * renderer,
|
||||
const SDL_Point * points, const int count)
|
||||
{
|
||||
int retval = -1;
|
||||
int retval;
|
||||
SDL_bool isstack;
|
||||
SDL_FRect *frects = SDL_small_alloc(SDL_FRect, count, &isstack);
|
||||
SDL_FRect *frects;
|
||||
int i;
|
||||
|
||||
if (count < 1) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
frects = SDL_small_alloc(SDL_FRect, count, &isstack);
|
||||
if (!frects) {
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
|
|
@ -2686,9 +2691,7 @@ RenderDrawPointsWithRects(SDL_Renderer * renderer,
|
|||
frects[i].h = renderer->scale.y;
|
||||
}
|
||||
|
||||
if (count) {
|
||||
retval = QueueCmdFillRects(renderer, frects, count);
|
||||
}
|
||||
retval = QueueCmdFillRects(renderer, frects, count);
|
||||
|
||||
SDL_small_free(frects, isstack);
|
||||
|
||||
|
|
@ -2743,11 +2746,16 @@ static int
|
|||
RenderDrawPointsWithRectsF(SDL_Renderer * renderer,
|
||||
const SDL_FPoint * fpoints, const int count)
|
||||
{
|
||||
int retval = -1;
|
||||
int retval;
|
||||
SDL_bool isstack;
|
||||
SDL_FRect *frects = SDL_small_alloc(SDL_FRect, count, &isstack);
|
||||
SDL_FRect *frects;
|
||||
int i;
|
||||
|
||||
if (count < 1) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
frects = SDL_small_alloc(SDL_FRect, count, &isstack);
|
||||
if (!frects) {
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
|
|
@ -2759,9 +2767,7 @@ RenderDrawPointsWithRectsF(SDL_Renderer * renderer,
|
|||
frects[i].h = renderer->scale.y;
|
||||
}
|
||||
|
||||
if (count) {
|
||||
retval = QueueCmdFillRects(renderer, frects, count);
|
||||
}
|
||||
retval = QueueCmdFillRects(renderer, frects, count);
|
||||
|
||||
SDL_small_free(frects, isstack);
|
||||
|
||||
|
|
|
|||
|
|
@ -41,6 +41,13 @@
|
|||
|
||||
#include "SDL_shaders_d3d.h"
|
||||
|
||||
#ifdef __WATCOMC__
|
||||
/* FIXME: Remove this once https://github.com/open-watcom/open-watcom-v2/pull/868 is merged */
|
||||
#define D3DBLENDOP_REVSUBTRACT 3
|
||||
/* FIXME: Remove this once https://github.com/open-watcom/open-watcom-v2/pull/869 is merged */
|
||||
#define D3DERR_UNSUPPORTEDCOLOROPERATION MAKE_D3DHRESULT( 2073 )
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
{
|
||||
SDL_Rect viewport;
|
||||
|
|
@ -1079,7 +1086,13 @@ SetDrawState(D3D_RenderData *data, const SDL_RenderCommand *cmd)
|
|||
|
||||
if (data->drawstate.viewport_dirty) {
|
||||
const SDL_Rect *viewport = &data->drawstate.viewport;
|
||||
const D3DVIEWPORT9 d3dviewport = { viewport->x, viewport->y, viewport->w, viewport->h, 0.0f, 1.0f };
|
||||
D3DVIEWPORT9 d3dviewport;
|
||||
d3dviewport.X = viewport->x;
|
||||
d3dviewport.Y = viewport->y;
|
||||
d3dviewport.Width = viewport->w;
|
||||
d3dviewport.Height = viewport->h;
|
||||
d3dviewport.MinZ = 0.0f;
|
||||
d3dviewport.MaxZ = 1.0f;
|
||||
IDirect3DDevice9_SetViewport(data->device, &d3dviewport);
|
||||
|
||||
/* Set an orthographic projection matrix */
|
||||
|
|
@ -1106,7 +1119,11 @@ SetDrawState(D3D_RenderData *data, const SDL_RenderCommand *cmd)
|
|||
if (data->drawstate.cliprect_dirty) {
|
||||
const SDL_Rect *viewport = &data->drawstate.viewport;
|
||||
const SDL_Rect *rect = &data->drawstate.cliprect;
|
||||
const RECT d3drect = { viewport->x + rect->x, viewport->y + rect->y, viewport->x + rect->x + rect->w, viewport->y + rect->y + rect->h };
|
||||
RECT d3drect;
|
||||
d3drect.left = viewport->x + rect->x;
|
||||
d3drect.top = viewport->y + rect->y;
|
||||
d3drect.right = viewport->x + rect->x + rect->w;
|
||||
d3drect.bottom = viewport->y + rect->y + rect->h;
|
||||
IDirect3DDevice9_SetScissorRect(data->device, &d3drect);
|
||||
data->drawstate.cliprect_dirty = SDL_FALSE;
|
||||
}
|
||||
|
|
@ -1221,7 +1238,9 @@ D3D_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *verti
|
|||
IDirect3DDevice9_Clear(data->device, 0, NULL, D3DCLEAR_TARGET, color, 0.0f, 0);
|
||||
} else {
|
||||
/* Clear is defined to clear the entire render target */
|
||||
const D3DVIEWPORT9 wholeviewport = { 0, 0, backw, backh, 0.0f, 1.0f };
|
||||
D3DVIEWPORT9 wholeviewport = { 0, 0, 0, 0, 0.0f, 1.0f };
|
||||
wholeviewport.Width = backw;
|
||||
wholeviewport.Height = backh;
|
||||
IDirect3DDevice9_SetViewport(data->device, &wholeviewport);
|
||||
data->drawstate.viewport_dirty = SDL_TRUE; /* we still need to (re)set orthographic projection, so always mark it dirty. */
|
||||
IDirect3DDevice9_Clear(data->device, 0, NULL, D3DCLEAR_TARGET, color, 0.0f, 0);
|
||||
|
|
|
|||
|
|
@ -142,24 +142,6 @@ typedef struct METAL_ShaderPipelines
|
|||
@end
|
||||
|
||||
@implementation METAL_RenderData
|
||||
#if !__has_feature(objc_arc)
|
||||
- (void)dealloc
|
||||
{
|
||||
[_mtldevice release];
|
||||
[_mtlcmdqueue release];
|
||||
[_mtlcmdbuffer release];
|
||||
[_mtlcmdencoder release];
|
||||
[_mtllibrary release];
|
||||
[_mtlbackbuffer release];
|
||||
[_mtlsamplernearest release];
|
||||
[_mtlsamplerlinear release];
|
||||
[_mtlbufconstants release];
|
||||
[_mtlbufquadindices release];
|
||||
[_mtllayer release];
|
||||
[_mtlpassdesc release];
|
||||
[super dealloc];
|
||||
}
|
||||
#endif
|
||||
@end
|
||||
|
||||
@interface METAL_TextureData : NSObject
|
||||
|
|
@ -178,16 +160,6 @@ typedef struct METAL_ShaderPipelines
|
|||
@end
|
||||
|
||||
@implementation METAL_TextureData
|
||||
#if !__has_feature(objc_arc)
|
||||
- (void)dealloc
|
||||
{
|
||||
[_mtltexture release];
|
||||
[_mtltexture_uv release];
|
||||
[_mtlsampler release];
|
||||
[_lockedbuffer release];
|
||||
[super dealloc];
|
||||
}
|
||||
#endif
|
||||
@end
|
||||
|
||||
static int
|
||||
|
|
@ -342,13 +314,6 @@ MakePipelineState(METAL_RenderData *data, METAL_PipelineCache *cache,
|
|||
|
||||
METAL_PipelineState *states = SDL_realloc(cache->states, (cache->count + 1) * sizeof(pipeline));
|
||||
|
||||
#if !__has_feature(objc_arc)
|
||||
[mtlpipedesc release]; // !!! FIXME: can these be reused for each creation, or does the pipeline obtain it?
|
||||
[mtlvertfn release];
|
||||
[mtlfragfn release];
|
||||
[state release];
|
||||
#endif
|
||||
|
||||
if (states) {
|
||||
states[cache->count++] = pipeline;
|
||||
cache->states = states;
|
||||
|
|
@ -632,9 +597,6 @@ METAL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
|
|||
if (yuv || nv12) {
|
||||
mtltexture_uv = [data.mtldevice newTextureWithDescriptor:mtltexdesc];
|
||||
if (mtltexture_uv == nil) {
|
||||
#if !__has_feature(objc_arc)
|
||||
[mtltexture release];
|
||||
#endif
|
||||
return SDL_SetError("Texture allocation failed");
|
||||
}
|
||||
}
|
||||
|
|
@ -677,12 +639,6 @@ METAL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
|
|||
#endif
|
||||
texture->driverdata = (void*)CFBridgingRetain(texturedata);
|
||||
|
||||
#if !__has_feature(objc_arc)
|
||||
[texturedata release];
|
||||
[mtltexture release];
|
||||
[mtltexture_uv release];
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}}
|
||||
|
||||
|
|
@ -742,10 +698,6 @@ METAL_UpdateTextureInternal(SDL_Renderer * renderer, METAL_TextureData *textured
|
|||
return SDL_OutOfMemory();
|
||||
}
|
||||
|
||||
#if !__has_feature(objc_arc)
|
||||
[stagingtex autorelease];
|
||||
#endif
|
||||
|
||||
METAL_UploadTextureData(stagingtex, stagingrect, 0, pixels, pitch);
|
||||
|
||||
if (data.mtlcmdencoder != nil) {
|
||||
|
|
@ -917,11 +869,6 @@ METAL_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
|
|||
texturedata.lockedbuffer = lockedbuffer;
|
||||
*pixels = [lockedbuffer contents];
|
||||
|
||||
/* METAL_TextureData.lockedbuffer retains. */
|
||||
#if !__has_feature(objc_arc)
|
||||
[lockedbuffer release];
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}}
|
||||
|
||||
|
|
@ -1209,13 +1156,8 @@ METAL_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture
|
|||
|
||||
typedef struct
|
||||
{
|
||||
#if __has_feature(objc_arc)
|
||||
__unsafe_unretained id<MTLRenderPipelineState> pipeline;
|
||||
__unsafe_unretained id<MTLBuffer> vertex_buffer;
|
||||
#else
|
||||
id<MTLRenderPipelineState> pipeline;
|
||||
id<MTLBuffer> vertex_buffer;
|
||||
#endif
|
||||
size_t constants_offset;
|
||||
SDL_Texture *texture;
|
||||
SDL_bool cliprect_dirty;
|
||||
|
|
@ -1365,9 +1307,6 @@ METAL_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *ver
|
|||
* TODO: this buffer is also used for constants. Is performance still
|
||||
* good for those, or should we have a managed buffer for them? */
|
||||
mtlbufvertex = [data.mtldevice newBufferWithLength:vertsize options:MTLResourceStorageModeShared];
|
||||
#if !__has_feature(objc_arc)
|
||||
[mtlbufvertex autorelease];
|
||||
#endif
|
||||
mtlbufvertex.label = @"SDL vertex data";
|
||||
SDL_memcpy([mtlbufvertex contents], vertices, vertsize);
|
||||
|
||||
|
|
@ -1711,9 +1650,6 @@ METAL_CreateRenderer(SDL_Window * window, Uint32 flags)
|
|||
}
|
||||
|
||||
if (view == NULL) {
|
||||
#if !__has_feature(objc_arc)
|
||||
[mtldevice release];
|
||||
#endif
|
||||
SDL_free(renderer);
|
||||
if (changed_window) {
|
||||
SDL_RecreateWindow(window, window_flags);
|
||||
|
|
@ -1725,9 +1661,6 @@ METAL_CreateRenderer(SDL_Window * window, Uint32 flags)
|
|||
data = [[METAL_RenderData alloc] init];
|
||||
|
||||
if (data == nil) {
|
||||
#if !__has_feature(objc_arc)
|
||||
[mtldevice release];
|
||||
#endif
|
||||
/* Release the metal view instead of destroying it,
|
||||
in case we want to use it later (recreating the renderer)
|
||||
*/
|
||||
|
|
@ -1746,7 +1679,7 @@ METAL_CreateRenderer(SDL_Window * window, Uint32 flags)
|
|||
data.mtlview = view;
|
||||
|
||||
#ifdef __MACOSX__
|
||||
layer = (CAMetalLayer *)[(NSView *)view layer];
|
||||
layer = (CAMetalLayer *)[(__bridge NSView *)view layer];
|
||||
#else
|
||||
layer = (CAMetalLayer *)[(__bridge UIView *)view layer];
|
||||
#endif
|
||||
|
|
@ -1771,9 +1704,6 @@ METAL_CreateRenderer(SDL_Window * window, Uint32 flags)
|
|||
id<MTLLibrary> mtllibrary = [data.mtldevice newLibraryWithData:mtllibdata error:&err];
|
||||
data.mtllibrary = mtllibrary;
|
||||
SDL_assert(err == nil);
|
||||
#if !__has_feature(objc_arc)
|
||||
dispatch_release(mtllibdata);
|
||||
#endif
|
||||
data.mtllibrary.label = @"SDL Metal renderer shader library";
|
||||
|
||||
/* Do some shader pipeline state loading up-front rather than on demand. */
|
||||
|
|
@ -1831,9 +1761,6 @@ METAL_CreateRenderer(SDL_Window * window, Uint32 flags)
|
|||
};
|
||||
|
||||
id<MTLBuffer> mtlbufconstantstaging = [data.mtldevice newBufferWithLength:CONSTANTS_LENGTH options:MTLResourceStorageModeShared];
|
||||
#if !__has_feature(objc_arc)
|
||||
[mtlbufconstantstaging autorelease];
|
||||
#endif
|
||||
|
||||
char *constantdata = [mtlbufconstantstaging contents];
|
||||
SDL_memcpy(constantdata + CONSTANTS_OFFSET_IDENTITY, identitytransform, sizeof(identitytransform));
|
||||
|
|
@ -1845,9 +1772,6 @@ METAL_CreateRenderer(SDL_Window * window, Uint32 flags)
|
|||
int quadcount = UINT16_MAX / 4;
|
||||
size_t indicessize = sizeof(UInt16) * quadcount * 6;
|
||||
id<MTLBuffer> mtlbufquadindicesstaging = [data.mtldevice newBufferWithLength:indicessize options:MTLResourceStorageModeShared];
|
||||
#if !__has_feature(objc_arc)
|
||||
[mtlbufquadindicesstaging autorelease];
|
||||
#endif
|
||||
|
||||
/* Quads in the following vertex order (matches the FillRects vertices):
|
||||
* 1---3
|
||||
|
|
@ -1965,18 +1889,6 @@ METAL_CreateRenderer(SDL_Window * window, Uint32 flags)
|
|||
renderer->info.max_texture_width = maxtexsize;
|
||||
renderer->info.max_texture_height = maxtexsize;
|
||||
|
||||
#if !__has_feature(objc_arc)
|
||||
[mtlcmdqueue release];
|
||||
[mtllibrary release];
|
||||
[samplerdesc release];
|
||||
[mtlsamplernearest release];
|
||||
[mtlsamplerlinear release];
|
||||
[mtlbufconstants release];
|
||||
[mtlbufquadindices release];
|
||||
[data release];
|
||||
[mtldevice release];
|
||||
#endif
|
||||
|
||||
return renderer;
|
||||
}}
|
||||
|
||||
|
|
|
|||
|
|
@ -61,11 +61,6 @@ typedef struct tColorY {
|
|||
Uint8 y;
|
||||
} tColorY;
|
||||
|
||||
/* !
|
||||
\brief Returns maximum of two numbers a and b.
|
||||
*/
|
||||
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
|
||||
|
||||
/* !
|
||||
\brief Number of guard rows added to destination surfaces.
|
||||
|
||||
|
|
|
|||
|
|
@ -22,10 +22,6 @@
|
|||
#ifndef SDL_rotate_h_
|
||||
#define SDL_rotate_h_
|
||||
|
||||
#ifndef MIN
|
||||
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
extern SDL_Surface *SDLgfx_rotateSurface(SDL_Surface * src, double angle, int smooth, int flipx, int flipy,
|
||||
const SDL_Rect *rect_dest, double cangle, double sangle, const SDL_FPoint *center);
|
||||
extern void SDLgfx_rotozoomSurfaceSizeTrig(int width, int height, double angle, const SDL_FPoint *center,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue