Get rid of header dependencies on GL in shader_common.h

This commit is contained in:
twinaphex 2014-10-02 11:27:11 +02:00
parent 039a5d7ab3
commit 89e449cc86
8 changed files with 65 additions and 41 deletions

View File

@ -27,6 +27,7 @@
#include "../backend/menu_common_backend.h"
#include "../../../general.h"
#include "../../../gfx/gfx_common.h"
#include "../../../gfx/shader/shader_gl_common.h"
#include "../../../config.def.h"
#include "../../../file.h"
#include "../../../dynamic.h"

View File

@ -22,6 +22,7 @@
#include "gfx_context.h"
#include "scaler/scaler.h"
#include "fonts/gl_font.h"
#include "shader/shader_common.h"
#include "shader/shader_parse.h"
#ifdef HAVE_CONFIG_H
@ -167,8 +168,6 @@ struct gl_coords
unsigned vertices;
};
typedef struct shader_backend shader_backend_t;
#define MAX_SHADERS 16
#define MAX_TEXTURES 8

View File

@ -18,6 +18,10 @@
#pragma comment(lib, "cggl")
#endif
#ifdef HAVE_OPENGL
#include "shader_gl_common.h"
#endif
#include "shader_cg.h"
#include "shader_common.h"
#include <Cg/cg.h>

View File

@ -17,6 +17,8 @@
#include "../../retroarch_logger.h"
#ifdef HAVE_OPENGL
#include "shader_gl_common.h"
void gl_load_texture_data(GLuint obj, const struct texture_image *img,
GLenum wrap, bool linear, bool mipmap)
{

View File

@ -1,5 +1,6 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2014 - Daniel De Matteis
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
@ -13,8 +14,8 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SHADER_COMMON_H__
#define SHADER_COMMON_H__
#ifndef SHADERS_COMMON_H__
#define SHADERS_COMMON_H__
#include "../../boolean.h"
@ -22,37 +23,10 @@
#include "../../config.h"
#endif
#ifdef HAVE_OPENGL
#include "../gl_common.h"
#endif
#include "../gfx_context.h"
#include "../math/matrix.h"
#if defined(_XBOX360)
#define DEFAULT_SHADER_TYPE RARCH_SHADER_HLSL
#elif defined(__PSL1GHT__)
#define DEFAULT_SHADER_TYPE RARCH_SHADER_GLSL
#elif defined(__CELLOS_LV2__)
#define DEFAULT_SHADER_TYPE RARCH_SHADER_CG
#elif defined(HAVE_OPENGLES2)
#define DEFAULT_SHADER_TYPE RARCH_SHADER_GLSL
#else
#define DEFAULT_SHADER_TYPE RARCH_SHADER_NONE
#endif
#if defined(HAVE_CG) || defined(HAVE_HLSL) || defined(HAVE_GLSL)
#ifndef HAVE_SHADER_MANAGER
#define HAVE_SHADER_MANAGER
#endif
#include "shader_parse.h"
#define GL_SHADER_STOCK_BLEND (GFX_MAX_SHADERS - 1)
#endif
struct shader_backend
typedef struct shader_backend
{
bool (*init)(void *data, const char *path);
void (*deinit)(void);
@ -77,18 +51,34 @@ struct shader_backend
struct gfx_shader *(*get_current_shader)(void);
enum rarch_shader_type type;
};
} shader_backend_t;
extern const shader_backend_t gl_glsl_backend;
extern const shader_backend_t hlsl_backend;
extern const shader_backend_t gl_cg_backend;
extern const shader_backend_t shader_null_backend;
#ifdef HAVE_OPENGL
void gl_load_texture_data(GLuint obj, const struct texture_image *img,
GLenum wrap, bool linear, bool mipmap);
bool gl_load_luts(const struct gfx_shader *generic_shader,
GLuint *lut_textures);
#if defined(_XBOX360)
#define DEFAULT_SHADER_TYPE RARCH_SHADER_HLSL
#elif defined(__PSL1GHT__)
#define DEFAULT_SHADER_TYPE RARCH_SHADER_GLSL
#elif defined(__CELLOS_LV2__)
#define DEFAULT_SHADER_TYPE RARCH_SHADER_CG
#elif defined(HAVE_OPENGLES2)
#define DEFAULT_SHADER_TYPE RARCH_SHADER_GLSL
#else
#define DEFAULT_SHADER_TYPE RARCH_SHADER_NONE
#endif
#if defined(HAVE_CG) || defined(HAVE_HLSL) || defined(HAVE_GLSL)
#ifndef HAVE_SHADER_MANAGER
#define HAVE_SHADER_MANAGER
#endif
#include "shader_parse.h"
#define GL_SHADER_STOCK_BLEND (GFX_MAX_SHADERS - 1)
#endif
#endif

View File

@ -0,0 +1,28 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2014 - Daniel De Matteis
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SHADERS_GL_COMMON_H__
#define SHADERS_GL_COMMON_H__
#include "../gl_common.h"
void gl_load_texture_data(GLuint obj, const struct texture_image *img,
GLenum wrap, bool linear, bool mipmap);
bool gl_load_luts(const struct gfx_shader *generic_shader,
GLuint *lut_textures);
#endif

View File

@ -32,7 +32,9 @@
#include "../gfx_context.h"
#include <stdlib.h>
#include "../gl_common.h"
#ifdef HAVE_OPENGL
#include "shader_gl_common.h"
#endif
#ifdef HAVE_OPENGLES2
#define BORDER_FUNC GL_CLAMP_TO_EDGE

View File

@ -32,8 +32,6 @@
#include "shader_common.h"
#include <stdlib.h>
typedef struct shader_backend shader_backend_t;
static void shader_null_deinit(void) { }
static bool shader_null_init(void *data, const char *path) { return true; }