diff --git a/Core/MemMap.cpp b/Core/MemMap.cpp index 6f324e6e3c..eb5d49ab14 100644 --- a/Core/MemMap.cpp +++ b/Core/MemMap.cpp @@ -438,14 +438,11 @@ void Write_Opcode_JIT(const u32 _Address, const Opcode& _Value) Memory::WriteUnchecked_U32(_Value.encoding, _Address); } -void Memset(const u32 _Address, const u8 _iValue, const u32 _iLength) -{ - u8 *ptr = GetPointer(_Address); - if (ptr != NULL) { +void Memset(const u32 _Address, const u8 _iValue, const u32 _iLength) { + if (IsValidRange(_Address, _iLength)) { + uint8_t *ptr = GetPointerUnchecked(_Address); memset(ptr, _iValue, _iLength); - } - else - { + } else { for (size_t i = 0; i < _iLength; i++) Write_U8(_iValue, (u32)(_Address + i)); } diff --git a/GPU/Common/ShaderId.cpp b/GPU/Common/ShaderId.cpp index d7975f1443..6329103da4 100644 --- a/GPU/Common/ShaderId.cpp +++ b/GPU/Common/ShaderId.cpp @@ -57,6 +57,7 @@ std::string VertexShaderDesc(const ShaderID &id) { } void ComputeVertexShaderID(ShaderID *id_out, u32 vertType, bool useHWTransform) { + bool isModeThrough = gstate.isModeThrough(); bool doTexture = gstate.isTextureMapEnabled() && !gstate.isModeClear(); bool doTextureTransform = gstate.getUVGenMode() == GE_TEXMAP_TEXTURE_MATRIX; bool doShadeMapping = doTexture && (gstate.getUVGenMode() == GE_TEXMAP_ENVIRONMENT_MAP); @@ -71,9 +72,8 @@ void ComputeVertexShaderID(ShaderID *id_out, u32 vertType, bool useHWTransform) bool hasColorTess = (gstate.vertType & GE_VTYPE_COL_MASK) != 0 && (doBezier || doSpline); bool hasTexcoordTess = (gstate.vertType & GE_VTYPE_TC_MASK) != 0 && (doBezier || doSpline); - bool enableFog = gstate.isFogEnabled() && !gstate.isModeThrough() && !gstate.isModeClear(); - bool lmode = gstate.isUsingSecondaryColor() && gstate.isLightingEnabled(); - // lmode: && !isModeThrough!? + bool enableFog = gstate.isFogEnabled() && !isModeThrough && !gstate.isModeClear(); + bool lmode = gstate.isUsingSecondaryColor() && gstate.isLightingEnabled() && !isModeThrough; ShaderID id; id.SetBit(VS_BIT_LMODE, lmode); diff --git a/GPU/Common/SoftwareTransformCommon.cpp b/GPU/Common/SoftwareTransformCommon.cpp index 4ec1aa4e70..a7f0410038 100644 --- a/GPU/Common/SoftwareTransformCommon.cpp +++ b/GPU/Common/SoftwareTransformCommon.cpp @@ -207,7 +207,6 @@ void SoftwareTransform( float uv[3] = {0, 0, 1}; float fogCoef = 1.0f; - // We do software T&L for now float out[3]; float pos[3]; Vec3f normal(0, 0, 1); diff --git a/GPU/GLES/ShaderManagerGLES.cpp b/GPU/GLES/ShaderManagerGLES.cpp index 461384eb70..a4b43c14cc 100644 --- a/GPU/GLES/ShaderManagerGLES.cpp +++ b/GPU/GLES/ShaderManagerGLES.cpp @@ -930,7 +930,7 @@ std::string ShaderManagerGLES::DebugGetShaderString(std::string id, DebugShaderT // as sometimes these features might have an effect on the ID bits. #define CACHE_HEADER_MAGIC 0x83277592 -#define CACHE_VERSION 4 +#define CACHE_VERSION 5 struct CacheHeader { uint32_t magic; uint32_t version; diff --git a/GPU/GLES/VertexShaderGeneratorGLES.cpp b/GPU/GLES/VertexShaderGeneratorGLES.cpp index a6087f33e1..c974af4a1f 100644 --- a/GPU/GLES/VertexShaderGeneratorGLES.cpp +++ b/GPU/GLES/VertexShaderGeneratorGLES.cpp @@ -112,7 +112,7 @@ void GenerateVertexShader(const ShaderID &id, char *buffer, uint32_t *attrMask, bool highpTexcoord = false; if (gl_extensions.IsGLES) { - if (gstate_c.featureFlags & GPU_SUPPORTS_GLSL_ES_300) { + if (gstate_c.Supports(GPU_SUPPORTS_GLSL_ES_300)) { WRITE(p, "#version 300 es\n"); glslES30 = true; texelFetch = "texelFetch"; diff --git a/ext/native/thin3d/VulkanQueueRunner.cpp b/ext/native/thin3d/VulkanQueueRunner.cpp index 628d95150b..e49ff6bd4c 100644 --- a/ext/native/thin3d/VulkanQueueRunner.cpp +++ b/ext/native/thin3d/VulkanQueueRunner.cpp @@ -594,8 +594,8 @@ void VulkanQueueRunner::PerformBindFramebufferAsRenderTarget(const VKRStep &step w = vulkan_->GetBackbufferWidth(); h = vulkan_->GetBackbufferHeight(); renderPass = GetBackbufferRenderPass(); - assert(step.render.color == VKRRenderPassAction::CLEAR || step.render.color == VKRRenderPassAction::DONT_CARE); - assert(step.render.depthStencil == VKRRenderPassAction::CLEAR || step.render.depthStencil == VKRRenderPassAction::DONT_CARE); + _dbg_assert_msg_(G3D, step.render.color == VKRRenderPassAction::CLEAR || step.render.color == VKRRenderPassAction::DONT_CARE, "Backbuffer pass should only be CLEAR or DONT_CARE"); + _dbg_assert_msg_(G3D, step.render.depthStencil == VKRRenderPassAction::CLEAR || step.render.depthStencil == VKRRenderPassAction::DONT_CARE, "Backbuffer pass should only be CLEAR or DONT_CARE"); Uint8x4ToFloat4(clearVal[0].color.float32, step.render.clearColor); numClearVals = 2; // We don't bother with a depth buffer here. clearVal[1].depthStencil.depth = 0.0f;