From df379dabae6cd214aa56c1fecdb55133249a1847 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 7 Jul 2015 18:12:14 -0400 Subject: VertexLoaderBase: Adjust the scope of a boolean variable if a or b do actually turn out to be null, this can cause a null pointer dereference. --- Source/Core/VideoCommon/VertexLoaderBase.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'Source/Core/VideoCommon/VertexLoaderBase.cpp') diff --git a/Source/Core/VideoCommon/VertexLoaderBase.cpp b/Source/Core/VideoCommon/VertexLoaderBase.cpp index d5831bc8e5..7f8134b85b 100644 --- a/Source/Core/VideoCommon/VertexLoaderBase.cpp +++ b/Source/Core/VideoCommon/VertexLoaderBase.cpp @@ -131,13 +131,14 @@ public: : VertexLoaderBase(vtx_desc, vtx_attr), a(_a), b(_b) { m_initialized = a && b && a->IsInitialized() && b->IsInitialized(); - bool can_test = a->m_VertexSize == b->m_VertexSize && - a->m_native_components == b->m_native_components && - a->m_native_vtx_decl.stride == b->m_native_vtx_decl.stride; if (m_initialized) { - if (can_test) + m_initialized = a->m_VertexSize == b->m_VertexSize && + a->m_native_components == b->m_native_components && + a->m_native_vtx_decl.stride == b->m_native_vtx_decl.stride; + + if (m_initialized) { m_VertexSize = a->m_VertexSize; m_native_components = a->m_native_components; @@ -152,8 +153,6 @@ public: b->m_VertexSize, b->m_native_components, b->m_native_vtx_decl.stride); } } - - m_initialized &= can_test; } ~VertexLoaderTester() override { -- cgit v1.2.3 From 2559a6f25c8b728aefe570ed1980c4d85b689828 Mon Sep 17 00:00:00 2001 From: Tillmann Karras Date: Wed, 8 Jul 2015 07:17:28 +0200 Subject: VertexLoader: avoid empty lines in perf-$pid.map --- Source/Core/VideoCommon/VertexLoaderBase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/VideoCommon/VertexLoaderBase.cpp') diff --git a/Source/Core/VideoCommon/VertexLoaderBase.cpp b/Source/Core/VideoCommon/VertexLoaderBase.cpp index d5831bc8e5..34fa375ee1 100644 --- a/Source/Core/VideoCommon/VertexLoaderBase.cpp +++ b/Source/Core/VideoCommon/VertexLoaderBase.cpp @@ -120,7 +120,7 @@ void VertexLoaderBase::AppendToString(std::string *dest) const i, m_VtxAttr.texCoord[i].Elements, posMode[tex_mode[i]], posFormats[m_VtxAttr.texCoord[i].Format])); } } - dest->append(StringFromFormat(" - %i v\n", m_numLoadedVertices)); + dest->append(StringFromFormat(" - %i v", m_numLoadedVertices)); } // a hacky implementation to compare two vertex loaders -- cgit v1.2.3 From 8fdb013d540cf5d79a23888053fda2897f997e61 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 4 Sep 2015 19:44:39 -0400 Subject: General: Toss out PRI macro usage Now that VS supports more printf specifiers, these aren't necessary --- Source/Core/VideoCommon/VertexLoaderBase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/VideoCommon/VertexLoaderBase.cpp') diff --git a/Source/Core/VideoCommon/VertexLoaderBase.cpp b/Source/Core/VideoCommon/VertexLoaderBase.cpp index 681f43b4fa..c23e9a1f36 100644 --- a/Source/Core/VideoCommon/VertexLoaderBase.cpp +++ b/Source/Core/VideoCommon/VertexLoaderBase.cpp @@ -173,7 +173,7 @@ public: if (memcmp(buffer_a.data(), buffer_b.data(), std::min(count_a, count_b) * m_native_vtx_decl.stride)) ERROR_LOG(VIDEO, "The two vertex loaders have loaded different data " - "(guru meditation 0x%016" PRIx64 ", 0x%08x, 0x%08x, 0x%08x).", + "(guru meditation 0x%016llx, 0x%08x, 0x%08x, 0x%08x).", m_VtxDesc.Hex, m_vat.g0.Hex, m_vat.g1.Hex, m_vat.g2.Hex); memcpy(dst.GetPointer(), buffer_a.data(), count_a * m_native_vtx_decl.stride); -- cgit v1.2.3 From 19459e827f6c15f9429598015019ecb66f2e6cad Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 8 Sep 2015 01:44:37 -0400 Subject: Partially revert "General: Toss out PRI macro usage" --- Source/Core/VideoCommon/VertexLoaderBase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/VideoCommon/VertexLoaderBase.cpp') diff --git a/Source/Core/VideoCommon/VertexLoaderBase.cpp b/Source/Core/VideoCommon/VertexLoaderBase.cpp index c23e9a1f36..681f43b4fa 100644 --- a/Source/Core/VideoCommon/VertexLoaderBase.cpp +++ b/Source/Core/VideoCommon/VertexLoaderBase.cpp @@ -173,7 +173,7 @@ public: if (memcmp(buffer_a.data(), buffer_b.data(), std::min(count_a, count_b) * m_native_vtx_decl.stride)) ERROR_LOG(VIDEO, "The two vertex loaders have loaded different data " - "(guru meditation 0x%016llx, 0x%08x, 0x%08x, 0x%08x).", + "(guru meditation 0x%016" PRIx64 ", 0x%08x, 0x%08x, 0x%08x).", m_VtxDesc.Hex, m_vat.g0.Hex, m_vat.g1.Hex, m_vat.g2.Hex); memcpy(dst.GetPointer(), buffer_a.data(), count_a * m_native_vtx_decl.stride); -- cgit v1.2.3