Commit fc8eb6db authored by Libretro-Admin's avatar Libretro-Admin
Browse files

Backport

https://github.com/flyinghead/reicast-emulator/commit/bb2d860902f26734008cd7556190960e3f418c52
- Reicast OIT now uses GL core profile 4.3 instead of a compatibility
context - hopefully better compatibility with Radeon/Intel et al
parent f8a77125
......@@ -486,9 +486,6 @@ ifeq ($(HAVE_GL3), 1)
CORE_DEFINES += -DHAVE_GL3
endif
ifeq ($(HAVE_CORE), 1)
CORE_DEFINES += -DCORE
endif
RZDCY_CFLAGS += $(CFLAGS) -c $(OPTFLAGS) -frename-registers -ffast-math -ftree-vectorize -fomit-frame-pointer
......@@ -528,9 +525,14 @@ CORE_DEFINES += -funroll-loops
endif
ifeq ($(HAVE_OIT), 1)
HAVE_CORE = 1
CORE_DEFINES += -DHAVE_OIT -DHAVE_GL4
endif
ifeq ($(HAVE_CORE), 1)
CORE_DEFINES += -DCORE
endif
ifeq ($(HAVE_GL), 1)
ifeq ($(GLES),1)
CORE_DEFINES += -DHAVE_OPENGLES -DHAVE_OPENGLES2
......
......@@ -27,6 +27,9 @@ float fb_scale_x = 0.0f;
float fb_scale_y = 0.0f;
float scale_x, scale_y;
#define FOG_CHANNEL "r"
#define FOG_IMG_TYPE GL_RED
//Fragment and vertex shaders code
//
const char* VertexShaderSource =
......@@ -150,7 +153,7 @@ lowp float fog_mode2(highp float w) \n\
highp float m = z * 16 / pow(2, i) - 16; \n\
float idx = floor(m) + i * 16 + 0.5; \n\
vec4 fog_coef = texture(fog_table, vec2(idx / 128, 0.75 - (m - floor(m)) / 2)); \n\
return fog_coef.a; \n\
return fog_coef." FOG_CHANNEL "; \n\
} \n\
void main() \n\
{ \n\
......@@ -693,7 +696,8 @@ void UpdateFogTexture(u8 *fog_table)
temp_tex_buffer[i] = fog_table[i * 4];
temp_tex_buffer[i + 128] = fog_table[i * 4 + 1];
}
glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, 128, 2, 0, GL_ALPHA, GL_UNSIGNED_BYTE, temp_tex_buffer);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glTexImage2D(GL_TEXTURE_2D, 0, FOG_IMG_TYPE, 128, 2, 0, FOG_IMG_TYPE, GL_UNSIGNED_BYTE, temp_tex_buffer);
glCheck();
glActiveTexture(GL_TEXTURE0);
......
......@@ -115,9 +115,13 @@ void main() \n\
#define TEXLOOKUP "texture"
#undef vary
#define vary "in"
#define FOG_CHANNEL "r"
#define FOG_IMG_TYPE GL_RED
#else
#define FRAGCOL "gl_FragColor"
#define TEXLOOKUP "texture2D"
#define FOG_CHANNEL "a"
#define FOG_IMG_TYPE GL_ALPHA
#endif
const char* PixelPipelineShader =
......@@ -178,7 +182,7 @@ INTERPOLATION " vary LOWP " vec4 vtx_offs; \n\
" HIGHP " float m = z * 16.0 / pow(2.0, exp) - 16.0; \n\
float idx = floor(m) + exp * 16.0 + 0.5; \n\
vec4 fog_coef = " TEXLOOKUP "(fog_table, vec2(idx / 128.0, 0.75 - (m - floor(m)) / 2.0)); \n\
return fog_coef.a; \n\
return fog_coef." FOG_CHANNEL "; \n\
} \n\
void main() \n\
{ \n\
......@@ -609,7 +613,8 @@ void UpdateFogTexture(u8 *fog_table)
temp_tex_buffer[i] = fog_table[i * 4];
temp_tex_buffer[i + 128] = fog_table[i * 4 + 1];
}
glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, 128, 2, 0, GL_ALPHA, GL_UNSIGNED_BYTE, temp_tex_buffer);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glTexImage2D(GL_TEXTURE_2D, 0, FOG_IMG_TYPE, 128, 2, 0, FOG_IMG_TYPE, GL_UNSIGNED_BYTE, temp_tex_buffer);
glActiveTexture(GL_TEXTURE0);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment