Merge branch 'master' into compat_openxr_gta

This commit is contained in:
Lubos committed 2022-09-12 23:04:31 +02:00
commit b695c1ffb3
62 files changed
+1717 -646

No files matched your search

+35
View File
@@ -24,6 +24,7 @@ const char * const hlsl_preamble_fs =
"#define vec4 float4\n"
"#define uvec3 uint3\n"
"#define uvec4 uint4\n"
"#define ivec2 int2\n"
"#define ivec3 int3\n"
"#define ivec4 int4\n"
"#define mat4 float4x4\n"
@@ -424,6 +425,40 @@ ShaderWriter &ShaderWriter::SampleTexture2D(const char *sampName, const char *uv
return *this;
}
ShaderWriter &ShaderWriter::SampleTexture2DOffset(const char *sampName, const char *uv, int offX, int offY) {
switch (lang_.shaderLanguage) {
case HLSL_D3D11:
F("%s.Sample(%sSamp, %s, int2(%d, %d))", sampName, sampName, uv, offX, offY);
break;
case HLSL_D3D9:
// Not supported, we do a normal sample here to not crash or something
F("tex2D(%s, %s)", sampName, uv);
break;
default:
// Note: we ignore the sampler. make sure you bound samplers to the textures correctly.
F("%sOffset(%s, %s, ivec2(%d, %d))", lang_.texture, sampName, uv, offX, offY);
break;
}
return *this;
}
ShaderWriter &ShaderWriter::LoadTexture2D(const char *sampName, const char *uv, int level) {
switch (lang_.shaderLanguage) {
case HLSL_D3D11:
F("%s.Load(ivec3(%s, %d))", sampName, uv, level);
break;
case HLSL_D3D9:
// Not supported, we return a bad value
C("float4(1.0, 0.0, 1.0, 1.0)");
break;
default:
// Note: we ignore the sampler. make sure you bound samplers to the textures correctly.
F("texelFetch(%s, %s, %d)", sampName, uv, level);
break;
}
return *this;
}
ShaderWriter &ShaderWriter::GetTextureSize(const char *szVariable, const char *texName) {
switch (lang_.shaderLanguage) {
case HLSL_D3D11:
+2
View File
@@ -78,6 +78,8 @@ public:
void ConstFloat(const char *name, float value);
ShaderWriter &SampleTexture2D(const char *texName, const char *uv);
ShaderWriter &SampleTexture2DOffset(const char *texName, const char *uv, int offX, int offY);
ShaderWriter &LoadTexture2D(const char *texName, const char *integer_uv, int level);
ShaderWriter &GetTextureSize(const char *szVariable, const char *texName);
// Simple shaders with no special tricks.
+4
View File
@@ -36,6 +36,10 @@ bool VulkanTexture::CreateDirect(VkCommandBuffer cmd, int w, int h, int depth, i
ERROR_LOG(G3D, "Can't create a zero-size VulkanTexture");
return false;
}
if (w > 4096 || h > 4096) {
ERROR_LOG(G3D, "Can't create a texture this large");
return false;
}
Wipe();
+9 -1
View File
@@ -553,6 +553,7 @@ void VulkanRenderManager::CompileThreadFunc() {
void VulkanRenderManager::DrainCompileQueue() {
std::unique_lock<std::mutex> lock(compileMutex_);
compileCond_.notify_all();
while (!compileQueue_.empty()) {
queueRunner_.WaitForCompileNotification();
}
@@ -733,13 +734,17 @@ VKRGraphicsPipeline *VulkanRenderManager::CreateGraphicsPipeline(VKRGraphicsPipe
};
VKRRenderPass *compatibleRenderPass = queueRunner_.GetRenderPass(key);
compileMutex_.lock();
bool needsCompile = false;
for (int i = 0; i < RP_TYPE_COUNT; i++) {
if (!(variantBitmask & (1 << i)))
continue;
RenderPassType rpType = (RenderPassType)i;
pipeline->pipeline[rpType] = Promise<VkPipeline>::CreateEmpty();
compileQueue_.push_back(CompileQueueEntry(pipeline, compatibleRenderPass->Get(vulkan_, rpType), rpType));
needsCompile = true;
}
if (needsCompile)
compileCond_.notify_one();
compileMutex_.unlock();
}
return pipeline;
@@ -775,13 +780,16 @@ void VulkanRenderManager::EndCurRenderStep() {
// Save the accumulated pipeline flags so we can use that to configure the render pass.
// We'll often be able to avoid loading/saving the depth/stencil buffer.
compileMutex_.lock();
bool needsCompile = false;
for (VKRGraphicsPipeline *pipeline : pipelinesToCheck_) {
if (!pipeline->pipeline[rpType]) {
pipeline->pipeline[rpType] = Promise<VkPipeline>::CreateEmpty();
compileQueue_.push_back(CompileQueueEntry(pipeline, renderPass->Get(vulkan_, rpType), rpType));
needsCompile = true;
}
}
compileCond_.notify_one();
if (needsCompile)
compileCond_.notify_one();
compileMutex_.unlock();
pipelinesToCheck_.clear();
+1 -1
View File
@@ -99,7 +99,7 @@ bool IsVRBuild() {
return true;
}
void InitVROnAndroid(void* vm, void* activity, int version, char* name) {
void InitVROnAndroid(void* vm, void* activity, int version, const char* name) {
ovrJava java;
java.Vm = (JavaVM*)vm;
java.ActivityObject = (jobject)activity;
+2 -2
View File
@@ -21,7 +21,7 @@ enum VRCompatFlag {
// VR app flow integration
bool IsVRBuild();
void InitVROnAndroid(void* vm, void* activity, int version, char* name);
void InitVROnAndroid(void* vm, void* activity, int version, const char* name);
void EnterVR(bool firstStart);
void GetVRResolutionPerEye(int* width, int* height);
void UpdateVRInput(bool(*NativeKey)(const KeyInput &key), bool(*NativeTouch)(const TouchInput &touch), bool haptics, float dp_xscale, float dp_yscale);
@@ -50,7 +50,7 @@ void UpdateVRView(float* projMatrix, float* leftEye, float* rightEye);
// VR app flow integration
inline bool IsVRBuild() { return false; }
inline void InitVROnAndroid(void* vm, void* activity, int version, char* name) {}
inline void InitVROnAndroid(void* vm, void* activity, int version, const char* name) {}
inline void EnterVR(bool firstTime) {}
inline void GetVRResolutionPerEye(int* width, int* height) {}
inline void UpdateVRInput(bool(*NativeKey)(const KeyInput &key), bool(*NativeTouch)(const TouchInput &touch), bool haptics, float dp_xscale, float dp_yscale) {}
+1
View File
@@ -98,6 +98,7 @@ void Compatibility::CheckSettings(IniFile &iniFile, const std::string &gameID) {
CheckSetting(iniFile, gameID, "DeswizzleDepth", &flags_.DeswizzleDepth);
CheckSetting(iniFile, gameID, "SplitFramebufferMargin", &flags_.SplitFramebufferMargin);
CheckSetting(iniFile, gameID, "ForceLowerResolutionForEffectsOn", &flags_.ForceLowerResolutionForEffectsOn);
CheckSetting(iniFile, gameID, "AllowDownloadCLUT", &flags_.AllowDownloadCLUT);
CheckSetting(iniFile, gameID, "VRSkyplane", &flags_.VRSkyplane);
}
+1
View File
@@ -88,6 +88,7 @@ struct CompatFlags {
bool DeswizzleDepth;
bool SplitFramebufferMargin;
bool ForceLowerResolutionForEffectsOn;
bool AllowDownloadCLUT;
bool VRSkyplane;
};
+13 -4
View File
@@ -116,6 +116,8 @@ const int PSP_ATRAC_LOOP_STREAM_DATA_IS_ON_MEMORY = -3;
const u32 ATRAC3_MAX_SAMPLES = 0x400;
const u32 ATRAC3PLUS_MAX_SAMPLES = 0x800;
const size_t overAllocBytes = 16384;
static const int atracDecodeDelay = 2300;
#ifdef USE_FFMPEG
@@ -264,7 +266,8 @@ struct Atrac {
if (p.mode == p.MODE_READ) {
if (dataBuf_)
delete [] dataBuf_;
dataBuf_ = new u8[first_.filesize];
dataBuf_ = new u8[first_.filesize + overAllocBytes];
memset(dataBuf_, 0, first_.filesize + overAllocBytes);
}
DoArray(p, dataBuf_, first_.filesize);
}
@@ -453,7 +456,7 @@ struct Atrac {
#else
// Future versions may add other things to free, but avcodec_free_context didn't exist yet here.
// Some old versions crash when we try to free extradata and subtitle_header, so let's not. A minor
// leak is better than a segfualt.
// leak is better than a segfault.
// av_freep(&codecCtx_->extradata);
// av_freep(&codecCtx_->subtitle_header);
avcodec_close(codecCtx_);
@@ -1948,7 +1951,11 @@ static int _AtracSetData(Atrac *atrac, u32 buffer, u32 readSize, u32 bufferSize,
const char *codecName = atrac->codecType_ == PSP_MODE_AT_3 ? "atrac3" : "atrac3+";
const char *channelName = atrac->channels_ == 1 ? "mono" : "stereo";
atrac->dataBuf_ = new u8[atrac->first_.filesize];
// Over-allocate databuf to prevent going off the end if the bitstream is bad or if there are
// bugs in the decoder. This happens, see issue #15788. Arbitrary, but let's make it a whole page on the popular
// architecture that has the largest pages (M1).
atrac->dataBuf_ = new u8[atrac->first_.filesize + overAllocBytes];
memset(atrac->dataBuf_, 0, atrac->first_.filesize + overAllocBytes);
if (!atrac->ignoreDataBuf_) {
u32 copybytes = std::min(bufferSize, atrac->first_.filesize);
Memory::Memcpy(atrac->dataBuf_, buffer, copybytes, "AtracSetData");
@@ -2455,7 +2462,9 @@ static int sceAtracLowLevelInitDecoder(int atracID, u32 paramsAddr) {
atrac->first_.size = 0;
atrac->first_.filesize = atrac->bytesPerFrame_;
atrac->bufferState_ = ATRAC_STATUS_LOW_LEVEL;
atrac->dataBuf_ = new u8[atrac->first_.filesize];
atrac->dataBuf_ = new u8[atrac->first_.filesize + overAllocBytes];
memset(atrac->dataBuf_, 0, atrac->first_.filesize + overAllocBytes);
atrac->currentSample_ = 0;
int ret = __AtracSetContext(atrac);
+56 -39
View File
@@ -92,8 +92,14 @@ bool GenerateFragmentShader(const FShaderID &id, char *buffer, const ShaderLangu
bool flatBug = bugs.Has(Draw::Bugs::BROKEN_FLAT_IN_SHADER) && g_Config.bVendorBugChecksEnabled;
bool doFlatShading = id.Bit(FS_BIT_FLATSHADE) && !flatBug;
bool shaderDepal = id.Bit(FS_BIT_SHADER_DEPAL) && !texture3D; // combination with texture3D not supported. Enforced elsewhere too.
bool smoothedDepal = id.Bit(FS_BIT_SHADER_SMOOTHED_DEPAL);
ShaderDepalMode shaderDepalMode = (ShaderDepalMode)id.Bits(FS_BIT_SHADER_DEPAL_MODE, 2);
if (texture3D) {
shaderDepalMode = ShaderDepalMode::OFF;
}
if (!compat.bitwiseOps && shaderDepalMode != ShaderDepalMode::OFF) {
*errorString = "depal requires bitwise ops";
return false;
}
bool bgraTexture = id.Bit(FS_BIT_BGRA_TEXTURE);
bool colorWriteMask = id.Bit(FS_BIT_COLOR_WRITEMASK) && compat.bitwiseOps;
@@ -134,7 +140,7 @@ 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) {
if (shaderDepalMode != ShaderDepalMode::OFF && !doTexture) {
*errorString = "depal requires a texture";
return false;
}
@@ -153,7 +159,7 @@ bool GenerateFragmentShader(const FShaderID &id, char *buffer, const ShaderLangu
WRITE(p, "layout (binding = 1) uniform sampler2D fbotex;\n");
}
if (shaderDepal) {
if (shaderDepalMode != ShaderDepalMode::OFF) {
WRITE(p, "layout (binding = 2) uniform sampler2D pal;\n");
}
@@ -221,7 +227,7 @@ bool GenerateFragmentShader(const FShaderID &id, char *buffer, const ShaderLangu
WRITE(p, "float u_mipBias : register(c%i);\n", CONST_PS_MIPBIAS);
}
} else {
WRITE(p, "SamplerState samp : register(s0);\n");
WRITE(p, "SamplerState texSamp : register(s0);\n");
if (texture3D) {
WRITE(p, "Texture3D<vec4> tex : register(t0);\n");
} else {
@@ -231,11 +237,14 @@ bool GenerateFragmentShader(const FShaderID &id, char *buffer, const ShaderLangu
// No sampler required, we Load
WRITE(p, "Texture2D<vec4> fbotex : register(t1);\n");
}
WRITE(p, "cbuffer base : register(b0) {\n%s};\n", ub_baseStr);
if (shaderDepal) {
if (shaderDepalMode != ShaderDepalMode::OFF) {
WRITE(p, "SamplerState palSamp : register(s3);\n");
WRITE(p, "Texture2D<vec4> pal : register(t3);\n");
WRITE(p, "float2 textureSize(Texture2D<float4> tex, int mip) { float2 size; tex.GetDimensions(size.x, size.y); return size; }\n");
}
WRITE(p, "cbuffer base : register(b0) {\n%s};\n", ub_baseStr);
}
if (enableAlphaTest) {
@@ -296,7 +305,7 @@ bool GenerateFragmentShader(const FShaderID &id, char *buffer, const ShaderLangu
WRITE(p, "};\n");
}
} else if (ShaderLanguageIsOpenGL(compat.shaderLanguage)) {
if ((shaderDepal || colorWriteMask) && gl_extensions.IsGLES) {
if ((shaderDepalMode != ShaderDepalMode::OFF || colorWriteMask) && gl_extensions.IsGLES) {
WRITE(p, "precision highp int;\n");
}
@@ -347,7 +356,7 @@ bool GenerateFragmentShader(const FShaderID &id, char *buffer, const ShaderLangu
}
}
if (shaderDepal) {
if (shaderDepalMode != ShaderDepalMode::OFF) {
WRITE(p, "uniform sampler2D pal;\n");
WRITE(p, "uniform uint u_depal_mask_shift_off_fmt;\n");
*uniformMask |= DIRTY_DEPAL;
@@ -557,19 +566,20 @@ bool GenerateFragmentShader(const FShaderID &id, char *buffer, const ShaderLangu
doTextureProjection = false;
}
if (!shaderDepal) {
switch (shaderDepalMode) {
case ShaderDepalMode::OFF:
if (compat.shaderLanguage == HLSL_D3D11) {
if (texture3D) {
if (doTextureProjection) {
WRITE(p, " vec4 t = tex.Sample(samp, vec3(v_texcoord.xy / v_texcoord.z, u_mipBias))%s;\n", bgraTexture ? ".bgra" : "");
WRITE(p, " vec4 t = tex.Sample(texSamp, vec3(v_texcoord.xy / v_texcoord.z, u_mipBias))%s;\n", bgraTexture ? ".bgra" : "");
} else {
WRITE(p, " vec4 t = tex.Sample(samp, vec3(%s.xy, u_mipBias))%s;\n", texcoord, bgraTexture ? ".bgra" : "");
WRITE(p, " vec4 t = tex.Sample(texSamp, vec3(%s.xy, u_mipBias))%s;\n", texcoord, bgraTexture ? ".bgra" : "");
}
} else {
if (doTextureProjection) {
WRITE(p, " vec4 t = tex.Sample(samp, v_texcoord.xy / v_texcoord.z)%s;\n", bgraTexture ? ".bgra" : "");
WRITE(p, " vec4 t = tex.Sample(texSamp, v_texcoord.xy / v_texcoord.z)%s;\n", bgraTexture ? ".bgra" : "");
} else {
WRITE(p, " vec4 t = tex.Sample(samp, %s.xy)%s;\n", texcoord, bgraTexture ? ".bgra" : "");
WRITE(p, " vec4 t = tex.Sample(texSamp, %s.xy)%s;\n", texcoord, bgraTexture ? ".bgra" : "");
}
}
} else if (compat.shaderLanguage == HLSL_D3D9) {
@@ -603,34 +613,36 @@ bool GenerateFragmentShader(const FShaderID &id, char *buffer, const ShaderLangu
}
}
}
} else if (shaderDepal && smoothedDepal) {
break;
case ShaderDepalMode::SMOOTHED:
// Specific mode for Test Drive. Fixes the banding.
if (doTextureProjection) {
// We don't use textureProj because we need better control and it's probably not much of a savings anyway.
// However it is good for precision on older hardware like PowerVR.
WRITE(p, " vec2 uv = %s.xy/%s.z;\n vec2 uv_round;\n", texcoord, texcoord);
p.F(" vec2 uv = %s.xy/%s.z;\n vec2 uv_round;\n", texcoord, texcoord);
} else {
WRITE(p, " vec2 uv = %s.xy;\n vec2 uv_round;\n", texcoord);
p.F(" vec2 uv = %s.xy;\n vec2 uv_round;\n", texcoord);
}
// Restrictions on this are checked before setting the smoothed flag.
// Only RGB565 and RGBA5551 are supported, and only the specific shifts hitting the
// channels directly.
// Also, since we know the CLUT is smooth, we do not need to do the bilinear filter manually, we can just
// lookup with the filtered value once.
WRITE(p, " vec4 t = %s(tex, %s.xy);\n", compat.texture, texcoord);
WRITE(p, " uint depalShift = (u_depal_mask_shift_off_fmt >> 8) & 0xFFU;\n");
WRITE(p, " uint depalFmt = (u_depal_mask_shift_off_fmt >> 24) & 0x3U;\n");
WRITE(p, " float index0 = t.r;\n");
WRITE(p, " float factor = 31.0 / 256.0;\n");
WRITE(p, " if (depalFmt == 0u) {\n"); // yes, different versions of Test Drive use different formats. Could do compile time by adding more compat flags but meh.
WRITE(p, " if (depalShift == 5u) { index0 = t.g; factor = 63.0 / 256.0; }\n");
WRITE(p, " else if (depalShift == 11u) { index0 = t.b; }\n");
WRITE(p, " } else {\n");
WRITE(p, " if (depalShift == 5u) { index0 = t.g; }\n");
WRITE(p, " else if (depalShift == 10u) { index0 = t.b; }\n");
WRITE(p, " }\n");
WRITE(p, " t = %s(pal, vec2(index0 * factor, 0.0));\n", compat.texture);
} else {
p.F(" vec4 t = ").SampleTexture2D("tex", "uv").C(";\n");
p.C(" uint depalShift = (u_depal_mask_shift_off_fmt >> 8) & 0xFFU;\n");
p.C(" uint depalFmt = (u_depal_mask_shift_off_fmt >> 24) & 0x3U;\n");
p.C(" float index0 = t.r;\n");
p.C(" float factor = 31.0 / 256.0;\n");
p.C(" if (depalFmt == 0u) {\n"); // yes, different versions of Test Drive use different formats. Could do compile time by adding more compat flags but meh.
p.C(" if (depalShift == 5u) { index0 = t.g; factor = 63.0 / 256.0; }\n");
p.C(" else if (depalShift == 11u) { index0 = t.b; }\n");
p.C(" } else {\n");
p.C(" if (depalShift == 5u) { index0 = t.g; }\n");
p.C(" else if (depalShift == 10u) { index0 = t.b; }\n");
p.C(" }\n");
p.F(" t = ").SampleTexture2D("pal", "vec2(index0 * factor, 0.0)").C(";\n");
break;
case ShaderDepalMode::NORMAL:
if (doTextureProjection) {
// We don't use textureProj because we need better control and it's probably not much of a savings anyway.
// However it is good for precision on older hardware like PowerVR.
@@ -648,10 +660,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, " 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);
p.C(" highp vec4 t = ").SampleTexture2D("tex", "uv_round").C(";\n");
p.C(" highp vec4 t1 = ").SampleTexture2DOffset("tex", "uv_round", 1, 0).C(";\n");
p.C(" highp vec4 t2 = ").SampleTexture2DOffset("tex", "uv_round", 0, 1).C(";\n");
p.C(" highp vec4 t3 = ").SampleTexture2DOffset("tex", "uv_round", 1, 1).C(";\n");
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");
@@ -708,18 +720,23 @@ bool GenerateFragmentShader(const FShaderID &id, char *buffer, const ShaderLangu
WRITE(p, " break;\n");
WRITE(p, " };\n");
WRITE(p, " index0 = ((index0 >> depalShift) & depalMask) | depalOffset;\n");
WRITE(p, " t = texelFetch(pal, ivec2(index0, 0), 0);\n");
p.C(" t = ").LoadTexture2D("pal", "ivec2(index0, 0)", 0).C(";\n");
WRITE(p, " if (bilinear && !(index0 == index1 && index1 == index2 && index2 == index3)) {\n");
WRITE(p, " index1 = ((index1 >> depalShift) & depalMask) | depalOffset;\n");
WRITE(p, " index2 = ((index2 >> depalShift) & depalMask) | depalOffset;\n");
WRITE(p, " index3 = ((index3 >> depalShift) & depalMask) | depalOffset;\n");
WRITE(p, " t1 = texelFetch(pal, ivec2(index1, 0), 0);\n");
WRITE(p, " t2 = texelFetch(pal, ivec2(index2, 0), 0);\n");
WRITE(p, " t3 = texelFetch(pal, ivec2(index3, 0), 0);\n");
p.C(" t1 = ").LoadTexture2D("pal", "ivec2(index1, 0)", 0).C(";\n");
p.C(" t2 = ").LoadTexture2D("pal", "ivec2(index2, 0)", 0).C(";\n");
p.C(" t3 = ").LoadTexture2D("pal", "ivec2(index3, 0)", 0).C(";\n");
WRITE(p, " t = mix(t, t1, fraction.x);\n");
WRITE(p, " t2 = mix(t2, t3, fraction.x);\n");
WRITE(p, " t = mix(t, t2, fraction.y);\n");
WRITE(p, " }\n");
break;
case ShaderDepalMode::CLUT8_8888:
// Not yet implemented.
WRITE(p, " vec4 t = vec4(0.0, 0.0, 0.0, 0.0);\n");
break;
}
if (texFunc != GE_TEXFUNC_REPLACE || !doTextureAlpha)
+5
View File
@@ -2552,6 +2552,11 @@ void FramebufferManagerCommon::DownloadFramebufferForClut(u32 fb_address, u32 lo
int w = std::min(pixels % vfb->fb_stride, (int)vfb->width);
int h = std::min((pixels + vfb->fb_stride - 1) / vfb->fb_stride, (int)vfb->height);
if (w == 0 || h > 1) {
// Exactly aligned, or more than one row.
w = std::min(vfb->fb_stride, vfb->width);
}
// We might still have a pending draw to the fb in question, flush if so.
FlushBeforeCopy();
+1
View File
@@ -148,6 +148,7 @@ struct VirtualFramebuffer {
// Convenience methods
inline int WidthInBytes() const { return width * BufferFormatBytesPerPixel(fb_format); }
inline int BufferWidthInBytes() const { return bufferWidth * BufferFormatBytesPerPixel(fb_format); }
inline int FbStrideInBytes() const { return fb_stride * BufferFormatBytesPerPixel(fb_format); }
inline int ZStrideInBytes() const { return z_stride * 2; }
};
+699 -6
View File
@@ -31,6 +31,18 @@ enum class GEReferenceIndex : uint32_t {
BFLAG,
OP,
DATA,
CLUTADDR,
TRANSFERSRC,
TRANSFERDST,
TEXADDR0,
TEXADDR1,
TEXADDR2,
TEXADDR3,
TEXADDR4,
TEXADDR5,
TEXADDR6,
TEXADDR7,
BONE_MATRIX = 0x200,
WORLD_MATRIX = 0x260,
@@ -38,6 +50,9 @@ enum class GEReferenceIndex : uint32_t {
PROJ_MATRIX = 0x278,
TGEN_MATRIX = 0x288,
MATRIX_END = 0x294,
FIELD_START = 0x1000,
FIELD_END = 0xFF000,
};
ENUM_CLASS_BITOPS(GEReferenceIndex);
@@ -56,6 +71,436 @@ static constexpr ReferenceName referenceNames[] = {
{ GEReferenceIndex::BFLAG, "boundflag" },
{ GEReferenceIndex::OP, "op" },
{ GEReferenceIndex::DATA, "data" },
{ GEReferenceIndex::CLUTADDR, "clutaddr" },
{ GEReferenceIndex::TRANSFERSRC, "transfersrc" },
{ GEReferenceIndex::TRANSFERDST, "transferdst" },
{ GEReferenceIndex::TEXADDR0, "texaddr0" },
{ GEReferenceIndex::TEXADDR1, "texaddr1" },
{ GEReferenceIndex::TEXADDR2, "texaddr2" },
{ GEReferenceIndex::TEXADDR3, "texaddr3" },
{ GEReferenceIndex::TEXADDR4, "texaddr4" },
{ GEReferenceIndex::TEXADDR5, "texaddr5" },
{ GEReferenceIndex::TEXADDR6, "texaddr6" },
{ GEReferenceIndex::TEXADDR7, "texaddr7" },
};
enum class GECmdField : uint8_t {
DATA, // Alias for the entire data.
LOW_FLAG,
LOW_U2,
LOW_U4,
LOW_U7,
LOW_U8,
LOW_U10,
LOW_U10_P1,
LOW_U11,
LOW_U16,
MID_U8,
MID_U10, // At 10, 10 bits.
MID_U10_P1, // At 10, 10 bits (add 1 to value.)
TOP_U8,
FLAG_AFTER_1, // At 1, 1 bit.
FLAG_AFTER_2, // At 2, 1 bit.
FLAG_AFTER_8, // At 8, 1 bit.
FLAG_AFTER_9, // At 9, 1 bit.
FLAG_AFTER_10, // At 10, 1 bit.
FLAG_AFTER_11, // At 11, 1 bit.
FLAG_AFTER_16, // At 16, 1 bit.
FLAG_AFTER_17, // At 17, 1 bit.
FLAG_AFTER_18, // At 18, 1 bit.
FLAG_AFTER_19, // At 19, 1 bit.
FLAG_AFTER_20, // At 20, 1 bit.
FLAG_AFTER_21, // At 21, 1 bit.
FLAG_AFTER_22, // At 22, 1 bit.
FLAG_AFTER_23, // At 23, 1 bit.
U2_AFTER_8, // At 8, 2 bits.
U3_AFTER_16, // At 16, 3 bits.
U12_AFTER_4, // At 4, 12 bits.
PRIM_TYPE, // At 16, 3 bits.
SIGNAL_TYPE, // At 16, 8 bits.
VTYPE_TC, // At 0, 2 bits.
VTYPE_COL, // At 2, 3 bits.
VTYPE_NRM, // At 5, 2 bits.
VTYPE_POS, // At 7, 2 bits.
VTYPE_WEIGHTTYPE, // At 9, 2 bits.
VTYPE_INDEX, // At 11, 2 bits.
VTYPE_WEIGHTCOUNT, // At 14, 3 bits.
VTYPE_MORPHCOUNT, // At 18, 3 bits.
PATCH_PRIM_TYPE, // At 0, 2 bits.
LIGHT_COMP, // At 0, 2 bits.
LIGHT_TYPE, // At 8, 2 bits.
LIGHT_TYPE_SPECULAR, // 1 if comp is 1 (but not 3.)
HIGH_ADDR, // At 16, 8 bits moved left to top 8 bits.
TEX_W, // At 0, 4 bits - 1 to this power.
TEX_H, // At 8, 4 bits - 1 to this power.
UVGEN_TYPE, // At 0, 2 bits.
UVGEN_PROJ, // At 8, 2 bits.
TEX_FORMAT, // At 0, 4 bits.
TEX_MINFILTER, // At 0, 3 bits.
TEX_MAGFILTER, // At 8, 1 bit.
TEX_LEVEL_MODE, // At 0, 2 bits.
LOW_U12_4_FLOAT, // At 0, 12.4 converted to float.
HIGH_S4_4_FLOAT, // At 16, s.3.4 converted to float.
TEX_FUNC, // At 0, 3 bits.
CLUT_BYTES, // At 0, 6 bits, multiplied by 8.
CLUT_FORMAT, // At 0, 2 bits.
CLUT_SHIFT, // At 2, 5 bits.
CLUT_OFFSET, // At 16, 5 bits, multiplied by 16.
COMPARE_FUNC2, // At 0, 2 bits.
COMPARE_FUNC3, // At 0, 3 bits.
STENCIL_OP_AT_0, // At 0, 3 bits.
STENCIL_OP_AT_8, // At 8, 3 bits.
STENCIL_OP_AT_16, // At 16, 3 bits.
BLEND_SRC, // At 0, 4 bits.
BLEND_DST, // At 4, 4 bits.
BLEND_EQUATION, // At 8, 3 bits.
LOGIC_OP, // At 0, 4 bits.
};
struct FieldName {
GECmdFormat fmt;
GECmdField field;
const char *name;
};
static constexpr FieldName fieldNames[] = {
{ GECmdFormat::PRIM, GECmdField::LOW_U16, "count" },
{ GECmdFormat::PRIM, GECmdField::PRIM_TYPE, "type" },
{ GECmdFormat::BEZIER, GECmdField::LOW_U8, "ucount" },
{ GECmdFormat::BEZIER, GECmdField::LOW_U8, "u" },
{ GECmdFormat::BEZIER, GECmdField::MID_U8, "vcount" },
{ GECmdFormat::BEZIER, GECmdField::MID_U8, "v" },
{ GECmdFormat::SPLINE, GECmdField::LOW_U8, "ucount" },
{ GECmdFormat::SPLINE, GECmdField::LOW_U8, "u" },
{ GECmdFormat::SPLINE, GECmdField::MID_U8, "vcount" },
{ GECmdFormat::SPLINE, GECmdField::MID_U8, "v" },
{ GECmdFormat::SPLINE, GECmdField::FLAG_AFTER_16, "ufirstopen" },
{ GECmdFormat::SPLINE, GECmdField::FLAG_AFTER_17, "ulastopen" },
{ GECmdFormat::SPLINE, GECmdField::FLAG_AFTER_18, "vfirstopen" },
{ GECmdFormat::SPLINE, GECmdField::FLAG_AFTER_19, "vlastopen" },
{ GECmdFormat::SIGNAL, GECmdField::LOW_U16, "data" },
{ GECmdFormat::SIGNAL, GECmdField::SIGNAL_TYPE, "type" },
{ GECmdFormat::VERTEX_TYPE, GECmdField::VTYPE_TC, "texcoord" },
{ GECmdFormat::VERTEX_TYPE, GECmdField::VTYPE_TC, "tc" },
{ GECmdFormat::VERTEX_TYPE, GECmdField::VTYPE_COL, "col" },
{ GECmdFormat::VERTEX_TYPE, GECmdField::VTYPE_COL, "color" },
{ GECmdFormat::VERTEX_TYPE, GECmdField::VTYPE_NRM, "normal" },
{ GECmdFormat::VERTEX_TYPE, GECmdField::VTYPE_POS, "pos" },
{ GECmdFormat::VERTEX_TYPE, GECmdField::VTYPE_POS, "position" },
{ GECmdFormat::VERTEX_TYPE, GECmdField::VTYPE_WEIGHTTYPE, "weighttype" },
{ GECmdFormat::VERTEX_TYPE, GECmdField::VTYPE_WEIGHTTYPE, "weight" },
{ GECmdFormat::VERTEX_TYPE, GECmdField::VTYPE_INDEX, "index" },
{ GECmdFormat::VERTEX_TYPE, GECmdField::VTYPE_WEIGHTCOUNT, "weightcount" },
{ GECmdFormat::VERTEX_TYPE, GECmdField::VTYPE_MORPHCOUNT, "morphcount" },
{ GECmdFormat::VERTEX_TYPE, GECmdField::FLAG_AFTER_23, "through" },
{ GECmdFormat::VERTEX_TYPE, GECmdField::FLAG_AFTER_23, "throughmode" },
{ GECmdFormat::X10_Y10, GECmdField::LOW_U10, "x" },
{ GECmdFormat::X10_Y10, GECmdField::MID_U10, "y" },
{ GECmdFormat::X10_Y10, GECmdField::LOW_U10_P1, "w" },
{ GECmdFormat::X10_Y10, GECmdField::MID_U10_P1, "h" },
{ GECmdFormat::FLAG, GECmdField::LOW_FLAG, "flag" },
{ GECmdFormat::BONE_NUM, GECmdField::LOW_U7, "num" },
{ GECmdFormat::MATRIX_NUM, GECmdField::LOW_U4, "num" },
{ GECmdFormat::FLOAT, GECmdField::DATA, "data" },
{ GECmdFormat::PATCH_DIVISION, GECmdField::LOW_U8, "u" },
{ GECmdFormat::PATCH_DIVISION, GECmdField::MID_U8, "v" },
{ GECmdFormat::PATCH_PRIM, GECmdField::PATCH_PRIM_TYPE, "type" },
{ GECmdFormat::SUBPIXEL_COORD, GECmdField::LOW_U4, "frac" },
{ GECmdFormat::SUBPIXEL_COORD, GECmdField::LOW_U4, "sub" },
{ GECmdFormat::SUBPIXEL_COORD, GECmdField::LOW_U4, "subpixels" },
{ GECmdFormat::SUBPIXEL_COORD, GECmdField::U12_AFTER_4, "int" },
{ GECmdFormat::SUBPIXEL_COORD, GECmdField::U12_AFTER_4, "integer" },
{ GECmdFormat::SUBPIXEL_COORD, GECmdField::LOW_U12_4_FLOAT, "pixels" },
{ GECmdFormat::MATERIAL_UPDATE, GECmdField::LOW_FLAG, "ambient" },
{ GECmdFormat::MATERIAL_UPDATE, GECmdField::FLAG_AFTER_1, "diffuse" },
{ GECmdFormat::MATERIAL_UPDATE, GECmdField::FLAG_AFTER_2, "specular" },
{ GECmdFormat::RGB, GECmdField::LOW_U8, "r" },
{ GECmdFormat::RGB, GECmdField::LOW_U8, "red" },
{ GECmdFormat::RGB, GECmdField::MID_U8, "g" },
{ GECmdFormat::RGB, GECmdField::MID_U8, "green" },
{ GECmdFormat::RGB, GECmdField::TOP_U8, "b" },
{ GECmdFormat::RGB, GECmdField::TOP_U8, "blue" },
{ GECmdFormat::LIGHT_TYPE, GECmdField::LIGHT_COMP, "computation" },
{ GECmdFormat::LIGHT_TYPE, GECmdField::LIGHT_TYPE, "type" },
{ GECmdFormat::LIGHT_TYPE, GECmdField::LIGHT_TYPE_SPECULAR, "specular" },
{ GECmdFormat::STRIDE, GECmdField::LOW_U11, "stride" },
{ GECmdFormat::STRIDE_HIGH_ADDR, GECmdField::HIGH_ADDR, "highaddr" },
{ GECmdFormat::HIGH_ADDR, GECmdField::HIGH_ADDR, "highaddr" },
{ GECmdFormat::HIGH_ADDR_ONLY, GECmdField::HIGH_ADDR, "highaddr" },
{ GECmdFormat::TEX_SIZE, GECmdField::TEX_W, "w" },
{ GECmdFormat::TEX_SIZE, GECmdField::TEX_W, "width" },
{ GECmdFormat::TEX_SIZE, GECmdField::TEX_H, "h" },
{ GECmdFormat::TEX_SIZE, GECmdField::TEX_H, "height" },
{ GECmdFormat::TEX_MAP_MODE, GECmdField::UVGEN_TYPE, "type" },
{ GECmdFormat::TEX_MAP_MODE, GECmdField::UVGEN_TYPE, "uv" },
{ GECmdFormat::TEX_MAP_MODE, GECmdField::UVGEN_PROJ, "proj" },
{ GECmdFormat::TEX_MAP_MODE, GECmdField::UVGEN_PROJ, "factor" },
{ GECmdFormat::TEX_LIGHT_SRC, GECmdField::LOW_U2, "u" },
{ GECmdFormat::TEX_LIGHT_SRC, GECmdField::U2_AFTER_8, "v" },
{ GECmdFormat::TEX_MODE, GECmdField::LOW_FLAG, "swizzle" },
{ GECmdFormat::TEX_MODE, GECmdField::FLAG_AFTER_8, "separateclut" },
{ GECmdFormat::TEX_MODE, GECmdField::FLAG_AFTER_8, "separate" },
{ GECmdFormat::TEX_MODE, GECmdField::U3_AFTER_16, "maxlevel" },
{ GECmdFormat::TEX_MODE, GECmdField::U3_AFTER_16, "level" },
{ GECmdFormat::TEX_FORMAT, GECmdField::TEX_FORMAT, "format" },
{ GECmdFormat::TEX_FORMAT, GECmdField::TEX_FORMAT, "fmt" },
{ GECmdFormat::TEX_FORMAT, GECmdField::FLAG_AFTER_2, "indexed" },
{ GECmdFormat::TEX_FILTER, GECmdField::TEX_MINFILTER, "min" },
{ GECmdFormat::TEX_FILTER, GECmdField::TEX_MINFILTER, "minify" },
{ GECmdFormat::TEX_FILTER, GECmdField::TEX_MAGFILTER, "mag" },
{ GECmdFormat::TEX_FILTER, GECmdField::TEX_MAGFILTER, "magnify" },
{ GECmdFormat::TEX_CLAMP, GECmdField::LOW_FLAG, "s" },
{ GECmdFormat::TEX_CLAMP, GECmdField::FLAG_AFTER_8, "t" },
{ GECmdFormat::TEX_LEVEL_MODE, GECmdField::TEX_LEVEL_MODE, "mode" },
{ GECmdFormat::TEX_LEVEL_MODE, GECmdField::HIGH_S4_4_FLOAT, "bias" },
{ GECmdFormat::TEX_FUNC, GECmdField::TEX_FUNC, "func" },
{ GECmdFormat::TEX_FUNC, GECmdField::TEX_FUNC, "function" },
{ GECmdFormat::TEX_FUNC, GECmdField::FLAG_AFTER_8, "alpha" },
{ GECmdFormat::TEX_FUNC, GECmdField::FLAG_AFTER_8, "a" },
{ GECmdFormat::TEX_FUNC, GECmdField::FLAG_AFTER_16, "double" },
{ GECmdFormat::TEX_FUNC, GECmdField::FLAG_AFTER_16, "doubling" },
{ GECmdFormat::CLUT_FORMAT, GECmdField::CLUT_FORMAT, "format" },
{ GECmdFormat::CLUT_FORMAT, GECmdField::CLUT_FORMAT, "fmt" },
{ GECmdFormat::CLUT_FORMAT, GECmdField::CLUT_SHIFT, "shift" },
{ GECmdFormat::CLUT_FORMAT, GECmdField::MID_U8, "mask" },
{ GECmdFormat::CLUT_FORMAT, GECmdField::CLUT_OFFSET, "offset" },
{ GECmdFormat::CLUT_FORMAT, GECmdField::CLUT_OFFSET, "base" },
{ GECmdFormat::CLEAR_MODE, GECmdField::LOW_FLAG, "on" },
{ GECmdFormat::CLEAR_MODE, GECmdField::LOW_FLAG, "enable" },
{ GECmdFormat::CLEAR_MODE, GECmdField::LOW_FLAG, "flag" },
{ GECmdFormat::CLEAR_MODE, GECmdField::FLAG_AFTER_8, "color" },
{ GECmdFormat::CLEAR_MODE, GECmdField::FLAG_AFTER_9, "alpha" },
{ GECmdFormat::CLEAR_MODE, GECmdField::FLAG_AFTER_9, "stencil" },
{ GECmdFormat::CLEAR_MODE, GECmdField::FLAG_AFTER_10, "depth" },
{ GECmdFormat::COLOR_TEST_FUNC, GECmdField::COMPARE_FUNC2, "func" },
{ GECmdFormat::ALPHA_TEST, GECmdField::COMPARE_FUNC3, "func" },
{ GECmdFormat::ALPHA_TEST, GECmdField::MID_U8, "ref" },
{ GECmdFormat::ALPHA_TEST, GECmdField::MID_U8, "reference" },
{ GECmdFormat::ALPHA_TEST, GECmdField::TOP_U8, "mask" },
{ GECmdFormat::STENCIL_OP, GECmdField::STENCIL_OP_AT_0, "sfail" },
{ GECmdFormat::STENCIL_OP, GECmdField::STENCIL_OP_AT_8, "zfail" },
{ GECmdFormat::STENCIL_OP, GECmdField::STENCIL_OP_AT_16, "zpass" },
{ GECmdFormat::STENCIL_OP, GECmdField::STENCIL_OP_AT_16, "pass" },
{ GECmdFormat::DEPTH_TEST_FUNC, GECmdField::COMPARE_FUNC3, "func" },
{ GECmdFormat::BLEND_MODE, GECmdField::BLEND_SRC, "src" },
{ GECmdFormat::BLEND_MODE, GECmdField::BLEND_SRC, "srcfactor" },
{ GECmdFormat::BLEND_MODE, GECmdField::BLEND_DST, "dst" },
{ GECmdFormat::BLEND_MODE, GECmdField::BLEND_DST, "dstfactor" },
{ GECmdFormat::BLEND_MODE, GECmdField::BLEND_DST, "dest" },
{ GECmdFormat::BLEND_MODE, GECmdField::BLEND_DST, "destfactor" },
{ GECmdFormat::BLEND_MODE, GECmdField::BLEND_EQUATION, "eq" },
{ GECmdFormat::BLEND_MODE, GECmdField::BLEND_EQUATION, "equation" },
{ GECmdFormat::BLEND_MODE, GECmdField::BLEND_EQUATION, "mode" },
{ GECmdFormat::LOGIC_OP, GECmdField::LOGIC_OP, "op" },
{ GECmdFormat::LOGIC_OP, GECmdField::LOGIC_OP, "mode" },
{ GECmdFormat::ALPHA_PRIM, GECmdField::LOW_U8, "alpha" },
{ GECmdFormat::ALPHA_PRIM, GECmdField::PRIM_TYPE, "type" },
{ GECmdFormat::ALPHA_PRIM, GECmdField::PRIM_TYPE, "prim" },
{ GECmdFormat::ALPHA_PRIM, GECmdField::FLAG_AFTER_11, "antialias" },
// TODO: Clip bits?
{ GECmdFormat::ALPHA_PRIM, GECmdField::FLAG_AFTER_18, "shading" },
{ GECmdFormat::ALPHA_PRIM, GECmdField::FLAG_AFTER_18, "gouraud" },
{ GECmdFormat::ALPHA_PRIM, GECmdField::FLAG_AFTER_19, "cull" },
{ GECmdFormat::ALPHA_PRIM, GECmdField::FLAG_AFTER_20, "cullccw" },
{ GECmdFormat::ALPHA_PRIM, GECmdField::FLAG_AFTER_21, "tex" },
{ GECmdFormat::ALPHA_PRIM, GECmdField::FLAG_AFTER_22, "fog" },
{ GECmdFormat::ALPHA_PRIM, GECmdField::FLAG_AFTER_23, "dither" },
};
struct GECmdConstant {
const char *name;
uint32_t value;
};
// TODO: It would be nice if these were somehow typed...
static constexpr GECmdConstant constantNames[] = {
{ "GE_PRIM_POINTS", GE_PRIM_POINTS },
{ "GE_PRIM_LINES", GE_PRIM_LINES },
{ "GE_PRIM_LINE_STRIP", GE_PRIM_LINE_STRIP },
{ "GE_PRIM_TRIANGLES", GE_PRIM_TRIANGLES },
{ "GE_PRIM_TRIANGLE_STRIP", GE_PRIM_TRIANGLE_STRIP },
{ "GE_PRIM_TRIANGLE_FAN", GE_PRIM_TRIANGLE_FAN },
{ "GE_PRIM_RECTANGLES", GE_PRIM_RECTANGLES },
{ "GE_PRIM_KEEP_PREVIOUS", GE_PRIM_KEEP_PREVIOUS },
{ "POINTS", GE_PRIM_POINTS },
{ "LINES", GE_PRIM_LINES },
{ "LINE_STRIP", GE_PRIM_LINE_STRIP },
{ "TRIANGLES", GE_PRIM_TRIANGLES },
{ "TRIANGLE_STRIP", GE_PRIM_TRIANGLE_STRIP },
{ "TRIANGLE_FAN", GE_PRIM_TRIANGLE_FAN },
{ "RECTANGLES", GE_PRIM_RECTANGLES },
{ "SPRITES", GE_PRIM_RECTANGLES },
{ "KEEP_PREVIOUS", GE_PRIM_KEEP_PREVIOUS },
{ "CONTINUE", GE_PRIM_KEEP_PREVIOUS },
{ "GE_PATCHPRIM_TRIANGLES", GE_PATCHPRIM_TRIANGLES, },
{ "GE_PATCHPRIM_LINES", GE_PATCHPRIM_LINES, },
{ "GE_PATCHPRIM_POINTS", GE_PATCHPRIM_POINTS, },
{ "GE_SIGNAL_NONE", PSP_GE_SIGNAL_NONE },
{ "GE_SIGNAL_HANDLER_SUSPEND", PSP_GE_SIGNAL_HANDLER_SUSPEND },
{ "GE_SIGNAL_HANDLER_CONTINUE", PSP_GE_SIGNAL_HANDLER_CONTINUE },
{ "GE_SIGNAL_HANDLER_PAUSE", PSP_GE_SIGNAL_HANDLER_PAUSE },
{ "GE_SIGNAL_SYNC", PSP_GE_SIGNAL_SYNC },
{ "GE_SIGNAL_JUMP", PSP_GE_SIGNAL_JUMP },
{ "GE_SIGNAL_CALL", PSP_GE_SIGNAL_CALL },
{ "GE_SIGNAL_RET", PSP_GE_SIGNAL_RET },
{ "GE_SIGNAL_RJUMP", PSP_GE_SIGNAL_RJUMP },
{ "GE_SIGNAL_RCALL", PSP_GE_SIGNAL_RCALL },
{ "GE_SIGNAL_OJUMP", PSP_GE_SIGNAL_OJUMP },
{ "GE_SIGNAL_OCALL", PSP_GE_SIGNAL_OCALL },
{ "GE_VTYPE_TC_NONE", GE_VTYPE_TC_NONE >> GE_VTYPE_TC_SHIFT },
{ "GE_VTYPE_TC_8BIT", GE_VTYPE_TC_8BIT >> GE_VTYPE_TC_SHIFT },
{ "GE_VTYPE_TC_16BIT", GE_VTYPE_TC_16BIT >> GE_VTYPE_TC_SHIFT },
{ "GE_VTYPE_TC_FLOAT", GE_VTYPE_TC_FLOAT >> GE_VTYPE_TC_SHIFT },
{ "GE_VTYPE_COL_NONE", GE_VTYPE_COL_NONE >> GE_VTYPE_COL_SHIFT },
{ "GE_VTYPE_COL_565", GE_VTYPE_COL_565 >> GE_VTYPE_COL_SHIFT },
{ "GE_VTYPE_COL_5650", GE_VTYPE_COL_565 >> GE_VTYPE_COL_SHIFT },
{ "GE_VTYPE_COL_5551", GE_VTYPE_COL_5551 >> GE_VTYPE_COL_SHIFT },
{ "GE_VTYPE_COL_4444", GE_VTYPE_COL_4444 >> GE_VTYPE_COL_SHIFT },
{ "GE_VTYPE_COL_8888", GE_VTYPE_COL_8888 >> GE_VTYPE_COL_SHIFT },
{ "GE_VTYPE_NRM_NONE", GE_VTYPE_NRM_NONE >> GE_VTYPE_NRM_SHIFT },
{ "GE_VTYPE_NRM_8BIT", GE_VTYPE_NRM_8BIT >> GE_VTYPE_NRM_SHIFT },
{ "GE_VTYPE_NRM_16BIT", GE_VTYPE_NRM_16BIT >> GE_VTYPE_NRM_SHIFT },
{ "GE_VTYPE_NRM_FLOAT", GE_VTYPE_NRM_FLOAT >> GE_VTYPE_NRM_SHIFT },
{ "GE_VTYPE_POS_8BIT", GE_VTYPE_POS_8BIT >> GE_VTYPE_POS_SHIFT },
{ "GE_VTYPE_POS_16BIT", GE_VTYPE_POS_16BIT >> GE_VTYPE_POS_SHIFT },
{ "GE_VTYPE_POS_FLOAT", GE_VTYPE_POS_FLOAT >> GE_VTYPE_POS_SHIFT },
{ "GE_VTYPE_WEIGHT_NONE", GE_VTYPE_WEIGHT_NONE >> GE_VTYPE_WEIGHT_SHIFT },
{ "GE_VTYPE_WEIGHT_8BIT", GE_VTYPE_WEIGHT_8BIT >> GE_VTYPE_WEIGHT_SHIFT },
{ "GE_VTYPE_WEIGHT_16BIT", GE_VTYPE_WEIGHT_16BIT >> GE_VTYPE_WEIGHT_SHIFT },
{ "GE_VTYPE_WEIGHT_FLOAT", GE_VTYPE_WEIGHT_FLOAT >> GE_VTYPE_WEIGHT_SHIFT },
{ "GE_VTYPE_IDX_NONE", GE_VTYPE_IDX_NONE >> GE_VTYPE_IDX_SHIFT },
{ "GE_VTYPE_IDX_8BIT", GE_VTYPE_IDX_8BIT >> GE_VTYPE_IDX_SHIFT },
{ "GE_VTYPE_IDX_16BIT", GE_VTYPE_IDX_16BIT >> GE_VTYPE_IDX_SHIFT },
{ "GE_VTYPE_IDX_32BIT", GE_VTYPE_IDX_32BIT >> GE_VTYPE_IDX_SHIFT },
{ "GE_LIGHTCOMP_ONLYDIFFUSE", GE_LIGHTCOMP_ONLYDIFFUSE },
{ "GE_LIGHTCOMP_BOTH", GE_LIGHTCOMP_BOTH },
{ "GE_LIGHTCOMP_ONLYPOWDIFFUSE", GE_LIGHTCOMP_ONLYPOWDIFFUSE },
{ "GE_LIGHTTYPE_DIRECTIONAL", GE_LIGHTTYPE_DIRECTIONAL },
{ "GE_LIGHTTYPE_POINT", GE_LIGHTTYPE_POINT },
{ "GE_LIGHTTYPE_SPOT", GE_LIGHTTYPE_SPOT },
{ "GE_TEXMAP_TEXTURE_COORDS", GE_TEXMAP_TEXTURE_COORDS },
{ "GE_TEXMAP_TEXTURE_MATRIX", GE_TEXMAP_TEXTURE_MATRIX },
{ "GE_TEXMAP_ENVIRONMENT_MAP", GE_TEXMAP_ENVIRONMENT_MAP },
{ "GE_PROJMAP_POSITION", GE_PROJMAP_POSITION },
{ "GE_PROJMAP_UV", GE_PROJMAP_UV },
{ "GE_PROJMAP_NORMALIZED_NORMAL", GE_PROJMAP_NORMALIZED_NORMAL },
{ "GE_PROJMAP_NORMAL", GE_PROJMAP_NORMAL },
{ "GE_TFMT_565", GE_TFMT_5650 },
{ "GE_TFMT_5650", GE_TFMT_5650 },
{ "GE_TFMT_5551", GE_TFMT_5551 },
{ "GE_TFMT_4444", GE_TFMT_4444 },
{ "GE_TFMT_8888", GE_TFMT_8888 },
{ "GE_TFMT_CLUT4", GE_TFMT_CLUT4 },
{ "GE_TFMT_CLUT8", GE_TFMT_CLUT8 },
{ "GE_TFMT_CLUT16", GE_TFMT_CLUT16 },
{ "GE_TFMT_CLUT32", GE_TFMT_CLUT32 },
{ "GE_TFMT_DXT1", GE_TFMT_DXT1 },
{ "GE_TFMT_DXT3", GE_TFMT_DXT3 },
{ "GE_TFMT_DXT5", GE_TFMT_DXT5 },
{ "GE_CMODE_16BIT_BGR5650", GE_CMODE_16BIT_BGR5650 },
{ "GE_CMODE_16BIT_ABGR5551", GE_CMODE_16BIT_ABGR5551 },
{ "GE_CMODE_16BIT_ABGR4444", GE_CMODE_16BIT_ABGR4444 },
{ "GE_CMODE_32BIT_ABGR8888", GE_CMODE_32BIT_ABGR8888 },
{ "GE_TFILT_NEAREST", GE_TFILT_NEAREST },
{ "GE_TFILT_LINEAR", GE_TFILT_LINEAR },
{ "GE_TFILT_NEAREST_MIPMAP_NEAREST", GE_TFILT_NEAREST_MIPMAP_NEAREST },
{ "GE_TFILT_LINEAR_MIPMAP_NEAREST", GE_TFILT_LINEAR_MIPMAP_NEAREST },
{ "GE_TFILT_NEAREST_MIPMAP_LINEAR", GE_TFILT_NEAREST_MIPMAP_LINEAR },
{ "GE_TFILT_LINEAR_MIPMAP_LINEAR", GE_TFILT_LINEAR_MIPMAP_LINEAR },
{ "NEAREST", GE_TFILT_NEAREST },
{ "LINEAR", GE_TFILT_LINEAR },
{ "GE_TEXLEVEL_MODE_AUTO", GE_TEXLEVEL_MODE_AUTO },
{ "GE_TEXLEVEL_MODE_CONST", GE_TEXLEVEL_MODE_CONST },
{ "GE_TEXLEVEL_MODE_SLOPE", GE_TEXLEVEL_MODE_SLOPE },
{ "GE_TEXFUNC_MODULATE", GE_TEXFUNC_MODULATE },
{ "GE_TEXFUNC_DECAL", GE_TEXFUNC_DECAL },
{ "GE_TEXFUNC_BLEND", GE_TEXFUNC_BLEND },
{ "GE_TEXFUNC_REPLACE", GE_TEXFUNC_REPLACE },
{ "GE_TEXFUNC_ADD", GE_TEXFUNC_ADD },
{ "GE_COMP_NEVER", GE_COMP_NEVER },
{ "GE_COMP_ALWAYS", GE_COMP_ALWAYS },
{ "GE_COMP_EQUAL", GE_COMP_EQUAL },
{ "GE_COMP_NOTEQUAL", GE_COMP_NOTEQUAL },
{ "GE_COMP_LESS", GE_COMP_LESS },
{ "GE_COMP_LEQUAL", GE_COMP_LEQUAL },
{ "GE_COMP_GREATER", GE_COMP_GREATER },
{ "GE_COMP_GEQUAL", GE_COMP_GEQUAL },
{ "NEVER", GE_COMP_NEVER },
{ "ALWAYS", GE_COMP_ALWAYS },
{ "EQUAL", GE_COMP_EQUAL },
{ "NOTEQUAL", GE_COMP_NOTEQUAL },
{ "LESS", GE_COMP_LESS },
{ "LEQUAL", GE_COMP_LEQUAL },
{ "LESSEQUAL", GE_COMP_LEQUAL },
{ "GREATER", GE_COMP_GREATER },
{ "GEQUAL", GE_COMP_GEQUAL },
{ "GREATEREQUAL", GE_COMP_GEQUAL },
{ "GE_STENCILOP_KEEP", GE_STENCILOP_KEEP },
{ "GE_STENCILOP_ZERO", GE_STENCILOP_ZERO },
{ "GE_STENCILOP_REPLACE", GE_STENCILOP_REPLACE },
{ "GE_STENCILOP_INVERT", GE_STENCILOP_INVERT },
{ "GE_STENCILOP_INCR", GE_STENCILOP_INCR },
{ "GE_STENCILOP_DECR", GE_STENCILOP_DECR },
{ "GE_BLENDMODE_MUL_AND_ADD", GE_BLENDMODE_MUL_AND_ADD },
{ "GE_BLENDMODE_MUL_AND_SUBTRACT", GE_BLENDMODE_MUL_AND_SUBTRACT },
{ "GE_BLENDMODE_MUL_AND_SUBTRACT_REVERSE", GE_BLENDMODE_MUL_AND_SUBTRACT_REVERSE },
{ "GE_BLENDMODE_MIN", GE_BLENDMODE_MIN },
{ "GE_BLENDMODE_MAX", GE_BLENDMODE_MAX },
{ "GE_BLENDMODE_ABSDIFF", GE_BLENDMODE_ABSDIFF },
{ "ADD", GE_BLENDMODE_MUL_AND_ADD },
{ "SUBTRACT", GE_BLENDMODE_MUL_AND_SUBTRACT },
{ "SUBTRACT_REVERSE", GE_BLENDMODE_MUL_AND_SUBTRACT_REVERSE },
{ "MIN", GE_BLENDMODE_MIN },
{ "MAX", GE_BLENDMODE_MAX },
{ "ABSDIFF", GE_BLENDMODE_ABSDIFF },
{ "GE_SRCBLEND_DSTCOLOR", GE_SRCBLEND_DSTCOLOR },
{ "GE_SRCBLEND_INVDSTCOLOR", GE_SRCBLEND_INVDSTCOLOR },
{ "GE_SRCBLEND_SRCALPHA", GE_SRCBLEND_SRCALPHA },
{ "GE_SRCBLEND_INVSRCALPHA", GE_SRCBLEND_INVSRCALPHA },
{ "GE_SRCBLEND_DSTALPHA", GE_SRCBLEND_DSTALPHA },
{ "GE_SRCBLEND_INVDSTALPHA", GE_SRCBLEND_INVDSTALPHA },
{ "GE_SRCBLEND_DOUBLESRCALPHA", GE_SRCBLEND_DOUBLESRCALPHA },
{ "GE_SRCBLEND_DOUBLEINVSRCALPHA", GE_SRCBLEND_DOUBLEINVSRCALPHA },
{ "GE_SRCBLEND_DOUBLEDSTALPHA", GE_SRCBLEND_DOUBLEDSTALPHA },
{ "GE_SRCBLEND_DOUBLEINVDSTALPHA", GE_SRCBLEND_DOUBLEINVDSTALPHA },
{ "GE_SRCBLEND_FIXA", GE_SRCBLEND_FIXA },
{ "GE_DSTBLEND_SRCCOLOR", GE_DSTBLEND_SRCCOLOR },
{ "GE_DSTBLEND_INVSRCCOLOR", GE_DSTBLEND_INVSRCCOLOR },
{ "GE_DSTBLEND_SRCALPHA", GE_DSTBLEND_SRCALPHA },
{ "GE_DSTBLEND_INVSRCALPHA", GE_DSTBLEND_INVSRCALPHA },
{ "GE_DSTBLEND_DSTALPHA", GE_DSTBLEND_DSTALPHA },
{ "GE_DSTBLEND_INVDSTALPHA", GE_DSTBLEND_INVDSTALPHA },
{ "GE_DSTBLEND_DOUBLESRCALPHA", GE_DSTBLEND_DOUBLESRCALPHA },
{ "GE_DSTBLEND_DOUBLEINVSRCALPHA", GE_DSTBLEND_DOUBLEINVSRCALPHA },
{ "GE_DSTBLEND_DOUBLEDSTALPHA", GE_DSTBLEND_DOUBLEDSTALPHA },
{ "GE_DSTBLEND_DOUBLEINVDSTALPHA", GE_DSTBLEND_DOUBLEINVDSTALPHA },
{ "GE_DSTBLEND_FIXB", GE_DSTBLEND_FIXB },
{ "SRCALPHA", GE_SRCBLEND_SRCALPHA },
{ "INVSRCALPHA", GE_SRCBLEND_INVSRCALPHA },
{ "INVERSESRCALPHA", GE_SRCBLEND_INVSRCALPHA },
{ "DSTALPHA", GE_DSTBLEND_DSTALPHA },
{ "INVDSTALPHA", GE_DSTBLEND_INVDSTALPHA },
{ "DOUBLESRCALPHA", GE_DSTBLEND_DOUBLESRCALPHA },
{ "DOUBLEINVSRCALPHA", GE_DSTBLEND_DOUBLEINVSRCALPHA },
{ "DOUBLEDSTALPHA", GE_DSTBLEND_DOUBLEDSTALPHA },
{ "DOUBLEINVDSTALPHA", GE_DSTBLEND_DOUBLEINVDSTALPHA },
{ "FIXED", GE_DSTBLEND_FIXB },
{ "GE_LOGIC_CLEAR", GE_LOGIC_CLEAR },
{ "GE_LOGIC_AND", GE_LOGIC_AND },
{ "GE_LOGIC_AND_REVERSE", GE_LOGIC_AND_REVERSE },
{ "GE_LOGIC_COPY", GE_LOGIC_COPY },
{ "GE_LOGIC_AND_INVERTED", GE_LOGIC_AND_INVERTED },
{ "GE_LOGIC_NOOP", GE_LOGIC_NOOP },
{ "GE_LOGIC_XOR", GE_LOGIC_XOR },
{ "GE_LOGIC_OR", GE_LOGIC_OR },
{ "GE_LOGIC_NOR", GE_LOGIC_NOR },
{ "GE_LOGIC_EQUIV", GE_LOGIC_EQUIV },
{ "GE_LOGIC_INVERTED", GE_LOGIC_INVERTED },
{ "GE_LOGIC_OR_REVERSE", GE_LOGIC_OR_REVERSE },
{ "GE_LOGIC_COPY_INVERTED", GE_LOGIC_COPY_INVERTED },
{ "GE_LOGIC_OR_INVERTED", GE_LOGIC_OR_INVERTED },
{ "GE_LOGIC_NAND", GE_LOGIC_NAND },
{ "GE_LOGIC_SET", GE_LOGIC_SET },
};
class GEExpressionFunctions : public IExpressionFunctions {
@@ -69,6 +514,10 @@ public:
bool getMemoryValue(uint32_t address, int size, uint32_t &dest, char *error) override;
private:
bool parseFieldReference(const char *ref, const char *field, uint32_t &referenceIndex);
uint32_t getFieldValue(GECmdFormat fmt, GECmdField field, uint32_t value);
ExpressionType getFieldType(GECmdFormat fmt, GECmdField field);
GPUDebugInterface *gpu_;
};
@@ -81,6 +530,15 @@ bool GEExpressionFunctions::parseReference(char *str, uint32_t &referenceIndex)
return true;
}
char *dot = strchr(str, '.');
if (dot != nullptr) {
*dot = '\0';
bool success = parseFieldReference(str, dot + 1, referenceIndex);
*dot = '.';
if (success)
return true;
}
// Also allow non-register references.
for (const auto &entry : referenceNames) {
if (strcasecmp(str, entry.name) == 0) {
@@ -127,21 +585,53 @@ bool GEExpressionFunctions::parseReference(char *str, uint32_t &referenceIndex)
return false;
}
bool GEExpressionFunctions::parseFieldReference(const char *ref, const char *field, uint32_t &referenceIndex) {
GECmdInfo info;
if (!GECmdInfoByName(ref, info)) {
return false;
}
for (const auto &entry : fieldNames) {
if (entry.fmt == info.fmt && strcasecmp(field, entry.name) == 0) {
referenceIndex = (info.reg << 12) | (uint32_t)entry.field;
return true;
}
}
return false;
}
bool GEExpressionFunctions::parseSymbol(char *str, uint32_t &symbolValue) {
// Mainly useful for checking memory addresses.
// Mainly useful for checking memory addresses and constants.
for (const auto &entry : constantNames) {
if (strcasecmp(str, entry.name) == 0) {
symbolValue = entry.value;
return true;
}
}
return g_symbolMap->GetLabelValue(str, symbolValue);
}
uint32_t GEExpressionFunctions::getReferenceValue(uint32_t referenceIndex) {
GPUgstate state = gpu_->GetGState();
if (referenceIndex < 0x100) {
uint32_t value = gpu_->GetGState().cmdmem[referenceIndex];
// TODO: Later, support float values and similar.
GECmdFormat fmt = GECmdInfoByCmd(GECommand(referenceIndex)).fmt;
uint32_t value = state.cmdmem[referenceIndex];
if (fmt == GECmdFormat::FLOAT)
return value << 8;
return value & 0x00FFFFFF;
}
if (referenceIndex >= (uint32_t)GEReferenceIndex::FIELD_START && referenceIndex <= (uint32_t)GEReferenceIndex::FIELD_END) {
uint32_t value = state.cmdmem[referenceIndex >> 12] & 0x00FFFFFF;
GECmdFormat fmt = GECmdInfoByCmd(GECommand(referenceIndex >> 12)).fmt;
return getFieldValue(fmt, GECmdField(referenceIndex & 0xFF), value);
}
// We return the matrix value as float bits, which gets interpreted correctly in the parser.
if (referenceIndex >= (uint32_t)GEReferenceIndex::BONE_MATRIX && referenceIndex < (uint32_t)GEReferenceIndex::MATRIX_END) {
GPUgstate state = gpu_->GetGState();
float value;
if (referenceIndex >= (uint32_t)GEReferenceIndex::TGEN_MATRIX) {
value = state.tgenMatrix[referenceIndex - (uint32_t)GEReferenceIndex::TGEN_MATRIX];
@@ -186,7 +676,6 @@ uint32_t GEExpressionFunctions::getReferenceValue(uint32_t referenceIndex) {
}
return 0;
case GEReferenceIndex::OP:
// TODO: Support fields under this as per the cmd format?
if (gpu_->GetCurrentDisplayList(list)) {
return Memory::Read_U32(list.pc);
}
@@ -197,12 +686,33 @@ uint32_t GEExpressionFunctions::getReferenceValue(uint32_t referenceIndex) {
}
return 0;
case GEReferenceIndex::CLUTADDR:
return state.getClutAddress();
case GEReferenceIndex::TRANSFERSRC:
return state.getTransferSrcAddress();
case GEReferenceIndex::TRANSFERDST:
return state.getTransferDstAddress();
case GEReferenceIndex::TEXADDR0:
case GEReferenceIndex::TEXADDR1:
case GEReferenceIndex::TEXADDR2:
case GEReferenceIndex::TEXADDR3:
case GEReferenceIndex::TEXADDR4:
case GEReferenceIndex::TEXADDR5:
case GEReferenceIndex::TEXADDR6:
case GEReferenceIndex::TEXADDR7:
return state.getTextureAddress((int)ref - (int)GEReferenceIndex::TEXADDR0);
case GEReferenceIndex::BONE_MATRIX:
case GEReferenceIndex::WORLD_MATRIX:
case GEReferenceIndex::VIEW_MATRIX:
case GEReferenceIndex::PROJ_MATRIX:
case GEReferenceIndex::TGEN_MATRIX:
case GEReferenceIndex::MATRIX_END:
case GEReferenceIndex::FIELD_START:
case GEReferenceIndex::FIELD_END:
// Shouldn't have gotten here.
break;
}
@@ -211,17 +721,200 @@ uint32_t GEExpressionFunctions::getReferenceValue(uint32_t referenceIndex) {
return 0;
}
uint32_t GEExpressionFunctions::getFieldValue(GECmdFormat fmt, GECmdField field, uint32_t value) {
switch (field) {
case GECmdField::DATA:
return value;
case GECmdField::LOW_FLAG:
return value & 1;
case GECmdField::LOW_U2:
return value & 3;
case GECmdField::LOW_U4:
return value & 0xF;
case GECmdField::LOW_U7:
return value & 0x7F;
case GECmdField::LOW_U8:
return value & 0xFF;
case GECmdField::LOW_U10:
return value & 0x03FF;
case GECmdField::LOW_U10_P1:
return (value & 0x03FF) + 1;
case GECmdField::LOW_U11:
return value & 0x07FF;
case GECmdField::LOW_U16:
return value & 0xFFFF;
case GECmdField::MID_U8:
return (value >> 8) & 0xFF;
case GECmdField::MID_U10:
return (value >> 10) & 0x03FF;
case GECmdField::MID_U10_P1:
return ((value >> 10) & 0x03FF) + 1;
case GECmdField::TOP_U8:
return (value >> 16) & 0xFF;
case GECmdField::FLAG_AFTER_1:
return (value >> 1) & 1;
case GECmdField::FLAG_AFTER_2:
return (value >> 2) & 1;
case GECmdField::FLAG_AFTER_8:
return (value >> 8) & 1;
case GECmdField::FLAG_AFTER_9:
return (value >> 8) & 1;
case GECmdField::FLAG_AFTER_10:
return (value >> 10) & 1;
case GECmdField::FLAG_AFTER_11:
return (value >> 11) & 1;
case GECmdField::FLAG_AFTER_16:
return (value >> 16) & 1;
case GECmdField::FLAG_AFTER_17:
return (value >> 17) & 1;
case GECmdField::FLAG_AFTER_18:
return (value >> 18) & 1;
case GECmdField::FLAG_AFTER_19:
return (value >> 19) & 1;
case GECmdField::FLAG_AFTER_20:
return (value >> 20) & 1;
case GECmdField::FLAG_AFTER_21:
return (value >> 21) & 1;
case GECmdField::FLAG_AFTER_22:
return (value >> 22) & 1;
case GECmdField::FLAG_AFTER_23:
return (value >> 23) & 1;
case GECmdField::U2_AFTER_8:
return (value >> 8) & 3;
case GECmdField::U3_AFTER_16:
return (value >> 16) & 7;
case GECmdField::U12_AFTER_4:
return (value >> 4) & 0x0FFF;
// Below here are "typed" values, maybe they'll be exposed differently than integers someday.
case GECmdField::PRIM_TYPE:
return (value >> 16) & 7;
case GECmdField::SIGNAL_TYPE:
return (value >> 16) & 0xFF;
case GECmdField::VTYPE_TC:
return value & 3;
case GECmdField::VTYPE_COL:
return (value >> 2) & 7;
case GECmdField::VTYPE_NRM:
return (value >> 5) & 3;
case GECmdField::VTYPE_POS:
return (value >> 7) & 3;
case GECmdField::VTYPE_WEIGHTTYPE:
return (value >> 9) & 3;
case GECmdField::VTYPE_INDEX:
return (value >> 11) & 3;
case GECmdField::VTYPE_WEIGHTCOUNT:
return ((value >> 14) & 7) + 1;
case GECmdField::VTYPE_MORPHCOUNT:
return ((value >> 18) & 7) + 1;
case GECmdField::PATCH_PRIM_TYPE:
return value & 3;
case GECmdField::LIGHT_COMP:
return value & 3;
case GECmdField::LIGHT_TYPE:
return (value >> 8) & 3;
case GECmdField::LIGHT_TYPE_SPECULAR:
return (value & 3) == 1;
case GECmdField::HIGH_ADDR:
return (value << 8) & 0xFF000000;
case GECmdField::TEX_W:
return 1 << (value & 0xF);
case GECmdField::TEX_H:
return 1 << ((value >> 8) & 0xF);
case GECmdField::UVGEN_TYPE:
return value & 3;
case GECmdField::UVGEN_PROJ:
return (value >> 8) & 3;
case GECmdField::TEX_FORMAT:
return value & 0xF;
case GECmdField::TEX_MINFILTER:
return value & 7;
case GECmdField::TEX_MAGFILTER:
return (value >> 8) & 1;
case GECmdField::TEX_LEVEL_MODE:
return value & 3;
case GECmdField::LOW_U12_4_FLOAT:
{
float f = (value & 0xFFFF) / 16.0f;
uint32_t result;
memcpy(&result, &f, sizeof(result));
return result;
}
case GECmdField::HIGH_S4_4_FLOAT: // At 16, s.3.4 converted to float.
{
int value8 = (int)(s8)((value >> 16) & 0xFF);
float f = value8 / 16.0f;
uint32_t result;
memcpy(&result, &f, sizeof(result));
return result;
}
case GECmdField::TEX_FUNC:
return value & 7;
case GECmdField::CLUT_BYTES:
return (value & 0x3F) * 8;
case GECmdField::CLUT_FORMAT:
return value & 3;
case GECmdField::CLUT_SHIFT:
return (value >> 2) & 0x1F;
case GECmdField::CLUT_OFFSET:
return ((value >> 16) & 0x1F) << 4;
case GECmdField::COMPARE_FUNC2:
return value & 3;
case GECmdField::COMPARE_FUNC3:
return value & 7;
case GECmdField::STENCIL_OP_AT_0:
return value & 7;
case GECmdField::STENCIL_OP_AT_8:
return (value >> 8) & 7;
case GECmdField::STENCIL_OP_AT_16:
return (value >> 16) & 7;
case GECmdField::BLEND_SRC:
return value & 0xF;
case GECmdField::BLEND_DST:
return (value >> 4) & 0xF;
case GECmdField::BLEND_EQUATION:
return (value >> 8) & 7;
case GECmdField::LOGIC_OP:
return value & 0xF;
}
_assert_msg_(false, "Invalid field type");
return 0;
}
ExpressionType GEExpressionFunctions::getReferenceType(uint32_t referenceIndex) {
if (referenceIndex < 0x100) {
// TODO: Later, support float values and similar.
GECmdFormat fmt = GECmdInfoByCmd(GECommand(referenceIndex)).fmt;
if (fmt == GECmdFormat::FLOAT)
return EXPR_TYPE_FLOAT;
return EXPR_TYPE_UINT;
}
if (referenceIndex >= (uint32_t)GEReferenceIndex::FIELD_START && referenceIndex <= (uint32_t)GEReferenceIndex::FIELD_END) {
GECmdFormat fmt = GECmdInfoByCmd(GECommand(referenceIndex >> 12)).fmt;
return getFieldType(fmt, GECmdField(referenceIndex & 0xFF));
}
if (referenceIndex >= (uint32_t)GEReferenceIndex::BONE_MATRIX && referenceIndex < (uint32_t)GEReferenceIndex::MATRIX_END)
return EXPR_TYPE_FLOAT;
return EXPR_TYPE_UINT;
}
ExpressionType GEExpressionFunctions::getFieldType(GECmdFormat fmt, GECmdField field) {
switch (field) {
case GECmdField::LOW_U12_4_FLOAT:
case GECmdField::HIGH_S4_4_FLOAT:
return EXPR_TYPE_FLOAT;
default:
// Almost all of these are uint, so not listing each one.
break;
}
return EXPR_TYPE_UINT;
}
bool GEExpressionFunctions::getMemoryValue(uint32_t address, int size, uint32_t &dest, char *error) {
if (!Memory::IsValidRange(address, size)) {
sprintf(error, "Invalid address or size %08x + %d", address, size);
+3 -1
View File
@@ -1058,8 +1058,10 @@ static void ConvertBlendState(GenericBlendState &blendState, bool forceReplaceBl
ReplaceBlendType replaceBlend = ReplaceBlendWithShader(gstate_c.framebufFormat);
if (forceReplaceBlend) {
replaceBlend = REPLACE_BLEND_READ_FRAMEBUFFER;
// Enforce blend replacement if enabled. If not, shouldn't do anything of course.
replaceBlend = gstate.isAlphaBlendEnabled() ? REPLACE_BLEND_READ_FRAMEBUFFER : REPLACE_BLEND_NO;
}
blendState.replaceBlend = replaceBlend;
blendState.simulateLogicOpType = SimulateLogicOpShaderTypeIfNeeded();
+3 -1
View File
@@ -245,7 +245,9 @@ struct ComputedPipelineState {
void Convert(bool shaderBitOpsSupported);
bool FramebufferRead() const {
return blendState.applyFramebufferRead;
// If blending is off, its applyFramebufferRead can be false even after state propagation.
// So it's not enough to check just that one.
return blendState.applyFramebufferRead || maskState.applyFramebufferRead || logicState.applyFramebufferRead;
}
};
+10 -6
View File
@@ -180,8 +180,12 @@ std::string FragmentShaderDesc(const FShaderID &id) {
if (id.Bit(FS_BIT_COLOR_DOUBLE)) desc << "2x ";
if (id.Bit(FS_BIT_FLATSHADE)) desc << "Flat ";
if (id.Bit(FS_BIT_BGRA_TEXTURE)) desc << "BGRA ";
if (id.Bit(FS_BIT_SHADER_DEPAL)) desc << "Depal ";
if (id.Bit(FS_BIT_SHADER_SMOOTHED_DEPAL)) desc << "SmoothDepal ";
switch ((ShaderDepalMode)id.Bit(FS_BIT_SHADER_DEPAL_MODE)) {
case ShaderDepalMode::OFF: break;
case ShaderDepalMode::NORMAL: desc << "Depal "; break;
case ShaderDepalMode::SMOOTHED: desc << "SmoothDepal "; break;
case ShaderDepalMode::CLUT8_8888: desc << "CLUT8From8888Depal"; break;
}
if (id.Bit(FS_BIT_COLOR_WRITEMASK)) desc << "WriteMask ";
if (id.Bit(FS_BIT_SHADER_TEX_CLAMP)) {
desc << "TClamp";
@@ -261,8 +265,9 @@ void ComputeFragmentShaderID(FShaderID *id_out, const ComputedPipelineState &pip
bool doTextureProjection = (gstate.getUVGenMode() == GE_TEXMAP_TEXTURE_MATRIX && MatrixNeedsProjection(gstate.tgenMatrix));
bool doTextureAlpha = gstate.isTextureAlphaUsed();
bool doFlatShading = gstate.getShadeMode() == GE_SHADE_FLAT;
bool useShaderDepal = gstate_c.useShaderDepal;
bool useSmoothedDepal = gstate_c.useSmoothedShaderDepal;
ShaderDepalMode shaderDepalMode = gstate_c.shaderDepalMode;
bool colorWriteMask = pipelineState.maskState.applyFramebufferRead;
ReplaceBlendType replaceBlend = pipelineState.blendState.replaceBlend;
@@ -289,8 +294,7 @@ void ComputeFragmentShaderID(FShaderID *id_out, const ComputedPipelineState &pip
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_SHADER_SMOOTHED_DEPAL, useSmoothedDepal);
id.SetBits(FS_BIT_SHADER_DEPAL_MODE, 2, (int)shaderDepalMode);
id.SetBit(FS_BIT_3D_TEXTURE, gstate_c.curTextureIs3D);
}
+3 -4
View File
@@ -66,7 +66,7 @@ enum FShaderBit : uint8_t {
FS_BIT_DO_TEXTURE = 1,
FS_BIT_TEXFUNC = 2, // 3 bits
FS_BIT_TEXALPHA = 5,
FS_BIT_SHADER_DEPAL = 6,
FS_BIT_3D_TEXTURE = 6,
FS_BIT_SHADER_TEX_CLAMP = 7,
FS_BIT_CLAMP_S = 8,
FS_BIT_CLAMP_T = 9,
@@ -93,9 +93,8 @@ enum FShaderBit : uint8_t {
FS_BIT_TEST_DISCARD_TO_ZERO = 48,
FS_BIT_NO_DEPTH_CANNOT_DISCARD_STENCIL = 49,
FS_BIT_COLOR_WRITEMASK = 50,
FS_BIT_3D_TEXTURE = 51,
FS_BIT_SHADER_SMOOTHED_DEPAL = 52,
FS_BIT_REPLACE_LOGIC_OP = 53, // 4 bits. GE_LOGIC_COPY means no-op/off.
FS_BIT_REPLACE_LOGIC_OP = 51, // 4 bits. GE_LOGIC_COPY means no-op/off.
FS_BIT_SHADER_DEPAL_MODE = 55, // 2 bits (ShaderDepalMode)
};
static inline FShaderBit operator +(FShaderBit bit, int i) {
+38 -34
View File
@@ -883,6 +883,11 @@ bool TextureCacheCommon::MatchFramebuffer(
return false;
}
if (!fb_stride) {
// Hard to make decisions.
return false;
}
switch (entry.format) {
case GE_TFMT_DXT1:
case GE_TFMT_DXT3:
@@ -915,10 +920,11 @@ bool TextureCacheCommon::MatchFramebuffer(
const bool noOffset = texaddr == addr;
const bool exactMatch = noOffset && entry.format < 4 && channel == RASTER_COLOR && fb_stride_in_bytes == tex_stride_in_bytes;
const u32 w = 1 << ((entry.dim >> 0) & 0xf);
const u32 h = 1 << ((entry.dim >> 8) & 0xf);
const u32 texWidth = 1 << ((entry.dim >> 0) & 0xf);
const u32 texHeight = 1 << ((entry.dim >> 8) & 0xf);
// 512 on a 272 framebuffer is sane, so let's be lenient.
const u32 minSubareaHeight = h / 4;
const u32 minSubareaHeight = texHeight / 4;
// If they match "exactly", it's non-CLUT and from the top left.
if (exactMatch) {
@@ -948,20 +954,18 @@ bool TextureCacheCommon::MatchFramebuffer(
(fb_format == GE_FORMAT_8888 && entry.format == GE_TFMT_CLUT32) ||
(fb_format != GE_FORMAT_8888 && entry.format == GE_TFMT_CLUT16);
const int bitOffset = (texaddr - addr) * 8;
if (bitOffset != 0) {
const int pixelOffset = bitOffset / (int)std::max(1U, (u32)textureBitsPerPixel[entry.format]);
if (pixelOffset > 0) {
matchInfo->yOffset = entry.bufw == 0 ? 0 : pixelOffset / (int)entry.bufw;
matchInfo->xOffset = entry.bufw == 0 ? 0 : pixelOffset % (int)entry.bufw;
} else if (pixelOffset < 0) {
// We don't support negative Y offsets, and negative X offsets are only for the Killzone workaround.
if (pixelOffset < -(int)entry.bufw || !PSP_CoreParameter().compat.flags().SplitFramebufferMargin) {
return false;
}
matchInfo->xOffset = entry.bufw == 0 ? 0 : -(-pixelOffset % (int)entry.bufw);
const int texBitsPerPixel = std::max(1U, (u32)textureBitsPerPixel[entry.format]);
const int byteOffset = texaddr - addr;
if (byteOffset > 0) {
matchInfo->yOffset = byteOffset / fb_stride_in_bytes;
matchInfo->xOffset = 8 * (byteOffset % fb_stride_in_bytes) / texBitsPerPixel;
} else if (byteOffset < 0) {
int texelOffset = 8 * byteOffset / texBitsPerPixel;
// We don't support negative Y offsets, and negative X offsets are only for the Killzone workaround.
if (texelOffset < -(int)entry.bufw || !PSP_CoreParameter().compat.flags().SplitFramebufferMargin) {
return false;
}
matchInfo->xOffset = entry.bufw == 0 ? 0 : -(-texelOffset % (int)entry.bufw);
}
if (matchInfo->yOffset > 0 && matchInfo->yOffset + minSubareaHeight >= framebuffer->height) {
@@ -969,13 +973,11 @@ bool TextureCacheCommon::MatchFramebuffer(
return false;
}
if (fb_stride_in_bytes != tex_stride_in_bytes) {
// Probably irrelevant.
return false;
}
// Check if it's in bufferWidth (which might be higher than width and may indicate the framebuffer includes the data.)
if (matchInfo->xOffset >= framebuffer->bufferWidth && matchInfo->xOffset + w <= (u32)fb_stride) {
// Do the computation in bytes so that it's valid even in case of weird reinterpret scenarios.
const int xOffsetInBytes = matchInfo->xOffset * 8 / texBitsPerPixel;
const int texWidthInBytes = texWidth * 8 / texBitsPerPixel;
if (xOffsetInBytes >= framebuffer->BufferWidthInBytes() && xOffsetInBytes + texWidthInBytes <= (int)fb_stride_in_bytes) {
// This happens in Brave Story, see #10045 - the texture is in the space between strides, with matching stride.
return false;
}
@@ -987,6 +989,11 @@ bool TextureCacheCommon::MatchFramebuffer(
return false;
}
if (fb_stride_in_bytes != tex_stride_in_bytes) {
// Probably irrelevant. Although, as we shall see soon, there are exceptions.
return false;
}
// Check for CLUT. The framebuffer is always RGB, but it can be interpreted as a CLUT texture.
// 3rd Birthday (and a bunch of other games) render to a 16 bit clut texture.
if (matchingClutFormat) {
@@ -1177,6 +1184,7 @@ void TextureCacheCommon::LoadClut(u32 clutAddr, u32 loadBytes) {
// And is it inside the rendered area? Sometimes games pack data outside.
bool matchRegion = ((offset / bpp) % framebuffer->fb_stride) < framebuffer->width;
if (matchRange && matchRegion && offset < clutRenderOffset_) {
WARN_LOG_N_TIMES(clutfb, 5, G3D, "Detected LoadCLUT(%d bytes) from framebuffer %08x (%s), byte offset %d", loadBytes, fb_address, GeBufferFormatToString(framebuffer->fb_format), offset);
framebuffer->last_frame_clut = gpuStats.numFlips;
framebuffer->usageFlags |= FB_USAGE_CLUT;
clutRenderAddress_ = framebuffer->fb_address;
@@ -1190,15 +1198,18 @@ void TextureCacheCommon::LoadClut(u32 clutAddr, u32 loadBytes) {
NotifyMemInfo(MemBlockFlags::ALLOC, clutAddr, loadBytes, "CLUT");
}
// It's possible for a game to (successfully) access outside valid memory.
// It's possible for a game to load CLUT outside valid memory without crashing, should result in zeroes.
u32 bytes = Memory::ValidSize(clutAddr, loadBytes);
if (clutRenderAddress_ != 0xFFFFFFFF && !g_Config.bBlockTransferGPU) {
if (clutRenderAddress_ != 0xFFFFFFFF && PSP_CoreParameter().compat.flags().AllowDownloadCLUT) {
framebufferManager_->DownloadFramebufferForClut(clutRenderAddress_, clutRenderOffset_ + bytes);
Memory::MemcpyUnchecked(clutBufRaw_, clutAddr, bytes);
if (bytes < loadBytes) {
memset((u8 *)clutBufRaw_ + bytes, 0x00, loadBytes - bytes);
}
} else {
// Here we could check for clutRenderAddres_ != 0xFFFFFFFF and zero the CLUT or something,
// but choosing not to for now. Though the results of loading the CLUT from RAM here is
// almost certainly going to be bogus.
#ifdef _M_SSE
if (bytes == loadBytes) {
const __m128i *source = (const __m128i *)Memory::GetPointerUnchecked(clutAddr);
@@ -1920,7 +1931,6 @@ void TextureCacheCommon::ApplyTextureFramebuffer(VirtualFramebuffer *framebuffer
// TODO: Implement shader depal in the fragment shader generator for D3D11 at least.
switch (draw_->GetShaderLanguageDesc().shaderLanguage) {
case ShaderLanguage::HLSL_D3D11:
case ShaderLanguage::HLSL_D3D9:
useShaderDepal = false;
break;
@@ -1953,7 +1963,7 @@ void TextureCacheCommon::ApplyTextureFramebuffer(VirtualFramebuffer *framebuffer
// Since we started/ended render passes, might need these.
gstate_c.Dirty(DIRTY_DEPAL);
gstate_c.SetUseShaderDepal(true, smoothedDepal);
gstate_c.SetUseShaderDepal(smoothedDepal ? ShaderDepalMode::SMOOTHED : ShaderDepalMode::NORMAL);
gstate_c.depalFramebufferFormat = framebuffer->fb_format;
const u32 bytesPerColor = clutFormat == GE_CMODE_32BIT_ABGR8888 ? sizeof(u32) : sizeof(u16);
@@ -1969,7 +1979,7 @@ void TextureCacheCommon::ApplyTextureFramebuffer(VirtualFramebuffer *framebuffer
depthUpperBits = (depth && framebuffer->fb_format == GE_FORMAT_8888) ? ((gstate.getTextureAddress(0) & 0x600000) >> 20) : 0;
textureShader = textureShaderCache_->GetDepalettizeShader(clutMode, texFormat, depth ? GE_FORMAT_DEPTH16 : framebuffer->fb_format, smoothedDepal, depthUpperBits);
gstate_c.SetUseShaderDepal(false, false);
gstate_c.SetUseShaderDepal(ShaderDepalMode::OFF);
}
if (textureShader) {
@@ -2042,7 +2052,7 @@ void TextureCacheCommon::ApplyTextureFramebuffer(VirtualFramebuffer *framebuffer
framebufferManager_->BindFramebufferAsColorTexture(0, framebuffer, BINDFBCOLOR_MAY_COPY_WITH_UV | BINDFBCOLOR_APPLY_TEX_OFFSET);
BoundFramebufferTexture();
gstate_c.SetUseShaderDepal(false, false);
gstate_c.SetUseShaderDepal(ShaderDepalMode::OFF);
gstate_c.SetTextureFullAlpha(gstate.getTextureFormat() == GE_TFMT_5650);
}
@@ -2270,12 +2280,6 @@ bool TextureCacheCommon::PrepareBuildTexture(BuildTexturePlan &plan, TexCacheEnt
// For the estimate, we assume cluts always point to 8888 for simplicity.
cacheSizeEstimate_ += EstimateTexMemoryUsage(entry);
if ((entry->bufw == 0 || (gstate.texbufwidth[0] & 0xf800) != 0) && entry->addr >= PSP_GetKernelMemoryEnd()) {
ERROR_LOG_REPORT(G3D, "Texture with unexpected bufw (full=%d)", gstate.texbufwidth[0] & 0xffff);
// Proceeding here can cause a crash.
return false;
}
plan.badMipSizes = false;
// maxLevel here is the max level to upload. Not the count.
plan.levelsToLoad = entry->maxLevel + 1;
+1 -1
View File
@@ -204,7 +204,7 @@ JittedVertexDecoder VertexDecoderJitCache::Compile(const VertexDecoder &dec, int
// Add code to convert matrices to 4x4.
// Later we might want to do this when the matrices are loaded instead.
if (dec.weighttype && g_Config.bSoftwareSkinning) {
if (dec.skinInDecode) {
// Copying from R3 to R4
MOVP2R(R3, gstate.boneMatrix);
MOVP2R(R4, bones);
+1 -1
View File
@@ -190,7 +190,7 @@ JittedVertexDecoder VertexDecoderJitCache::Compile(const VertexDecoder &dec, int
// Add code to convert matrices to 4x4.
// Later we might want to do this when the matrices are loaded instead.
if (dec.weighttype && g_Config.bSoftwareSkinning) {
if (dec.skinInDecode) {
// Copying from R3 to R4
MOVP2R(X3, gstate.boneMatrix);
MOVP2R(X4, bones);
+1 -1
View File
@@ -1083,7 +1083,7 @@ void VertexDecoder::SetVertexType(u32 fmt, const VertexDecoderOptions &options,
DEBUG_LOG(G3D, "VTYPE: THRU=%i TC=%i COL=%i POS=%i NRM=%i WT=%i NW=%i IDX=%i MC=%i", (int)throughmode, tc, col, pos, nrm, weighttype, nweights, idx, morphcount);
}
bool skinInDecode = weighttype != 0 && g_Config.bSoftwareSkinning;
skinInDecode = weighttype != 0 && g_Config.bSoftwareSkinning;
if (weighttype) { // && nweights?
weightoff = size;
+1
View File
@@ -458,6 +458,7 @@ public:
DecVtxFormat decFmt;
bool throughmode;
bool skinInDecode;
u8 size;
u8 onesize_;
+1 -1
View File
@@ -219,7 +219,7 @@ JittedVertexDecoder VertexDecoderJitCache::Compile(const VertexDecoder &dec, int
// Add code to convert matrices to 4x4.
// Later we might want to do this when the matrices are loaded instead.
if (dec.weighttype && g_Config.bSoftwareSkinning) {
if (dec.skinInDecode) {
MOV(PTRBITS, R(tempReg1), ImmPtr(&threeMasks));
MOVAPS(XMM4, MatR(tempReg1));
MOV(PTRBITS, R(tempReg1), ImmPtr(&aOne));
+3
View File
@@ -276,6 +276,9 @@ bool GenerateVertexShader(const VShaderID &id, char *buffer, const ShaderLanguag
// See the fragment shader generator
WRITE(p, "layout (location = 3) out highp float v_fogdepth;\n");
}
WRITE(p, "invariant gl_Position;\n");
} else if (compat.shaderLanguage == HLSL_D3D11 || compat.shaderLanguage == HLSL_D3D9) {
// Note: These two share some code after this hellishly large if/else.
if (compat.shaderLanguage == HLSL_D3D11) {
+3 -2
View File
@@ -26,13 +26,14 @@ std::vector<uint8_t> CompileShaderToBytecodeD3D11(const char *code, size_t codeS
std::string errors;
if (errorMsgs) {
errors = std::string((const char *)errorMsgs->GetBufferPointer(), errorMsgs->GetBufferSize());
std::string numberedCode = LineNumberString(code);
if (SUCCEEDED(result)) {
WARN_LOG(G3D, "%s: %s", "warnings", errors.c_str());
} else {
ERROR_LOG(G3D, "%s: %s", "errors", errors.c_str());
ERROR_LOG(G3D, "%s: %s\n\n%s", "errors", errors.c_str(), numberedCode.c_str());
}
OutputDebugStringA(LineNumberString(code).c_str());
OutputDebugStringA(errors.c_str());
OutputDebugStringA(numberedCode.c_str());
errorMsgs->Release();
}
if (compiledCode) {
+7 -2
View File
@@ -180,8 +180,8 @@ void TextureCacheD3D11::ReleaseTexture(TexCacheEntry *entry, bool delete_them) {
void TextureCacheD3D11::ForgetLastTexture() {
InvalidateLastTexture();
ID3D11ShaderResourceView *nullTex[2]{};
context_->PSSetShaderResources(0, 2, nullTex);
ID3D11ShaderResourceView *nullTex[4]{};
context_->PSSetShaderResources(0, 4, nullTex);
}
void TextureCacheD3D11::InvalidateLastTexture() {
@@ -258,6 +258,7 @@ void TextureCacheD3D11::BindTexture(TexCacheEntry *entry) {
SamplerCacheKey samplerKey = GetSamplingParams(maxLevel, entry);
ID3D11SamplerState *state = samplerCache_.GetOrCreateSampler(device_, samplerKey);
context_->PSSetSamplers(0, 1, &state);
gstate_c.SetUseShaderDepal(ShaderDepalMode::OFF);
}
void TextureCacheD3D11::ApplySamplingParams(const SamplerCacheKey &key) {
@@ -300,6 +301,10 @@ void TextureCacheD3D11::BuildTexture(TexCacheEntry *const entry) {
int tw;
int th;
plan.GetMipSize(0, &tw, &th);
if (tw > 16384)
tw = 16384;
if (th > 16384)
th = 16384;
if (plan.depth == 1) {
// We don't yet have mip generation, so clamp the number of levels to the ones we can load directly.
+25 -11
View File
@@ -29,6 +29,9 @@
namespace GPUBreakpoints {
static void NothingToDo(bool) {
}
struct BreakpointInfo {
bool isConditional = false;
PostfixExpression expression;
@@ -45,7 +48,7 @@ static std::set<u32> breakRenderTargets;
static size_t breakPCsCount = 0;
static size_t breakTexturesCount = 0;
static size_t breakRenderTargetsCount = 0;
static std::function<void(bool)> notifyBreakpoints;
static std::function<void(bool)> notifyBreakpoints = &NothingToDo;
// If these are set, the above are also, but they should be temporary.
static bool breakCmdsTemp[256];
@@ -168,7 +171,24 @@ bool IsRenderTargetCmdBreakpoint(u32 op) {
return false;
}
static bool HitAddressBreakpoint(u32 pc) {
static bool HitBreakpointCond(BreakpointInfo &bp, u32 op) {
u8 cmd = op >> 24;
// Temporarily set the value while running the breakpoint.
// It makes more intuitive sense for the referenced data to already be set.
// Note this won't perform actions, like matrix uploads.
u32 diff = gstate.cmdmem[cmd] ^ op;
gstate.cmdmem[cmd] ^= diff;
u32 result = 1;
if (!GPUDebugExecExpression(gpuDebug, bp.expression, result))
result = 0;
gstate.cmdmem[cmd] ^= diff;
return result != 0;
}
static bool HitAddressBreakpoint(u32 pc, u32 op) {
if (breakPCsCount == 0)
return false;
@@ -178,10 +198,7 @@ static bool HitAddressBreakpoint(u32 pc) {
return false;
if (entry->second.isConditional) {
u32 result = 1;
if (!GPUDebugExecExpression(gpuDebug, breakPCs[pc].expression, result))
return false;
return result != 0;
return HitBreakpointCond(entry->second, op);
}
return true;
}
@@ -193,17 +210,14 @@ static bool HitOpBreakpoint(u32 op) {
if (breakCmdsInfo[cmd].isConditional) {
std::lock_guard<std::mutex> guard(breaksLock);
u32 result = 1;
if (!GPUDebugExecExpression(gpuDebug, breakCmdsInfo[cmd].expression, result))
return false;
return result != 0;
return HitBreakpointCond(breakCmdsInfo[cmd], op);
}
return true;
}
bool IsBreakpoint(u32 pc, u32 op) {
if (HitAddressBreakpoint(pc) || HitOpBreakpoint(op)) {
if (HitAddressBreakpoint(pc, op) || HitOpBreakpoint(op)) {
return true;
}
+11 -11
View File
@@ -188,14 +188,14 @@ static constexpr GECmdInfo geCmdInfo[] = {
{ GE_CMD_FRAMEBUFWIDTH, "fbstride", GECmdFormat::STRIDE },
{ GE_CMD_ZBUFPTR, "zbptr", GECmdFormat::LOW_ADDR_ONLY },
{ GE_CMD_ZBUFWIDTH, "zbstride", GECmdFormat::STRIDE },
{ GE_CMD_TEXADDR0, "texaddr0", GECmdFormat::LOW_ADDR },
{ GE_CMD_TEXADDR1, "texaddr1", GECmdFormat::LOW_ADDR },
{ GE_CMD_TEXADDR2, "texaddr2", GECmdFormat::LOW_ADDR },
{ GE_CMD_TEXADDR3, "texaddr3", GECmdFormat::LOW_ADDR },
{ GE_CMD_TEXADDR4, "texaddr4", GECmdFormat::LOW_ADDR },
{ GE_CMD_TEXADDR5, "texaddr5", GECmdFormat::LOW_ADDR },
{ GE_CMD_TEXADDR6, "texaddr6", GECmdFormat::LOW_ADDR },
{ GE_CMD_TEXADDR7, "texaddr7", GECmdFormat::LOW_ADDR },
{ GE_CMD_TEXADDR0, "texaddr0low", GECmdFormat::LOW_ADDR },
{ GE_CMD_TEXADDR1, "texaddr1low", GECmdFormat::LOW_ADDR },
{ GE_CMD_TEXADDR2, "texaddr2low", GECmdFormat::LOW_ADDR },
{ GE_CMD_TEXADDR3, "texaddr3low", GECmdFormat::LOW_ADDR },
{ GE_CMD_TEXADDR4, "texaddr4low", GECmdFormat::LOW_ADDR },
{ GE_CMD_TEXADDR5, "texaddr5low", GECmdFormat::LOW_ADDR },
{ GE_CMD_TEXADDR6, "texaddr6low", GECmdFormat::LOW_ADDR },
{ GE_CMD_TEXADDR7, "texaddr7low", GECmdFormat::LOW_ADDR },
{ GE_CMD_TEXBUFWIDTH0, "texbufw0", GECmdFormat::STRIDE_HIGH_ADDR },
{ GE_CMD_TEXBUFWIDTH1, "texbufw1", GECmdFormat::STRIDE_HIGH_ADDR },
{ GE_CMD_TEXBUFWIDTH2, "texbufw2", GECmdFormat::STRIDE_HIGH_ADDR },
@@ -204,11 +204,11 @@ static constexpr GECmdInfo geCmdInfo[] = {
{ GE_CMD_TEXBUFWIDTH5, "texbufw5", GECmdFormat::STRIDE_HIGH_ADDR },
{ GE_CMD_TEXBUFWIDTH6, "texbufw6", GECmdFormat::STRIDE_HIGH_ADDR },
{ GE_CMD_TEXBUFWIDTH7, "texbufw7", GECmdFormat::STRIDE_HIGH_ADDR },
{ GE_CMD_CLUTADDR, "clutaddr", GECmdFormat::LOW_ADDR },
{ GE_CMD_CLUTADDR, "clutaddrlow", GECmdFormat::LOW_ADDR },
{ GE_CMD_CLUTADDRUPPER, "clutaddrhigh", GECmdFormat::HIGH_ADDR },
{ GE_CMD_TRANSFERSRC, "transfersrc", GECmdFormat::LOW_ADDR },
{ GE_CMD_TRANSFERSRC, "transfersrclow", GECmdFormat::LOW_ADDR },
{ GE_CMD_TRANSFERSRCW, "transfersrcstride", GECmdFormat::STRIDE_HIGH_ADDR },
{ GE_CMD_TRANSFERDST, "transferdst", GECmdFormat::LOW_ADDR },
{ GE_CMD_TRANSFERDST, "transferdstlow", GECmdFormat::LOW_ADDR },
{ GE_CMD_TRANSFERDSTW, "transferdststride", GECmdFormat::STRIDE_HIGH_ADDR },
{ GE_CMD_UNKNOWN_B6, "unknownb6", GECmdFormat::NONE },
{ GE_CMD_UNKNOWN_B7, "unknownb7", GECmdFormat::NONE },
+1 -1
View File
@@ -48,7 +48,7 @@ enum class GECmdFormat {
STRIDE, // 11 bits.
STRIDE_HIGH_ADDR, // 11 bits stride, 5 ignored, 8 bits high address.
TEX_SIZE, // 4 bits width power, 4 bits ignored, 4 bits height power.
TEX_MAP_MODE, // 8 bits mode (2 bits), 2 bits environment factor.
TEX_MAP_MODE, // 8 bits mode (2 bits), 2 bits matrix factor.
TEX_LIGHT_SRC, // 8 bits lightu (2 bits), 2 bits lightv.
TEX_MODE, // 8 bits swizzle (1 bit), 8 bits separate clut4 (1 bit), 3 bits max level.
TEX_FORMAT, // 4 bits format.
+7 -7
View File
@@ -184,13 +184,13 @@ LinkedShader::LinkedShader(GLRenderManager *render, VShaderID VSID, Shader *vs,
availableUniforms = vs->GetUniformMask() | fs->GetUniformMask();
std::vector<GLRProgram::Initializer> initialize;
initialize.push_back({ &u_tex, 0, 0 });
initialize.push_back({ &u_fbotex, 0, 1 });
initialize.push_back({ &u_testtex, 0, 2 });
initialize.push_back({ &u_pal, 0, 3 }); // CLUT
initialize.push_back({ &u_tess_points, 0, 4 }); // Control Points
initialize.push_back({ &u_tess_weights_u, 0, 5 });
initialize.push_back({ &u_tess_weights_v, 0, 6 });
initialize.push_back({ &u_tex, 0, TEX_SLOT_PSP_TEXTURE });
initialize.push_back({ &u_fbotex, 0, TEX_SLOT_SHADERBLEND_SRC });
initialize.push_back({ &u_testtex, 0, TEX_SLOT_ALPHATEST });
initialize.push_back({ &u_pal, 0, TEX_SLOT_CLUT }); // CLUT
initialize.push_back({ &u_tess_points, 0, TEX_SLOT_SPLINE_POINTS }); // Control Points
initialize.push_back({ &u_tess_weights_u, 0, TEX_SLOT_SPLINE_WEIGHTS_U });
initialize.push_back({ &u_tess_weights_v, 0, TEX_SLOT_SPLINE_WEIGHTS_V });
bool useDualSource = (gstate_c.featureFlags & GPU_SUPPORTS_DUALSOURCE_BLEND) != 0;
bool useClip0 = VSID.Bit(VS_BIT_VERTEX_RANGE_CULLING) && gstate_c.Supports(GPU_SUPPORTS_CLIP_DISTANCE);
+1 -1
View File
@@ -230,7 +230,7 @@ void TextureCacheGLES::BindTexture(TexCacheEntry *entry) {
int maxLevel = (entry->status & TexCacheEntry::STATUS_NO_MIPS) ? 0 : entry->maxLevel;
SamplerCacheKey samplerKey = GetSamplingParams(maxLevel, entry);
ApplySamplingParams(samplerKey);
gstate_c.SetUseShaderDepal(false, false);
gstate_c.SetUseShaderDepal(ShaderDepalMode::OFF);
}
void TextureCacheGLES::Unbind() {
+7
View File
@@ -40,6 +40,13 @@ enum SkipDrawReasonFlags {
SKIPDRAW_WINDOW_MINIMIZED = 8, // Don't draw when the host window is minimized.
};
enum class ShaderDepalMode {
OFF = 0,
NORMAL = 1,
SMOOTHED = 2,
CLUT8_8888 = 3, // Read 8888 framebuffer as 8-bit CLUT.
};
// Global GPU-related utility functions.
// Nothing directly Ge-related in here.
+4 -6
View File
@@ -529,10 +529,9 @@ struct GPUStateCache {
bool IsDirty(u64 what) const {
return (dirty & what) != 0ULL;
}
void SetUseShaderDepal(bool depal, bool smoothed) {
if (depal != useShaderDepal) {
useShaderDepal = depal;
useSmoothedShaderDepal = smoothed;
void SetUseShaderDepal(ShaderDepalMode mode) {
if (mode != shaderDepalMode) {
shaderDepalMode = mode;
Dirty(DIRTY_FRAGMENTSHADER_STATE);
}
}
@@ -628,8 +627,7 @@ struct GPUStateCache {
SubmitType submitType;
int spline_num_points_u;
bool useShaderDepal;
bool useSmoothedShaderDepal;
ShaderDepalMode shaderDepalMode;
GEBufferFormat depalFramebufferFormat;
u32 getRelativeAddress(u32 data) const;
+1 -1
View File
@@ -605,7 +605,7 @@ void GeDisassembleOp(u32 pc, u32 op, u32 prev, char *buffer, int bufsize) {
{
int w = 1 << (data & 0xf);
int h = 1 << ((data>>8) & 0xf);
if ((data & ~0x0F0F) && w <= 512 && h <= 512)
if ((data & ~0x0F0F) == 0 && w <= 512 && h <= 512)
snprintf(buffer, bufsize, "Texture size %d: %dx%d", cmd - GE_CMD_TEXSIZE0, w, h);
else
snprintf(buffer, bufsize, "Texture size %d: %dx%d (extra %06x)", cmd - GE_CMD_TEXSIZE0, w, h, data);
+5 -5
View File
@@ -228,11 +228,11 @@ public:
Vec3() {}
Vec3(const T a[3]) : x(a[0]), y(a[1]), z(a[2]) {}
Vec3(const T& _x, const T& _y, const T& _z) : x(_x), y(_y), z(_z) {}
constexpr Vec3(const T& _x, const T& _y, const T& _z) : x(_x), y(_y), z(_z) {}
Vec3(const Vec2<T>& _xy, const T& _z) : x(_xy.x), y(_xy.y), z(_z) {}
#if defined(_M_SSE)
Vec3(const __m128 &_vec) : vec(_vec) {}
Vec3(const __m128i &_ivec) : ivec(_ivec) {}
constexpr Vec3(const __m128 &_vec) : vec(_vec) {}
constexpr Vec3(const __m128i &_ivec) : ivec(_ivec) {}
Vec3(const Vec3Packed<T> &_xyz) {
vec = _mm_loadu_ps(_xyz.AsArray());
}
@@ -249,7 +249,7 @@ public:
#endif
template<typename T2>
Vec3<T2> Cast() const
constexpr Vec3<T2> Cast() const
{
return Vec3<T2>((T2)x, (T2)y, (T2)z);
}
@@ -258,7 +258,7 @@ public:
static Vec3 FromRGB(unsigned int rgb);
unsigned int ToRGB() const; // alpha bits set to zero
static Vec3 AssignToAll(const T& f)
static constexpr Vec3 AssignToAll(const T& f)
{
return Vec3<T>(f, f, f);
}
+2 -2
View File
@@ -166,7 +166,7 @@ void BinManager::UpdateState(bool throughMode) {
if (HasDirty(SoftDirty::PIXEL_ALL | SoftDirty::SAMPLER_ALL | SoftDirty::RAST_ALL)) {
if (states_.Full())
Flush("states");
stateIndex_ = (int)states_.Push(RasterizerState());
stateIndex_ = (uint16_t)states_.Push(RasterizerState());
ComputeRasterizerState(&states_[stateIndex_], throughMode);
states_[stateIndex_].samplerID.cached.clut = cluts_[clutIndex_].readable;
@@ -312,7 +312,7 @@ void BinManager::UpdateClut(const void *src) {
PROFILE_THIS_SCOPE("bin_clut");
if (cluts_.Full())
Flush("cluts");
clutIndex_ = (int)cluts_.Push(BinClut());
clutIndex_ = (uint16_t)cluts_.Push(BinClut());
memcpy(cluts_[clutIndex_].readable, src, sizeof(BinClut));
}
+4 -4
View File
@@ -24,7 +24,7 @@
struct BinWaitable;
class DrawBinItemsTask;
enum class BinItemType {
enum class BinItemType : uint8_t {
TRIANGLE,
CLEAR_RECT,
RECT,
@@ -48,7 +48,7 @@ struct BinCoords {
struct BinItem {
BinItemType type;
int stateIndex;
uint16_t stateIndex;
BinCoords range;
VertexData v0;
VertexData v1;
@@ -237,9 +237,9 @@ protected:
private:
BinStateQueue states_;
int stateIndex_;
BinClutQueue cluts_;
int clutIndex_;
uint16_t stateIndex_;
uint16_t clutIndex_;
BinCoords scissor_;
BinItemQueue queue_;
BinCoords queueRange_;
+10 -6
View File
@@ -325,6 +325,10 @@ static inline bool DepthTestPassed(GEComparison func, int x, int y, int stride,
}
}
bool CheckDepthTestPassed(GEComparison func, int x, int y, int stride, u16 z) {
return DepthTestPassed(func, x, y, stride, z);
}
static inline u32 ApplyLogicOp(GELogicOp op, u32 old_color, u32 new_color) {
// All of the operations here intentionally preserve alpha/stencil.
switch (op) {
@@ -400,7 +404,7 @@ template <bool clearMode, GEBufferFormat fbFormat>
void SOFTRAST_CALL DrawSinglePixel(int x, int y, int z, int fog, Vec4IntArg color_in, const PixelFuncID &pixelID) {
Vec4<int> prim_color = Vec4<int>(color_in).Clamp(0, 255);
// Depth range test - applied in clear mode, if not through mode.
if (pixelID.applyDepthRange)
if (pixelID.applyDepthRange && !pixelID.earlyZChecks)
if (z < pixelID.cached.minz || z > pixelID.cached.maxz)
return;
@@ -411,7 +415,9 @@ void SOFTRAST_CALL DrawSinglePixel(int x, int y, int z, int fog, Vec4IntArg colo
// Fog is applied prior to color test.
if (pixelID.applyFog && !clearMode) {
Vec3<int> fogColor = Vec3<int>::FromRGB(pixelID.cached.fogColor);
fogColor = (prim_color.rgb() * fog + fogColor * (255 - fog)) / 255;
// This is very similar to the BLEND texfunc, and simply always rounds up.
static constexpr Vec3<int> roundup = Vec3<int>::AssignToAll(255);
fogColor = (prim_color.rgb() * fog + fogColor * (255 - fog) + roundup) / 256;
prim_color.r() = fogColor.r();
prim_color.g() = fogColor.g();
prim_color.b() = fogColor.b();
@@ -436,14 +442,14 @@ void SOFTRAST_CALL DrawSinglePixel(int x, int y, int z, int fog, Vec4IntArg colo
}
// Also apply depth at the same time. If disabled, same as passing.
if (pixelID.DepthTestFunc() != GE_COMP_ALWAYS && !DepthTestPassed(pixelID.DepthTestFunc(), x, y, pixelID.cached.depthbufStride, z)) {
if (!pixelID.earlyZChecks && pixelID.DepthTestFunc() != GE_COMP_ALWAYS && !DepthTestPassed(pixelID.DepthTestFunc(), x, y, pixelID.cached.depthbufStride, z)) {
stencil = ApplyStencilOp(fbFormat, stencilReplace, pixelID.ZFail(), stencil);
SetPixelStencil(fbFormat, pixelID.cached.framebufStride, targetWriteMask, x, y, stencil);
return;
}
stencil = ApplyStencilOp(fbFormat, stencilReplace, pixelID.ZPass(), stencil);
} else {
} else if (!pixelID.earlyZChecks) {
if (pixelID.DepthTestFunc() != GE_COMP_ALWAYS && !DepthTestPassed(pixelID.DepthTestFunc(), x, y, pixelID.cached.depthbufStride, z)) {
return;
}
@@ -544,8 +550,6 @@ void PixelJitCache::Clear() {
constBlendHalf_11_4s_ = nullptr;
constBlendInvert_11_4s_ = nullptr;
const255_16s_ = nullptr;
constBy255i_ = nullptr;
}
std::string PixelJitCache::DescribeCodePtr(const u8 *ptr) {
+2 -2
View File
@@ -41,6 +41,8 @@ SingleFunc GetSingleFunc(const PixelFuncID &id);
void Init();
void Shutdown();
bool CheckDepthTestPassed(GEComparison func, int x, int y, int stride, u16 z);
bool DescribeCodePtr(const u8 *ptr, std::string &name);
struct PixelBlendState {
@@ -104,8 +106,6 @@ private:
const u8 *constBlendHalf_11_4s_ = nullptr;
const u8 *constBlendInvert_11_4s_ = nullptr;
const u8 *const255_16s_ = nullptr;
const u8 *constBy255i_ = nullptr;
#if PPSSPP_ARCH(X86) || PPSSPP_ARCH(AMD64)
void Discard();
+17 -19
View File
@@ -149,7 +149,7 @@ RegCache::Reg PixelJitCache::GetColorOff(const PixelFuncID &id) {
if (!regCache_.Has(RegCache::GEN_COLOR_OFF)) {
Describe("GetColorOff");
if (id.useStandardStride && !id.dithering) {
bool loadDepthOff = id.depthWrite || id.DepthTestFunc() != GE_COMP_ALWAYS;
bool loadDepthOff = id.depthWrite || (id.DepthTestFunc() != GE_COMP_ALWAYS && !id.earlyZChecks);
X64Reg depthTemp = INVALID_REG;
X64Reg argYReg = regCache_.Find(RegCache::GEN_ARG_Y);
X64Reg argXReg = regCache_.Find(RegCache::GEN_ARG_X);
@@ -336,16 +336,10 @@ void PixelJitCache::WriteConstantPool(const PixelFuncID &id) {
// This is used for shifted blend factors, to inverse them.
WriteSimpleConst8x16(constBlendInvert_11_4s_, 0xFF << 4);
// A set of 255s, used to inverse fog.
WriteSimpleConst8x16(const255_16s_, 0xFF);
// This is used for a multiply that divides by 255 with shifting.
WriteSimpleConst8x16(constBy255i_, 0x8081);
}
bool PixelJitCache::Jit_ApplyDepthRange(const PixelFuncID &id) {
if (id.applyDepthRange) {
if (id.applyDepthRange && !id.earlyZChecks) {
Describe("ApplyDepthR");
X64Reg argZReg = regCache_.Find(RegCache::GEN_ARG_Z);
X64Reg idReg = GetPixelID();
@@ -365,7 +359,7 @@ bool PixelJitCache::Jit_ApplyDepthRange(const PixelFuncID &id) {
// Since this is early on, try to free up the z reg if we don't need it anymore.
if (id.clearMode && !id.DepthClear())
regCache_.ForceRelease(RegCache::GEN_ARG_Z);
else if (!id.clearMode && !id.depthWrite && id.DepthTestFunc() == GE_COMP_ALWAYS)
else if (!id.clearMode && !id.depthWrite && (id.DepthTestFunc() == GE_COMP_ALWAYS || id.earlyZChecks))
regCache_.ForceRelease(RegCache::GEN_ARG_Z);
return true;
@@ -535,7 +529,8 @@ bool PixelJitCache::Jit_ApplyFog(const PixelFuncID &id) {
// Load a set of 255s at 16 bit into a reg for later...
X64Reg invertReg = regCache_.Alloc(RegCache::VEC_TEMP2);
MOVDQA(invertReg, M(const255_16s_));
PCMPEQW(invertReg, R(invertReg));
PSRLW(invertReg, 8);
// Expand (we clamped) color to 16 bit as well, so we can multiply with fog.
X64Reg argColorReg = regCache_.Find(RegCache::VEC_ARG_COLOR);
@@ -568,21 +563,24 @@ bool PixelJitCache::Jit_ApplyFog(const PixelFuncID &id) {
// We can free up the actual fog reg now.
regCache_.ForceRelease(RegCache::GEN_ARG_FOG);
// Our goal here is to calculate this formula:
// (argColor * fog + fogColor * (255 - fog) + 255) / 256
// Now we multiply the existing color by fog...
PMULLW(argColorReg, R(fogMultReg));
// And then inverse the fog value using those 255s we loaded, and multiply by fog color.
PSUBUSW(invertReg, R(fogMultReg));
// Before inversing, let's add that 255 we loaded in as well, since we have it.
PADDW(argColorReg, R(invertReg));
// And then inverse the fog value using those 255s, and multiply by fog color.
PSUBW(invertReg, R(fogMultReg));
PMULLW(fogColorReg, R(invertReg));
// At this point, argColorReg and fogColorReg are multiplied at 16-bit, so we need to sum.
PADDUSW(argColorReg, R(fogColorReg));
PADDW(argColorReg, R(fogColorReg));
regCache_.Release(fogColorReg, RegCache::VEC_TEMP1);
regCache_.Release(invertReg, RegCache::VEC_TEMP2);
regCache_.Release(fogMultReg, RegCache::VEC_TEMP3);
// Now to divide by 255, we use bit tricks: multiply by 0x8081, and shift right by 16+7.
PMULHUW(argColorReg, M(constBy255i_));
// Now shift right by 7 (PMULHUW already did 16 of the shift.)
PSRLW(argColorReg, 7);
// Now we simply divide by 256, or in other words shift by 8.
PSRLW(argColorReg, 8);
// Okay, put A back in, we'll shrink it to 8888 when needed.
PINSRW(argColorReg, R(alphaReg), 3);
@@ -721,7 +719,7 @@ bool PixelJitCache::Jit_StencilTest(const PixelFuncID &id, RegCache::Reg stencil
}
bool PixelJitCache::Jit_DepthTestForStencil(const PixelFuncID &id, RegCache::Reg stencilReg) {
if (id.DepthTestFunc() == GE_COMP_ALWAYS)
if (id.DepthTestFunc() == GE_COMP_ALWAYS || id.earlyZChecks)
return true;
X64Reg depthOffReg = GetDepthOff(id);
@@ -964,7 +962,7 @@ bool PixelJitCache::Jit_WriteStencilOnly(const PixelFuncID &id, RegCache::Reg st
}
bool PixelJitCache::Jit_DepthTest(const PixelFuncID &id) {
if (id.DepthTestFunc() == GE_COMP_ALWAYS)
if (id.DepthTestFunc() == GE_COMP_ALWAYS || id.earlyZChecks)
return true;
if (id.DepthTestFunc() == GE_COMP_NEVER) {
+47 -19
View File
@@ -79,6 +79,7 @@ void ComputePixelFuncID(PixelFuncID *id, bool throughMode) {
id->stencilTest = gstate.isStencilTestEnabled();
}
id->depthWrite = gstate.isDepthTestEnabled() && gstate.isDepthWriteEnabled();
id->depthTestFunc = gstate.isDepthTestEnabled() ? gstate.getDepthTestFunction() : GE_COMP_ALWAYS;
if (id->stencilTest) {
id->stencilTestRef = gstate.getStencilTestRef() & gstate.getStencilTestMask();
@@ -93,13 +94,6 @@ void ComputePixelFuncID(PixelFuncID *id, bool throughMode) {
if (gstate.FrameBufFormat() != GE_FORMAT_565 && gstate.getStencilOpZPass() <= GE_STENCILOP_DECR)
id->zPass = gstate.getStencilOpZPass();
// Always treat zPass/zFail the same if there's no depth test.
if (!gstate.isDepthTestEnabled() || gstate.getDepthTestFunction() == GE_COMP_ALWAYS)
id->zFail = id->zPass;
// And same for sFail if there's no stencil test.
if (id->StencilTestFunc() == GE_COMP_ALWAYS)
id->sFail = id->zPass;
// Normalize REPLACE 00 to ZERO, especially if using a mask.
if (gstate.getStencilTestRef() == 0) {
if (id->SFail() == GE_STENCILOP_REPLACE)
@@ -120,14 +114,27 @@ void ComputePixelFuncID(PixelFuncID *id, bool throughMode) {
id->zPass = GE_STENCILOP_ZERO;
}
// Turn off stencil testing if it's doing nothing.
if (id->SFail() == GE_STENCILOP_KEEP && id->ZFail() == GE_STENCILOP_KEEP && id->ZPass() == GE_STENCILOP_KEEP) {
if (id->StencilTestFunc() == GE_COMP_ALWAYS)
// And same for sFail if there's no stencil test. Prefer KEEP, though.
if (id->StencilTestFunc() == GE_COMP_ALWAYS) {
if (id->DepthTestFunc() == GE_COMP_ALWAYS)
id->zFail = GE_STENCILOP_KEEP;
id->sFail = GE_STENCILOP_KEEP;
// Always doesn't need a mask.
id->stencilTestRef = gstate.getStencilTestRef();
id->hasStencilTestMask = false;
// Turn off stencil testing if it's doing nothing.
if (id->SFail() == GE_STENCILOP_KEEP && id->ZFail() == GE_STENCILOP_KEEP && id->ZPass() == GE_STENCILOP_KEEP) {
id->stencilTest = false;
id->stencilTestFunc = 0;
id->stencilTestRef = 0;
}
} else if (id->DepthTestFunc() == GE_COMP_ALWAYS) {
// Always treat zPass/zFail the same if there's no depth test.
id->zFail = id->zPass;
}
}
id->depthTestFunc = gstate.isDepthTestEnabled() ? gstate.getDepthTestFunction() : GE_COMP_ALWAYS;
id->alphaTestFunc = gstate.isAlphaTestEnabled() ? gstate.getAlphaTestFunction() : GE_COMP_ALWAYS;
if (id->AlphaTestFunc() != GE_COMP_ALWAYS) {
id->alphaTestRef = gstate.getAlphaTestRef() & gstate.getAlphaTestMask();
@@ -163,6 +170,13 @@ void ComputePixelFuncID(PixelFuncID *id, bool throughMode) {
id->applyLogicOp = gstate.isLogicOpEnabled() && gstate.getLogicOp() != GE_LOGIC_COPY;
id->applyFog = gstate.isFogEnabled() && !throughMode;
id->earlyZChecks = id->DepthTestFunc() != GE_COMP_ALWAYS;
if (id->stencilTest && id->earlyZChecks) {
// Can't do them early if stencil might need to write.
if (id->SFail() != GE_STENCILOP_KEEP || id->ZFail() != GE_STENCILOP_KEEP)
id->earlyZChecks = false;
}
}
// Cache some values for later convenience.
@@ -272,6 +286,8 @@ std::string DescribePixelFuncID(const PixelFuncID &id) {
desc = "INVALID:" + desc;
}
if (id.earlyZChecks)
desc += "ZEarly:";
if (id.DepthTestFunc() != GE_COMP_ALWAYS) {
if (id.clearMode)
desc = "INVALID:" + desc;
@@ -305,7 +321,8 @@ std::string DescribePixelFuncID(const PixelFuncID &id) {
}
if (id.hasStencilTestMask)
desc += "Msk";
desc += StringFromFormat("%02X:", id.stencilTestRef);
if (id.StencilTestFunc() != GE_COMP_ALWAYS || id.DepthTestFunc() != GE_COMP_ALWAYS)
desc += StringFromFormat("%02X:", id.stencilTestRef);
} else if (id.hasStencilTestMask || id.stencilTestRef != 0 || id.stencilTestFunc != 0) {
desc = "INVALID:" + desc;
}
@@ -326,13 +343,24 @@ std::string DescribePixelFuncID(const PixelFuncID &id) {
case GE_STENCILOP_INCR: desc += "ZTstFInc:"; break;
case GE_STENCILOP_DECR: desc += "ZTstFDec:"; break;
}
switch (id.ZPass()) {
case GE_STENCILOP_KEEP: break;
case GE_STENCILOP_ZERO: desc += "ZTstT0:"; break;
case GE_STENCILOP_REPLACE: desc += "ZTstTRpl:"; break;
case GE_STENCILOP_INVERT: desc += "ZTstTXor:"; break;
case GE_STENCILOP_INCR: desc += "ZTstTInc:"; break;
case GE_STENCILOP_DECR: desc += "ZTstTDec:"; break;
if (id.StencilTestFunc() == GE_COMP_ALWAYS && id.DepthTestFunc() == GE_COMP_ALWAYS) {
switch (id.ZPass()) {
case GE_STENCILOP_KEEP: break;
case GE_STENCILOP_ZERO: desc += "Zero:"; break;
case GE_STENCILOP_REPLACE: desc += StringFromFormat("Rpl%02X:", id.stencilTestRef); break;
case GE_STENCILOP_INVERT: desc += "Xor:"; break;
case GE_STENCILOP_INCR: desc += "Inc:"; break;
case GE_STENCILOP_DECR: desc += "Dec:"; break;
}
} else {
switch (id.ZPass()) {
case GE_STENCILOP_KEEP: break;
case GE_STENCILOP_ZERO: desc += "ZTstT0:"; break;
case GE_STENCILOP_REPLACE: desc += "ZTstTRpl:"; break;
case GE_STENCILOP_INVERT: desc += "ZTstTXor:"; break;
case GE_STENCILOP_INCR: desc += "ZTstTInc:"; break;
case GE_STENCILOP_DECR: desc += "ZTstTDec:"; break;
}
}
if (!id.stencilTest || id.clearMode) {
if (id.sFail != 0 || id.zFail != 0 || id.zPass != 0)
+2 -1
View File
@@ -107,7 +107,8 @@ struct PixelFuncID {
uint8_t sFail : 3;
uint8_t zFail : 3;
uint8_t zPass : 3;
// 60 bits, 4 free.
bool earlyZChecks : 1;
// 61 bits, 3 free.
};
};
+4 -4
View File
@@ -276,12 +276,12 @@ void Process(VertexData &vertex, const WorldCoords &worldpos, const WorldCoords
}
if (state.setColor1) {
vertex.color0 = final_color.Clamp(0, 255);
vertex.color1 = specular_color.Clamp(0, 255).rgb();
vertex.color0 = final_color.Clamp(0, 255).ToRGBA();
vertex.color1 = specular_color.Clamp(0, 255).rgb().ToRGB();
} else if (state.addColor1) {
vertex.color0 = (final_color + specular_color).Clamp(0, 255);
vertex.color0 = (final_color + specular_color).Clamp(0, 255).ToRGBA();
} else {
vertex.color0 = final_color.Clamp(0, 255);
vertex.color0 = final_color.Clamp(0, 255).ToRGBA();
}
}
+116 -33
View File
@@ -348,7 +348,7 @@ Vec3<int> AlphaBlendingResult(const PixelFuncID &pixelID, const Vec4<int> &sourc
return Vec3<int>(_mm_unpacklo_epi16(_mm_adds_epi16(s, d), _mm_setzero_si128()));
#else
Vec3<int> half = Vec3<int>::AssignToAll(1);
static constexpr Vec3<int> half = Vec3<int>::AssignToAll(1);
Vec3<int> lhs = ((source.rgb() * 2 + half) * (srcfactor * 2 + half)) / 1024;
Vec3<int> rhs = ((dst.rgb() * 2 + half) * (dstfactor * 2 + half)) / 1024;
return lhs + rhs;
@@ -370,7 +370,7 @@ Vec3<int> AlphaBlendingResult(const PixelFuncID &pixelID, const Vec4<int> &sourc
return Vec3<int>(_mm_unpacklo_epi16(_mm_max_epi16(_mm_subs_epi16(s, d), _mm_setzero_si128()), _mm_setzero_si128()));
#else
Vec3<int> half = Vec3<int>::AssignToAll(1);
static constexpr Vec3<int> half = Vec3<int>::AssignToAll(1);
Vec3<int> lhs = ((source.rgb() * 2 + half) * (srcfactor * 2 + half)) / 1024;
Vec3<int> rhs = ((dst.rgb() * 2 + half) * (dstfactor * 2 + half)) / 1024;
return lhs - rhs;
@@ -392,7 +392,7 @@ Vec3<int> AlphaBlendingResult(const PixelFuncID &pixelID, const Vec4<int> &sourc
return Vec3<int>(_mm_unpacklo_epi16(_mm_max_epi16(_mm_subs_epi16(d, s), _mm_setzero_si128()), _mm_setzero_si128()));
#else
Vec3<int> half = Vec3<int>::AssignToAll(1);
static constexpr Vec3<int> half = Vec3<int>::AssignToAll(1);
Vec3<int> lhs = ((source.rgb() * 2 + half) * (srcfactor * 2 + half)) / 1024;
Vec3<int> rhs = ((dst.rgb() * 2 + half) * (dstfactor * 2 + half)) / 1024;
return rhs - lhs;
@@ -710,12 +710,24 @@ void DrawTriangleSlice(
const bool flatColor1 = flatColorAll || (v0.color1 == v1.color1 && v0.color1 == v2.color1);
const bool noFog = clearMode || !pixelID.applyFog || (v0.fogdepth >= 1.0f && v1.fogdepth >= 1.0f && v2.fogdepth >= 1.0f);
if (pixelID.applyDepthRange && flatZ) {
if (v0.screenpos.z < pixelID.cached.minz || v0.screenpos.z > pixelID.cached.maxz)
return;
}
#if defined(SOFTGPU_MEMORY_TAGGING_DETAILED) || defined(SOFTGPU_MEMORY_TAGGING_BASIC)
uint32_t bpp = pixelID.FBFormat() == GE_FORMAT_8888 ? 4 : 2;
std::string tag = StringFromFormat("DisplayListT_%08x", state.listPC);
std::string ztag = StringFromFormat("DisplayListTZ_%08x", state.listPC);
#endif
const Vec4<int> v0_c0 = Vec4<int>::FromRGBA(v0.color0);
const Vec4<int> v1_c0 = Vec4<int>::FromRGBA(v1.color0);
const Vec4<int> v2_c0 = Vec4<int>::FromRGBA(v2.color0);
const Vec3<int> v0_c1 = Vec3<int>::FromRGB(v0.color1);
const Vec3<int> v1_c1 = Vec3<int>::FromRGB(v1.color1);
const Vec3<int> v2_c1 = Vec3<int>::FromRGB(v2.color1);
for (int64_t curY = minY; curY <= maxY; curY += SCREEN_SCALE_FACTOR * 2,
w0_base = e0.StepY(w0_base),
w1_base = e1.StepY(w1_base),
@@ -754,27 +766,53 @@ void DrawTriangleSlice(
if (AnyMask<useSSE4>(mask)) {
Vec4<float> wsum_recip = EdgeRecip(w0, w1, w2);
Vec4<int> z;
if (flatZ) {
z = Vec4<int>::AssignToAll(v2.screenpos.z);
} else {
// Z is interpolated pretty much directly.
Vec4<float> zfloats = w0.Cast<float>() * v0.screenpos.z + w1.Cast<float>() * v1.screenpos.z + w2.Cast<float>() * v2.screenpos.z;
z = (zfloats * wsum_recip).Cast<int>();
}
if (pixelID.earlyZChecks) {
for (int i = 0; i < 4; ++i) {
if (pixelID.applyDepthRange) {
if (z[i] < pixelID.cached.minz || z[i] > pixelID.cached.maxz)
mask[i] = -1;
}
if (mask[i] < 0)
continue;
int x = p.x + (i & 1);
int y = p.y + (i / 2);
if (!CheckDepthTestPassed(pixelID.DepthTestFunc(), x, y, pixelID.cached.depthbufStride, z[i])) {
mask[i] = -1;
}
}
}
// Color interpolation is not perspective corrected on the PSP.
Vec4<int> prim_color[4];
if (!flatColor0) {
for (int i = 0; i < 4; ++i) {
if (mask[i] >= 0)
prim_color[i] = Interpolate(v0.color0, v1.color0, v2.color0, w0[i], w1[i], w2[i], wsum_recip[i]);
prim_color[i] = Interpolate(v0_c0, v1_c0, v2_c0, w0[i], w1[i], w2[i], wsum_recip[i]);
}
} else {
for (int i = 0; i < 4; ++i) {
prim_color[i] = v2.color0;
prim_color[i] = v2_c0;
}
}
Vec3<int> sec_color[4];
if (!flatColor1) {
for (int i = 0; i < 4; ++i) {
if (mask[i] >= 0)
sec_color[i] = Interpolate(v0.color1, v1.color1, v2.color1, w0[i], w1[i], w2[i], wsum_recip[i]);
sec_color[i] = Interpolate(v0_c1, v1_c1, v2_c1, w0[i], w1[i], w2[i], wsum_recip[i]);
}
} else {
for (int i = 0; i < 4; ++i) {
sec_color[i] = v2.color1;
sec_color[i] = v2_c1;
}
}
@@ -816,15 +854,6 @@ void DrawTriangleSlice(
}
}
Vec4<int> z;
if (flatZ) {
z = Vec4<int>::AssignToAll(v2.screenpos.z);
} else {
// Z is interpolated pretty much directly.
Vec4<float> zfloats = w0.Cast<float>() * v0.screenpos.z + w1.Cast<float>() * v1.screenpos.z + w2.Cast<float>() * v2.screenpos.z;
z = (zfloats * wsum_recip).Cast<int>();
}
PROFILE_THIS_SCOPE("draw_tri_px");
DrawingCoords subp = p;
for (int i = 0; i < 4; ++i) {
@@ -943,9 +972,16 @@ void DrawRectangle(const VertexData &v0, const VertexData &v1, const BinCoords &
const Vec4f tto4(0.0f, 0.5f * stx.t(), 0.5f * sty.t(), 0.5f * stx.t() + 0.5f * sty.t());
ScreenCoords pprime(minX, minY, 0);
Vec4<int> fog = Vec4<int>::AssignToAll(ClampFogDepth(v1.fogdepth));
Vec4<int> z = Vec4<int>::AssignToAll(v1.screenpos.z);
Vec3<int> sec_color = v1.color1;
const Vec4<int> fog = Vec4<int>::AssignToAll(ClampFogDepth(v1.fogdepth));
const Vec4<int> z = Vec4<int>::AssignToAll(v1.screenpos.z);
const Vec4<int> c0 = Vec4<int>::FromRGBA(v1.color0);
const Vec3<int> sec_color = Vec3<int>::FromRGB(v1.color1);
if (state.pixelID.applyDepthRange) {
// We can bail early since the Z is flat.
if (v1.screenpos.z < state.pixelID.cached.minz || v1.screenpos.z > state.pixelID.cached.maxz)
return;
}
#if defined(SOFTGPU_MEMORY_TAGGING_DETAILED) || defined(SOFTGPU_MEMORY_TAGGING_BASIC)
uint32_t bpp = state.pixelID.FBFormat() == GE_FORMAT_8888 ? 4 : 2;
@@ -969,7 +1005,20 @@ void DrawRectangle(const VertexData &v0, const VertexData &v1, const BinCoords &
Vec4<int> prim_color[4];
for (int i = 0; i < 4; ++i) {
prim_color[i] = v1.color0;
prim_color[i] = c0;
}
if (state.pixelID.earlyZChecks) {
for (int i = 0; i < 4; ++i) {
if (mask[i] < 0)
continue;
int x = p.x + (i & 1);
int y = p.y + (i / 2);
if (!CheckDepthTestPassed(state.pixelID.DepthTestFunc(), x, y, state.pixelID.cached.depthbufStride, z[i])) {
mask[i] = -1;
}
}
}
if (state.enableTextures) {
@@ -1032,12 +1081,26 @@ void DrawRectangle(const VertexData &v0, const VertexData &v1, const BinCoords &
void DrawPoint(const VertexData &v0, const BinCoords &range, const RasterizerState &state) {
ScreenCoords pos = v0.screenpos;
Vec4<int> prim_color = v0.color0;
Vec3<int> sec_color = v0.color1;
Vec4<int> prim_color = Vec4<int>::FromRGBA(v0.color0);
Vec3<int> sec_color = Vec3<int>::FromRGB(v0.color1);
auto &pixelID = state.pixelID;
auto &samplerID = state.samplerID;
DrawingCoords p = TransformUnit::ScreenToDrawing(pos);
u16 z = pos.z;
if (pixelID.earlyZChecks) {
if (pixelID.applyDepthRange) {
if (z < pixelID.cached.minz || z > pixelID.cached.maxz)
return;
}
if (!CheckDepthTestPassed(pixelID.DepthTestFunc(), p.x, p.y, pixelID.cached.depthbufStride, z)) {
return;
}
}
if (state.enableTextures) {
float s = v0.texturecoords.s();
float t = v0.texturecoords.t();
@@ -1060,9 +1123,6 @@ void DrawPoint(const VertexData &v0, const BinCoords &range, const RasterizerSta
if (!pixelID.clearMode)
prim_color += Vec4<int>(sec_color, 0);
DrawingCoords p = TransformUnit::ScreenToDrawing(pos);
u16 z = pos.z;
u8 fog = 255;
if (pixelID.applyFog) {
fog = ClampFogDepth(v0.fogdepth);
@@ -1166,7 +1226,7 @@ void ClearRectangle(const VertexData &v0, const VertexData &v1, const BinCoords
keepOldMask |= pixelID.cached.colorWriteMask;
}
const u32 new_color = v1.color0.ToRGBA();
const u32 new_color = v1.color0;
u16 new_color16;
switch (pixelID.FBFormat()) {
case GE_FORMAT_565:
@@ -1291,6 +1351,10 @@ void DrawLine(const VertexData &v0, const VertexData &v1, const BinCoords &range
auto &samplerID = state.samplerID;
const bool interpolateColor = !state.shadeGouraud || (v0.color0 == v1.color0 && v0.color1 == v1.color1);
const Vec4<int> v0_c0 = Vec4<int>::FromRGBA(v0.color0);
const Vec4<int> v1_c0 = Vec4<int>::FromRGBA(v1.color0);
const Vec3<int> v0_c1 = Vec3<int>::FromRGB(v0.color1);
const Vec3<int> v1_c1 = Vec3<int>::FromRGB(v1.color1);
#if defined(SOFTGPU_MEMORY_TAGGING_DETAILED) || defined(SOFTGPU_MEMORY_TAGGING_BASIC)
std::string tag = StringFromFormat("DisplayListL_%08x", state.listPC);
@@ -1302,16 +1366,32 @@ void DrawLine(const VertexData &v0, const VertexData &v1, const BinCoords &range
double z = a.z;
const int steps1 = steps == 0 ? 1 : steps;
for (int i = 0; i < steps; i++) {
if (x >= range.x1 && y >= range.y1 && x <= range.x2 && y <= range.y2) {
DrawingCoords p = TransformUnit::ScreenToDrawing(x, y);
bool maskOK = x >= range.x1 && y >= range.y1 && x <= range.x2 && y <= range.y2;
if (maskOK) {
if (pixelID.earlyZChecks) {
if (pixelID.applyDepthRange) {
if (z < pixelID.cached.minz || z > pixelID.cached.maxz)
maskOK = false;
}
if (!CheckDepthTestPassed(pixelID.DepthTestFunc(), x, y, pixelID.cached.depthbufStride, z)) {
maskOK = false;
}
}
}
if (maskOK) {
// Interpolate between the two points.
Vec4<int> prim_color;
Vec3<int> sec_color;
if (interpolateColor) {
prim_color = (v0.color0 * (steps - i) + v1.color0 * i) / steps1;
sec_color = (v0.color1 * (steps - i) + v1.color1 * i) / steps1;
prim_color = (v0_c0 * (steps - i) + v1_c0 * i) / steps1;
sec_color = (v0_c1 * (steps - i) + v1_c1 * i) / steps1;
} else {
prim_color = v1.color0;
sec_color = v1.color1;
prim_color = v1_c0;
sec_color = v1_c1;
}
u8 fog = 255;
@@ -1368,7 +1448,6 @@ void DrawLine(const VertexData &v0, const VertexData &v1, const BinCoords &range
prim_color += Vec4<int>(sec_color, 0);
PROFILE_THIS_SCOPE("draw_px");
DrawingCoords p = TransformUnit::ScreenToDrawing(x, y);
state.drawPixel(p.x, p.y, z, fog, ToVec4IntArg(prim_color), pixelID);
#if defined(SOFTGPU_MEMORY_TAGGING_DETAILED) || defined(SOFTGPU_MEMORY_TAGGING_BASIC)
@@ -1401,7 +1480,11 @@ bool GetCurrentTexture(GPUDebugBuffer &buffer, int level)
int w = gstate.getTextureWidth(level);
int h = gstate.getTextureHeight(level);
if (!texaddr || !Memory::IsValidRange(texaddr, (textureBitsPerPixel[texfmt] * texbufw * h) / 8))
u32 sizeInBits = textureBitsPerPixel[texfmt] * (texbufw * (h - 1) + w);
if (!texaddr || !Memory::IsValidRange(texaddr, sizeInBits / 8))
return false;
// We'll break trying to allocate this much.
if (w >= 0x8000 && h >= 0x8000)
return false;
buffer.Allocate(w, h, GE_FORMAT_8888, false);
+98 -46
View File
@@ -119,7 +119,7 @@ void DrawSprite(const VertexData &v0, const VertexData &v1, const BinCoords &ran
int z = v1.screenpos.z;
int fog = 255;
bool isWhite = v1.color0 == Vec4<int>(255, 255, 255, 255);
bool isWhite = v1.color0 == 0xFFFFFFFF;
if (state.enableTextures) {
// 1:1 (but with mirror support) texture mapping!
@@ -176,11 +176,12 @@ void DrawSprite(const VertexData &v0, const VertexData &v1, const BinCoords &ran
}
} else {
int t = t_start;
const Vec4<int> c0 = Vec4<int>::FromRGBA(v1.color0);
for (int y = pos0.y; y < pos1.y; y++) {
int s = s_start;
u16 *pixel = fb.Get16Ptr(pos0.x, y, pixelID.cached.framebufStride);
for (int x = pos0.x; x < pos1.x; x++) {
Vec4<int> prim_color = v1.color0;
Vec4<int> prim_color = c0;
Vec4<int> tex_color = fetchFunc(s, t, texptr, texbufw, 0, state.samplerID);
prim_color = Vec4<int>(ModulateRGBA(ToVec4IntArg(prim_color), ToVec4IntArg(tex_color), state.samplerID));
if (prim_color.a() > 0) {
@@ -202,11 +203,12 @@ void DrawSprite(const VertexData &v0, const VertexData &v1, const BinCoords &ran
float tf_start = t_start * (1.0f / (float)(1 << state.samplerID.height0Shift));
float t = tf_start;
const Vec4<int> c0 = Vec4<int>::FromRGBA(v1.color0);
for (int y = pos0.y; y < pos1.y; y++) {
float s = sf_start;
// Not really that fast but faster than triangle.
for (int x = pos0.x; x < pos1.x; x++) {
Vec4<int> prim_color = state.nearest(s, t, xoff, yoff, ToVec4IntArg(v1.color0), &texptr, &texbufw, 0, 0, state.samplerID);
Vec4<int> prim_color = state.nearest(s, t, xoff, yoff, ToVec4IntArg(c0), &texptr, &texbufw, 0, 0, state.samplerID);
state.drawPixel(x, y, z, 255, ToVec4IntArg(prim_color), pixelID);
s += dsf;
}
@@ -227,21 +229,20 @@ void DrawSprite(const VertexData &v0, const VertexData &v1, const BinCoords &ran
AlphaTestIsNeedless(pixelID) &&
!pixelID.applyColorWriteMask &&
pixelID.FBFormat() == GE_FORMAT_5551) {
if (v1.color0.a() == 0)
if (Vec4<int>::FromRGBA(v1.color0).a() == 0)
return;
for (int y = pos0.y; y < pos1.y; y++) {
u16 *pixel = fb.Get16Ptr(pos0.x, y, pixelID.cached.framebufStride);
for (int x = pos0.x; x < pos1.x; x++) {
Vec4<int> prim_color = v1.color0;
DrawSinglePixel5551(pixel, prim_color.ToRGBA(), pixelID);
DrawSinglePixel5551(pixel, v1.color0, pixelID);
pixel++;
}
}
} else {
const Vec4<int> prim_color = Vec4<int>::FromRGBA(v1.color0);
for (int y = pos0.y; y < pos1.y; y++) {
for (int x = pos0.x; x < pos1.x; x++) {
Vec4<int> prim_color = v1.color0;
state.drawPixel(x, y, z, fog, ToVec4IntArg(prim_color), pixelID);
}
}
@@ -265,6 +266,8 @@ bool g_needsClearAfterDialog = false;
static inline bool NoClampOrWrap(const RasterizerState &state, const Vec2f &tc) {
if (tc.x < 0 || tc.y < 0)
return false;
if (state.samplerID.cached.sizes[0].w > 512 || state.samplerID.cached.sizes[0].h > 512)
return false;
return tc.x <= state.samplerID.cached.sizes[0].w && tc.y <= state.samplerID.cached.sizes[0].h;
}
@@ -284,7 +287,7 @@ bool RectangleFastPath(const VertexData &v0, const VertexData &v1, BinManager &b
// Currently only works for TL/BR, which is the most common but not required.
bool orient_check = xdiff >= 0 && ydiff >= 0;
// We already have a fast path for clear in ClearRectangle.
bool state_check = !state.pixelID.clearMode && !state.samplerID.hasAnyMips && NoClampOrWrap(state, v0.texturecoords) && NoClampOrWrap(state, v1.texturecoords);
bool state_check = state.throughMode && !state.pixelID.clearMode && !state.samplerID.hasAnyMips && NoClampOrWrap(state, v0.texturecoords) && NoClampOrWrap(state, v1.texturecoords);
// This doesn't work well with offset drawing, see #15876. Through never has a subpixel offset.
bool subpixel_check = ((v0.screenpos.x | v0.screenpos.y | v1.screenpos.x | v1.screenpos.y) & 0xF) == 0;
if ((coord_check || !state.enableTextures) && orient_check && state_check && subpixel_check) {
@@ -309,7 +312,7 @@ bool RectangleFastPath(const VertexData &v0, const VertexData &v1, BinManager &b
// Afterwards, we also need to clear the actual destination. Can do a fast rectfill.
gstate.textureMapEnable &= ~1;
VertexData newV1 = v1;
newV1.color0 = Vec4<int>(0, 0, 0, 255);
newV1.color0 = 0xFF000000;
binner.AddSprite(v0, newV1);
gstate.textureMapEnable |= 1;
}
@@ -321,26 +324,40 @@ bool RectangleFastPath(const VertexData &v0, const VertexData &v1, BinManager &b
return false;
}
static bool AreCoordsRectangleCompatible(const RasterizerState &state, const VertexData &data0, const VertexData &data1) {
if (!(data1.color0 == data0.color0))
return false;
if (!(data1.screenpos.z == data0.screenpos.z)) {
// Sometimes, we don't actually care about z.
if (state.pixelID.depthWrite || state.pixelID.DepthTestFunc() != GE_COMP_ALWAYS)
return false;
}
if (!state.throughMode) {
if (!state.throughMode && !(data1.color1 == data0.color1))
return false;
// Do we have to think about perspective correction or slope mip level?
if (state.enableTextures && data1.clippos.w != data0.clippos.w) {
// If the w is off by less than a factor of 1/512, it should be safe to treat as a rectangle.
static constexpr float halftexel = 0.5f / 512.0f;
if (data1.clippos.w - halftexel > data0.clippos.w || data1.clippos.w + halftexel < data0.clippos.w)
return false;
}
if (state.pixelID.applyFog && data1.fogdepth != data0.fogdepth) {
// Similar to w, this only matters if they're farther apart than 1/255.
static constexpr float foghalfstep = 0.5f / 255.0f;
if (data1.fogdepth - foghalfstep > data0.fogdepth || data1.fogdepth + foghalfstep < data0.fogdepth)
return false;
}
}
return true;
}
bool DetectRectangleFromStrip(const RasterizerState &state, const VertexData data[4], int *tlIndex, int *brIndex) {
// Color and Z must be flat. Also find the TL and BR meanwhile.
int tl = 0, br = 0;
for (int i = 1; i < 4; ++i) {
if (!(data[i].color0 == data[0].color0))
if (!AreCoordsRectangleCompatible(state, data[i], data[0]))
return false;
if (!(data[i].screenpos.z == data[0].screenpos.z)) {
// Sometimes, we don't actually care about z.
if (state.pixelID.depthWrite || state.pixelID.DepthTestFunc() != GE_COMP_ALWAYS)
return false;
}
if (!state.throughMode) {
if (!state.throughMode && !(data[i].color1 == data[0].color1))
return false;
// Do we have to think about perspective correction or slope mip level?
if (state.enableTextures && data[i].clippos.w != data[0].clippos.w)
return false;
if (state.pixelID.applyFog && data[i].fogdepth != data[0].fogdepth)
return false;
}
if (data[i].screenpos.x <= data[tl].screenpos.x && data[i].screenpos.y <= data[tl].screenpos.y)
tl = i;
@@ -394,34 +411,20 @@ bool DetectRectangleFromStrip(const RasterizerState &state, const VertexData dat
bool DetectRectangleFromFan(const RasterizerState &state, const VertexData *data, int c, int *tlIndex, int *brIndex) {
// Color and Z must be flat.
for (int i = 1; i < c; ++i) {
if (!(data[i].color0 == data[0].color0))
if (!AreCoordsRectangleCompatible(state, data[i], data[0]))
return false;
if (!(data[i].screenpos.z == data[0].screenpos.z)) {
// Sometimes, we don't actually care about z.
if (state.pixelID.depthWrite || state.pixelID.DepthTestFunc() != GE_COMP_ALWAYS)
return false;
}
if (!state.throughMode) {
if (!state.throughMode && !(data[i].color1 == data[0].color1))
return false;
// Do we have to think about perspective correction or slope mip level?
if (state.enableTextures && data[i].clippos.w != data[0].clippos.w)
return false;
if (state.pixelID.applyFog && data[i].fogdepth != data[0].fogdepth)
return false;
}
}
// Check for the common case: a single TL-TR-BR-BL.
if (c == 4) {
const auto &tl = data[0].screenpos, &tr = data[1].screenpos;
const auto &bl = data[3].screenpos, &br = data[2].screenpos;
if (tl.x == bl.x && tr.x == br.x && tl.y == tr.y && bl.y == br.y) {
const auto &pos0 = data[0].screenpos, &pos1 = data[1].screenpos;
const auto &pos2 = data[2].screenpos, &pos3 = data[3].screenpos;
if (pos0.x == pos3.x && pos1.x == pos2.x && pos0.y == pos1.y && pos3.y == pos2.y) {
// Looking like yes. Set TL/BR based on y order first...
*tlIndex = tl.y > bl.y ? 2 : 0;
*brIndex = tl.y > bl.y ? 0 : 2;
*tlIndex = pos0.y > pos3.y ? 2 : 0;
*brIndex = pos0.y > pos3.y ? 0 : 2;
// And if it's horizontally flipped, trade to the actual TL/BR.
if (tl.x > tr.x) {
if (pos0.x > pos1.x) {
*tlIndex ^= 1;
*brIndex ^= 1;
}
@@ -435,7 +438,56 @@ bool DetectRectangleFromFan(const RasterizerState &state, const VertexData *data
if (textl.x == texbl.x && textr.x == texbr.x && textl.y == textr.y && texbl.y == texbr.y) {
// Okay, the texture is also good, but let's avoid rotation issues.
return textl.y < texbr.y && textl.x < texbr.x;
const auto &postl = data[*tlIndex].screenpos;
const auto &posbr = data[*brIndex].screenpos;
return textl.y < texbr.y && postl.y < posbr.y && textl.x < texbr.x && postl.x < posbr.x;
}
}
}
return false;
}
bool DetectRectangleFromPair(const RasterizerState &state, const VertexData data[6], int *tlIndex, int *brIndex) {
// Color and Z must be flat. Also find the TL and BR meanwhile.
int tl = 0, br = 0;
for (int i = 1; i < 6; ++i) {
if (!AreCoordsRectangleCompatible(state, data[i], data[0]))
return false;
if (data[i].screenpos.x <= data[tl].screenpos.x && data[i].screenpos.y <= data[tl].screenpos.y)
tl = i;
if (data[i].screenpos.x >= data[br].screenpos.x && data[i].screenpos.y >= data[br].screenpos.y)
br = i;
}
*tlIndex = tl;
*brIndex = br;
auto xat = [&](int i) { return data[i].screenpos.x; };
auto yat = [&](int i) { return data[i].screenpos.y; };
auto uat = [&](int i) { return data[i].texturecoords.x; };
auto vat = [&](int i) { return data[i].texturecoords.y; };
// A likely order would be: TL, TR, BR, TL, BR, BL. We'd have the last index of each.
// TODO: Make more generic.
if (tl == 3 && br == 4) {
bool x1_match = xat(0) == xat(3) && xat(0) == xat(5);
bool x2_match = xat(1) == xat(2) && xat(1) == xat(4);
bool y1_match = yat(0) == yat(1) && yat(0) == yat(3);
bool y2_match = yat(2) == yat(4) && yat(2) == yat(5);
if (x1_match && y1_match && x2_match && y2_match) {
// Do we need to think about rotation or UVs?
if (!state.enableTextures)
return true;
x1_match = uat(0) == uat(3) && uat(0) == uat(5);
x2_match = uat(1) == uat(2) && uat(1) == uat(4);
y1_match = vat(0) == vat(1) && vat(0) == vat(3);
y2_match = vat(2) == vat(4) && vat(2) == vat(5);
if (x1_match && y1_match && x2_match && y2_match) {
// Double check rotation direction.
return vat(tl) < vat(br) && yat(tl) < yat(br) && uat(tl) < uat(br) && xat(tl) < xat(br);
}
}
}
+1
View File
@@ -22,5 +22,6 @@ namespace Rasterizer {
bool DetectRectangleFromStrip(const RasterizerState &state, const VertexData data[4], int *tlIndex, int *brIndex);
bool DetectRectangleFromFan(const RasterizerState &state, const VertexData *data, int c, int *tlIndex, int *brIndex);
bool DetectRectangleFromPair(const RasterizerState &state, const VertexData data[6], int *tlIndex, int *brIndex);
bool DetectRectangleThroughModeSlices(const RasterizerState &state, const VertexData data[4]);
}
+3 -1
View File
@@ -383,13 +383,15 @@ inline static Nearest4 SOFTRAST_CALL SampleNearest(const int u[N], const int v[N
static inline int ClampUV(int v, int height) {
if (v >= height - 1)
return height - 1;
if (v >= 511)
return 511;
else if (v < 0)
return 0;
return v;
}
static inline int WrapUV(int v, int height) {
return v & (height - 1);
return v & (height - 1) & 511;
}
template <int N>
+1
View File
@@ -114,6 +114,7 @@ private:
const u8 *constVNext_ = nullptr;
const u8 *constOnes32_ = nullptr;
const u8 *constOnes16_ = nullptr;
const u8 *constMaxTexel32_ = nullptr;
const u8 *const10All16_ = nullptr;
const u8 *const10Low_ = nullptr;
const u8 *const10All8_ = nullptr;
+10 -2
View File
@@ -903,6 +903,8 @@ void SamplerJitCache::WriteConstantPool(const SamplerID &id) {
WriteSimpleConst4x32(constOnes32_, 1);
WriteSimpleConst8x16(constOnes16_, 1);
// This is the mask for clamp or wrap, the max texel in the S or T direction.
WriteSimpleConst4x32(constMaxTexel32_, 511);
if (constUNext_ == nullptr) {
constUNext_ = AlignCode16();
@@ -927,8 +929,8 @@ void SamplerJitCache::WriteConstantPool(const SamplerID &id) {
Write32(*(uint32_t *)&w256f);
Write32(*(uint32_t *)&h256f);
WriteDynamicConst4x32(constWidthMinus1i_, (1 << id.width0Shift) - 1);
WriteDynamicConst4x32(constHeightMinus1i_, (1 << id.height0Shift) - 1);
WriteDynamicConst4x32(constWidthMinus1i_, id.width0Shift > 9 ? 511 : (1 << id.width0Shift) - 1);
WriteDynamicConst4x32(constHeightMinus1i_, id.height0Shift > 9 ? 511 : (1 << id.height0Shift) - 1);
} else {
constWidthHeight256f_ = nullptr;
constWidthMinus1i_ = nullptr;
@@ -2651,6 +2653,7 @@ bool SamplerJitCache::Jit_GetTexelCoords(const SamplerID &id) {
}
SUB(32, R(tempReg), Imm8(1));
AND(32, R(tempReg), Imm32(0x000001FF));
if (clamp) {
CMP(32, R(dest), R(tempReg));
CMOVcc(32, dest, R(tempReg), CC_G);
@@ -2710,6 +2713,10 @@ bool SamplerJitCache::Jit_GetTexelCoords(const SamplerID &id) {
AND(32, R(uReg), R(uReg));
auto applyClampWrap = [this](X64Reg dest, bool clamp, uint8_t shift) {
// Clamp and wrap both max out at 512.
if (shift > 9)
shift = 9;
if (clamp) {
X64Reg tempReg = regCache_.Alloc(RegCache::GEN_TEMP0);
MOV(32, R(tempReg), Imm32((1 << shift) - 1));
@@ -2802,6 +2809,7 @@ bool SamplerJitCache::Jit_GetTexelCoordsQuad(const SamplerID &id) {
// For wrap/clamp purposes, we want width or height minus one. Do that now.
PSUBD(sizesReg, M(constOnes32_));
PAND(sizesReg, M(constMaxTexel32_));
} else {
// Easy mode.
UNPCKLPS(sReg, R(tReg));
+1 -1
View File
@@ -838,7 +838,7 @@ void SoftGPU::Execute_Prim(u32 op, u32 diff) {
return;
}
const void *verts = Memory::GetPointer(gstate_c.vertexAddr);
const void *verts = Memory::GetPointerUnchecked(gstate_c.vertexAddr);
const void *indices = NULL;
if ((gstate.vertType & GE_VTYPE_IDX_MASK) != GE_VTYPE_IDX_NONE) {
if (!Memory::IsValidAddress(gstate_c.indexAddr)) {
+148 -112
View File
@@ -317,24 +317,12 @@ VertexData TransformUnit::ReadVertex(VertexReader &vreader, const TransformState
}
if (vreader.hasColor0()) {
#ifdef _M_SSE
vreader.ReadColor0_8888((u8 *)vertex.color0.AsArray());
vertex.color0.ivec = _mm_unpacklo_epi8(vertex.color0.ivec, _mm_setzero_si128());
vertex.color0.ivec = _mm_unpacklo_epi16(vertex.color0.ivec, _mm_setzero_si128());
#else
float col[4];
vreader.ReadColor0(col);
vertex.color0 = Vec4<int>(col[0]*255, col[1]*255, col[2]*255, col[3]*255);
#endif
vreader.ReadColor0_8888((u8 *)&vertex.color0);
} else {
vertex.color0 = Vec4<int>::FromRGBA(gstate.getMaterialAmbientRGBA());
vertex.color0 = gstate.getMaterialAmbientRGBA();
}
#ifdef _M_SSE
vertex.color1 = _mm_setzero_si128();
#else
vertex.color1 = Vec3<int>(0, 0, 0);
#endif
vertex.color1 = 0;
if (state.enableTransform) {
WorldCoords worldpos;
@@ -447,12 +435,6 @@ SoftDirty TransformUnit::GetDirty() {
return binner_->GetDirty();
}
enum class CullType {
CW,
CCW,
OFF,
};
void TransformUnit::SubmitPrimitive(const void* vertices, const void* indices, GEPrimitiveType prim_type, int vertex_count, u32 vertex_type, int *bytesRead, SoftwareDrawEngine *drawEngine)
{
VertexDecoder &vdecoder = *drawEngine->FindVertexDecoder(vertex_type);
@@ -482,16 +464,11 @@ void TransformUnit::SubmitPrimitive(const void* vertices, const void* indices, G
VertexReader vreader(decoded_, vtxfmt, vertex_type);
static VertexData data[4]; // Normally max verts per prim is 3, but we temporarily need 4 to detect rectangles from strips.
// This is the index of the next vert in data (or higher, may need modulus.)
static int data_index = 0;
static GEPrimitiveType prev_prim = GE_PRIM_POINTS;
if (prim_type != GE_PRIM_KEEP_PREVIOUS) {
data_index = 0;
prev_prim = prim_type;
data_index_ = 0;
prev_prim_ = prim_type;
} else {
prim_type = prev_prim;
prim_type = prev_prim_;
}
int vtcs_per_prim;
@@ -518,6 +495,63 @@ void TransformUnit::SubmitPrimitive(const void* vertices, const void* indices, G
const CullType cullType = skipCull ? CullType::OFF : (gstate.getCullMode() ? CullType::CCW : CullType::CW);
bool outside_range_flag = false;
if (vreader.isThrough() && cullType == CullType::OFF && prim_type == GE_PRIM_TRIANGLES && data_index_ + vertex_count >= 6 && ((data_index_ + vertex_count) % 6) == 0) {
// Some games send rectangles as a series of regular triangles.
// We look for this, but only in throughmode.
VertexData buf[6];
int buf_index = data_index_;
for (int i = 0; i < data_index_; ++i) {
buf[i] = data_[i];
}
for (int vtx = 0; vtx < vertex_count; ++vtx) {
if (indices) {
vreader.Goto(ConvertIndex(vtx) - index_lower_bound);
} else {
vreader.Goto(vtx);
}
buf[buf_index++] = ReadVertex(vreader, transformState, outside_range_flag);
if (buf_index >= 3 && outside_range_flag) {
// Cull, just pretend it didn't happen.
buf_index -= 3;
outside_range_flag = false;
continue;
}
if (buf_index < 6)
continue;
int tl = -1, br = -1;
if (Rasterizer::DetectRectangleFromPair(binner_->State(), buf, &tl, &br)) {
Clipper::ProcessRect(buf[tl], buf[br], *binner_);
} else {
SendTriangle(cullType, &buf[0]);
SendTriangle(cullType, &buf[3]);
}
buf_index = 0;
}
if (buf_index >= 3) {
SendTriangle(cullType, &buf[0]);
data_index_ = 0;
for (int i = 3; i < buf_index; ++i) {
data_[data_index_++] = buf[i];
}
} else if (buf_index > 0) {
for (int i = 0; i < buf_index; ++i) {
data_[i] = buf[i];
}
data_index_ = buf_index;
} else {
data_index_ = 0;
}
return;
}
switch (prim_type) {
case GE_PRIM_POINTS:
case GE_PRIM_LINES:
@@ -530,14 +564,14 @@ void TransformUnit::SubmitPrimitive(const void* vertices, const void* indices, G
vreader.Goto(vtx);
}
data[data_index++] = ReadVertex(vreader, transformState, outside_range_flag);
if (data_index < vtcs_per_prim) {
data_[data_index_++] = ReadVertex(vreader, transformState, outside_range_flag);
if (data_index_ < vtcs_per_prim) {
// Keep reading. Note: an incomplete prim will stay read for GE_PRIM_KEEP_PREVIOUS.
continue;
}
// Okay, we've got enough verts. Reset the index for next time.
data_index = 0;
data_index_ = 0;
if (outside_range_flag) {
// Cull the prim if it was outside, and move to the next prim.
outside_range_flag = false;
@@ -546,24 +580,15 @@ void TransformUnit::SubmitPrimitive(const void* vertices, const void* indices, G
switch (prim_type) {
case GE_PRIM_TRIANGLES:
{
if (cullType == CullType::OFF) {
Clipper::ProcessTriangle(data[0], data[1], data[2], data[2], *binner_);
Clipper::ProcessTriangle(data[2], data[1], data[0], data[2], *binner_);
} else if (cullType == CullType::CW) {
Clipper::ProcessTriangle(data[2], data[1], data[0], data[2], *binner_);
} else {
Clipper::ProcessTriangle(data[0], data[1], data[2], data[2], *binner_);
}
SendTriangle(cullType, &data_[0]);
break;
}
case GE_PRIM_LINES:
Clipper::ProcessLine(data[0], data[1], *binner_);
Clipper::ProcessLine(data_[0], data_[1], *binner_);
break;
case GE_PRIM_POINTS:
Clipper::ProcessPoint(data[0], *binner_);
Clipper::ProcessPoint(data_[0], *binner_);
break;
default:
@@ -581,45 +606,45 @@ void TransformUnit::SubmitPrimitive(const void* vertices, const void* indices, G
vreader.Goto(vtx);
}
data[data_index++] = ReadVertex(vreader, transformState, outside_range_flag);
data_[data_index_++] = ReadVertex(vreader, transformState, outside_range_flag);
if (outside_range_flag) {
outside_range_flag = false;
// Note: this is the post increment index. If odd, we set the first vert.
if (data_index & 1) {
if (data_index_ & 1) {
// Skip the next one and forget this one.
vtx++;
data_index--;
data_index_--;
} else {
// Forget both of the last 2.
data_index -= 2;
data_index_ -= 2;
}
}
if (data_index == 4 && vreader.isThrough() && cullType == CullType::OFF) {
if (Rasterizer::DetectRectangleThroughModeSlices(binner_->State(), data)) {
data[1] = data[3];
data_index = 2;
if (data_index_ == 4 && vreader.isThrough() && cullType == CullType::OFF) {
if (Rasterizer::DetectRectangleThroughModeSlices(binner_->State(), data_)) {
data_[1] = data_[3];
data_index_ = 2;
}
}
if (data_index == 4) {
Clipper::ProcessRect(data[0], data[1], *binner_);
Clipper::ProcessRect(data[2], data[3], *binner_);
data_index = 0;
if (data_index_ == 4) {
Clipper::ProcessRect(data_[0], data_[1], *binner_);
Clipper::ProcessRect(data_[2], data_[3], *binner_);
data_index_ = 0;
}
}
if (data_index >= 2) {
Clipper::ProcessRect(data[0], data[1], *binner_);
data_index -= 2;
if (data_index_ >= 2) {
Clipper::ProcessRect(data_[0], data_[1], *binner_);
data_index_ -= 2;
}
break;
case GE_PRIM_LINE_STRIP:
{
// Don't draw a line when loading the first vertex.
// If data_index is 1 or 2, etc., it means we're continuing a line strip.
int skip_count = data_index == 0 ? 1 : 0;
// If data_index_ is 1 or 2, etc., it means we're continuing a line strip.
int skip_count = data_index_ == 0 ? 1 : 0;
for (int vtx = 0; vtx < vertex_count; ++vtx) {
if (indices) {
vreader.Goto(ConvertIndex(vtx) - index_lower_bound);
@@ -627,7 +652,7 @@ void TransformUnit::SubmitPrimitive(const void* vertices, const void* indices, G
vreader.Goto(vtx);
}
data[(data_index++) & 1] = ReadVertex(vreader, transformState, outside_range_flag);
data_[(data_index_++) & 1] = ReadVertex(vreader, transformState, outside_range_flag);
if (outside_range_flag) {
// Drop all primitives containing the current vertex
skip_count = 2;
@@ -638,8 +663,8 @@ void TransformUnit::SubmitPrimitive(const void* vertices, const void* indices, G
if (skip_count) {
--skip_count;
} else {
// We already incremented data_index, so data_index & 1 is previous one.
Clipper::ProcessLine(data[data_index & 1], data[(data_index & 1) ^ 1], *binner_);
// We already incremented data_index_, so data_index_ & 1 is previous one.
Clipper::ProcessLine(data_[data_index_ & 1], data_[(data_index_ & 1) ^ 1], *binner_);
}
}
break;
@@ -648,39 +673,53 @@ void TransformUnit::SubmitPrimitive(const void* vertices, const void* indices, G
case GE_PRIM_TRIANGLE_STRIP:
{
// Don't draw a triangle when loading the first two vertices.
int skip_count = data_index >= 2 ? 0 : 2 - data_index;
int skip_count = data_index_ >= 2 ? 0 : 2 - data_index_;
int start_vtx = 0;
// If index count == 4, check if we can convert to a rectangle.
// This is for Darkstalkers (and should speed up many 2D games).
if (data_index == 0 && vertex_count == 4 && cullType == CullType::OFF) {
for (int vtx = 0; vtx < 4; ++vtx) {
if (indices) {
vreader.Goto(ConvertIndex(vtx) - index_lower_bound);
if (data_index_ == 0 && vertex_count >= 4 && (vertex_count & 1) == 0 && cullType == CullType::OFF) {
for (int base = 0; base < vertex_count - 2; base += 2) {
for (int vtx = base == 0 ? 0 : 2; vtx < 4; ++vtx) {
if (indices) {
vreader.Goto(ConvertIndex(base + vtx) - index_lower_bound);
} else {
vreader.Goto(base + vtx);
}
data_[vtx] = ReadVertex(vreader, transformState, outside_range_flag);
}
else {
vreader.Goto(vtx);
}
data[vtx] = ReadVertex(vreader, transformState, outside_range_flag);
}
// If a strip is effectively a rectangle, draw it as such!
int tl = -1, br = -1;
if (!outside_range_flag && Rasterizer::DetectRectangleFromStrip(binner_->State(), data, &tl, &br)) {
Clipper::ProcessRect(data[tl], data[br], *binner_);
break;
// If a strip is effectively a rectangle, draw it as such!
int tl = -1, br = -1;
if (!outside_range_flag && Rasterizer::DetectRectangleFromStrip(binner_->State(), data_, &tl, &br)) {
Clipper::ProcessRect(data_[tl], data_[br], *binner_);
start_vtx += 2;
if (base + 4 >= vertex_count) {
start_vtx = vertex_count;
break;
}
// Just copy the first two so we can detect easier.
// TODO: Maybe should give detection two halves?
data_[0] = data_[2];
data_[1] = data_[3];
} else {
// Go into triangle mode. Unfortunately, we re-read the verts.
break;
}
}
}
outside_range_flag = false;
for (int vtx = 0; vtx < vertex_count; ++vtx) {
for (int vtx = start_vtx; vtx < vertex_count; ++vtx) {
if (indices) {
vreader.Goto(ConvertIndex(vtx) - index_lower_bound);
} else {
vreader.Goto(vtx);
}
int provoking_index = (data_index++) % 3;
data[provoking_index] = ReadVertex(vreader, transformState, outside_range_flag);
int provoking_index = (data_index_++) % 3;
data_[provoking_index] = ReadVertex(vreader, transformState, outside_range_flag);
if (outside_range_flag) {
// Drop all primitives containing the current vertex
skip_count = 2;
@@ -693,16 +732,9 @@ void TransformUnit::SubmitPrimitive(const void* vertices, const void* indices, G
continue;
}
if (cullType == CullType::OFF) {
Clipper::ProcessTriangle(data[0], data[1], data[2], data[provoking_index], *binner_);
Clipper::ProcessTriangle(data[2], data[1], data[0], data[provoking_index], *binner_);
} else if ((!(int)cullType) ^ ((data_index - 1) % 2)) {
// We need to reverse the vertex order for each second primitive,
// but we additionally need to do that for every primitive if CCW cullmode is used.
Clipper::ProcessTriangle(data[2], data[1], data[0], data[provoking_index], *binner_);
} else {
Clipper::ProcessTriangle(data[0], data[1], data[2], data[provoking_index], *binner_);
}
int wind = (data_index_ - 1) % 2;
CullType altCullType = cullType == CullType::OFF ? cullType : CullType((int)cullType ^ wind);
SendTriangle(altCullType, &data_[0], provoking_index);
}
break;
}
@@ -711,18 +743,18 @@ void TransformUnit::SubmitPrimitive(const void* vertices, const void* indices, G
{
// Don't draw a triangle when loading the first two vertices.
// (this doesn't count the central one.)
int skip_count = data_index <= 1 ? 1 : 0;
int skip_count = data_index_ <= 1 ? 1 : 0;
int start_vtx = 0;
// Only read the central vertex if we're not continuing.
if (data_index == 0) {
if (data_index_ == 0) {
if (indices) {
vreader.Goto(ConvertIndex(0) - index_lower_bound);
} else {
vreader.Goto(0);
}
data[0] = ReadVertex(vreader, transformState, outside_range_flag);
data_index++;
data_[0] = ReadVertex(vreader, transformState, outside_range_flag);
data_index_++;
start_vtx = 1;
// If the central vertex is outside range, all the points are toast.
@@ -730,19 +762,19 @@ void TransformUnit::SubmitPrimitive(const void* vertices, const void* indices, G
break;
}
if (data_index == 1 && vertex_count == 4 && cullType == CullType::OFF) {
if (data_index_ == 1 && vertex_count == 4 && cullType == CullType::OFF) {
for (int vtx = start_vtx; vtx < vertex_count; ++vtx) {
if (indices) {
vreader.Goto(ConvertIndex(vtx) - index_lower_bound);
} else {
vreader.Goto(vtx);
}
data[vtx] = ReadVertex(vreader, transformState, outside_range_flag);
data_[vtx] = ReadVertex(vreader, transformState, outside_range_flag);
}
int tl = -1, br = -1;
if (!outside_range_flag && Rasterizer::DetectRectangleFromFan(binner_->State(), data, vertex_count, &tl, &br)) {
Clipper::ProcessRect(data[tl], data[br], *binner_);
if (!outside_range_flag && Rasterizer::DetectRectangleFromFan(binner_->State(), data_, vertex_count, &tl, &br)) {
Clipper::ProcessRect(data_[tl], data_[br], *binner_);
break;
}
}
@@ -755,8 +787,8 @@ void TransformUnit::SubmitPrimitive(const void* vertices, const void* indices, G
vreader.Goto(vtx);
}
int provoking_index = 2 - ((data_index++) % 2);
data[provoking_index] = ReadVertex(vreader, transformState, outside_range_flag);
int provoking_index = 2 - ((data_index_++) % 2);
data_[provoking_index] = ReadVertex(vreader, transformState, outside_range_flag);
if (outside_range_flag) {
// Drop all primitives containing the current vertex
skip_count = 2;
@@ -769,16 +801,9 @@ void TransformUnit::SubmitPrimitive(const void* vertices, const void* indices, G
continue;
}
if (cullType == CullType::OFF) {
Clipper::ProcessTriangle(data[0], data[1], data[2], data[provoking_index], *binner_);
Clipper::ProcessTriangle(data[2], data[1], data[0], data[provoking_index], *binner_);
} else if ((!(int)cullType) ^ ((data_index - 1) % 2)) {
// We need to reverse the vertex order for each second primitive,
// but we additionally need to do that for every primitive if CCW cullmode is used.
Clipper::ProcessTriangle(data[2], data[1], data[0], data[provoking_index], *binner_);
} else {
Clipper::ProcessTriangle(data[0], data[1], data[2], data[provoking_index], *binner_);
}
int wind = (data_index_ - 1) % 2;
CullType altCullType = cullType == CullType::OFF ? cullType : CullType((int)cullType ^ wind);
SendTriangle(altCullType, &data_[0], provoking_index);
}
break;
}
@@ -789,6 +814,17 @@ void TransformUnit::SubmitPrimitive(const void* vertices, const void* indices, G
}
}
void TransformUnit::SendTriangle(CullType cullType, const VertexData *verts, int provoking) {
if (cullType == CullType::OFF) {
Clipper::ProcessTriangle(verts[0], verts[1], verts[2], verts[provoking], *binner_);
Clipper::ProcessTriangle(verts[2], verts[1], verts[0], verts[provoking], *binner_);
} else if (cullType == CullType::CW) {
Clipper::ProcessTriangle(verts[2], verts[1], verts[0], verts[provoking], *binner_);
} else {
Clipper::ProcessTriangle(verts[0], verts[1], verts[2], verts[provoking], *binner_);
}
}
void TransformUnit::Flush(const char *reason) {
binner_->Flush(reason);
GPUDebug::NotifyDraw();
+18 -5
View File
@@ -37,6 +37,12 @@ typedef Vec4<float> ClipCoords; // Range: -w <= x/y/z <= w
class BinManager;
struct TransformState;
enum class CullType {
CW = 0,
CCW = 1,
OFF = 2,
};
struct ScreenCoords
{
ScreenCoords() {}
@@ -79,15 +85,15 @@ struct VertexData {
texturecoords = ::Lerp(a.texturecoords, b.texturecoords, t);
fogdepth = ::Lerp(a.fogdepth, b.fogdepth, t);
u16 t_int = (u16)(t*256);
color0 = LerpInt<Vec4<int>,256>(a.color0, b.color0, t_int);
color1 = LerpInt<Vec3<int>,256>(a.color1, b.color1, t_int);
u16 t_int = (u16)(t * 256);
color0 = LerpInt<Vec4<int>, 256>(Vec4<int>::FromRGBA(a.color0), Vec4<int>::FromRGBA(b.color0), t_int).ToRGBA();
color1 = LerpInt<Vec3<int>, 256>(Vec3<int>::FromRGB(a.color1), Vec3<int>::FromRGB(b.color1), t_int).ToRGB();
}
ClipCoords clippos;
Vec2<float> texturecoords;
Vec4<int> color0;
Vec3<int> color1;
uint32_t color0;
uint32_t color1;
ScreenCoords screenpos; // TODO: Shouldn't store this ?
float fogdepth;
};
@@ -133,9 +139,16 @@ public:
private:
VertexData ReadVertex(VertexReader &vreader, const TransformState &lstate, bool &outside_range_flag);
void SendTriangle(CullType cullType, const VertexData *verts, int provoking = 2);
u8 *decoded_ = nullptr;
BinManager *binner_ = nullptr;
// Normally max verts per prim is 3, but we temporarily need 4 to detect rectangles from strips.
VertexData data_[4];
// This is the index of the next vert in data (or higher, may need modulus.)
int data_index_ = 0;
GEPrimitiveType prev_prim_ = GE_PRIM_POINTS;
};
class SoftwareDrawEngine : public DrawEngineCommon {
+13 -7
View File
@@ -44,7 +44,8 @@
// Most drivers treat vkCreateShaderModule as pretty much a memcpy. What actually
// takes time here, and makes this worthy of parallelization, is GLSLtoSPV.
Promise<VkShaderModule> *CompileShaderModuleAsync(VulkanContext *vulkan, VkShaderStageFlagBits stage, const char *code) {
// Takes ownership over tag.
static Promise<VkShaderModule> *CompileShaderModuleAsync(VulkanContext *vulkan, VkShaderStageFlagBits stage, const char *code, std::string *tag) {
auto compile = [=] {
PROFILE_THIS_SCOPE("shadercomp");
@@ -59,12 +60,13 @@ Promise<VkShaderModule> *CompileShaderModuleAsync(VulkanContext *vulkan, VkShade
} else {
ERROR_LOG(G3D, "Error in shader compilation!");
}
std::string numberedSource = LineNumberString(code);
ERROR_LOG(G3D, "Messages: %s", errorMessage.c_str());
ERROR_LOG(G3D, "Shader source:\n%s", code);
#ifdef SHADERLOG
OutputDebugStringA(LineNumberString(code).c_str());
ERROR_LOG(G3D, "Shader source:\n%s", numberedSource.c_str());
#if PPSSPP_PLATFORM(WINDOWS)
OutputDebugStringA("Error messages:\n");
OutputDebugStringA(errorMessage.c_str());
OutputDebugStringA(numberedSource.c_str());
#endif
Reporting::ReportMessage("Vulkan error in shader compilation: info: %s / code: %s", errorMessage.c_str(), code);
}
@@ -75,6 +77,10 @@ Promise<VkShaderModule> *CompileShaderModuleAsync(VulkanContext *vulkan, VkShade
#ifdef SHADERLOG
OutputDebugStringA("OK");
#endif
if (tag) {
vulkan->SetDebugName(shaderModule, VK_OBJECT_TYPE_SHADER_MODULE, tag->c_str());
delete tag;
}
}
return shaderModule;
@@ -92,7 +98,7 @@ Promise<VkShaderModule> *CompileShaderModuleAsync(VulkanContext *vulkan, VkShade
VulkanFragmentShader::VulkanFragmentShader(VulkanContext *vulkan, FShaderID id, FragmentShaderFlags flags, const char *code)
: vulkan_(vulkan), id_(id), flags_(flags) {
source_ = code;
module_ = CompileShaderModuleAsync(vulkan, VK_SHADER_STAGE_FRAGMENT_BIT, source_.c_str());
module_ = CompileShaderModuleAsync(vulkan, VK_SHADER_STAGE_FRAGMENT_BIT, source_.c_str(), new std::string(FragmentShaderDesc(id)));
if (!module_) {
failed_ = true;
} else {
@@ -122,7 +128,7 @@ std::string VulkanFragmentShader::GetShaderString(DebugShaderStringType type) co
VulkanVertexShader::VulkanVertexShader(VulkanContext *vulkan, VShaderID id, const char *code, bool useHWTransform)
: vulkan_(vulkan), useHWTransform_(useHWTransform), id_(id) {
source_ = code;
module_ = CompileShaderModuleAsync(vulkan, VK_SHADER_STAGE_VERTEX_BIT, source_.c_str());
module_ = CompileShaderModuleAsync(vulkan, VK_SHADER_STAGE_VERTEX_BIT, source_.c_str(), new std::string(VertexShaderDesc(id).c_str()));
if (!module_) {
failed_ = true;
} else {
@@ -371,7 +377,7 @@ VulkanFragmentShader *ShaderManagerVulkan::GetFragmentShaderFromModule(VkShaderM
// instantaneous.
#define CACHE_HEADER_MAGIC 0xff51f420
#define CACHE_VERSION 25
#define CACHE_VERSION 26
struct VulkanCacheHeader {
uint32_t magic;
uint32_t version;
+2 -3
View File
@@ -389,13 +389,12 @@ void TextureCacheVulkan::UpdateCurrentClut(GEPaletteFormat clutFormat, u32 clutB
}
void TextureCacheVulkan::BindTexture(TexCacheEntry *entry) {
if (!entry) {
if (!entry || !entry->vkTex) {
imageView_ = VK_NULL_HANDLE;
curSampler_ = VK_NULL_HANDLE;
return;
}
_dbg_assert_(entry->vkTex);
entry->vkTex->Touch();
int maxLevel = (entry->status & TexCacheEntry::STATUS_NO_MIPS) ? 0 : entry->maxLevel;
@@ -403,7 +402,7 @@ void TextureCacheVulkan::BindTexture(TexCacheEntry *entry) {
curSampler_ = samplerCache_.GetOrCreateSampler(samplerKey);
imageView_ = entry->vkTex->GetImageView();
drawEngine_->SetDepalTexture(VK_NULL_HANDLE, false);
gstate_c.SetUseShaderDepal(false, false);
gstate_c.SetUseShaderDepal(ShaderDepalMode::OFF);
}
void TextureCacheVulkan::ApplySamplingParams(const SamplerCacheKey &key) {
+6 -218
View File
@@ -25,6 +25,12 @@ If you want to download regularly updated builds for Android, Windows x86 and x6
For game compatibility, see [community compatibility feedback](https://report.ppsspp.org/games).
What's new in 1.13.2
====================
* Crashfix on Android 12 when playing certain background music ([#15990])
* Fix Star Ocean battles in D3D backends (#[15889])
* Minor fixes that might fix some other crashes
What's new in 1.13.1
====================
@@ -160,110 +166,6 @@ Adhoc/Network:
* Reduce HLE delays due to multiplayer performance regressions (ie. Ys vs. Sora no Kiseki) ([#14513])
* Fix socket error 10014 on Windows when hosting a game of Vulcanus Seek and Destroy ([#14849])
What's new in 1.11.3
====================
* Fix for graphics glitches in the on-screen keyboard
What's new in 1.11.2
====================
* An additional few crash fixes ([#14129], [#14134], [#14132])
What's new in 1.11.1
====================
* A few crash fixes ([#14085], [#14089], [#14091], [#14092]), a few adhoc fixes
* Glitchy menu audio on some devices ([#14101]), in-game UI font memory leak ([#14078])
* Couple of adhoc fixes ([#14106], [#14117])
What's new in 1.11.0
====================
* Lots of minor bug fixes, crash fixes, and performance fixes and improvements.
* New Browse... button to allow opening SD cards on Android 11
* Countless AdHoc networking fixes by ANR2ME, for example Dragon Ball Shin Budokai, PowerStone,
Bleach Heat The Soul 7, Kingdom Hearts, GTA: VCS and many more.
* Graphics issue with car reflections fixed in Outrun, Dirt 2 ([#13636], [#13640], [#13760])
* Cut-off cards in Yu Gi Oh fixed ([#7124]).
* Numerous fixes to the builtin fonts by nassau-tk
* Added exception handler so PPSSPP stays alive if a game crashes ([#11795]/[#13092])
* Desktop: Support for multiple instance multiplayer ([#13172], ...)
* Workaround for rendering bugs with flat shading in iOS 14
* Multiple fixes to the IR interpreter ([#13897], ...)
* UI: New fullscreen button on desktop platforms, optional navigation sounds ([#13239])
* Audio and multiple hangs fixes in UWP version ([#13792], ...)
* Partial microphone support ([#12336], ...)
* Workaround for wacky action mirroring bug in Hitman Reborn Battle Arena 2 ([#13706], [#13526])
* Hardware texture upscaling for Vulkan, mipmap generation ([#13235], [#13514])
* Added MMPX Vulkan texture upscaling shader ([#13986])
* Depth texturing support in Vulkan and D3D11 ([#13262], [#13556], ...)
* Performance fix for Test Drive Unlimited ([#13355], ...)
* Allow rewind on mobile ([#13866])
* Added option to disable on-screen messages ([#13695])
* Added "Lower resolution for effects" on libretro ([#13654])
* Allow chaining multiple post-processing shaders ([#12924])
* Support for loading game-specific plugins ([#13335])
* Fixed Assassin's Creed: Bloodlines Save issue on Android ([#12761])
* Hanayaka Nari Wa ga Ichizoku: mono voices fixed ([#5213])
* Additional fixed games:
* Namco Museum - Battle Collection, Vol 2 ([#9523], [#13297], [#13298])
* Dream Club Portable (graphics bugs, GL and Vulkan) ([#6025])
* Capcom Classic Collection Reloaded (stuck in return game) ([#4671])
* Xyanide Resurrection (freezing) ([#8526])
* Dissidia Final Fantasy Chinese (patched game, invalid address) ([#13204])
* Crazy Taxi ([#13368])
* Spiderman: Friend or Foe ([#13969])
* Downstream Panic (US) (New Game crash) ([#13633])
What's new in 1.10.3
--------------------
* Fix for control layout editor ([#13125])
What's new in 1.10.2
--------------------
* More crashfixes ([#13094], [#13093])
* Improve download performance and cancel behavior ([#13095])
* Restore the removed I/O on Thread option ([#13096])
What's new in 1.10.1
--------------------
* Fixes for common crashes ([#13077], [#13076], see [#13057])
* Fix for offset rendering in D3D9 ([#13071])
What's new in 1.10.0
--------------------
* Graphics and compatibility fixes ([#12800], [#12670], [#12635], [#12857], [#12941], [#11898], [#12695], more)
* Assorted minor performance improvements, game load speedup ([#12462], [#12652])
* Screen inset (notch) support on Android ([#12779])
* Analog stick support for menu navigation ([#12685])
* Fixed audio glitches in SDL builds ([#12916], [#12920])
* Support more languages in in-game dialogs ([#12702]). Croatian language added to PPSSPP.
* Simple multiplayer chat ([#12667])
* More advanced postprocessing (multipass, parameters) ([#12905], [#12901])
* Add PPSSPP-specific CWCheat ([#12816], [#12912])
* Reintroduce Cardboard VR, allow more resolutions ([#12449], [#8714])
* Fix some crashes ([#12908], [#12876])
* Ghost in the Shell graphics fixed (JIT inaccuracy with inf * 0) ([#12519])
* Mac build now supports Vulkan on top of MoltenVK ([#12583])
* Raspberry Pi 4 EGL crash fixed ([#12474])
* VSync now supported on all backends, frame duplication option added for 30 Hz games ([#12659], [#12602])
* Camera supported on Windows, Linux and Mac (still no microphone though) ([#12572], [#12580], [#12607])
* Darkstalkers fixed and working through software rendering. SW rendering fixed on GLES 2.0 ([#12443], [#12898])
* Hot Shots Golf slowdown and flicker on Vulkan fixed ([#12873], [#12746])
* Pangya Golf crashes and hangs fixed ([#12718])
* Allow rebinding of right touch screen analog ([#12486])
* Add option to prevent mipmaps from being dumped ([#12818])
* Tilt control now have a base radius to help with deadzone ([#12756])
* Mappable auto rotating analog stick to pass some game checks ([#12749])
* Touch control position can now be snapped to a grid ([#12517])
* HiDPI retina display support ([#12552])
* Rapid-fire on touch control ([#12601])
* Toggle mute button ([#12643])
* Add option to resize game icons and more ([#12646], [#12637])
* Frames in-flight now configurable to reduce input lag at the cost of speed ([#12660])
* Add toggle mode to combo button ([#12623])
* SDL mouse support, Qt menu upgrades ([#12612], [#12817])
* Real support for Chinese patched version of Hatsune Miku Project Diva Extend ([#13007])
* Some minor kernel module support ([#13028], [#12225], [#13026], [#13004], [#13038], [#13023])
* Fixed fullscreen toggling with Vulkan in SDL builds ([#11974])
Looking for [older news](history.md)?
@@ -281,120 +183,6 @@ Credit goes to:
[comment]: # (LINK_LIST_BEGIN_HERE)
[#13125]: https://github.com/hrydgard/ppsspp/issues/13125 "Refactor and fix touch control layout screen for notch"
[#13094]: https://github.com/hrydgard/ppsspp/issues/13094 "Camera initialization crash fix"
[#13093]: https://github.com/hrydgard/ppsspp/issues/13093 "Add a try/catch to Android camera device listing."
[#13095]: https://github.com/hrydgard/ppsspp/issues/13095 "http: Check cancel flag more often"
[#13096]: https://github.com/hrydgard/ppsspp/issues/13096 "Revert \"Remove the I/O on Thread option - treat it as always on.\""
[#13077]: https://github.com/hrydgard/ppsspp/issues/13077 "SaveState: Make sure to default init net data"
[#13076]: https://github.com/hrydgard/ppsspp/issues/13076 "Add some excessive null checks to GameScreen::render()"
[#13057]: https://github.com/hrydgard/ppsspp/issues/13057 "The 1.10 Android mystery crash thread!"
[#13071]: https://github.com/hrydgard/ppsspp/issues/13071 "D3D9: Fix a sign mistake generating the projection matrix."
[#12800]: https://github.com/hrydgard/ppsspp/issues/12800 "x86jit: Force INF * 0 to +NAN"
[#12670]: https://github.com/hrydgard/ppsspp/issues/12670 "Attempts to replace 0 frame width with valid frame width.(sceMpegAvcCsc)"
[#12635]: https://github.com/hrydgard/ppsspp/issues/12635 "Kernel: Delay better in sceKernelReferThreadStatus"
[#12857]: https://github.com/hrydgard/ppsspp/issues/12857 "Mumbo Jumbo games freeze on loading screen since v1.6"
[#12941]: https://github.com/hrydgard/ppsspp/issues/12941 "Vulkan: Deal with the reformat clear better"
[#11898]: https://github.com/hrydgard/ppsspp/issues/11898 "Strike Witches - Hakugin no Tsubasa missing intro video"
[#12695]: https://github.com/hrydgard/ppsspp/issues/12695 "New heuristic for getting rid of unnecessary \"antialias-lines\"."
[#12462]: https://github.com/hrydgard/ppsspp/issues/12462 "Vulkan: Enable renderpass merging for all games"
[#12652]: https://github.com/hrydgard/ppsspp/issues/12652 "ScanForFunctions: Speed up game loading"
[#12779]: https://github.com/hrydgard/ppsspp/issues/12779 "Support drawing around notches on Android displays. Fixes #12261"
[#12685]: https://github.com/hrydgard/ppsspp/issues/12685 "UI: Simple joystick navigation. Fixes #10996."
[#12916]: https://github.com/hrydgard/ppsspp/issues/12916 "More audio buffering fixes (primarily affects SDL)"
[#12920]: https://github.com/hrydgard/ppsspp/issues/12920 "Remove the Audio Resampling setting (now always on)."
[#12702]: https://github.com/hrydgard/ppsspp/issues/12702 "PPGe: Use TextDrawer for save UI if available"
[#12667]: https://github.com/hrydgard/ppsspp/issues/12667 "Chat feature based on Adenovan's Rechat branch"
[#12905]: https://github.com/hrydgard/ppsspp/issues/12905 "Allow chained post-processing shaders"
[#12901]: https://github.com/hrydgard/ppsspp/issues/12901 "Post shader setting uniform"
[#12816]: https://github.com/hrydgard/ppsspp/issues/12816 "Implement Xinput vibration CWCheat (PPSSPP specific 0xA code type)"
[#12912]: https://github.com/hrydgard/ppsspp/issues/12912 "Add CWCHEAT for postprocessing"
[#12449]: https://github.com/hrydgard/ppsspp/issues/12449 "Reintroduce Cardboard VR"
[#8714]: https://github.com/hrydgard/ppsspp/issues/8714 "Allow > 5x PSP resolution for devices like iPad Pro 12.9"
[#12908]: https://github.com/hrydgard/ppsspp/issues/12908 "Fix \"Improved compatibility of sceGeListEnQueue: verify that stackDepth < 256\""
[#12876]: https://github.com/hrydgard/ppsspp/issues/12876 "Windows: Add safety checks to WASAPI code"
[#12519]: https://github.com/hrydgard/ppsspp/issues/12519 "Ghost In The Shell - Stand Alone Complex (ULUS10020) - Black Textures and missing screens."
[#12583]: https://github.com/hrydgard/ppsspp/issues/12583 "macOS: Initial support for vulkan on macOS ( MoltenVK )"
[#12474]: https://github.com/hrydgard/ppsspp/issues/12474 "Egl bug on rpi4 with master mesa?"
[#12659]: https://github.com/hrydgard/ppsspp/issues/12659 "Support vsync in all hardware backends, support runtime update"
[#12602]: https://github.com/hrydgard/ppsspp/issues/12602 "Add option to improve frame pacing through duplicate frames if below 60hz."
[#12572]: https://github.com/hrydgard/ppsspp/issues/12572 "Add camera support for windows."
[#12580]: https://github.com/hrydgard/ppsspp/issues/12580 "Add camera support for linux (V4L2)"
[#12607]: https://github.com/hrydgard/ppsspp/issues/12607 "QT API for camera (Linux/macOS)"
[#12443]: https://github.com/hrydgard/ppsspp/issues/12443 "Darkstalkers Chronicle: Add specializations and speedhacks to get it kinda playable"
[#12898]: https://github.com/hrydgard/ppsspp/issues/12898 "[Android] [Mali GPU] [OpenGL] Lastest build blackscreen on buffered rendering mode"
[#12873]: https://github.com/hrydgard/ppsspp/issues/12873 "Vulkan: Framebuffer manager: Use an allocator for \"MakePixelTexture\" images."
[#12746]: https://github.com/hrydgard/ppsspp/issues/12746 "GPU: Assume a scissor of 481x273 is a mistake"
[#12718]: https://github.com/hrydgard/ppsspp/issues/12718 "Vpl: Correct allocation order when splitting block"
[#12486]: https://github.com/hrydgard/ppsspp/issues/12486 "Rebindable touch right analog"
[#12818]: https://github.com/hrydgard/ppsspp/issues/12818 "Add option to prevent Mipmaps from being dumped"
[#12756]: https://github.com/hrydgard/ppsspp/issues/12756 "Skip deadzone option on tilt"
[#12749]: https://github.com/hrydgard/ppsspp/issues/12749 "Auto rotating analog"
[#12517]: https://github.com/hrydgard/ppsspp/issues/12517 "Touch control grid snap"
[#12552]: https://github.com/hrydgard/ppsspp/issues/12552 "Qt/macOS: enable HiDPI ( retina display ) support"
[#12601]: https://github.com/hrydgard/ppsspp/issues/12601 "Add rapid fire to touch control"
[#12643]: https://github.com/hrydgard/ppsspp/issues/12643 "Toggle mute button"
[#12646]: https://github.com/hrydgard/ppsspp/issues/12646 "Resizable game icons"
[#12637]: https://github.com/hrydgard/ppsspp/issues/12637 "Region flag and game ID on game selection screen"
[#12660]: https://github.com/hrydgard/ppsspp/issues/12660 "GPU: Add setting to control inflight frame usage"
[#12623]: https://github.com/hrydgard/ppsspp/issues/12623 "Add toggle flag to combo button"
[#12612]: https://github.com/hrydgard/ppsspp/issues/12612 "SDL analog mouse input"
[#12817]: https://github.com/hrydgard/ppsspp/issues/12817 "Unification of the menu of Linux and Windows versions"
[#13007]: https://github.com/hrydgard/ppsspp/issues/13007 "Real support \"Hatsune Miku Project Diva Extend\" chinese patched version"
[#13028]: https://github.com/hrydgard/ppsspp/issues/13028 "Real support Code Geass: Lost Colors chinese patched version"
[#12225]: https://github.com/hrydgard/ppsspp/issues/12225 "Rebased: Wrap some SysMemForKernel's nids, fixing #7960"
[#13026]: https://github.com/hrydgard/ppsspp/issues/13026 "Add some ThreadManForKernel nids"
[#13004]: https://github.com/hrydgard/ppsspp/issues/13004 "Warp some ThreadManForKernel and sceKernelExitVSHKernel"
[#13038]: https://github.com/hrydgard/ppsspp/issues/13038 "Add sysclib_strncmp,sysclib_memmove"
[#13023]: https://github.com/hrydgard/ppsspp/issues/13023 "Add sysclib_strstr"
[#11974]: https://github.com/hrydgard/ppsspp/issues/11974 "[Linux] [Vulkan] Toggle fullscreen doesn't update display properly"
[#13636]: https://github.com/hrydgard/ppsspp/issues/13636 "Reinterpret framebuffer formats as needed. Outrun reflections partial fix"
[#13640]: https://github.com/hrydgard/ppsspp/issues/13640 "Fix car reflections in Outrun"
[#13760]: https://github.com/hrydgard/ppsspp/issues/13760 "Fix car lighting issues in DiRT 2."
[#7124]: https://github.com/hrydgard/ppsspp/issues/7124 "Yu-Gi-Oh! GX Tag Force Card summoning (card cut-off / cropped)"
[#11795]: https://github.com/hrydgard/ppsspp/issues/11795 "Exception handler - catch bad memory accesses"
[#13092]: https://github.com/hrydgard/ppsspp/issues/13092 "Bad memory access handling improvements"
[#13172]: https://github.com/hrydgard/ppsspp/issues/13172 "Generalized multi-instance"
[#13897]: https://github.com/hrydgard/ppsspp/issues/13897 "LittleBigPlanet - Game Not Loading, Blue Screen (iOS, Unplayable)"
[#13239]: https://github.com/hrydgard/ppsspp/issues/13239 "Add sound effects for PPSSPP interface navigation"
[#13792]: https://github.com/hrydgard/ppsspp/issues/13792 "Fix UWP audio and a hang bug"
[#12336]: https://github.com/hrydgard/ppsspp/issues/12336 "Microphone support"
[#13706]: https://github.com/hrydgard/ppsspp/issues/13706 "Add back the old implementation of vfpu_sin/cos/sincos."
[#13526]: https://github.com/hrydgard/ppsspp/issues/13526 "VFPU: Compute sines and cosines in double precision."
[#13235]: https://github.com/hrydgard/ppsspp/issues/13235 "Vulkan: Allow custom texture upscaling shaders"
[#13514]: https://github.com/hrydgard/ppsspp/issues/13514 "Vulkan: Automatically generate mipmaps for replaced/scaled textures"
[#13986]: https://github.com/hrydgard/ppsspp/issues/13986 "Vulkan: Add MMPX upscaling texture shader"
[#13355]: https://github.com/hrydgard/ppsspp/issues/13355 "Refactor framebuffer attachment. Fixes Test Drive Unlimited performance"
[#13866]: https://github.com/hrydgard/ppsspp/issues/13866 "SaveState: Allow rewind on mobile"
[#13695]: https://github.com/hrydgard/ppsspp/issues/13695 "Add developer setting \"Show on-screen messages\". Uncheck to hide them."
[#13654]: https://github.com/hrydgard/ppsspp/issues/13654 "Expose the \"Lower resolution for effects\" setting in libretro."
[#12924]: https://github.com/hrydgard/ppsspp/issues/12924 "Postprocessing: User chain support"
[#13335]: https://github.com/hrydgard/ppsspp/issues/13335 "Support for loading game-specific plugins"
[#12761]: https://github.com/hrydgard/ppsspp/issues/12761 "[Android][OpenGL&Vulkan][Save issue] Assassin's Creed : Bloodlines (ULJM05571)"
[#5213]: https://github.com/hrydgard/ppsspp/issues/5213 "Hanayaka Nari Wa ga Ichizoku strange MP3 mono voice"
[#9523]: https://github.com/hrydgard/ppsspp/issues/9523 "Namco Museum - Battle Collection - ULUS100035 loading problem"
[#13297]: https://github.com/hrydgard/ppsspp/issues/13297 "Namco Museum Vol. 2 - ULJS00047 infinite loading in some game"
[#13298]: https://github.com/hrydgard/ppsspp/issues/13298 "Fix sceKernelExitThread"
[#6025]: https://github.com/hrydgard/ppsspp/issues/6025 "Dream Club Portable crash after select girl"
[#4671]: https://github.com/hrydgard/ppsspp/issues/4671 "Capcom Classic Collection Reloaded stuck in return game"
[#8526]: https://github.com/hrydgard/ppsspp/issues/8526 "Xyanide Resurrection freezing"
[#13204]: https://github.com/hrydgard/ppsspp/issues/13204 "Dissidia Final Fantasy Chinese patch invalid address"
[#13368]: https://github.com/hrydgard/ppsspp/issues/13368 "Reschedule after resuming thread from suspend."
[#13969]: https://github.com/hrydgard/ppsspp/issues/13969 "Io: Don't allow async close while async busy"
[#13633]: https://github.com/hrydgard/ppsspp/issues/13633 "Downstream Panic (US) New Game crashes"
[#13262]: https://github.com/hrydgard/ppsspp/issues/13262 "Implement texturing from depth buffers (Vulkan only so far)"
[#13556]: https://github.com/hrydgard/ppsspp/issues/13556 "D3D11 depth texture support"
[#14085]: https://github.com/hrydgard/ppsspp/issues/14085 "Handle exec addr errors better - don't let IgnoreBadMemoryAccesses skip dispatcher exceptions"
[#14089]: https://github.com/hrydgard/ppsspp/issues/14089 "GL: Call CreateDeviceObjects *after* updating render_."
[#14091]: https://github.com/hrydgard/ppsspp/issues/14091 "Only allow sceMpegGetAvcAu warmup for God Eater Series"
[#14092]: https://github.com/hrydgard/ppsspp/issues/14092 "SaveState: Prevent crash on bad cookie marker"
[#14101]: https://github.com/hrydgard/ppsspp/issues/14101 "Menu audio glitchfix"
[#14078]: https://github.com/hrydgard/ppsspp/issues/14078 "PPGe: Decimate text images properly"
[#14106]: https://github.com/hrydgard/ppsspp/issues/14106 "[Adhoc] Fix frozen (0 FPS) issue on Kao Challengers and Asterix & Obelix XX"
[#14117]: https://github.com/hrydgard/ppsspp/issues/14117 "[Adhoc] Fix lob"
[#14129]: https://github.com/hrydgard/ppsspp/issues/14129 "GPU: Force reinterpret off without copy image"
[#14134]: https://github.com/hrydgard/ppsspp/issues/14134 "Android: Ensure shutdown waits for render"
[#14132]: https://github.com/hrydgard/ppsspp/issues/14132 "Io: Truncate reads/writes to valid memory"
[#11997]: https://github.com/hrydgard/ppsspp/issues/11997 "Android 12 scoped storage hell"
[#5099]: https://github.com/hrydgard/ppsspp/issues/5099 "IOS touch controls problems."
[#14053]: https://github.com/hrydgard/ppsspp/issues/14053 "Toggle screenshot minor issue."
+12 -3
View File
@@ -63,6 +63,7 @@ enum CmdFormatType {
CMD_FMT_XY,
CMD_FMT_XYXY,
CMD_FMT_XYZ,
CMD_FMT_XYPLUS1,
CMD_FMT_TEXSIZE,
CMD_FMT_F16_XY,
CMD_FMT_VERTEXTYPE,
@@ -233,7 +234,7 @@ static const TabStateRow stateSettingsRows[] = {
{ L"Transfer src pos", GE_CMD_TRANSFERSRCPOS, CMD_FMT_XY },
{ L"Transfer dst", GE_CMD_TRANSFERDST, CMD_FMT_PTRWIDTH, 0, GE_CMD_TRANSFERDSTW },
{ L"Transfer dst pos", GE_CMD_TRANSFERDSTPOS, CMD_FMT_XY },
{ L"Transfer size", GE_CMD_TRANSFERSIZE, CMD_FMT_XY },
{ L"Transfer size", GE_CMD_TRANSFERSIZE, CMD_FMT_XYPLUS1 },
{ L"Vertex type", GE_CMD_VERTEXTYPE, CMD_FMT_VERTEXTYPE },
{ L"Offset addr", GE_CMD_OFFSETADDR, CMD_FMT_OFFSETADDR },
{ L"Vertex addr", GE_CMD_VADDR, CMD_FMT_VADDR },
@@ -376,6 +377,14 @@ void FormatStateRow(wchar_t *dest, const TabStateRow &info, u32 value, bool enab
}
break;
case CMD_FMT_XYPLUS1:
{
int x = value & 0x3FF;
int y = value >> 10;
swprintf(dest, 255, L"%d,%d", x + 1, y + 1);
}
break;
case CMD_FMT_XYXY:
{
int x1 = value & 0x3FF;
@@ -910,7 +919,7 @@ void CtrlStateValues::OnDoubleClick(int row, int column) {
if (column == STATEVALUES_COL_BREAKPOINT) {
bool proceed = true;
if (IsCmdBreakpoint(info.cmd)) {
if (GetCmdBreakpointCond(info.cmd, nullptr)) {
int ret = MessageBox(GetHandle(), L"This breakpoint has a custom condition.\nDo you want to remove it?", L"Confirmation", MB_YESNO);
proceed = ret == IDYES;
}
@@ -993,7 +1002,7 @@ void CtrlStateValues::OnRightClick(int row, int column, const POINT &point) {
{
case ID_DISASM_TOGGLEBREAKPOINT: {
bool proceed = true;
if (IsCmdBreakpoint(info.cmd)) {
if (GetCmdBreakpointCond(info.cmd, nullptr)) {
int ret = MessageBox(GetHandle(), L"This breakpoint has a custom condition.\nDo you want to remove it?", L"Confirmation", MB_YESNO);
proceed = ret == IDYES;
}
+5 -3
View File
@@ -571,9 +571,11 @@ void CtrlMatrixList::ToggleBreakpoint(int row) {
if (state) {
GPUBreakpoints::AddCmdBreakpoint(info->cmd);
} else {
int ret = MessageBox(GetHandle(), L"This breakpoint has a custom condition.\nDo you want to remove it?", L"Confirmation", MB_YESNO);
if (ret != IDYES)
return;
if (GPUBreakpoints::GetCmdBreakpointCond(info->cmd, nullptr)) {
int ret = MessageBox(GetHandle(), L"This breakpoint has a custom condition.\nDo you want to remove it?", L"Confirmation", MB_YESNO);
if (ret != IDYES)
return;
}
GPUBreakpoints::RemoveCmdBreakpoint(info->cmd);
}
+2 -2
View File
@@ -3,8 +3,8 @@
xmlns:tools="http://schemas.android.com/tools"
package="org.ppsspp.ppsspp"
android:installLocation="auto"
android:versionCode="113010000"
android:versionName="1.13.1.0">
android:versionCode="113020000"
android:versionName="1.13.2.0">
<!-- Note that versionCode should be in the format xyyzzrrrr. Example: 110030000 -->
<!-- In this same case, versionName should be 1.10.3.0 -->
<!-- Also note that we are overriding these values anyway from gradle. -->
+8
View File
@@ -325,6 +325,11 @@ UCJS18036 = true
UCAS40292 = true
UCJS18053 = true
# Rewrite
# fixes softlocks, see #15904
ULJM06364 = true
ULJM06365 = true
# Crash Tag Team Racing used to need it to pass checking memory stick screen.
# ULES00168 = true
# ULES00169 = true
@@ -1295,6 +1300,9 @@ ULES00262 = true
ULUS10064 = true
ULKS46087 = true
[AllowDownloadCLUT]
# Temporary compatibility option, while developing a GPU CLUT-from-framebuffer path.
[VRSkyplane]
# Grand Theft Auto: Liberty City Stories
ULUS10041 = true
+218 -1
View File
@@ -1,5 +1,109 @@
This is history moved out from README.md, which was getting a bit long.
What's new in 1.11.3
====================
* Fix for graphics glitches in the on-screen keyboard
What's new in 1.11.2
====================
* An additional few crash fixes ([#14129], [#14134], [#14132])
What's new in 1.11.1
====================
* A few crash fixes ([#14085], [#14089], [#14091], [#14092]), a few adhoc fixes
* Glitchy menu audio on some devices ([#14101]), in-game UI font memory leak ([#14078])
* Couple of adhoc fixes ([#14106], [#14117])
What's new in 1.11.0
====================
* Lots of minor bug fixes, crash fixes, and performance fixes and improvements.
* New Browse... button to allow opening SD cards on Android 11
* Countless AdHoc networking fixes by ANR2ME, for example Dragon Ball Shin Budokai, PowerStone,
Bleach Heat The Soul 7, Kingdom Hearts, GTA: VCS and many more.
* Graphics issue with car reflections fixed in Outrun, Dirt 2 ([#13636], [#13640], [#13760])
* Cut-off cards in Yu Gi Oh fixed ([#7124]).
* Numerous fixes to the builtin fonts by nassau-tk
* Added exception handler so PPSSPP stays alive if a game crashes ([#11795]/[#13092])
* Desktop: Support for multiple instance multiplayer ([#13172], ...)
* Workaround for rendering bugs with flat shading in iOS 14
* Multiple fixes to the IR interpreter ([#13897], ...)
* UI: New fullscreen button on desktop platforms, optional navigation sounds ([#13239])
* Audio and multiple hangs fixes in UWP version ([#13792], ...)
* Partial microphone support ([#12336], ...)
* Workaround for wacky action mirroring bug in Hitman Reborn Battle Arena 2 ([#13706], [#13526])
* Hardware texture upscaling for Vulkan, mipmap generation ([#13235], [#13514])
* Added MMPX Vulkan texture upscaling shader ([#13986])
* Depth texturing support in Vulkan and D3D11 ([#13262], [#13556], ...)
* Performance fix for Test Drive Unlimited ([#13355], ...)
* Allow rewind on mobile ([#13866])
* Added option to disable on-screen messages ([#13695])
* Added "Lower resolution for effects" on libretro ([#13654])
* Allow chaining multiple post-processing shaders ([#12924])
* Support for loading game-specific plugins ([#13335])
* Fixed Assassin's Creed: Bloodlines Save issue on Android ([#12761])
* Hanayaka Nari Wa ga Ichizoku: mono voices fixed ([#5213])
* Additional fixed games:
* Namco Museum - Battle Collection, Vol 2 ([#9523], [#13297], [#13298])
* Dream Club Portable (graphics bugs, GL and Vulkan) ([#6025])
* Capcom Classic Collection Reloaded (stuck in return game) ([#4671])
* Xyanide Resurrection (freezing) ([#8526])
* Dissidia Final Fantasy Chinese (patched game, invalid address) ([#13204])
* Crazy Taxi ([#13368])
* Spiderman: Friend or Foe ([#13969])
* Downstream Panic (US) (New Game crash) ([#13633])
What's new in 1.10.3
--------------------
* Fix for control layout editor ([#13125])
What's new in 1.10.2
--------------------
* More crashfixes ([#13094], [#13093])
* Improve download performance and cancel behavior ([#13095])
* Restore the removed I/O on Thread option ([#13096])
What's new in 1.10.1
--------------------
* Fixes for common crashes ([#13077], [#13076], see [#13057])
* Fix for offset rendering in D3D9 ([#13071])
What's new in 1.10.0
--------------------
* Graphics and compatibility fixes ([#12800], [#12670], [#12635], [#12857], [#12941], [#11898], [#12695], more)
* Assorted minor performance improvements, game load speedup ([#12462], [#12652])
* Screen inset (notch) support on Android ([#12779])
* Analog stick support for menu navigation ([#12685])
* Fixed audio glitches in SDL builds ([#12916], [#12920])
* Support more languages in in-game dialogs ([#12702]). Croatian language added to PPSSPP.
* Simple multiplayer chat ([#12667])
* More advanced postprocessing (multipass, parameters) ([#12905], [#12901])
* Add PPSSPP-specific CWCheat ([#12816], [#12912])
* Reintroduce Cardboard VR, allow more resolutions ([#12449], [#8714])
* Fix some crashes ([#12908], [#12876])
* Ghost in the Shell graphics fixed (JIT inaccuracy with inf * 0) ([#12519])
* Mac build now supports Vulkan on top of MoltenVK ([#12583])
* Raspberry Pi 4 EGL crash fixed ([#12474])
* VSync now supported on all backends, frame duplication option added for 30 Hz games ([#12659], [#12602])
* Camera supported on Windows, Linux and Mac (still no microphone though) ([#12572], [#12580], [#12607])
* Darkstalkers fixed and working through software rendering. SW rendering fixed on GLES 2.0 ([#12443], [#12898])
* Hot Shots Golf slowdown and flicker on Vulkan fixed ([#12873], [#12746])
* Pangya Golf crashes and hangs fixed ([#12718])
* Allow rebinding of right touch screen analog ([#12486])
* Add option to prevent mipmaps from being dumped ([#12818])
* Tilt control now have a base radius to help with deadzone ([#12756])
* Mappable auto rotating analog stick to pass some game checks ([#12749])
* Touch control position can now be snapped to a grid ([#12517])
* HiDPI retina display support ([#12552])
* Rapid-fire on touch control ([#12601])
* Toggle mute button ([#12643])
* Add option to resize game icons and more ([#12646], [#12637])
* Frames in-flight now configurable to reduce input lag at the cost of speed ([#12660])
* Add toggle mode to combo button ([#12623])
* SDL mouse support, Qt menu upgrades ([#12612], [#12817])
* Real support for Chinese patched version of Hatsune Miku Project Diva Extend ([#13007])
* Some minor kernel module support ([#13028], [#12225], [#13026], [#13004], [#13038], [#13023])
* Fixed fullscreen toggling with Vulkan in SDL builds ([#11974])
What's new in 1.9.0/1.9.3
-------------------------
* Sizing/touch fixes on Android
@@ -565,4 +669,117 @@ go to see there http://forums.ppsspp.org/showthread.php?tid=3595&pid=59241#pid59
[#11307]: https://github.com/hrydgard/ppsspp/issues/11307 "Enable Discord integration for Mac and Linux."
[#10909]: https://github.com/hrydgard/ppsspp/issues/10909 "WebSocket based debugger interface"
[#11447]: https://github.com/hrydgard/ppsspp/issues/11447 "Avoid calling any GL calls during shutdown on Android. Should help #11063"
[#11350]: https://github.com/hrydgard/ppsspp/issues/11350 "TexCache: Optimize DXT3/DXT5 decode to single pass"
[#11350]: https://github.com/hrydgard/ppsspp/issues/11350 "TexCache: Optimize DXT3/DXT5 decode to single pass"
[#13023]: https://github.com/hrydgard/ppsspp/issues/13023 "Add sysclib_strstr"
[#13038]: https://github.com/hrydgard/ppsspp/issues/13038 "Add sysclib_strncmp,sysclib_memmove"
[#13004]: https://github.com/hrydgard/ppsspp/issues/13004 "Warp some ThreadManForKernel and sceKernelExitVSHKernel"
[#13026]: https://github.com/hrydgard/ppsspp/issues/13026 "Add some ThreadManForKernel nids"
[#12225]: https://github.com/hrydgard/ppsspp/issues/12225 "Rebased: Wrap some SysMemForKernel's nids, fixing #7960"
[#13028]: https://github.com/hrydgard/ppsspp/issues/13028 "Real support Code Geass: Lost Colors chinese patched version"
[#13007]: https://github.com/hrydgard/ppsspp/issues/13007 "Real support \"Hatsune Miku Project Diva Extend\" chinese patched version"
[#12817]: https://github.com/hrydgard/ppsspp/issues/12817 "Unification of the menu of Linux and Windows versions"
[#12612]: https://github.com/hrydgard/ppsspp/issues/12612 "SDL analog mouse input"
[#12623]: https://github.com/hrydgard/ppsspp/issues/12623 "Add toggle flag to combo button"
[#12660]: https://github.com/hrydgard/ppsspp/issues/12660 "GPU: Add setting to control inflight frame usage"
[#12637]: https://github.com/hrydgard/ppsspp/issues/12637 "Region flag and game ID on game selection screen"
[#12646]: https://github.com/hrydgard/ppsspp/issues/12646 "Resizable game icons"
[#12643]: https://github.com/hrydgard/ppsspp/issues/12643 "Toggle mute button"
[#12601]: https://github.com/hrydgard/ppsspp/issues/12601 "Add rapid fire to touch control"
[#12552]: https://github.com/hrydgard/ppsspp/issues/12552 "Qt/macOS: enable HiDPI ( retina display ) support"
[#12517]: https://github.com/hrydgard/ppsspp/issues/12517 "Touch control grid snap"
[#12749]: https://github.com/hrydgard/ppsspp/issues/12749 "Auto rotating analog"
[#12756]: https://github.com/hrydgard/ppsspp/issues/12756 "Skip deadzone option on tilt"
[#12818]: https://github.com/hrydgard/ppsspp/issues/12818 "Add option to prevent Mipmaps from being dumped"
[#12486]: https://github.com/hrydgard/ppsspp/issues/12486 "Rebindable touch right analog"
[#12718]: https://github.com/hrydgard/ppsspp/issues/12718 "Vpl: Correct allocation order when splitting block"
[#12746]: https://github.com/hrydgard/ppsspp/issues/12746 "GPU: Assume a scissor of 481x273 is a mistake"
[#12873]: https://github.com/hrydgard/ppsspp/issues/12873 "Vulkan: Framebuffer manager: Use an allocator for \"MakePixelTexture\" images."
[#12898]: https://github.com/hrydgard/ppsspp/issues/12898 "[Android] [Mali GPU] [OpenGL] Lastest build blackscreen on buffered rendering mode"
[#12443]: https://github.com/hrydgard/ppsspp/issues/12443 "Darkstalkers Chronicle: Add specializations and speedhacks to get it kinda playable"
[#12607]: https://github.com/hrydgard/ppsspp/issues/12607 "QT API for camera (Linux/macOS)"
[#12580]: https://github.com/hrydgard/ppsspp/issues/12580 "Add camera support for linux (V4L2)"
[#12572]: https://github.com/hrydgard/ppsspp/issues/12572 "Add camera support for windows."
[#12602]: https://github.com/hrydgard/ppsspp/issues/12602 "Add option to improve frame pacing through duplicate frames if below 60hz."
[#12659]: https://github.com/hrydgard/ppsspp/issues/12659 "Support vsync in all hardware backends, support runtime update"
[#12474]: https://github.com/hrydgard/ppsspp/issues/12474 "Egl bug on rpi4 with master mesa?"
[#12583]: https://github.com/hrydgard/ppsspp/issues/12583 "macOS: Initial support for vulkan on macOS ( MoltenVK )"
[#12519]: https://github.com/hrydgard/ppsspp/issues/12519 "Ghost In The Shell - Stand Alone Complex (ULUS10020) - Black Textures and missing screens."
[#12876]: https://github.com/hrydgard/ppsspp/issues/12876 "Windows: Add safety checks to WASAPI code"
[#12908]: https://github.com/hrydgard/ppsspp/issues/12908 "Fix \"Improved compatibility of sceGeListEnQueue: verify that stackDepth < 256\""
[#8714]: https://github.com/hrydgard/ppsspp/issues/8714 "Allow > 5x PSP resolution for devices like iPad Pro 12.9"
[#12449]: https://github.com/hrydgard/ppsspp/issues/12449 "Reintroduce Cardboard VR"
[#12912]: https://github.com/hrydgard/ppsspp/issues/12912 "Add CWCHEAT for postprocessing"
[#12816]: https://github.com/hrydgard/ppsspp/issues/12816 "Implement Xinput vibration CWCheat (PPSSPP specific 0xA code type)"
[#12901]: https://github.com/hrydgard/ppsspp/issues/12901 "Post shader setting uniform"
[#12905]: https://github.com/hrydgard/ppsspp/issues/12905 "Allow chained post-processing shaders"
[#12667]: https://github.com/hrydgard/ppsspp/issues/12667 "Chat feature based on Adenovan's Rechat branch"
[#12702]: https://github.com/hrydgard/ppsspp/issues/12702 "PPGe: Use TextDrawer for save UI if available"
[#12920]: https://github.com/hrydgard/ppsspp/issues/12920 "Remove the Audio Resampling setting (now always on)."
[#12916]: https://github.com/hrydgard/ppsspp/issues/12916 "More audio buffering fixes (primarily affects SDL)"
[#12685]: https://github.com/hrydgard/ppsspp/issues/12685 "UI: Simple joystick navigation. Fixes #10996."
[#12779]: https://github.com/hrydgard/ppsspp/issues/12779 "Support drawing around notches on Android displays. Fixes #12261"
[#12652]: https://github.com/hrydgard/ppsspp/issues/12652 "ScanForFunctions: Speed up game loading"
[#12462]: https://github.com/hrydgard/ppsspp/issues/12462 "Vulkan: Enable renderpass merging for all games"
[#12695]: https://github.com/hrydgard/ppsspp/issues/12695 "New heuristic for getting rid of unnecessary \"antialias-lines\"."
[#11898]: https://github.com/hrydgard/ppsspp/issues/11898 "Strike Witches - Hakugin no Tsubasa missing intro video"
[#12941]: https://github.com/hrydgard/ppsspp/issues/12941 "Vulkan: Deal with the reformat clear better"
[#12857]: https://github.com/hrydgard/ppsspp/issues/12857 "Mumbo Jumbo games freeze on loading screen since v1.6"
[#12635]: https://github.com/hrydgard/ppsspp/issues/12635 "Kernel: Delay better in sceKernelReferThreadStatus"
[#12670]: https://github.com/hrydgard/ppsspp/issues/12670 "Attempts to replace 0 frame width with valid frame width.(sceMpegAvcCsc)"
[#12800]: https://github.com/hrydgard/ppsspp/issues/12800 "x86jit: Force INF * 0 to +NAN"
[#13071]: https://github.com/hrydgard/ppsspp/issues/13071 "D3D9: Fix a sign mistake generating the projection matrix."
[#13076]: https://github.com/hrydgard/ppsspp/issues/13076 "Add some excessive null checks to GameScreen::render()"
[#13057]: https://github.com/hrydgard/ppsspp/issues/13057 "The 1.10 Android mystery crash thread!"
[#13077]: https://github.com/hrydgard/ppsspp/issues/13077 "SaveState: Make sure to default init net data"
[#13096]: https://github.com/hrydgard/ppsspp/issues/13096 "Revert \"Remove the I/O on Thread option - treat it as always on.\""
[#13095]: https://github.com/hrydgard/ppsspp/issues/13095 "http: Check cancel flag more often"
[#13093]: https://github.com/hrydgard/ppsspp/issues/13093 "Add a try/catch to Android camera device listing."
[#13094]: https://github.com/hrydgard/ppsspp/issues/13094 "Camera initialization crash fix"
[#13125]: https://github.com/hrydgard/ppsspp/issues/13125 "Refactor and fix touch control layout screen for notch"
[#13633]: https://github.com/hrydgard/ppsspp/issues/13633 "Downstream Panic (US) New Game crashes"
[#13969]: https://github.com/hrydgard/ppsspp/issues/13969 "Io: Don't allow async close while async busy"
[#13368]: https://github.com/hrydgard/ppsspp/issues/13368 "Reschedule after resuming thread from suspend."
[#13204]: https://github.com/hrydgard/ppsspp/issues/13204 "Dissidia Final Fantasy Chinese patch invalid address"
[#8526]: https://github.com/hrydgard/ppsspp/issues/8526 "Xyanide Resurrection freezing"
[#4671]: https://github.com/hrydgard/ppsspp/issues/4671 "Capcom Classic Collection Reloaded stuck in return game"
[#6025]: https://github.com/hrydgard/ppsspp/issues/6025 "Dream Club Portable crash after select girl"
[#13298]: https://github.com/hrydgard/ppsspp/issues/13298 "Fix sceKernelExitThread"
[#13297]: https://github.com/hrydgard/ppsspp/issues/13297 "Namco Museum Vol. 2 - ULJS00047 infinite loading in some game"
[#9523]: https://github.com/hrydgard/ppsspp/issues/9523 "Namco Museum - Battle Collection - ULUS100035 loading problem"
[#5213]: https://github.com/hrydgard/ppsspp/issues/5213 "Hanayaka Nari Wa ga Ichizoku strange MP3 mono voice"
[#12761]: https://github.com/hrydgard/ppsspp/issues/12761 "[Android][OpenGL&Vulkan][Save issue] Assassin's Creed : Bloodlines (ULJM05571)"
[#13335]: https://github.com/hrydgard/ppsspp/issues/13335 "Support for loading game-specific plugins"
[#12924]: https://github.com/hrydgard/ppsspp/issues/12924 "Postprocessing: User chain support"
[#13654]: https://github.com/hrydgard/ppsspp/issues/13654 "Expose the \"Lower resolution for effects\" setting in libretro."
[#13695]: https://github.com/hrydgard/ppsspp/issues/13695 "Add developer setting \"Show on-screen messages\". Uncheck to hide them."
[#13866]: https://github.com/hrydgard/ppsspp/issues/13866 "SaveState: Allow rewind on mobile"
[#13355]: https://github.com/hrydgard/ppsspp/issues/13355 "Refactor framebuffer attachment. Fixes Test Drive Unlimited performance"
[#13556]: https://github.com/hrydgard/ppsspp/issues/13556 "D3D11 depth texture support"
[#13262]: https://github.com/hrydgard/ppsspp/issues/13262 "Implement texturing from depth buffers (Vulkan only so far)"
[#13986]: https://github.com/hrydgard/ppsspp/issues/13986 "Vulkan: Add MMPX upscaling texture shader"
[#13514]: https://github.com/hrydgard/ppsspp/issues/13514 "Vulkan: Automatically generate mipmaps for replaced/scaled textures"
[#13235]: https://github.com/hrydgard/ppsspp/issues/13235 "Vulkan: Allow custom texture upscaling shaders"
[#13526]: https://github.com/hrydgard/ppsspp/issues/13526 "VFPU: Compute sines and cosines in double precision."
[#13706]: https://github.com/hrydgard/ppsspp/issues/13706 "Add back the old implementation of vfpu_sin/cos/sincos."
[#12336]: https://github.com/hrydgard/ppsspp/issues/12336 "Microphone support"
[#13792]: https://github.com/hrydgard/ppsspp/issues/13792 "Fix UWP audio and a hang bug"
[#13239]: https://github.com/hrydgard/ppsspp/issues/13239 "Add sound effects for PPSSPP interface navigation"
[#13897]: https://github.com/hrydgard/ppsspp/issues/13897 "LittleBigPlanet - Game Not Loading, Blue Screen (iOS, Unplayable)"
[#13172]: https://github.com/hrydgard/ppsspp/issues/13172 "Generalized multi-instance"
[#13092]: https://github.com/hrydgard/ppsspp/issues/13092 "Bad memory access handling improvements"
[#11795]: https://github.com/hrydgard/ppsspp/issues/11795 "Exception handler - catch bad memory accesses"
[#7124]: https://github.com/hrydgard/ppsspp/issues/7124 "Yu-Gi-Oh! GX Tag Force Card summoning (card cut-off / cropped)"
[#13760]: https://github.com/hrydgard/ppsspp/issues/13760 "Fix car lighting issues in DiRT 2."
[#13640]: https://github.com/hrydgard/ppsspp/issues/13640 "Fix car reflections in Outrun"
[#13636]: https://github.com/hrydgard/ppsspp/issues/13636 "Reinterpret framebuffer formats as needed. Outrun reflections partial fix"
[#14117]: https://github.com/hrydgard/ppsspp/issues/14117 "[Adhoc] Fix lob"
[#14106]: https://github.com/hrydgard/ppsspp/issues/14106 "[Adhoc] Fix frozen (0 FPS) issue on Kao Challengers and Asterix & Obelix XX"
[#14078]: https://github.com/hrydgard/ppsspp/issues/14078 "PPGe: Decimate text images properly"
[#14101]: https://github.com/hrydgard/ppsspp/issues/14101 "Menu audio glitchfix"
[#14092]: https://github.com/hrydgard/ppsspp/issues/14092 "SaveState: Prevent crash on bad cookie marker"
[#14091]: https://github.com/hrydgard/ppsspp/issues/14091 "Only allow sceMpegGetAvcAu warmup for God Eater Series"
[#14089]: https://github.com/hrydgard/ppsspp/issues/14089 "GL: Call CreateDeviceObjects *after* updating render_."
[#14085]: https://github.com/hrydgard/ppsspp/issues/14085 "Handle exec addr errors better - don't let IgnoreBadMemoryAccesses skip dispatcher exceptions"
[#14132]: https://github.com/hrydgard/ppsspp/issues/14132 "Io: Truncate reads/writes to valid memory"
[#14134]: https://github.com/hrydgard/ppsspp/issues/14134 "Android: Ensure shutdown waits for render"
[#14129]: https://github.com/hrydgard/ppsspp/issues/14129 "GPU: Force reinterpret off without copy image"
+1 -1
View File
@@ -4,4 +4,4 @@ Exec=@TargetBin@
Icon=ppsspp
Type=Application
Comment=ppsspp (fast and portable PSP emulator)
Categories=Game
Categories=Game;Emulator
-1
View File
@@ -402,7 +402,6 @@ bool TestFragmentShaders() {
// bits we don't need to test because they are irrelevant on d3d11
id.SetBit(FS_BIT_NO_DEPTH_CANNOT_DISCARD_STENCIL, false);
id.SetBit(FS_BIT_SHADER_DEPAL, false);
// DX9 disabling:
if (static_cast<ReplaceAlphaType>(id.Bits(FS_BIT_STENCIL_TO_ALPHA, 2)) == ReplaceAlphaType::REPLACE_ALPHA_DUALSOURCE)