Merge pull request #15280 from unknownbrackets/samplerjit-dxt

Correct some recent regressions in samplerjit
This commit is contained in:
Henrik Rydgård 2022-01-05 09:42:30 +01:00 committed by GitHub
commit f82f24a9bb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View file

@ -374,7 +374,7 @@ void ComputeSamplerID(SamplerID *id_out) {
int bitspp = textureBitsPerPixel[gstate.getTextureFormat()];
// We use a 16 byte minimum for all small bufws, so allow those as standard.
int w = gstate.getTextureWidth(i);
if (w != bufw && w * bitspp > 128)
if (bitspp == 0 || std::max(w, 128 / bitspp) != bufw)
id.useStandardBufw = false;
int h = gstate.getTextureHeight(i);

View file

@ -69,6 +69,7 @@ FetchFunc SamplerJitCache::CompileFetch(const SamplerID &id) {
regCache_.Reset(false);
EndWrite();
ResetCodePtr(GetOffset(start));
ERROR_LOG(G3D, "Failed to compile fetch %s", DescribeSamplerID(id).c_str());
return nullptr;
}
@ -386,6 +387,7 @@ NearestFunc SamplerJitCache::CompileNearest(const SamplerID &id) {
regCache_.Reset(false);
EndWrite();
ResetCodePtr(GetOffset(start));
ERROR_LOG(G3D, "Failed to compile nearest %s", DescribeSamplerID(id).c_str());
return nullptr;
}
@ -447,12 +449,13 @@ LinearFunc SamplerJitCache::CompileLinear(const SamplerID &id) {
// We'll first write the nearest sampler, which we will CALL.
// This may differ slightly based on the "linear" flag.
const u8 *nearest = AlignCode16();
nearest = AlignCode16();
if (!Jit_ReadTextureFormat(id)) {
regCache_.Reset(false);
EndWrite();
ResetCodePtr(GetOffset(nearest));
ERROR_LOG(G3D, "Failed to compile linear nearest %s", DescribeSamplerID(id).c_str());
return nullptr;
}
@ -807,7 +810,8 @@ LinearFunc SamplerJitCache::CompileLinear(const SamplerID &id) {
if (!success) {
regCache_.Reset(false);
EndWrite();
ResetCodePtr(GetOffset(nearest));
ResetCodePtr(GetOffset(nearest ? nearest : start));
ERROR_LOG(G3D, "Failed to compile linear %s", DescribeSamplerID(id).c_str());
return nullptr;
}