mirror of https://github.com/encounter/SDL.git
Separate vita piglet renderer. Add proper render initialization and window re-creation.
This commit is contained in:
parent
d75ea51ac0
commit
dbb730d395
|
@ -21,8 +21,7 @@ SOURCES = \
|
||||||
src/filesystem/vita/*.c \
|
src/filesystem/vita/*.c \
|
||||||
src/render/*.c \
|
src/render/*.c \
|
||||||
src/render/software/*.c \
|
src/render/software/*.c \
|
||||||
src/render/opengles2/SDL_render_gles2.c \
|
src/render/vitagles2/*.c \
|
||||||
src/render/vita/*.c \
|
|
||||||
src/sensor/*.c \
|
src/sensor/*.c \
|
||||||
src/sensor/dummy/*.c \
|
src/sensor/dummy/*.c \
|
||||||
src/stdlib/*.c \
|
src/stdlib/*.c \
|
||||||
|
|
|
@ -139,8 +139,12 @@
|
||||||
#define SDL_FILESYSTEM_VITA 1
|
#define SDL_FILESYSTEM_VITA 1
|
||||||
|
|
||||||
|
|
||||||
#define SDL_VIDEO_RENDER_OGL_ES2 1
|
#define SDL_VIDEO_RENDER_VITA_GLES2 1
|
||||||
|
//#define SDL_VIDEO_RENDER_VITA_GXM 1
|
||||||
|
|
||||||
|
#if defined(SDL_VIDEO_RENDER_VITA_GLES2)
|
||||||
#define SDL_VIDEO_OPENGL_ES2 1
|
#define SDL_VIDEO_OPENGL_ES2 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* VITA doesn't have haptic device (src/haptic/dummy/\*.c) */
|
/* VITA doesn't have haptic device (src/haptic/dummy/\*.c) */
|
||||||
|
|
|
@ -95,6 +95,12 @@ static const SDL_RenderDriver *render_drivers[] = {
|
||||||
#if SDL_VIDEO_RENDER_OGL_ES2
|
#if SDL_VIDEO_RENDER_OGL_ES2
|
||||||
&GLES2_RenderDriver,
|
&GLES2_RenderDriver,
|
||||||
#endif
|
#endif
|
||||||
|
#if SDL_VIDEO_RENDER_VITA_GLES2
|
||||||
|
&VITA_GLES2_RenderDriver,
|
||||||
|
#endif
|
||||||
|
#if SDL_VIDEO_RENDER_VITA_GXM
|
||||||
|
&VITA_GXM__RenderDriver,
|
||||||
|
#endif
|
||||||
#if SDL_VIDEO_RENDER_OGL_ES
|
#if SDL_VIDEO_RENDER_OGL_ES
|
||||||
&GLES_RenderDriver,
|
&GLES_RenderDriver,
|
||||||
#endif
|
#endif
|
||||||
|
@ -274,7 +280,9 @@ SDL_AllocateRenderVertices(SDL_Renderer *renderer, const size_t numbytes, const
|
||||||
while (newsize < needed) {
|
while (newsize < needed) {
|
||||||
newsize *= 2;
|
newsize *= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
ptr = SDL_realloc(renderer->vertex_data, newsize);
|
ptr = SDL_realloc(renderer->vertex_data, newsize);
|
||||||
|
|
||||||
if (ptr == NULL) {
|
if (ptr == NULL) {
|
||||||
SDL_OutOfMemory();
|
SDL_OutOfMemory();
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -245,6 +245,8 @@ extern SDL_RenderDriver D3D_RenderDriver;
|
||||||
extern SDL_RenderDriver D3D11_RenderDriver;
|
extern SDL_RenderDriver D3D11_RenderDriver;
|
||||||
extern SDL_RenderDriver GL_RenderDriver;
|
extern SDL_RenderDriver GL_RenderDriver;
|
||||||
extern SDL_RenderDriver GLES2_RenderDriver;
|
extern SDL_RenderDriver GLES2_RenderDriver;
|
||||||
|
extern SDL_RenderDriver VITA_GLES2_RenderDriver;
|
||||||
|
extern SDL_RenderDriver VITA_GXM_RenderDriver;
|
||||||
extern SDL_RenderDriver GLES_RenderDriver;
|
extern SDL_RenderDriver GLES_RenderDriver;
|
||||||
extern SDL_RenderDriver DirectFB_RenderDriver;
|
extern SDL_RenderDriver DirectFB_RenderDriver;
|
||||||
extern SDL_RenderDriver METAL_RenderDriver;
|
extern SDL_RenderDriver METAL_RenderDriver;
|
||||||
|
|
|
@ -0,0 +1,77 @@
|
||||||
|
/*
|
||||||
|
Simple DirectMedia Layer
|
||||||
|
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
|
This software is provided 'as-is', without any express or implied
|
||||||
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
arising from the use of this software.
|
||||||
|
|
||||||
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
|
including commercial applications, and to alter it and redistribute it
|
||||||
|
freely, subject to the following restrictions:
|
||||||
|
|
||||||
|
1. The origin of this software must not be misrepresented; you must not
|
||||||
|
claim that you wrote the original software. If you use this software
|
||||||
|
in a product, an acknowledgment in the product documentation would be
|
||||||
|
appreciated but is not required.
|
||||||
|
2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
misrepresented as being the original software.
|
||||||
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
*/
|
||||||
|
|
||||||
|
SDL_PROC(void, glActiveTexture, (GLenum))
|
||||||
|
SDL_PROC(void, glAttachShader, (GLuint, GLuint))
|
||||||
|
SDL_PROC(void, glBindAttribLocation, (GLuint, GLuint, const char *))
|
||||||
|
SDL_PROC(void, glBindTexture, (GLenum, GLuint))
|
||||||
|
SDL_PROC(void, glBlendEquationSeparate, (GLenum, GLenum))
|
||||||
|
SDL_PROC(void, glBlendFuncSeparate, (GLenum, GLenum, GLenum, GLenum))
|
||||||
|
SDL_PROC(void, glClear, (GLbitfield))
|
||||||
|
SDL_PROC(void, glClearColor, (GLclampf, GLclampf, GLclampf, GLclampf))
|
||||||
|
SDL_PROC(void, glCompileShader, (GLuint))
|
||||||
|
SDL_PROC(GLuint, glCreateProgram, (void))
|
||||||
|
SDL_PROC(GLuint, glCreateShader, (GLenum))
|
||||||
|
SDL_PROC(void, glDeleteProgram, (GLuint))
|
||||||
|
SDL_PROC(void, glDeleteShader, (GLuint))
|
||||||
|
SDL_PROC(void, glDeleteTextures, (GLsizei, const GLuint *))
|
||||||
|
SDL_PROC(void, glDisable, (GLenum))
|
||||||
|
SDL_PROC(void, glDisableVertexAttribArray, (GLuint))
|
||||||
|
SDL_PROC(void, glDrawArrays, (GLenum, GLint, GLsizei))
|
||||||
|
SDL_PROC(void, glEnable, (GLenum))
|
||||||
|
SDL_PROC(void, glEnableVertexAttribArray, (GLuint))
|
||||||
|
SDL_PROC(void, glFinish, (void))
|
||||||
|
SDL_PROC(void, glGenFramebuffers, (GLsizei, GLuint *))
|
||||||
|
SDL_PROC(void, glGenTextures, (GLsizei, GLuint *))
|
||||||
|
SDL_PROC(void, glGetBooleanv, (GLenum, GLboolean *))
|
||||||
|
SDL_PROC(const GLubyte *, glGetString, (GLenum))
|
||||||
|
SDL_PROC(GLenum, glGetError, (void))
|
||||||
|
SDL_PROC(void, glGetIntegerv, (GLenum, GLint *))
|
||||||
|
SDL_PROC(void, glGetProgramiv, (GLuint, GLenum, GLint *))
|
||||||
|
SDL_PROC(void, glGetShaderInfoLog, (GLuint, GLsizei, GLsizei *, char *))
|
||||||
|
SDL_PROC(void, glGetShaderiv, (GLuint, GLenum, GLint *))
|
||||||
|
SDL_PROC(GLint, glGetUniformLocation, (GLuint, const char *))
|
||||||
|
SDL_PROC(void, glLinkProgram, (GLuint))
|
||||||
|
SDL_PROC(void, glPixelStorei, (GLenum, GLint))
|
||||||
|
SDL_PROC(void, glReadPixels, (GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoid*))
|
||||||
|
SDL_PROC(void, glScissor, (GLint, GLint, GLsizei, GLsizei))
|
||||||
|
SDL_PROC(void, glShaderBinary, (GLsizei, const GLuint *, GLenum, const void *, GLsizei))
|
||||||
|
SDL_PROC(void, glShaderSource, (GLuint, GLsizei, const GLchar* const*, const GLint *))
|
||||||
|
SDL_PROC(void, glTexImage2D, (GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const void *))
|
||||||
|
SDL_PROC(void, glTexParameteri, (GLenum, GLenum, GLint))
|
||||||
|
SDL_PROC(void, glTexSubImage2D, (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *))
|
||||||
|
SDL_PROC(void, glUniform1i, (GLint, GLint))
|
||||||
|
SDL_PROC(void, glUniform4f, (GLint, GLfloat, GLfloat, GLfloat, GLfloat))
|
||||||
|
SDL_PROC(void, glUniformMatrix4fv, (GLint, GLsizei, GLboolean, const GLfloat *))
|
||||||
|
SDL_PROC(void, glUseProgram, (GLuint))
|
||||||
|
SDL_PROC(void, glVertexAttribPointer, (GLuint, GLint, GLenum, GLboolean, GLsizei, const void *))
|
||||||
|
SDL_PROC(void, glViewport, (GLint, GLint, GLsizei, GLsizei))
|
||||||
|
SDL_PROC(void, glBindFramebuffer, (GLenum, GLuint))
|
||||||
|
SDL_PROC(void, glFramebufferTexture2D, (GLenum, GLenum, GLenum, GLuint, GLint))
|
||||||
|
SDL_PROC(GLenum, glCheckFramebufferStatus, (GLenum))
|
||||||
|
SDL_PROC(void, glDeleteFramebuffers, (GLsizei, const GLuint *))
|
||||||
|
SDL_PROC(GLint, glGetAttribLocation, (GLuint, const GLchar *))
|
||||||
|
SDL_PROC(void, glGetProgramInfoLog, (GLuint, GLsizei, GLsizei*, GLchar*))
|
||||||
|
SDL_PROC(void, glGenBuffers, (GLsizei, GLuint *))
|
||||||
|
SDL_PROC(void, glDeleteBuffers, (GLsizei, const GLuint *))
|
||||||
|
SDL_PROC(void, glBindBuffer, (GLenum, GLuint))
|
||||||
|
SDL_PROC(void, glBufferData, (GLenum, GLsizeiptr, const GLvoid *, GLenum))
|
||||||
|
SDL_PROC(void, glBufferSubData, (GLenum, GLintptr, GLsizeiptr, const GLvoid *))
|
File diff suppressed because it is too large
Load Diff
|
@ -20,11 +20,11 @@
|
||||||
*/
|
*/
|
||||||
#include "../../SDL_internal.h"
|
#include "../../SDL_internal.h"
|
||||||
|
|
||||||
#if SDL_VIDEO_RENDER_OGL_ES2 && !SDL_RENDER_DISABLED
|
#if SDL_VIDEO_RENDER_VITA_GLES2 && !SDL_RENDER_DISABLED
|
||||||
|
|
||||||
#include "SDL_video.h"
|
#include "SDL_video.h"
|
||||||
#include "SDL_opengles2.h"
|
#include "SDL_opengles2.h"
|
||||||
#include "../opengles2/SDL_shaders_gles2.h"
|
#include "SDL_shaders_gles2vita.h"
|
||||||
#include "SDL_stdinc.h"
|
#include "SDL_stdinc.h"
|
||||||
|
|
||||||
/* While Vita is gles2-compliant, shaders should be in Cg format, not glsl */
|
/* While Vita is gles2-compliant, shaders should be in Cg format, not glsl */
|
||||||
|
@ -38,7 +38,7 @@
|
||||||
value is decremented by 1.0 to get proper output with 0.0 which is
|
value is decremented by 1.0 to get proper output with 0.0 which is
|
||||||
default value
|
default value
|
||||||
*/
|
*/
|
||||||
static const Uint8 GLES2_VertexSrc_Default_[] = " \
|
static const Uint8 VITA_GLES2_VertexSrc_Default_[] = " \
|
||||||
struct _Output { \
|
struct _Output { \
|
||||||
float2 v_texCoord : TEXCOORD0; \
|
float2 v_texCoord : TEXCOORD0; \
|
||||||
float4 position : POSITION; \
|
float4 position : POSITION; \
|
||||||
|
@ -67,14 +67,14 @@ static const Uint8 GLES2_VertexSrc_Default_[] = " \
|
||||||
} \
|
} \
|
||||||
";
|
";
|
||||||
|
|
||||||
static const Uint8 GLES2_FragmentSrc_SolidSrc_[] = " \
|
static const Uint8 VITA_GLES2_FragmentSrc_SolidSrc_[] = " \
|
||||||
float4 main(uniform float4 u_color : COLOR) : COLOR \
|
float4 main(uniform float4 u_color : COLOR) : COLOR \
|
||||||
{ \
|
{ \
|
||||||
return u_color; \
|
return u_color; \
|
||||||
} \
|
} \
|
||||||
";
|
";
|
||||||
|
|
||||||
static const Uint8 GLES2_FragmentSrc_TextureABGRSrc_[] = " \
|
static const Uint8 VITA_GLES2_FragmentSrc_TextureABGRSrc_[] = " \
|
||||||
float4 main(uniform sampler2D u_texture, uniform float4 u_color : COLOR, float2 v_texCoord : TEXCOORD0 ) : COLOR \
|
float4 main(uniform sampler2D u_texture, uniform float4 u_color : COLOR, float2 v_texCoord : TEXCOORD0 ) : COLOR \
|
||||||
{ \
|
{ \
|
||||||
float4 color = tex2D(u_texture, v_texCoord); \
|
float4 color = tex2D(u_texture, v_texCoord); \
|
||||||
|
@ -83,7 +83,7 @@ static const Uint8 GLES2_FragmentSrc_TextureABGRSrc_[] = " \
|
||||||
";
|
";
|
||||||
|
|
||||||
/* ARGB to ABGR conversion */
|
/* ARGB to ABGR conversion */
|
||||||
static const Uint8 GLES2_FragmentSrc_TextureARGBSrc_[] = " \
|
static const Uint8 VITA_GLES2_FragmentSrc_TextureARGBSrc_[] = " \
|
||||||
float4 main(uniform sampler2D u_texture, uniform float4 u_color : COLOR, float2 v_texCoord : TEXCOORD0 ) : COLOR \
|
float4 main(uniform sampler2D u_texture, uniform float4 u_color : COLOR, float2 v_texCoord : TEXCOORD0 ) : COLOR \
|
||||||
{ \
|
{ \
|
||||||
float4 abgr = tex2D(u_texture, v_texCoord); \
|
float4 abgr = tex2D(u_texture, v_texCoord); \
|
||||||
|
@ -95,7 +95,7 @@ static const Uint8 GLES2_FragmentSrc_TextureARGBSrc_[] = " \
|
||||||
";
|
";
|
||||||
|
|
||||||
/* RGB to ABGR conversion */
|
/* RGB to ABGR conversion */
|
||||||
static const Uint8 GLES2_FragmentSrc_TextureRGBSrc_[] = " \
|
static const Uint8 VITA_GLES2_FragmentSrc_TextureRGBSrc_[] = " \
|
||||||
float4 main(uniform sampler2D u_texture, uniform float4 u_color : COLOR, float2 v_texCoord : TEXCOORD0 ) : COLOR \
|
float4 main(uniform sampler2D u_texture, uniform float4 u_color : COLOR, float2 v_texCoord : TEXCOORD0 ) : COLOR \
|
||||||
{ \
|
{ \
|
||||||
float4 abgr = tex2D(u_texture, v_texCoord); \
|
float4 abgr = tex2D(u_texture, v_texCoord); \
|
||||||
|
@ -108,7 +108,7 @@ static const Uint8 GLES2_FragmentSrc_TextureRGBSrc_[] = " \
|
||||||
";
|
";
|
||||||
|
|
||||||
/* BGR to ABGR conversion */
|
/* BGR to ABGR conversion */
|
||||||
static const Uint8 GLES2_FragmentSrc_TextureBGRSrc_[] = " \
|
static const Uint8 VITA_GLES2_FragmentSrc_TextureBGRSrc_[] = " \
|
||||||
float4 main(uniform sampler2D u_texture, uniform float4 u_color : COLOR, float2 v_texCoord : TEXCOORD0 ) : COLOR \
|
float4 main(uniform sampler2D u_texture, uniform float4 u_color : COLOR, float2 v_texCoord : TEXCOORD0 ) : COLOR \
|
||||||
{ \
|
{ \
|
||||||
float4 abgr = tex2D(u_texture, v_texCoord); \
|
float4 abgr = tex2D(u_texture, v_texCoord); \
|
||||||
|
@ -219,58 +219,58 @@ static const Uint8 GLES2_FragmentSrc_TextureBGRSrc_[] = " \
|
||||||
"}" \
|
"}" \
|
||||||
|
|
||||||
/* YUV to ABGR conversion */
|
/* YUV to ABGR conversion */
|
||||||
static const Uint8 GLES2_FragmentSrc_TextureYUVJPEGSrc_[] = \
|
static const Uint8 VITA_GLES2_FragmentSrc_TextureYUVJPEGSrc_[] = \
|
||||||
YUV_SHADER_PROLOGUE \
|
YUV_SHADER_PROLOGUE \
|
||||||
JPEG_SHADER_CONSTANTS \
|
JPEG_SHADER_CONSTANTS \
|
||||||
YUV_SHADER_BODY \
|
YUV_SHADER_BODY \
|
||||||
;
|
;
|
||||||
static const Uint8 GLES2_FragmentSrc_TextureYUVBT601Src_[] = \
|
static const Uint8 VITA_GLES2_FragmentSrc_TextureYUVBT601Src_[] = \
|
||||||
YUV_SHADER_PROLOGUE \
|
YUV_SHADER_PROLOGUE \
|
||||||
BT601_SHADER_CONSTANTS \
|
BT601_SHADER_CONSTANTS \
|
||||||
YUV_SHADER_BODY \
|
YUV_SHADER_BODY \
|
||||||
;
|
;
|
||||||
static const Uint8 GLES2_FragmentSrc_TextureYUVBT709Src_[] = \
|
static const Uint8 VITA_GLES2_FragmentSrc_TextureYUVBT709Src_[] = \
|
||||||
YUV_SHADER_PROLOGUE \
|
YUV_SHADER_PROLOGUE \
|
||||||
BT709_SHADER_CONSTANTS \
|
BT709_SHADER_CONSTANTS \
|
||||||
YUV_SHADER_BODY \
|
YUV_SHADER_BODY \
|
||||||
;
|
;
|
||||||
|
|
||||||
/* NV12 to ABGR conversion */
|
/* NV12 to ABGR conversion */
|
||||||
static const Uint8 GLES2_FragmentSrc_TextureNV12JPEGSrc_[] = \
|
static const Uint8 VITA_GLES2_FragmentSrc_TextureNV12JPEGSrc_[] = \
|
||||||
YUV_SHADER_PROLOGUE \
|
YUV_SHADER_PROLOGUE \
|
||||||
JPEG_SHADER_CONSTANTS \
|
JPEG_SHADER_CONSTANTS \
|
||||||
NV12_SHADER_BODY \
|
NV12_SHADER_BODY \
|
||||||
;
|
;
|
||||||
static const Uint8 GLES2_FragmentSrc_TextureNV12BT601Src_[] = \
|
static const Uint8 VITA_GLES2_FragmentSrc_TextureNV12BT601Src_[] = \
|
||||||
YUV_SHADER_PROLOGUE \
|
YUV_SHADER_PROLOGUE \
|
||||||
BT601_SHADER_CONSTANTS \
|
BT601_SHADER_CONSTANTS \
|
||||||
NV12_SHADER_BODY \
|
NV12_SHADER_BODY \
|
||||||
;
|
;
|
||||||
static const Uint8 GLES2_FragmentSrc_TextureNV12BT709Src_[] = \
|
static const Uint8 VITA_GLES2_FragmentSrc_TextureNV12BT709Src_[] = \
|
||||||
YUV_SHADER_PROLOGUE \
|
YUV_SHADER_PROLOGUE \
|
||||||
BT709_SHADER_CONSTANTS \
|
BT709_SHADER_CONSTANTS \
|
||||||
NV12_SHADER_BODY \
|
NV12_SHADER_BODY \
|
||||||
;
|
;
|
||||||
|
|
||||||
/* NV21 to ABGR conversion */
|
/* NV21 to ABGR conversion */
|
||||||
static const Uint8 GLES2_FragmentSrc_TextureNV21JPEGSrc_[] = \
|
static const Uint8 VITA_GLES2_FragmentSrc_TextureNV21JPEGSrc_[] = \
|
||||||
YUV_SHADER_PROLOGUE \
|
YUV_SHADER_PROLOGUE \
|
||||||
JPEG_SHADER_CONSTANTS \
|
JPEG_SHADER_CONSTANTS \
|
||||||
NV21_SHADER_BODY \
|
NV21_SHADER_BODY \
|
||||||
;
|
;
|
||||||
static const Uint8 GLES2_FragmentSrc_TextureNV21BT601Src_[] = \
|
static const Uint8 VITA_GLES2_FragmentSrc_TextureNV21BT601Src_[] = \
|
||||||
YUV_SHADER_PROLOGUE \
|
YUV_SHADER_PROLOGUE \
|
||||||
BT601_SHADER_CONSTANTS \
|
BT601_SHADER_CONSTANTS \
|
||||||
NV21_SHADER_BODY \
|
NV21_SHADER_BODY \
|
||||||
;
|
;
|
||||||
static const Uint8 GLES2_FragmentSrc_TextureNV21BT709Src_[] = \
|
static const Uint8 VITA_GLES2_FragmentSrc_TextureNV21BT709Src_[] = \
|
||||||
YUV_SHADER_PROLOGUE \
|
YUV_SHADER_PROLOGUE \
|
||||||
BT709_SHADER_CONSTANTS \
|
BT709_SHADER_CONSTANTS \
|
||||||
NV21_SHADER_BODY \
|
NV21_SHADER_BODY \
|
||||||
;
|
;
|
||||||
|
|
||||||
/* Custom Android video format texture */
|
/* Custom Android video format texture */
|
||||||
static const Uint8 GLES2_FragmentSrc_TextureExternalOESSrc_[] = " \
|
static const Uint8 VITA_GLES2_FragmentSrc_TextureExternalOESSrc_[] = " \
|
||||||
#extension GL_OES_EGL_image_external : require\n\
|
#extension GL_OES_EGL_image_external : require\n\
|
||||||
precision mediump float; \
|
precision mediump float; \
|
||||||
uniform samplerExternalOES u_texture; \
|
uniform samplerExternalOES u_texture; \
|
||||||
|
@ -284,116 +284,116 @@ static const Uint8 GLES2_FragmentSrc_TextureExternalOESSrc_[] = " \
|
||||||
} \
|
} \
|
||||||
";
|
";
|
||||||
|
|
||||||
static const GLES2_ShaderInstance GLES2_VertexSrc_Default = {
|
static const VITA_GLES2_ShaderInstance VITA_GLES2_VertexSrc_Default = {
|
||||||
GL_VERTEX_SHADER,
|
GL_VERTEX_SHADER,
|
||||||
GLES2_SOURCE_SHADER,
|
VITA_GLES2_SOURCE_SHADER,
|
||||||
sizeof(GLES2_VertexSrc_Default_),
|
sizeof(VITA_GLES2_VertexSrc_Default_),
|
||||||
GLES2_VertexSrc_Default_
|
VITA_GLES2_VertexSrc_Default_
|
||||||
};
|
};
|
||||||
|
|
||||||
static const GLES2_ShaderInstance GLES2_FragmentSrc_SolidSrc = {
|
static const VITA_GLES2_ShaderInstance VITA_GLES2_FragmentSrc_SolidSrc = {
|
||||||
GL_FRAGMENT_SHADER,
|
GL_FRAGMENT_SHADER,
|
||||||
GLES2_SOURCE_SHADER,
|
VITA_GLES2_SOURCE_SHADER,
|
||||||
sizeof(GLES2_FragmentSrc_SolidSrc_),
|
sizeof(VITA_GLES2_FragmentSrc_SolidSrc_),
|
||||||
GLES2_FragmentSrc_SolidSrc_
|
VITA_GLES2_FragmentSrc_SolidSrc_
|
||||||
};
|
};
|
||||||
|
|
||||||
static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureABGRSrc = {
|
static const VITA_GLES2_ShaderInstance VITA_GLES2_FragmentSrc_TextureABGRSrc = {
|
||||||
GL_FRAGMENT_SHADER,
|
GL_FRAGMENT_SHADER,
|
||||||
GLES2_SOURCE_SHADER,
|
VITA_GLES2_SOURCE_SHADER,
|
||||||
sizeof(GLES2_FragmentSrc_TextureABGRSrc_),
|
sizeof(VITA_GLES2_FragmentSrc_TextureABGRSrc_),
|
||||||
GLES2_FragmentSrc_TextureABGRSrc_
|
VITA_GLES2_FragmentSrc_TextureABGRSrc_
|
||||||
};
|
};
|
||||||
|
|
||||||
static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureARGBSrc = {
|
static const VITA_GLES2_ShaderInstance VITA_GLES2_FragmentSrc_TextureARGBSrc = {
|
||||||
GL_FRAGMENT_SHADER,
|
GL_FRAGMENT_SHADER,
|
||||||
GLES2_SOURCE_SHADER,
|
VITA_GLES2_SOURCE_SHADER,
|
||||||
sizeof(GLES2_FragmentSrc_TextureARGBSrc_),
|
sizeof(VITA_GLES2_FragmentSrc_TextureARGBSrc_),
|
||||||
GLES2_FragmentSrc_TextureARGBSrc_
|
VITA_GLES2_FragmentSrc_TextureARGBSrc_
|
||||||
};
|
};
|
||||||
|
|
||||||
static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureRGBSrc = {
|
static const VITA_GLES2_ShaderInstance VITA_GLES2_FragmentSrc_TextureRGBSrc = {
|
||||||
GL_FRAGMENT_SHADER,
|
GL_FRAGMENT_SHADER,
|
||||||
GLES2_SOURCE_SHADER,
|
VITA_GLES2_SOURCE_SHADER,
|
||||||
sizeof(GLES2_FragmentSrc_TextureRGBSrc_),
|
sizeof(VITA_GLES2_FragmentSrc_TextureRGBSrc_),
|
||||||
GLES2_FragmentSrc_TextureRGBSrc_
|
VITA_GLES2_FragmentSrc_TextureRGBSrc_
|
||||||
};
|
};
|
||||||
|
|
||||||
static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureBGRSrc = {
|
static const VITA_GLES2_ShaderInstance VITA_GLES2_FragmentSrc_TextureBGRSrc = {
|
||||||
GL_FRAGMENT_SHADER,
|
GL_FRAGMENT_SHADER,
|
||||||
GLES2_SOURCE_SHADER,
|
VITA_GLES2_SOURCE_SHADER,
|
||||||
sizeof(GLES2_FragmentSrc_TextureBGRSrc_),
|
sizeof(VITA_GLES2_FragmentSrc_TextureBGRSrc_),
|
||||||
GLES2_FragmentSrc_TextureBGRSrc_
|
VITA_GLES2_FragmentSrc_TextureBGRSrc_
|
||||||
};
|
};
|
||||||
|
|
||||||
static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureYUVJPEGSrc = {
|
static const VITA_GLES2_ShaderInstance VITA_GLES2_FragmentSrc_TextureYUVJPEGSrc = {
|
||||||
GL_FRAGMENT_SHADER,
|
GL_FRAGMENT_SHADER,
|
||||||
GLES2_SOURCE_SHADER,
|
VITA_GLES2_SOURCE_SHADER,
|
||||||
sizeof(GLES2_FragmentSrc_TextureYUVJPEGSrc_),
|
sizeof(VITA_GLES2_FragmentSrc_TextureYUVJPEGSrc_),
|
||||||
GLES2_FragmentSrc_TextureYUVJPEGSrc_
|
VITA_GLES2_FragmentSrc_TextureYUVJPEGSrc_
|
||||||
};
|
};
|
||||||
|
|
||||||
static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureYUVBT601Src = {
|
static const VITA_GLES2_ShaderInstance VITA_GLES2_FragmentSrc_TextureYUVBT601Src = {
|
||||||
GL_FRAGMENT_SHADER,
|
GL_FRAGMENT_SHADER,
|
||||||
GLES2_SOURCE_SHADER,
|
VITA_GLES2_SOURCE_SHADER,
|
||||||
sizeof(GLES2_FragmentSrc_TextureYUVBT601Src_),
|
sizeof(VITA_GLES2_FragmentSrc_TextureYUVBT601Src_),
|
||||||
GLES2_FragmentSrc_TextureYUVBT601Src_
|
VITA_GLES2_FragmentSrc_TextureYUVBT601Src_
|
||||||
};
|
};
|
||||||
|
|
||||||
static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureYUVBT709Src = {
|
static const VITA_GLES2_ShaderInstance VITA_GLES2_FragmentSrc_TextureYUVBT709Src = {
|
||||||
GL_FRAGMENT_SHADER,
|
GL_FRAGMENT_SHADER,
|
||||||
GLES2_SOURCE_SHADER,
|
VITA_GLES2_SOURCE_SHADER,
|
||||||
sizeof(GLES2_FragmentSrc_TextureYUVBT709Src_),
|
sizeof(VITA_GLES2_FragmentSrc_TextureYUVBT709Src_),
|
||||||
GLES2_FragmentSrc_TextureYUVBT709Src_
|
VITA_GLES2_FragmentSrc_TextureYUVBT709Src_
|
||||||
};
|
};
|
||||||
|
|
||||||
static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureNV12JPEGSrc = {
|
static const VITA_GLES2_ShaderInstance VITA_GLES2_FragmentSrc_TextureNV12JPEGSrc = {
|
||||||
GL_FRAGMENT_SHADER,
|
GL_FRAGMENT_SHADER,
|
||||||
GLES2_SOURCE_SHADER,
|
VITA_GLES2_SOURCE_SHADER,
|
||||||
sizeof(GLES2_FragmentSrc_TextureNV12JPEGSrc_),
|
sizeof(VITA_GLES2_FragmentSrc_TextureNV12JPEGSrc_),
|
||||||
GLES2_FragmentSrc_TextureNV12JPEGSrc_
|
VITA_GLES2_FragmentSrc_TextureNV12JPEGSrc_
|
||||||
};
|
};
|
||||||
|
|
||||||
static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureNV12BT601Src = {
|
static const VITA_GLES2_ShaderInstance VITA_GLES2_FragmentSrc_TextureNV12BT601Src = {
|
||||||
GL_FRAGMENT_SHADER,
|
GL_FRAGMENT_SHADER,
|
||||||
GLES2_SOURCE_SHADER,
|
VITA_GLES2_SOURCE_SHADER,
|
||||||
sizeof(GLES2_FragmentSrc_TextureNV12BT601Src_),
|
sizeof(VITA_GLES2_FragmentSrc_TextureNV12BT601Src_),
|
||||||
GLES2_FragmentSrc_TextureNV12BT601Src_
|
VITA_GLES2_FragmentSrc_TextureNV12BT601Src_
|
||||||
};
|
};
|
||||||
|
|
||||||
static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureNV21BT709Src = {
|
static const VITA_GLES2_ShaderInstance VITA_GLES2_FragmentSrc_TextureNV21BT709Src = {
|
||||||
GL_FRAGMENT_SHADER,
|
GL_FRAGMENT_SHADER,
|
||||||
GLES2_SOURCE_SHADER,
|
VITA_GLES2_SOURCE_SHADER,
|
||||||
sizeof(GLES2_FragmentSrc_TextureNV21BT709Src_),
|
sizeof(VITA_GLES2_FragmentSrc_TextureNV21BT709Src_),
|
||||||
GLES2_FragmentSrc_TextureNV21BT709Src_
|
VITA_GLES2_FragmentSrc_TextureNV21BT709Src_
|
||||||
};
|
};
|
||||||
|
|
||||||
static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureNV21JPEGSrc = {
|
static const VITA_GLES2_ShaderInstance VITA_GLES2_FragmentSrc_TextureNV21JPEGSrc = {
|
||||||
GL_FRAGMENT_SHADER,
|
GL_FRAGMENT_SHADER,
|
||||||
GLES2_SOURCE_SHADER,
|
VITA_GLES2_SOURCE_SHADER,
|
||||||
sizeof(GLES2_FragmentSrc_TextureNV21JPEGSrc_),
|
sizeof(VITA_GLES2_FragmentSrc_TextureNV21JPEGSrc_),
|
||||||
GLES2_FragmentSrc_TextureNV21JPEGSrc_
|
VITA_GLES2_FragmentSrc_TextureNV21JPEGSrc_
|
||||||
};
|
};
|
||||||
|
|
||||||
static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureNV21BT601Src = {
|
static const VITA_GLES2_ShaderInstance VITA_GLES2_FragmentSrc_TextureNV21BT601Src = {
|
||||||
GL_FRAGMENT_SHADER,
|
GL_FRAGMENT_SHADER,
|
||||||
GLES2_SOURCE_SHADER,
|
VITA_GLES2_SOURCE_SHADER,
|
||||||
sizeof(GLES2_FragmentSrc_TextureNV21BT601Src_),
|
sizeof(VITA_GLES2_FragmentSrc_TextureNV21BT601Src_),
|
||||||
GLES2_FragmentSrc_TextureNV21BT601Src_
|
VITA_GLES2_FragmentSrc_TextureNV21BT601Src_
|
||||||
};
|
};
|
||||||
|
|
||||||
static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureNV12BT709Src = {
|
static const VITA_GLES2_ShaderInstance VITA_GLES2_FragmentSrc_TextureNV12BT709Src = {
|
||||||
GL_FRAGMENT_SHADER,
|
GL_FRAGMENT_SHADER,
|
||||||
GLES2_SOURCE_SHADER,
|
VITA_GLES2_SOURCE_SHADER,
|
||||||
sizeof(GLES2_FragmentSrc_TextureNV12BT709Src_),
|
sizeof(VITA_GLES2_FragmentSrc_TextureNV12BT709Src_),
|
||||||
GLES2_FragmentSrc_TextureNV12BT709Src_
|
VITA_GLES2_FragmentSrc_TextureNV12BT709Src_
|
||||||
};
|
};
|
||||||
|
|
||||||
static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureExternalOESSrc = {
|
static const VITA_GLES2_ShaderInstance VITA_GLES2_FragmentSrc_TextureExternalOESSrc = {
|
||||||
GL_FRAGMENT_SHADER,
|
GL_FRAGMENT_SHADER,
|
||||||
GLES2_SOURCE_SHADER,
|
VITA_GLES2_SOURCE_SHADER,
|
||||||
sizeof(GLES2_FragmentSrc_TextureExternalOESSrc_),
|
sizeof(VITA_GLES2_FragmentSrc_TextureExternalOESSrc_),
|
||||||
GLES2_FragmentSrc_TextureExternalOESSrc_
|
VITA_GLES2_FragmentSrc_TextureExternalOESSrc_
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -401,115 +401,115 @@ static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureExternalOESSrc = {
|
||||||
* Vertex/fragment shader definitions *
|
* Vertex/fragment shader definitions *
|
||||||
*************************************************************************************************/
|
*************************************************************************************************/
|
||||||
|
|
||||||
static GLES2_Shader GLES2_VertexShader_Default = {
|
static VITA_GLES2_Shader VITA_GLES2_VertexShader_Default = {
|
||||||
1,
|
1,
|
||||||
{
|
{
|
||||||
&GLES2_VertexSrc_Default
|
&VITA_GLES2_VertexSrc_Default
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static GLES2_Shader GLES2_FragmentShader_SolidSrc = {
|
static VITA_GLES2_Shader VITA_GLES2_FragmentShader_SolidSrc = {
|
||||||
1,
|
1,
|
||||||
{
|
{
|
||||||
&GLES2_FragmentSrc_SolidSrc
|
&VITA_GLES2_FragmentSrc_SolidSrc
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static GLES2_Shader GLES2_FragmentShader_TextureABGRSrc = {
|
static VITA_GLES2_Shader VITA_GLES2_FragmentShader_TextureABGRSrc = {
|
||||||
1,
|
1,
|
||||||
{
|
{
|
||||||
&GLES2_FragmentSrc_TextureABGRSrc
|
&VITA_GLES2_FragmentSrc_TextureABGRSrc
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static GLES2_Shader GLES2_FragmentShader_TextureARGBSrc = {
|
static VITA_GLES2_Shader VITA_GLES2_FragmentShader_TextureARGBSrc = {
|
||||||
1,
|
1,
|
||||||
{
|
{
|
||||||
&GLES2_FragmentSrc_TextureARGBSrc
|
&VITA_GLES2_FragmentSrc_TextureARGBSrc
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static GLES2_Shader GLES2_FragmentShader_TextureRGBSrc = {
|
static VITA_GLES2_Shader VITA_GLES2_FragmentShader_TextureRGBSrc = {
|
||||||
1,
|
1,
|
||||||
{
|
{
|
||||||
&GLES2_FragmentSrc_TextureRGBSrc
|
&VITA_GLES2_FragmentSrc_TextureRGBSrc
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static GLES2_Shader GLES2_FragmentShader_TextureBGRSrc = {
|
static VITA_GLES2_Shader VITA_GLES2_FragmentShader_TextureBGRSrc = {
|
||||||
1,
|
1,
|
||||||
{
|
{
|
||||||
&GLES2_FragmentSrc_TextureBGRSrc
|
&VITA_GLES2_FragmentSrc_TextureBGRSrc
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static GLES2_Shader GLES2_FragmentShader_TextureYUVJPEGSrc = {
|
static VITA_GLES2_Shader VITA_GLES2_FragmentShader_TextureYUVJPEGSrc = {
|
||||||
1,
|
1,
|
||||||
{
|
{
|
||||||
&GLES2_FragmentSrc_TextureYUVJPEGSrc
|
&VITA_GLES2_FragmentSrc_TextureYUVJPEGSrc
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static GLES2_Shader GLES2_FragmentShader_TextureYUVBT601Src = {
|
static VITA_GLES2_Shader VITA_GLES2_FragmentShader_TextureYUVBT601Src = {
|
||||||
1,
|
1,
|
||||||
{
|
{
|
||||||
&GLES2_FragmentSrc_TextureYUVBT601Src
|
&VITA_GLES2_FragmentSrc_TextureYUVBT601Src
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static GLES2_Shader GLES2_FragmentShader_TextureYUVBT709Src = {
|
static VITA_GLES2_Shader VITA_GLES2_FragmentShader_TextureYUVBT709Src = {
|
||||||
1,
|
1,
|
||||||
{
|
{
|
||||||
&GLES2_FragmentSrc_TextureYUVBT709Src
|
&VITA_GLES2_FragmentSrc_TextureYUVBT709Src
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static GLES2_Shader GLES2_FragmentShader_TextureNV12JPEGSrc = {
|
static VITA_GLES2_Shader VITA_GLES2_FragmentShader_TextureNV12JPEGSrc = {
|
||||||
1,
|
1,
|
||||||
{
|
{
|
||||||
&GLES2_FragmentSrc_TextureNV12JPEGSrc
|
&VITA_GLES2_FragmentSrc_TextureNV12JPEGSrc
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static GLES2_Shader GLES2_FragmentShader_TextureNV12BT601Src = {
|
static VITA_GLES2_Shader VITA_GLES2_FragmentShader_TextureNV12BT601Src = {
|
||||||
1,
|
1,
|
||||||
{
|
{
|
||||||
&GLES2_FragmentSrc_TextureNV12BT601Src
|
&VITA_GLES2_FragmentSrc_TextureNV12BT601Src
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static GLES2_Shader GLES2_FragmentShader_TextureNV12BT709Src = {
|
static VITA_GLES2_Shader VITA_GLES2_FragmentShader_TextureNV12BT709Src = {
|
||||||
1,
|
1,
|
||||||
{
|
{
|
||||||
&GLES2_FragmentSrc_TextureNV12BT709Src
|
&VITA_GLES2_FragmentSrc_TextureNV12BT709Src
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static GLES2_Shader GLES2_FragmentShader_TextureNV21JPEGSrc = {
|
static VITA_GLES2_Shader VITA_GLES2_FragmentShader_TextureNV21JPEGSrc = {
|
||||||
1,
|
1,
|
||||||
{
|
{
|
||||||
&GLES2_FragmentSrc_TextureNV21JPEGSrc
|
&VITA_GLES2_FragmentSrc_TextureNV21JPEGSrc
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static GLES2_Shader GLES2_FragmentShader_TextureNV21BT601Src = {
|
static VITA_GLES2_Shader VITA_GLES2_FragmentShader_TextureNV21BT601Src = {
|
||||||
1,
|
1,
|
||||||
{
|
{
|
||||||
&GLES2_FragmentSrc_TextureNV21BT601Src
|
&VITA_GLES2_FragmentSrc_TextureNV21BT601Src
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static GLES2_Shader GLES2_FragmentShader_TextureNV21BT709Src = {
|
static VITA_GLES2_Shader VITA_GLES2_FragmentShader_TextureNV21BT709Src = {
|
||||||
1,
|
1,
|
||||||
{
|
{
|
||||||
&GLES2_FragmentSrc_TextureNV21BT709Src
|
&VITA_GLES2_FragmentSrc_TextureNV21BT709Src
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static GLES2_Shader GLES2_FragmentShader_TextureExternalOESSrc = {
|
static VITA_GLES2_Shader VITA_GLES2_FragmentShader_TextureExternalOESSrc = {
|
||||||
1,
|
1,
|
||||||
{
|
{
|
||||||
&GLES2_FragmentSrc_TextureExternalOESSrc
|
&VITA_GLES2_FragmentSrc_TextureExternalOESSrc
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -518,46 +518,46 @@ static GLES2_Shader GLES2_FragmentShader_TextureExternalOESSrc = {
|
||||||
* Shader selector *
|
* Shader selector *
|
||||||
*************************************************************************************************/
|
*************************************************************************************************/
|
||||||
|
|
||||||
const GLES2_Shader *GLES2_GetShader(GLES2_ShaderType type)
|
const VITA_GLES2_Shader *VITA_GLES2_GetShader(VITA_GLES2_ShaderType type)
|
||||||
{
|
{
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case GLES2_SHADER_VERTEX_DEFAULT:
|
case VITA_GLES2_SHADER_VERTEX_DEFAULT:
|
||||||
return &GLES2_VertexShader_Default;
|
return &VITA_GLES2_VertexShader_Default;
|
||||||
case GLES2_SHADER_FRAGMENT_SOLID_SRC:
|
case VITA_GLES2_SHADER_FRAGMENT_SOLID_SRC:
|
||||||
return &GLES2_FragmentShader_SolidSrc;
|
return &VITA_GLES2_FragmentShader_SolidSrc;
|
||||||
case GLES2_SHADER_FRAGMENT_TEXTURE_ABGR_SRC:
|
case VITA_GLES2_SHADER_FRAGMENT_TEXTURE_ABGR_SRC:
|
||||||
return &GLES2_FragmentShader_TextureABGRSrc;
|
return &VITA_GLES2_FragmentShader_TextureABGRSrc;
|
||||||
case GLES2_SHADER_FRAGMENT_TEXTURE_ARGB_SRC:
|
case VITA_GLES2_SHADER_FRAGMENT_TEXTURE_ARGB_SRC:
|
||||||
return &GLES2_FragmentShader_TextureARGBSrc;
|
return &VITA_GLES2_FragmentShader_TextureARGBSrc;
|
||||||
case GLES2_SHADER_FRAGMENT_TEXTURE_RGB_SRC:
|
case VITA_GLES2_SHADER_FRAGMENT_TEXTURE_RGB_SRC:
|
||||||
return &GLES2_FragmentShader_TextureRGBSrc;
|
return &VITA_GLES2_FragmentShader_TextureRGBSrc;
|
||||||
case GLES2_SHADER_FRAGMENT_TEXTURE_BGR_SRC:
|
case VITA_GLES2_SHADER_FRAGMENT_TEXTURE_BGR_SRC:
|
||||||
return &GLES2_FragmentShader_TextureBGRSrc;
|
return &VITA_GLES2_FragmentShader_TextureBGRSrc;
|
||||||
case GLES2_SHADER_FRAGMENT_TEXTURE_YUV_JPEG_SRC:
|
case VITA_GLES2_SHADER_FRAGMENT_TEXTURE_YUV_JPEG_SRC:
|
||||||
return &GLES2_FragmentShader_TextureYUVJPEGSrc;
|
return &VITA_GLES2_FragmentShader_TextureYUVJPEGSrc;
|
||||||
case GLES2_SHADER_FRAGMENT_TEXTURE_YUV_BT601_SRC:
|
case VITA_GLES2_SHADER_FRAGMENT_TEXTURE_YUV_BT601_SRC:
|
||||||
return &GLES2_FragmentShader_TextureYUVBT601Src;
|
return &VITA_GLES2_FragmentShader_TextureYUVBT601Src;
|
||||||
case GLES2_SHADER_FRAGMENT_TEXTURE_YUV_BT709_SRC:
|
case VITA_GLES2_SHADER_FRAGMENT_TEXTURE_YUV_BT709_SRC:
|
||||||
return &GLES2_FragmentShader_TextureYUVBT709Src;
|
return &VITA_GLES2_FragmentShader_TextureYUVBT709Src;
|
||||||
case GLES2_SHADER_FRAGMENT_TEXTURE_NV12_JPEG_SRC:
|
case VITA_GLES2_SHADER_FRAGMENT_TEXTURE_NV12_JPEG_SRC:
|
||||||
return &GLES2_FragmentShader_TextureNV12JPEGSrc;
|
return &VITA_GLES2_FragmentShader_TextureNV12JPEGSrc;
|
||||||
case GLES2_SHADER_FRAGMENT_TEXTURE_NV12_BT601_SRC:
|
case VITA_GLES2_SHADER_FRAGMENT_TEXTURE_NV12_BT601_SRC:
|
||||||
return &GLES2_FragmentShader_TextureNV12BT601Src;
|
return &VITA_GLES2_FragmentShader_TextureNV12BT601Src;
|
||||||
case GLES2_SHADER_FRAGMENT_TEXTURE_NV12_BT709_SRC:
|
case VITA_GLES2_SHADER_FRAGMENT_TEXTURE_NV12_BT709_SRC:
|
||||||
return &GLES2_FragmentShader_TextureNV12BT709Src;
|
return &VITA_GLES2_FragmentShader_TextureNV12BT709Src;
|
||||||
case GLES2_SHADER_FRAGMENT_TEXTURE_NV21_JPEG_SRC:
|
case VITA_GLES2_SHADER_FRAGMENT_TEXTURE_NV21_JPEG_SRC:
|
||||||
return &GLES2_FragmentShader_TextureNV21JPEGSrc;
|
return &VITA_GLES2_FragmentShader_TextureNV21JPEGSrc;
|
||||||
case GLES2_SHADER_FRAGMENT_TEXTURE_NV21_BT601_SRC:
|
case VITA_GLES2_SHADER_FRAGMENT_TEXTURE_NV21_BT601_SRC:
|
||||||
return &GLES2_FragmentShader_TextureNV21BT601Src;
|
return &VITA_GLES2_FragmentShader_TextureNV21BT601Src;
|
||||||
case GLES2_SHADER_FRAGMENT_TEXTURE_NV21_BT709_SRC:
|
case VITA_GLES2_SHADER_FRAGMENT_TEXTURE_NV21_BT709_SRC:
|
||||||
return &GLES2_FragmentShader_TextureNV21BT709Src;
|
return &VITA_GLES2_FragmentShader_TextureNV21BT709Src;
|
||||||
case GLES2_SHADER_FRAGMENT_TEXTURE_EXTERNAL_OES_SRC:
|
case VITA_GLES2_SHADER_FRAGMENT_TEXTURE_EXTERNAL_OES_SRC:
|
||||||
return &GLES2_FragmentShader_TextureExternalOESSrc;
|
return &VITA_GLES2_FragmentShader_TextureExternalOESSrc;
|
||||||
default:
|
default:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* SDL_VIDEO_RENDER_OGL_ES2 && !SDL_RENDER_DISABLED */
|
#endif /* SDL_VIDEO_RENDER_VITA_GLES2 && !SDL_RENDER_DISABLED */
|
||||||
|
|
||||||
/* vi: set ts=4 sw=4 expandtab: */
|
/* vi: set ts=4 sw=4 expandtab: */
|
|
@ -0,0 +1,70 @@
|
||||||
|
/*
|
||||||
|
Simple DirectMedia Layer
|
||||||
|
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
|
This software is provided 'as-is', without any express or implied
|
||||||
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
arising from the use of this software.
|
||||||
|
|
||||||
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
|
including commercial applications, and to alter it and redistribute it
|
||||||
|
freely, subject to the following restrictions:
|
||||||
|
|
||||||
|
1. The origin of this software must not be misrepresented; you must not
|
||||||
|
claim that you wrote the original software. If you use this software
|
||||||
|
in a product, an acknowledgment in the product documentation would be
|
||||||
|
appreciated but is not required.
|
||||||
|
2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
misrepresented as being the original software.
|
||||||
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
*/
|
||||||
|
#include "../../SDL_internal.h"
|
||||||
|
|
||||||
|
#ifndef SDL_shaders_gles2vita_h_
|
||||||
|
#define SDL_shaders_gles2vita_h_
|
||||||
|
|
||||||
|
#if SDL_VIDEO_RENDER_VITA_GLES2
|
||||||
|
|
||||||
|
typedef struct VITA_GLES2_ShaderInstance
|
||||||
|
{
|
||||||
|
GLenum type;
|
||||||
|
GLenum format;
|
||||||
|
int length;
|
||||||
|
const void *data;
|
||||||
|
} VITA_GLES2_ShaderInstance;
|
||||||
|
|
||||||
|
typedef struct VITA_GLES2_Shader
|
||||||
|
{
|
||||||
|
int instance_count;
|
||||||
|
const VITA_GLES2_ShaderInstance *instances[4];
|
||||||
|
} VITA_GLES2_Shader;
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
VITA_GLES2_SHADER_VERTEX_DEFAULT,
|
||||||
|
VITA_GLES2_SHADER_FRAGMENT_SOLID_SRC,
|
||||||
|
VITA_GLES2_SHADER_FRAGMENT_TEXTURE_ABGR_SRC,
|
||||||
|
VITA_GLES2_SHADER_FRAGMENT_TEXTURE_ARGB_SRC,
|
||||||
|
VITA_GLES2_SHADER_FRAGMENT_TEXTURE_BGR_SRC,
|
||||||
|
VITA_GLES2_SHADER_FRAGMENT_TEXTURE_RGB_SRC,
|
||||||
|
VITA_GLES2_SHADER_FRAGMENT_TEXTURE_YUV_JPEG_SRC,
|
||||||
|
VITA_GLES2_SHADER_FRAGMENT_TEXTURE_YUV_BT601_SRC,
|
||||||
|
VITA_GLES2_SHADER_FRAGMENT_TEXTURE_YUV_BT709_SRC,
|
||||||
|
VITA_GLES2_SHADER_FRAGMENT_TEXTURE_NV12_JPEG_SRC,
|
||||||
|
VITA_GLES2_SHADER_FRAGMENT_TEXTURE_NV12_BT601_SRC,
|
||||||
|
VITA_GLES2_SHADER_FRAGMENT_TEXTURE_NV12_BT709_SRC,
|
||||||
|
VITA_GLES2_SHADER_FRAGMENT_TEXTURE_NV21_JPEG_SRC,
|
||||||
|
VITA_GLES2_SHADER_FRAGMENT_TEXTURE_NV21_BT601_SRC,
|
||||||
|
VITA_GLES2_SHADER_FRAGMENT_TEXTURE_NV21_BT709_SRC,
|
||||||
|
VITA_GLES2_SHADER_FRAGMENT_TEXTURE_EXTERNAL_OES_SRC
|
||||||
|
} VITA_GLES2_ShaderType;
|
||||||
|
|
||||||
|
#define VITA_GLES2_SOURCE_SHADER (GLenum)-1
|
||||||
|
|
||||||
|
const VITA_GLES2_Shader *VITA_GLES2_GetShader(VITA_GLES2_ShaderType type);
|
||||||
|
|
||||||
|
#endif /* SDL_VIDEO_RENDER_VITA_GLES2 */
|
||||||
|
|
||||||
|
#endif /* SDL_shaders_gles2vita_h_ */
|
||||||
|
|
||||||
|
/* vi: set ts=4 sw=4 expandtab: */
|
|
@ -26,6 +26,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "SDL_error.h"
|
#include "SDL_error.h"
|
||||||
|
#include "SDL_log.h"
|
||||||
#include "SDL_vitavideo.h"
|
#include "SDL_vitavideo.h"
|
||||||
#include "SDL_vitagl_c.h"
|
#include "SDL_vitagl_c.h"
|
||||||
|
|
||||||
|
@ -47,20 +48,20 @@
|
||||||
int
|
int
|
||||||
VITA_GL_LoadLibrary(_THIS, const char *path)
|
VITA_GL_LoadLibrary(_THIS, const char *path)
|
||||||
{
|
{
|
||||||
pibInit(PIB_SHACCCG);
|
pibInit(PIB_SHACCCG | PIB_GET_PROC_ADDR_CORE);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *
|
void *
|
||||||
VITA_GL_GetProcAddress(_THIS, const char *proc)
|
VITA_GL_GetProcAddress(_THIS, const char *proc)
|
||||||
{
|
{
|
||||||
return eglGetProcAddress(proc);
|
return eglGetProcAddress(proc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
VITA_GL_UnloadLibrary(_THIS)
|
VITA_GL_UnloadLibrary(_THIS)
|
||||||
{
|
{
|
||||||
eglTerminate(_this->gl_data->display);
|
eglTerminate(_this->gl_data->display);
|
||||||
}
|
}
|
||||||
|
|
||||||
static EGLint width = 960;
|
static EGLint width = 960;
|
||||||
|
@ -72,80 +73,72 @@ VITA_GL_CreateContext(_THIS, SDL_Window * window)
|
||||||
|
|
||||||
SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata;
|
SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata;
|
||||||
|
|
||||||
EGLint attribs[32];
|
EGLint attribs[32];
|
||||||
EGLDisplay display;
|
EGLDisplay display;
|
||||||
EGLContext context;
|
EGLContext context;
|
||||||
EGLSurface surface;
|
EGLSurface surface;
|
||||||
EGLConfig config;
|
EGLConfig config;
|
||||||
EGLint num_configs;
|
EGLint num_configs;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
EGLCHK(display = eglGetDisplay(0));
|
||||||
|
|
||||||
/* EGL init taken from glutCreateWindow() in VITAGL's glut.c. */
|
EGLCHK(eglInitialize(display, NULL, NULL));
|
||||||
EGLCHK(display = eglGetDisplay(0));
|
wdata->uses_gles = SDL_TRUE;
|
||||||
|
window->flags |= SDL_WINDOW_FULLSCREEN;
|
||||||
|
|
||||||
EGLCHK(eglInitialize(display, NULL, NULL));
|
EGLCHK(eglBindAPI(EGL_OPENGL_ES_API));
|
||||||
wdata->uses_gles = SDL_TRUE;
|
|
||||||
window->flags |= SDL_WINDOW_FULLSCREEN;
|
|
||||||
|
|
||||||
EGLCHK(eglBindAPI(EGL_OPENGL_ES_API));
|
i = 0;
|
||||||
|
attribs[i++] = EGL_RED_SIZE;
|
||||||
|
attribs[i++] = 8;
|
||||||
|
attribs[i++] = EGL_GREEN_SIZE;
|
||||||
|
attribs[i++] = 8;
|
||||||
|
attribs[i++] = EGL_BLUE_SIZE;
|
||||||
|
attribs[i++] = 8;
|
||||||
|
attribs[i++] = EGL_DEPTH_SIZE;
|
||||||
|
attribs[i++] = 0;
|
||||||
|
attribs[i++] = EGL_ALPHA_SIZE;
|
||||||
|
attribs[i++] = 8;
|
||||||
|
attribs[i++] = EGL_STENCIL_SIZE;
|
||||||
|
attribs[i++] = 0;;
|
||||||
|
|
||||||
/* Setup the config based on SDL's current values. */
|
attribs[i++] = EGL_SURFACE_TYPE;
|
||||||
i = 0;
|
attribs[i++] = 5;
|
||||||
attribs[i++] = EGL_RED_SIZE;
|
|
||||||
attribs[i++] = 8;//_this->gl_config.red_size;
|
|
||||||
attribs[i++] = EGL_GREEN_SIZE;
|
|
||||||
attribs[i++] = 8;//_this->gl_config.green_size;
|
|
||||||
attribs[i++] = EGL_BLUE_SIZE;
|
|
||||||
attribs[i++] = 8;//_this->gl_config.blue_size;
|
|
||||||
attribs[i++] = EGL_DEPTH_SIZE;
|
|
||||||
attribs[i++] = 32;//_this->gl_config.depth_size;
|
|
||||||
|
|
||||||
// if (_this->gl_config.alpha_size)
|
attribs[i++] = EGL_RENDERABLE_TYPE;
|
||||||
{
|
attribs[i++] = EGL_OPENGL_ES2_BIT;
|
||||||
attribs[i++] = EGL_ALPHA_SIZE;
|
|
||||||
attribs[i++] = 8;//_this->gl_config.alpha_size;
|
|
||||||
}
|
|
||||||
if (_this->gl_config.stencil_size)
|
|
||||||
{
|
|
||||||
attribs[i++] = EGL_STENCIL_SIZE;
|
|
||||||
attribs[i++] = _this->gl_config.stencil_size;
|
|
||||||
}
|
|
||||||
|
|
||||||
attribs[i++] = EGL_SURFACE_TYPE;
|
attribs[i++] = EGL_CONFORMANT;
|
||||||
attribs[i++] = 5;
|
attribs[i++] = EGL_OPENGL_ES2_BIT;
|
||||||
|
|
||||||
attribs[i++] = EGL_RENDERABLE_TYPE;
|
attribs[i++] = EGL_NONE;
|
||||||
attribs[i++] = EGL_OPENGL_ES2_BIT;
|
|
||||||
|
|
||||||
attribs[i++] = EGL_NONE;
|
EGLCHK(eglChooseConfig(display, attribs, &config, 1, &num_configs));
|
||||||
|
|
||||||
EGLCHK(eglChooseConfig(display, attribs, &config, 1, &num_configs));
|
if (num_configs == 0)
|
||||||
|
{
|
||||||
|
SDL_SetError("No valid EGL configs for requested mode");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (num_configs == 0)
|
const EGLint contextAttribs[] = {
|
||||||
{
|
EGL_CONTEXT_CLIENT_VERSION, 2,
|
||||||
SDL_SetError("No valid EGL configs for requested mode");
|
EGL_NONE
|
||||||
return 0;
|
};
|
||||||
}
|
|
||||||
|
|
||||||
const EGLint contextAttribs[] = {
|
EGLCHK(surface = eglCreateWindowSurface(display, config, VITA_WINDOW_960X544, NULL));
|
||||||
EGL_CONTEXT_CLIENT_VERSION, 2,
|
|
||||||
EGL_NONE
|
|
||||||
};
|
|
||||||
|
|
||||||
EGLCHK(surface = eglCreateWindowSurface(display, config, VITA_WINDOW_960X544, NULL));
|
EGLCHK(context = eglCreateContext(display, config, EGL_NO_CONTEXT, contextAttribs));
|
||||||
|
|
||||||
EGLCHK(context = eglCreateContext(display, config, EGL_NO_CONTEXT, contextAttribs));
|
EGLCHK(eglMakeCurrent(display, surface, surface, context));
|
||||||
|
|
||||||
EGLCHK(eglMakeCurrent(display, surface, surface, context));
|
EGLCHK(eglQuerySurface(display, surface, EGL_WIDTH, &width));
|
||||||
|
EGLCHK(eglQuerySurface(display, surface, EGL_HEIGHT, &height));
|
||||||
EGLCHK(eglQuerySurface(display, surface, EGL_WIDTH, &width));
|
|
||||||
EGLCHK(eglQuerySurface(display, surface, EGL_HEIGHT, &height));
|
|
||||||
|
|
||||||
_this->gl_data->display = display;
|
|
||||||
_this->gl_data->context = context;
|
|
||||||
_this->gl_data->surface = surface;
|
|
||||||
|
|
||||||
|
_this->gl_data->display = display;
|
||||||
|
_this->gl_data->context = context;
|
||||||
|
_this->gl_data->surface = surface;
|
||||||
|
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,9 +41,6 @@
|
||||||
|
|
||||||
SDL_Window *Vita_Window;
|
SDL_Window *Vita_Window;
|
||||||
|
|
||||||
/* unused
|
|
||||||
static SDL_bool VITA_initialized = SDL_FALSE;
|
|
||||||
*/
|
|
||||||
static int
|
static int
|
||||||
VITA_Available(void)
|
VITA_Available(void)
|
||||||
{
|
{
|
||||||
|
@ -67,15 +64,6 @@ VITA_Create()
|
||||||
SDL_VideoData *phdata;
|
SDL_VideoData *phdata;
|
||||||
SDL_GLDriverData *gldata;
|
SDL_GLDriverData *gldata;
|
||||||
|
|
||||||
int status;
|
|
||||||
|
|
||||||
/* Check if VITA could be initialized */
|
|
||||||
status = VITA_Available();
|
|
||||||
if (status == 0) {
|
|
||||||
/* VITA could not be used */
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Initialize SDL_VideoDevice structure */
|
/* Initialize SDL_VideoDevice structure */
|
||||||
device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
|
device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
|
||||||
if (device == NULL) {
|
if (device == NULL) {
|
||||||
|
@ -225,8 +213,8 @@ VITA_CreateWindow(_THIS, SDL_Window * window)
|
||||||
// Vita can only have one window
|
// Vita can only have one window
|
||||||
if (Vita_Window != NULL)
|
if (Vita_Window != NULL)
|
||||||
{
|
{
|
||||||
// Replace this with something else
|
SDL_SetError("Only one window supported");
|
||||||
return SDL_OutOfMemory();
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vita_Window = window;
|
Vita_Window = window;
|
||||||
|
@ -292,6 +280,17 @@ VITA_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed)
|
||||||
void
|
void
|
||||||
VITA_DestroyWindow(_THIS, SDL_Window * window)
|
VITA_DestroyWindow(_THIS, SDL_Window * window)
|
||||||
{
|
{
|
||||||
|
SDL_VideoData *videodata = (SDL_VideoData *)_this->driverdata;
|
||||||
|
SDL_WindowData *data;
|
||||||
|
|
||||||
|
data = window->driverdata;
|
||||||
|
if (data) {
|
||||||
|
// TODO: should we destroy egl context? No one sane should recreate ogl window as non-ogl
|
||||||
|
SDL_free(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
window->driverdata = NULL;
|
||||||
|
Vita_Window = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
Loading…
Reference in New Issue