mirror of
https://github.com/libretro/RetroArch.git
synced 2026-01-09 06:34:03 +08:00
Add support for Cg and GLSL shaders in the glcore video driver (#18151)
This commit is contained in:
parent
248af45eaf
commit
c8ab73607c
@ -1687,11 +1687,15 @@ ifeq ($(HAVE_VULKAN), 1)
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_OPENGL_CORE), 1)
|
||||
OBJ += gfx/drivers/gl3.o \
|
||||
gfx/drivers_shader/shader_gl3.o
|
||||
OBJ += gfx/drivers/gl3.o
|
||||
|
||||
DEFINES += -DHAVE_OPENGL_CORE
|
||||
NEED_CXX_LINKER = 1
|
||||
|
||||
ifeq ($(HAVE_SLANG), 1)
|
||||
OBJ += gfx/drivers_shader/shader_gl3.o
|
||||
|
||||
NEED_CXX_LINKER = 1
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_OMAP), 1)
|
||||
|
||||
@ -1385,7 +1385,8 @@ static void gl2_renderchain_render(
|
||||
rect->img_width, rect->img_height, true, false,
|
||||
video_scale_integer);
|
||||
|
||||
params.data = gl;
|
||||
params.vp_width = gl->out_vp_width;
|
||||
params.vp_height = gl->out_vp_height;
|
||||
params.width = prev_rect->img_width;
|
||||
params.height = prev_rect->img_height;
|
||||
params.tex_width = prev_rect->width;
|
||||
@ -1450,7 +1451,8 @@ static void gl2_renderchain_render(
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
gl2_set_viewport(gl, width, height, false, true, video_scale_integer);
|
||||
|
||||
params.data = gl;
|
||||
params.vp_width = gl->out_vp_width;
|
||||
params.vp_height = gl->out_vp_height;
|
||||
params.width = prev_rect->img_width;
|
||||
params.height = prev_rect->img_height;
|
||||
params.tex_width = prev_rect->width;
|
||||
@ -3560,7 +3562,8 @@ static bool gl2_frame(void *data, const void *frame,
|
||||
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
params.data = gl;
|
||||
params.vp_width = gl->out_vp_width;
|
||||
params.vp_height = gl->out_vp_height;
|
||||
params.width = frame_width;
|
||||
params.height = frame_height;
|
||||
params.tex_width = gl->tex_w;
|
||||
|
||||
1893
gfx/drivers/gl3.c
1893
gfx/drivers/gl3.c
File diff suppressed because it is too large
Load Diff
@ -101,14 +101,14 @@ static uint32_t cocoa_gl_gfx_ctx_get_flags(void *data)
|
||||
break;
|
||||
case GFX_CTX_OPENGL_API:
|
||||
if (string_is_equal(video_driver_get_ident(), "gl1")) { }
|
||||
else if (string_is_equal(video_driver_get_ident(), "glcore"))
|
||||
{
|
||||
#if defined(HAVE_SLANG) && defined(HAVE_SPIRV_CROSS)
|
||||
BIT32_SET(flags, GFX_CTX_FLAGS_SHADERS_SLANG);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
if (string_is_equal(video_driver_get_ident(), "glcore"))
|
||||
{
|
||||
#if defined(HAVE_SLANG) && defined(HAVE_SPIRV_CROSS)
|
||||
BIT32_SET(flags, GFX_CTX_FLAGS_SHADERS_SLANG);
|
||||
#endif
|
||||
}
|
||||
#ifdef HAVE_GLSL
|
||||
BIT32_SET(flags, GFX_CTX_FLAGS_SHADERS_GLSL);
|
||||
#endif
|
||||
|
||||
@ -1050,8 +1050,9 @@ static uint32_t gfx_ctx_drm_get_flags(void *data)
|
||||
BIT32_SET(flags, GFX_CTX_FLAGS_SHADERS_SLANG);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
BIT32_SET(flags, GFX_CTX_FLAGS_SHADERS_GLSL);
|
||||
#ifdef HAVE_GLSL
|
||||
BIT32_SET(flags, GFX_CTX_FLAGS_SHADERS_GLSL);
|
||||
#endif
|
||||
|
||||
BIT32_SET(flags, GFX_CTX_FLAGS_CRT_SWITCHRES);
|
||||
|
||||
|
||||
@ -367,8 +367,9 @@ static uint32_t gfx_ctx_go2_drm_get_flags(void *data)
|
||||
BIT32_SET(flags, GFX_CTX_FLAGS_SHADERS_SLANG);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
BIT32_SET(flags, GFX_CTX_FLAGS_SHADERS_GLSL);
|
||||
#ifdef HAVE_GLSL
|
||||
BIT32_SET(flags, GFX_CTX_FLAGS_SHADERS_GLSL);
|
||||
#endif
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
@ -318,10 +318,9 @@ static uint32_t orbis_ctx_get_flags(void *data)
|
||||
BIT32_SET(flags, GFX_CTX_FLAGS_SHADERS_SLANG);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
BIT32_SET(flags, GFX_CTX_FLAGS_SHADERS_GLSL);
|
||||
}
|
||||
#ifdef HAVE_GLSL
|
||||
BIT32_SET(flags, GFX_CTX_FLAGS_SHADERS_GLSL);
|
||||
#endif
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
@ -238,12 +238,9 @@ static uint32_t switch_ctx_get_flags(void *data)
|
||||
BIT32_SET(flags, GFX_CTX_FLAGS_SHADERS_SLANG);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef HAVE_GLSL
|
||||
BIT32_SET(flags, GFX_CTX_FLAGS_SHADERS_GLSL);
|
||||
BIT32_SET(flags, GFX_CTX_FLAGS_SHADERS_GLSL);
|
||||
#endif
|
||||
}
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
@ -573,14 +573,14 @@ static uint32_t gfx_ctx_wl_get_flags(void *data)
|
||||
if (wl->core_hw_context_enable)
|
||||
BIT32_SET(flags, GFX_CTX_FLAGS_GL_CORE_CONTEXT);
|
||||
|
||||
if (string_is_equal(video_ident, "glcore"))
|
||||
if (string_is_equal(video_ident, "glcore") || string_is_equal(video_ident, "gl"))
|
||||
{
|
||||
if (string_is_equal(video_ident, "glcore"))
|
||||
{
|
||||
#if defined(HAVE_SLANG) && defined(HAVE_SPIRV_CROSS)
|
||||
BIT32_SET(flags, GFX_CTX_FLAGS_SHADERS_SLANG);
|
||||
BIT32_SET(flags, GFX_CTX_FLAGS_SHADERS_SLANG);
|
||||
#endif
|
||||
}
|
||||
else if (string_is_equal(video_ident, "gl"))
|
||||
{
|
||||
}
|
||||
#ifdef HAVE_GLSL
|
||||
BIT32_SET(flags, GFX_CTX_FLAGS_SHADERS_GLSL);
|
||||
#endif
|
||||
|
||||
@ -785,14 +785,14 @@ static uint32_t gfx_ctx_wgl_get_flags(void *data)
|
||||
BIT32_SET(flags, GFX_CTX_FLAGS_GL_CORE_CONTEXT);
|
||||
|
||||
if (string_is_equal(video_driver_get_ident(), "gl1")) { }
|
||||
else if (string_is_equal(video_driver_get_ident(), "glcore"))
|
||||
{
|
||||
#if defined(HAVE_SLANG) && defined(HAVE_SPIRV_CROSS)
|
||||
BIT32_SET(flags, GFX_CTX_FLAGS_SHADERS_SLANG);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
if (string_is_equal(video_driver_get_ident(), "glcore"))
|
||||
{
|
||||
#if defined(HAVE_SLANG) && defined(HAVE_SPIRV_CROSS)
|
||||
BIT32_SET(flags, GFX_CTX_FLAGS_SHADERS_SLANG);
|
||||
#endif
|
||||
}
|
||||
#ifdef HAVE_CG
|
||||
if (!(wgl_flags & WGL_FLAG_CORE_HW_CTX_ENABLE))
|
||||
BIT32_SET(flags, GFX_CTX_FLAGS_SHADERS_CG);
|
||||
|
||||
@ -1076,14 +1076,14 @@ static uint32_t gfx_ctx_x_get_flags(void *data)
|
||||
BIT32_SET(flags, GFX_CTX_FLAGS_MULTISAMPLING);
|
||||
|
||||
if (string_is_equal(video_driver_get_ident(), "gl1")) { }
|
||||
else if (string_is_equal(video_driver_get_ident(), "glcore"))
|
||||
{
|
||||
#if defined(HAVE_SLANG) && defined(HAVE_SPIRV_CROSS)
|
||||
BIT32_SET(flags, GFX_CTX_FLAGS_SHADERS_SLANG);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
if (string_is_equal(video_driver_get_ident(), "glcore"))
|
||||
{
|
||||
#if defined(HAVE_SLANG) && defined(HAVE_SPIRV_CROSS)
|
||||
BIT32_SET(flags, GFX_CTX_FLAGS_SHADERS_SLANG);
|
||||
#endif
|
||||
}
|
||||
#ifdef HAVE_CG
|
||||
if (!(x->core_hw_context_enable || x->core_es))
|
||||
BIT32_SET(flags, GFX_CTX_FLAGS_SHADERS_CG);
|
||||
|
||||
@ -572,10 +572,9 @@ static uint32_t gfx_ctx_xegl_get_flags(void *data)
|
||||
BIT32_SET(flags, GFX_CTX_FLAGS_SHADERS_SLANG);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
BIT32_SET(flags, GFX_CTX_FLAGS_SHADERS_GLSL);
|
||||
}
|
||||
#ifdef HAVE_GLSL
|
||||
BIT32_SET(flags, GFX_CTX_FLAGS_SHADERS_GLSL);
|
||||
#endif
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
@ -1297,9 +1297,8 @@ static void gl_glsl_set_params(void *dat, void *shader_data)
|
||||
struct glsl_attrib attribs[32];
|
||||
float input_size[2], output_size[2], texture_size[2], final_vp_size[2];
|
||||
video_shader_ctx_params_t *params = (video_shader_ctx_params_t*)dat;
|
||||
gl2_t *gl_data = (gl2_t*)params->data;
|
||||
unsigned vp_width = gl_data->out_vp_width;
|
||||
unsigned vp_height = gl_data->out_vp_height;
|
||||
unsigned vp_width = params->vp_width;
|
||||
unsigned vp_height = params->vp_height;
|
||||
unsigned width = params->width;
|
||||
unsigned height = params->height;
|
||||
unsigned tex_width = params->tex_width;
|
||||
|
||||
@ -65,7 +65,11 @@
|
||||
|
||||
#if defined(_XBOX360)
|
||||
#define DEFAULT_SHADER_TYPE RARCH_SHADER_HLSL
|
||||
#elif defined(HAVE_OPENGLES2) || defined(HAVE_GLSL)
|
||||
#elif defined(HAVE_OPENGLES2)
|
||||
#define DEFAULT_SHADER_TYPE RARCH_SHADER_GLSL
|
||||
#elif defined(HAVE_SLANG)
|
||||
#define DEFAULT_SHADER_TYPE RARCH_SHADER_SLANG
|
||||
#elif defined(HAVE_GLSL)
|
||||
#define DEFAULT_SHADER_TYPE RARCH_SHADER_GLSL
|
||||
#elif defined(HAVE_CG)
|
||||
#define DEFAULT_SHADER_TYPE RARCH_SHADER_CG
|
||||
@ -275,11 +279,12 @@ typedef struct shader_backend
|
||||
|
||||
typedef struct video_shader_ctx_params
|
||||
{
|
||||
void *data;
|
||||
const void *info;
|
||||
const void *prev_info;
|
||||
const void *feedback_info;
|
||||
const void *fbo_info;
|
||||
unsigned vp_width;
|
||||
unsigned vp_height;
|
||||
unsigned width;
|
||||
unsigned height;
|
||||
unsigned tex_width;
|
||||
|
||||
@ -70,11 +70,11 @@ UI
|
||||
/*============================================================
|
||||
VIDEO DRIVER
|
||||
============================================================ */
|
||||
#ifdef HAVE_VULKAN
|
||||
#if defined(HAVE_VULKAN) && defined(HAVE_SLANG)
|
||||
#include "../gfx/drivers_shader/shader_vulkan.cpp"
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_OPENGL_CORE)
|
||||
#if defined(HAVE_OPENGL_CORE) && defined(HAVE_SLANG)
|
||||
#include "../gfx/drivers_shader/shader_gl3.cpp"
|
||||
#endif
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user