libretro: fix nvidia palette issue. request 3.2 to get a core gl ctx

This commit is contained in:
Flyinghead 2021-07-09 13:10:30 +02:00
parent 5c952021b7
commit 345dab9633
3 changed files with 12 additions and 12 deletions

View File

@ -164,8 +164,8 @@ vec4 fog_clamp(vec4 col)
vec4 palettePixel(sampler2D tex, vec2 coords)
{
int color_idx = int(floor(texture(tex, coords).r * 255.0 + 0.5)) + palette_index;
vec2 c = vec2(float(color_idx % 32) / 31.0, float(color_idx / 32) / 31.0);
return texture(palette, c);
ivec2 c = ivec2(color_idx % 32, color_idx / 32);
return texelFetch(palette, c, 0);
}
#endif

View File

@ -160,9 +160,13 @@ highp vec4 fog_clamp(lowp vec4 col)
lowp vec4 palettePixel(highp vec2 coords)
{
highp int color_idx = int(floor(texture(tex, coords).FOG_CHANNEL * 255.0 + 0.5)) + palette_index;
highp vec2 c = vec2(mod(float(color_idx), 32.0) / 31.0, float(color_idx / 32) / 31.0);
//highp vec2 c = vec2((mod(float(color_idx), 32.0) * 2.0 + 1.0) / 64.0, (float(color_idx / 32) * 2.0 + 1.0) / 64.0);
#if TARGET_GL == GLES2 || TARGET_GL == GL2
highp vec2 c = vec2((mod(float(color_idx), 32.0) * 2.0 + 1.0) / 64.0, (float(color_idx / 32) * 2.0 + 1.0) / 64.0);
return texture(palette, c);
#else
highp ivec2 c = ivec2(color_idx % 32, color_idx / 32);
return texelFetch(palette, c, 0);
#endif
}
#endif

View File

@ -1330,6 +1330,7 @@ static bool set_opengl_hw_render(u32 preferred)
// There are some weirdness with RA's gl context's versioning :
// - any value above 3.0 won't provide a valid context, while the GLSM_CTL_STATE_CONTEXT_INIT call returns true...
// - the only way to overwrite previously set version with zero values is to set them directly in hw_render, otherwise they are ignored (see glsm_state_ctx_init logic)
// FIXME what's the point of this?
retro_hw_render_callback hw_render;
hw_render.version_major = 3;
hw_render.version_minor = 0;
@ -1341,19 +1342,14 @@ static bool set_opengl_hw_render(u32 preferred)
}
}
else
#endif
{
params.context_type = (retro_hw_context_type)preferred;
params.major = 3;
params.minor = 0;
params.minor = preferred == RETRO_HW_CONTEXT_OPENGL_CORE ? 2 : 0;
config::RendererType = RenderType::OpenGL;
config::RendererType.commit();
}
#elif defined(HAVE_GL3)
params.context_type = (retro_hw_context_type)preferred;
params.major = 3;
params.minor = 0;
config::RendererType = RenderType::OpenGL;
#endif
config::RendererType.commit();
if (glsm_ctl(GLSM_CTL_STATE_CONTEXT_INIT, &params))
return true;