src/render/SDL_sysrender.h
author Ryan C. Gordon
Mon, 23 Jan 2017 12:06:10 -0500
changeset 10837 c2f241c2f6ad
parent 10737 3406a0f8b041
child 10914 ebc7ff92677d
permissions -rw-r--r--
audio: Fix same bug as last commit, but for _mm_bslli_si128 vs _mm_slli_si128.
slouken@5154
     1
/*
slouken@5535
     2
  Simple DirectMedia Layer
slouken@10737
     3
  Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
slouken@5154
     4
slouken@5535
     5
  This software is provided 'as-is', without any express or implied
slouken@5535
     6
  warranty.  In no event will the authors be held liable for any damages
slouken@5535
     7
  arising from the use of this software.
slouken@5154
     8
slouken@5535
     9
  Permission is granted to anyone to use this software for any purpose,
slouken@5535
    10
  including commercial applications, and to alter it and redistribute it
slouken@5535
    11
  freely, subject to the following restrictions:
slouken@5154
    12
slouken@5535
    13
  1. The origin of this software must not be misrepresented; you must not
slouken@5535
    14
     claim that you wrote the original software. If you use this software
slouken@5535
    15
     in a product, an acknowledgment in the product documentation would be
slouken@5535
    16
     appreciated but is not required.
slouken@5535
    17
  2. Altered source versions must be plainly marked as such, and must not be
slouken@5535
    18
     misrepresented as being the original software.
slouken@5535
    19
  3. This notice may not be removed or altered from any source distribution.
slouken@5154
    20
*/
icculus@8093
    21
#include "../SDL_internal.h"
slouken@5154
    22
slouken@10638
    23
#ifndef SDL_sysrender_h_
slouken@10638
    24
#define SDL_sysrender_h_
slouken@5154
    25
slouken@5154
    26
#include "SDL_render.h"
slouken@5154
    27
#include "SDL_events.h"
slouken@5156
    28
#include "SDL_yuv_sw_c.h"
slouken@5154
    29
slouken@5154
    30
/* The SDL 2D rendering system */
slouken@5154
    31
slouken@5154
    32
typedef struct SDL_RenderDriver SDL_RenderDriver;
slouken@5154
    33
slouken@6528
    34
typedef struct
slouken@6528
    35
{
slouken@6528
    36
    float x;
slouken@6528
    37
    float y;
slouken@6528
    38
} SDL_FPoint;
slouken@6528
    39
slouken@6528
    40
typedef struct
slouken@6528
    41
{
slouken@6528
    42
    float x;
slouken@6528
    43
    float y;
slouken@6528
    44
    float w;
slouken@6528
    45
    float h;
slouken@6528
    46
} SDL_FRect;
slouken@6528
    47
slouken@5154
    48
/* Define the SDL texture structure */
slouken@5154
    49
struct SDL_Texture
slouken@5154
    50
{
slouken@5154
    51
    const void *magic;
slouken@5154
    52
    Uint32 format;              /**< The pixel format of the texture */
slouken@5154
    53
    int access;                 /**< SDL_TextureAccess */
slouken@5154
    54
    int w;                      /**< The width of the texture */
slouken@5154
    55
    int h;                      /**< The height of the texture */
slouken@5154
    56
    int modMode;                /**< The texture modulation mode */
slouken@5154
    57
    SDL_BlendMode blendMode;    /**< The texture blend mode */
slouken@5154
    58
    Uint8 r, g, b, a;           /**< Texture modulation values */
slouken@5154
    59
slouken@5154
    60
    SDL_Renderer *renderer;
slouken@5154
    61
slouken@5156
    62
    /* Support for formats not supported directly by the renderer */
slouken@5156
    63
    SDL_Texture *native;
slouken@5156
    64
    SDL_SW_YUVTexture *yuv;
slouken@5156
    65
    void *pixels;
slouken@5156
    66
    int pitch;
slouken@5156
    67
    SDL_Rect locked_rect;
slouken@5156
    68
slouken@5154
    69
    void *driverdata;           /**< Driver specific texture representation */
slouken@5154
    70
slouken@5154
    71
    SDL_Texture *prev;
slouken@5154
    72
    SDL_Texture *next;
slouken@5154
    73
};
slouken@5154
    74
slouken@5154
    75
/* Define the SDL renderer structure */
slouken@5154
    76
