mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
OpenGL: Assorted shader-depal bugfixes and regression fixes.
Fixes #13517
This commit is contained in:
parent
653a4bddde
commit
e14437cb3f
6 changed files with 27 additions and 13 deletions
|
@ -474,9 +474,10 @@ void CheckGLExtensions() {
|
|||
}
|
||||
}
|
||||
|
||||
// Now, Adreno lies. So let's override it.
|
||||
if (gl_extensions.gpuVendor == GPU_VENDOR_QUALCOMM) {
|
||||
WARN_LOG(G3D, "Detected Adreno - lowering int precision");
|
||||
// Now, old Adreno lies. So let's override it.
|
||||
// Not sure about the exact limit here.
|
||||
if (gl_extensions.gpuVendor == GPU_VENDOR_QUALCOMM && gl_extensions.modelNumber < 500) {
|
||||
WARN_LOG(G3D, "Detected old Adreno - lowering int precision for safety");
|
||||
gl_extensions.range[1][5][0] = 15;
|
||||
gl_extensions.range[1][5][1] = 15;
|
||||
}
|
||||
|
|
|
@ -116,6 +116,11 @@ bool GenerateFragmentShader(const FShaderID &id, char *buffer, const ShaderLangu
|
|||
bool needFragCoord = readFramebuffer || gstate_c.Supports(GPU_ROUND_FRAGMENT_DEPTH_TO_16BIT);
|
||||
bool writeDepth = gstate_c.Supports(GPU_ROUND_FRAGMENT_DEPTH_TO_16BIT);
|
||||
|
||||
if (shaderDepal && !doTexture) {
|
||||
*errorString = "depal requires a texture";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (readFramebuffer && compat.shaderLanguage == HLSL_D3D9) {
|
||||
*errorString = "Framebuffer read not yet supported in HLSL D3D9";
|
||||
return false;
|
||||
|
@ -565,10 +570,10 @@ bool GenerateFragmentShader(const FShaderID &id, char *buffer, const ShaderLangu
|
|||
WRITE(p, " } else {\n");
|
||||
WRITE(p, " uv_round = uv;\n");
|
||||
WRITE(p, " }\n");
|
||||
WRITE(p, " vec4 t = %s(tex, uv_round);\n", compat.texture);
|
||||
WRITE(p, " vec4 t1 = %sOffset(tex, uv_round, ivec2(1, 0));\n", compat.texture);
|
||||
WRITE(p, " vec4 t2 = %sOffset(tex, uv_round, ivec2(0, 1));\n", compat.texture);
|
||||
WRITE(p, " vec4 t3 = %sOffset(tex, uv_round, ivec2(1, 1));\n", compat.texture);
|
||||
WRITE(p, " highp vec4 t = %s(tex, uv_round);\n", compat.texture);
|
||||
WRITE(p, " highp vec4 t1 = %sOffset(tex, uv_round, ivec2(1, 0));\n", compat.texture);
|
||||
WRITE(p, " highp vec4 t2 = %sOffset(tex, uv_round, ivec2(0, 1));\n", compat.texture);
|
||||
WRITE(p, " highp vec4 t3 = %sOffset(tex, uv_round, ivec2(1, 1));\n", compat.texture);
|
||||
WRITE(p, " uint depalMask = (u_depal_mask_shift_off_fmt & 0xFFU);\n");
|
||||
WRITE(p, " uint depalShift = (u_depal_mask_shift_off_fmt >> 8) & 0xFFU;\n");
|
||||
WRITE(p, " uint depalOffset = ((u_depal_mask_shift_off_fmt >> 16) & 0xFFU) << 4;\n");
|
||||
|
|
|
@ -265,6 +265,7 @@ void ComputeFragmentShaderID(FShaderID *id_out, const Draw::Bugs &bugs) {
|
|||
id.SetBit(FS_BIT_TEXTURE_AT_OFFSET, textureAtOffset);
|
||||
}
|
||||
id.SetBit(FS_BIT_BGRA_TEXTURE, gstate_c.bgraTexture);
|
||||
id.SetBit(FS_BIT_SHADER_DEPAL, useShaderDepal);
|
||||
}
|
||||
|
||||
id.SetBit(FS_BIT_LMODE, lmode);
|
||||
|
@ -310,7 +311,6 @@ void ComputeFragmentShaderID(FShaderID *id_out, const Draw::Bugs &bugs) {
|
|||
}
|
||||
id.SetBit(FS_BIT_FLATSHADE, doFlatShading);
|
||||
|
||||
id.SetBit(FS_BIT_SHADER_DEPAL, useShaderDepal);
|
||||
id.SetBit(FS_BIT_COLOR_WRITEMASK, colorWriteMask);
|
||||
|
||||
if (g_Config.bVendorBugChecksEnabled) {
|
||||
|
|
|
@ -300,7 +300,7 @@ void LinkedShader::UpdateUniforms(u32 vertType, const ShaderID &vsid, bool useBu
|
|||
uint32_t val = BytesToUint32(indexMask, indexShift, indexOffset, format);
|
||||
// Poke in a bilinear filter flag in the top bit.
|
||||
val |= gstate.isMagnifyFilteringEnabled() << 31;
|
||||
render_->SetUniformI1(&u_depal_mask_shift_off_fmt, val);
|
||||
render_->SetUniformUI1(&u_depal_mask_shift_off_fmt, val);
|
||||
}
|
||||
|
||||
// Update any dirty uniforms before we draw
|
||||
|
|
|
@ -347,10 +347,11 @@ void TextureCacheGLES::ApplyTextureFramebuffer(VirtualFramebuffer *framebuffer,
|
|||
uint32_t clutMode = gstate.clutformat & 0xFFFFFF;
|
||||
bool need_depalettize = IsClutFormat(texFormat);
|
||||
|
||||
bool useShaderDepal = framebufferManager_->GetCurrentRenderVFB() != framebuffer && gstate_c.Supports(GPU_SUPPORTS_GLSL_ES_300);
|
||||
bool useShaderDepal = framebufferManager_->GetCurrentRenderVFB() != framebuffer && (gstate_c.Supports(GPU_SUPPORTS_GLSL_ES_300) || gstate_c.Supports(GPU_SUPPORTS_GLSL_330));
|
||||
if (!gstate_c.Supports(GPU_SUPPORTS_32BIT_INT_FSHADER)) {
|
||||
useShaderDepal = false;
|
||||
}
|
||||
|
||||
if (need_depalettize && !g_Config.bDisableSlowFramebufEffects) {
|
||||
if (useShaderDepal) {
|
||||
const GEPaletteFormat clutFormat = gstate.getClutPaletteFormat();
|
||||
|
|
|
@ -496,10 +496,17 @@ void SystemInfoScreen::CreateViews() {
|
|||
deviceSpecs->Add(new InfoItem(si->T("Core Context"), gl_extensions.IsCoreContext ? di->T("Active") : di->T("Inactive")));
|
||||
int highp_int_min = gl_extensions.range[1][5][0];
|
||||
int highp_int_max = gl_extensions.range[1][5][1];
|
||||
int highp_float_min = gl_extensions.range[1][2][0];
|
||||
int highp_float_max = gl_extensions.range[1][2][1];
|
||||
if (highp_int_max != 0) {
|
||||
char highp_int_range[512];
|
||||
snprintf(highp_int_range, sizeof(highp_int_range), "Highp int range: %d-%d", highp_int_min, highp_int_max);
|
||||
deviceSpecs->Add(new InfoItem(si->T("High precision int range"), highp_int_range));
|
||||
char temp[512];
|
||||
snprintf(temp, sizeof(temp), "Highp int range: %d-%d", highp_int_min, highp_int_max);
|
||||
deviceSpecs->Add(new InfoItem(si->T("High precision int range"), temp));
|
||||
}
|
||||
if (highp_float_max != 0) {
|
||||
char temp[512];
|
||||
snprintf(temp, sizeof(temp), "Highp float range: %d-%d", highp_int_min, highp_int_max);
|
||||
deviceSpecs->Add(new InfoItem(si->T("High precision float range"), temp));
|
||||
}
|
||||
}
|
||||
deviceSpecs->Add(new ItemHeader(si->T("OS Information")));
|
||||
|
|
Loading…
Add table
Reference in a new issue