1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-07-02 09:03:37 +00:00

Fix some shader compilation errors

This commit is contained in:
fzurita 2021-09-05 12:43:55 -04:00 committed by Sergey Lipskiy
parent 8a3939aa70
commit 21eb341b8d
5 changed files with 25 additions and 10 deletions

View File

@ -553,7 +553,9 @@ public:
ss << "#extension GL_NV_fragment_shader_interlock : enable" << std::endl
<< "layout(pixel_interlock_ordered) in;" << std::endl;
}
}
} else if (_glinfo.fetch_depth)
ss << "#extension GL_ARM_shader_framebuffer_fetch_depth_stencil : enable" << std::endl;
ss << "# define IN in" << std::endl
<< "# define OUT out" << std::endl
<< "# define texture2D texture" << std::endl;
@ -579,6 +581,7 @@ public:
ss << "#extension GL_INTEL_fragment_shader_ordering : enable" << std::endl;
}
}
ss << "# define IN in" << std::endl
<< "# define OUT out" << std::endl
<< "# define texture2D texture" << std::endl;
@ -2048,8 +2051,8 @@ public:
// Fetch from texture atlas
// First 8 texels contain info about tile size and offset, 1 texel per tile
" mediump vec2 texSize = uTextureSize[1]; \n"
" mediump vec4 texWdthAndOff0 = 255.0 * texture(tex, vec2(0.5, 0.5)/texSize); \n"
" mediump vec4 texWdthAndOff = 255.0 * texture(tex, vec2(lod + 0.5, 0.5)/texSize); \n"
" mediump vec4 texWdthAndOff0 = 255.0 * texture2D(tex, vec2(0.5, 0.5)/texSize); \n"
" mediump vec4 texWdthAndOff = 255.0 * texture2D(tex, vec2(lod + 0.5, 0.5)/texSize); \n"
" mediump vec2 lod_scale = texWdthAndOff.ba / texWdthAndOff0.ba; \n"
" mediump float offset = texWdthAndOff.r + texWdthAndOff.g * 256.0; \n"
" mediump float width = texWdthAndOff.b; \n"
@ -2119,11 +2122,17 @@ public:
;
}
m_part +=
" lowp int max_tile = min(uTextureDetail != 2 ? 7 : 6, uMaxTile); \n"
"#define MIN(x, y) y < x ? y : x \n"
"#define MAX(x, y) x < y ? y : x \n"
" lowp int lod_max_tile = uTextureDetail != 2 ? 7 : 6; \n"
" lowp int max_tile = MIN(lod_max_tile, uMaxTile); \n"
" mediump float min_lod = uTextureDetail != 0 ? uMinLod : 1.0; \n"
" mediump float max_lod = pow(2.0, float(max_tile)) - 1.0 / 32.0; \n"
" mediump float lod_clamp = min(max(lod, min_lod), max_lod); \n"
" lowp int lod_tile = clamp(int(log2(lod_clamp)), 0 , max_tile); \n"
// Simulate clamp function, needed for GLES 2.0 and integer types
" mediump int lod_clamp_int = int(log2(lod_clamp)); \n"
" mediump int lod_clamp_max = MAX(lod_clamp_int, 0); \n"
" lowp int lod_tile = MIN(lod_clamp_max, max_tile); \n"
" lowp int tile0 = 0; \n"
" lowp int tile1 = 1; \n"
" if (uEnableLod != 0) { \n"

View File

@ -130,9 +130,6 @@ namespace glsl {
" fragColor = vec4(uFogColor.rgb, get_alpha()); \n"
"} \n"
;
if (config.frameBufferEmulation.N64DepthCompare == Config::dcDisable && _glinfo.fetch_depth)
m_part = "#extension GL_ARM_shader_framebuffer_fetch_depth_stencil : enable \n" + m_part;
}
};

View File

@ -276,8 +276,13 @@ s32 ContextImpl::getMaxTextureSize() const
f32 ContextImpl::getMaxAnisotropy() const
{
GLfloat maxInisotropy = 0.0f;
glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &maxInisotropy);
return maxInisotropy;
if (m_glInfo.anisotropic_filtering) {
glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &maxInisotropy);
return maxInisotropy;
} else {
return 0.0f;
}
}
void ContextImpl::bindImageTexture(const graphics::Context::BindImageTextureParameters & _params)

View File

@ -180,6 +180,7 @@ void GLInfo::init() {
ext_fetch_arm = Utils::isExtensionSupported(*this, "GL_ARM_shader_framebuffer_fetch") && !ext_fetch;
dual_source_blending = !isGLESX || (Utils::isExtensionSupported(*this, "GL_EXT_blend_func_extended") && !isAnyAdreno);
anisotropic_filtering = Utils::isExtensionSupported(*this, "GL_EXT_texture_filter_anisotropic");
#ifdef OS_ANDROID
eglImage = eglImage &&
@ -223,6 +224,8 @@ void GLInfo::init() {
}
#endif
#ifdef GL_DEBUG
glDebugMessageCallback(on_gl_error, nullptr);
glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, NULL, GL_TRUE);

View File

@ -39,6 +39,7 @@ struct GLInfo {
bool eglImage = false;
bool eglImageFramebuffer = false;
bool dual_source_blending = false;
bool anisotropic_filtering = false;
bool coverage = false;
Renderer renderer = Renderer::Other;