struct SDL_Renderer
slouken@5154
    77
{
slouken@5154
    78
    const void *magic;
slouken@5154
    79
slouken@5154
    80
    void (*WindowEvent) (SDL_Renderer * renderer, const SDL_WindowEvent *event);
slouken@7239
    81
    int (*GetOutputSize) (SDL_Renderer * renderer, int *w, int *h);
slouken@5154
    82
    int (*CreateTexture) (SDL_Renderer * renderer, SDL_Texture * texture);
slouken@5154
    83
    int (*SetTextureColorMod) (SDL_Renderer * renderer,
slouken@5154
    84
                               SDL_Texture * texture);
slouken@5154
    85
    int (*SetTextureAlphaMod) (SDL_Renderer * renderer,
slouken@5154
    86
                               SDL_Texture * texture);
slouken@5154
    87
    int (*SetTextureBlendMode) (SDL_Renderer * renderer,
slouken@5154
    88
                                SDL_Texture * texture);
slouken@5154
    89
    int (*UpdateTexture) (SDL_Renderer * renderer, SDL_Texture * texture,
slouken@5154
    90
                          const SDL_Rect * rect, const void *pixels,
slouken@5154
    91
                          int pitch);
slouken@7759
    92
    int (*UpdateTextureYUV) (SDL_Renderer * renderer, SDL_Texture * texture,
slouken@7759
    93
                            const SDL_Rect * rect,
slouken@7759
    94
                            const Uint8 *Yplane, int Ypitch,
slouken@7759
    95
                            const Uint8 *Uplane, int Upitch,
slouken@7759
    96
                            const Uint8 *Vplane, int Vpitch);
slouken@5154
    97
    int (*LockTexture) (SDL_Renderer * renderer, SDL_Texture * texture,
slouken@5156
    98
                        const SDL_Rect * rect, void **pixels, int *pitch);
slouken@5154
    99
    void (*UnlockTexture) (SDL_Renderer * renderer, SDL_Texture * texture);
slouken@6247
   100
    int (*SetRenderTarget) (SDL_Renderer * renderer, SDL_Texture * texture);
slouken@5297
   101
    int (*UpdateViewport) (SDL_Renderer * renderer);
slouken@7141
   102
    int (*UpdateClipRect) (SDL_Renderer * renderer);
slouken@5154
   103
    int (*RenderClear) (SDL_Renderer * renderer);
slouken@6528
   104
    int (*RenderDrawPoints) (SDL_Renderer * renderer, const SDL_FPoint * points,
slouken@5154
   105
                             int count);
slouken@6528
   106
    int (*RenderDrawLines) (SDL_Renderer * renderer, const SDL_FPoint * points,
slouken@5154
   107
                            int count);
slouken@6528
   108
    int (*RenderFillRects) (SDL_Renderer * renderer, const SDL_FRect * rects,
slouken@5154
   109
                            int count);
slouken@5154
   110
    int (*RenderCopy) (SDL_Renderer * renderer, SDL_Texture * texture,
slouken@6528
   111
                       const SDL_Rect * srcrect, const SDL_FRect * dstrect);
gabomdq@6320
   112
    int (*RenderCopyEx) (SDL_Renderer * renderer, SDL_Texture * texture,
slouken@6528
   113
                       const SDL_Rect * srcquad, const SDL_FRect * dstrect,
slouken@6528
   114
                       const double angle, const SDL_FPoint *center, const SDL_RendererFlip flip);
slouken@5154
   115
    int (*RenderReadPixels) (SDL_Renderer * renderer, const SDL_Rect * rect,
slouken@5154
   116
                             Uint32 format, void * pixels, int pitch);
slouken@5154
   117
    void (*RenderPresent) (SDL_Renderer * renderer);
slouken@5154
   118
    void (*DestroyTexture) (SDL_Renderer * renderer, SDL_Texture * texture);
slouken@5154
   119
slouken@5154
   120
    void (*DestroyRenderer) (SDL_Renderer * renderer);
slouken@5154
   121
gabomdq@6414
   122
    int (*GL_BindTexture) (SDL_Renderer * renderer, SDL_Texture *texture, float *texw, float *texh);
gabomdq@6414
   123
    int (*GL_UnbindTexture) (SDL_Renderer * renderer, SDL_Texture *texture);
gabomdq@6414
   124
slouken@5154
   125
    /* The current renderer info */
slouken@5154
   126
    SDL_RendererInfo info;
slouken@5154
   127
slouken@5154
   128
    /* The window associated with the renderer */
slouken@5154
   129
    SDL_Window *window;
slouken@6260
   130
    SDL_bool hidden;
slouken@5154
   131
slouken@6530
   132
    /* The logical resolution for rendering */
slouken@6530
   133
    int logical_w;
slouken@6530
   134
    int logical_h;
slouken@6581
   135
    int logical_w_backup;
slouken@6581
   136
    int logical_h_backup;
slouken@6530
   137
flibitijibibo@10039
   138
    /* Whether or not to force the viewport to even integer intervals */
flibitijibibo@10039
   139
    SDL_bool integer_scale;
flibitijibibo@10039
   140
slouken@5297
   141
    /* The drawable area within the window */
slouken@5297
   142
    SDL_Rect viewport;
slouken@6246
   143
    SDL_Rect viewport_backup;
slouken@5297
   144
slouken@7141
   145
    /* The clip rectangle within the window */
slouken@7141
   146
    SDL_Rect clip_rect;
slouken@7141
   147
    SDL_Rect clip_rect_backup;
slouken@7141
   148
jorgenpt@8728
   149
    /* Wether or not the clipping rectangle is used. */
jorgenpt@8728
   150
    SDL_bool clipping_enabled;
jorgenpt@8728
   151
    SDL_bool clipping_enabled_backup;
jorgenpt@8728
   152
slouken@6528
   153
    /* The render output coordinate scale */
slouken@6528
   154
    SDL_FPoint scale;
slouken@6528
   155
    SDL_FPoint scale_backup;
slouken@6528
   156
slouken@5154
   157
    /* The list of textures */
slouken@5154
   158
    SDL_Texture *textures;
slouken@6246
   159
    SDL_Texture *target;
slouken@5154
   160
slouken@5154
   161
    Uint8 r, g, b, a;                   /**< Color for drawing operations values */
slouken@5154
   162
    SDL_BlendMode blendMode;            /**< The drawing blend mode */
slouken@5154
   163
slouken@5154
   164
    void *driverdata;
slouken@5154
   165
};
slouken@5154
   166
slouken@5154
   167
/* Define the SDL render driver structure */
slouken@5154
   168
struct SDL_RenderDriver
slouken@5154
   169
{
slouken@5154
   170
    SDL_Renderer *(*CreateRenderer) (SDL_Window * window, Uint32 flags);
slouken@5154
   171
slouken@5154
   172
    /* Info about the renderer capabilities */
slouken@5154
   173
    SDL_RendererInfo info;
slouken@5154
   174
};
slouken@5154
   175
slouken@5226
   176
#if !SDL_RENDER_DISABLED
slouken@5226
   177
slouken@5154
   178
#if SDL_VIDEO_RENDER_D3D
slouken@5154
   179
extern SDL_RenderDriver D3D_RenderDriver;
slouken@5154
   180
#endif
dludwig@8400
   181
#if SDL_VIDEO_RENDER_D3D11
dludwig@8400
   182
extern SDL_RenderDriver D3D11_RenderDriver;
dludwig@8400
   183
#endif
slouken@5154
   184
#if SDL_VIDEO_RENDER_OGL
slouken@5154
   185
extern SDL_RenderDriver GL_RenderDriver;
slouken@5154
   186
#endif
slouken@5209
   187
#if SDL_VIDEO_RENDER_OGL_ES2
slouken@5209
   188
extern SDL_RenderDriver GLES2_RenderDriver;
slouken@5209
   189
#endif
slouken@5154
   190
#if SDL_VIDEO_RENDER_OGL_ES
slouken@5201
   191
extern SDL_RenderDriver GLES_RenderDriver;
slouken@5201
   192
#endif
slouken@5199
   193
#if SDL_VIDEO_RENDER_DIRECTFB
slouken@5199
   194
extern SDL_RenderDriver DirectFB_RenderDriver;
slouken@5199
   195
#endif
kimonline@7009
   196
#if SDL_VIDEO_RENDER_PSP
kimonline@7009
   197
extern SDL_RenderDriver PSP_RenderDriver;
kimonline@7009
   198
#endif
slouken@5154
   199
extern SDL_RenderDriver SW_RenderDriver;
slouken@5154
   200
slouken@5226
   201
#endif /* !SDL_RENDER_DISABLED */
slouken@5226
   202
slouken@10638
   203
#endif /* SDL_sysrender_h_ */
slouken@5154
   204
slouken@5154
   205
/* vi: set ts=4 sw=4 expandtab: */