From ca8554e7d1d7c77b3c2a9ed8a7fb12de7096c67b Mon Sep 17 00:00:00 2001 From: degasus Date: Fri, 29 Mar 2013 14:27:33 +0100 Subject: first try of primitive restart index generator Convert all quads+triangles into trangle_strip and uses primitive restart to split them. Speed up triangle_strip, but slows down all others primitive formats. Only implemented in ogl. --- Source/Core/VideoCommon/Src/VertexLoader.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Source/Core/VideoCommon/Src/VertexLoader.cpp') diff --git a/Source/Core/VideoCommon/Src/VertexLoader.cpp b/Source/Core/VideoCommon/Src/VertexLoader.cpp index 5df495a44c..74c1bd9705 100644 --- a/Source/Core/VideoCommon/Src/VertexLoader.cpp +++ b/Source/Core/VideoCommon/Src/VertexLoader.cpp @@ -659,6 +659,10 @@ void VertexLoader::SetVAT(u32 _group0, u32 _group1, u32 _group2) m_VtxAttr.texCoord[7].Elements = vat.g2.Tex7CoordElements; m_VtxAttr.texCoord[7].Format = vat.g2.Tex7CoordFormat; m_VtxAttr.texCoord[7].Frac = vat.g2.Tex7Frac; + + if(!m_VtxAttr.ByteDequant) { + ERROR_LOG(VIDEO, "ByteDequant is set to zero"); + } }; void VertexLoader::AppendToString(std::string *dest) const -- cgit v1.2.3 From f432d6038e353f98cbe0fa522bd9d6034027246e Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 31 Mar 2013 19:10:21 -0400 Subject: Fix some typos and correct some capitalizations in the log messages. Makes the logging look more orderly and less spammy when spitting out things. --- Source/Core/VideoCommon/Src/VertexLoader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/VideoCommon/Src/VertexLoader.cpp') diff --git a/Source/Core/VideoCommon/Src/VertexLoader.cpp b/Source/Core/VideoCommon/Src/VertexLoader.cpp index 5df495a44c..d1e8b14e8a 100644 --- a/Source/Core/VideoCommon/Src/VertexLoader.cpp +++ b/Source/Core/VideoCommon/Src/VertexLoader.cpp @@ -227,7 +227,7 @@ void VertexLoader::CompileVertexTranslator() #ifdef USE_JIT if (m_compiledCode) - PanicAlert("trying to recompile a vtx translator"); + PanicAlert("Trying to recompile a vtx translator"); m_compiledCode = GetCodePtr(); ABI_EmitPrologue(4); -- cgit v1.2.3 From bab9963b00953d60bdd6fabe265d5daa45a27661 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 17 Apr 2013 23:09:55 -0400 Subject: New license header introduced for DiscIO, AudioCommon, InputCommon, VideoCommon, and Common projects. --- Source/Core/VideoCommon/Src/VertexLoader.cpp | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) (limited to 'Source/Core/VideoCommon/Src/VertexLoader.cpp') diff --git a/Source/Core/VideoCommon/Src/VertexLoader.cpp b/Source/Core/VideoCommon/Src/VertexLoader.cpp index f27271efe6..bb042ed332 100644 --- a/Source/Core/VideoCommon/Src/VertexLoader.cpp +++ b/Source/Core/VideoCommon/Src/VertexLoader.cpp @@ -1,19 +1,6 @@ -// Copyright (C) 2003 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ +// Copyright 2013 Dolphin Emulator Project +// Licensed under GPLv2 +// Refer to the license.txt file included. #include -- cgit v1.2.3 From d244bca1f5f210e03839d0e0a485fc5511ede2d6 Mon Sep 17 00:00:00 2001 From: lioncash Date: Fri, 19 Apr 2013 09:21:45 -0400 Subject: Fix a bunch of random typos in comments and logging. Also update the comment headers for two functions in GCMemcard.cpp. --- Source/Core/VideoCommon/Src/VertexLoader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/VideoCommon/Src/VertexLoader.cpp') diff --git a/Source/Core/VideoCommon/Src/VertexLoader.cpp b/Source/Core/VideoCommon/Src/VertexLoader.cpp index bb042ed332..38a36c3861 100644 --- a/Source/Core/VideoCommon/Src/VertexLoader.cpp +++ b/Source/Core/VideoCommon/Src/VertexLoader.cpp @@ -399,7 +399,7 @@ void VertexLoader::CompileVertexTranslator() } else { _assert_msg_(VIDEO, DIRECT <= tc[i] && tc[i] <= INDEX16, "Invalid texture coordinates!\n(tc[i] = %d)", tc[i]); _assert_msg_(VIDEO, FORMAT_UBYTE <= format && format <= FORMAT_FLOAT, "Invalid texture coordinates format!\n(format = %d)", format); - _assert_msg_(VIDEO, 0 <= elements && elements <= 1, "Invalid number of texture coordinates elemnts!\n(elements = %d)", elements); + _assert_msg_(VIDEO, 0 <= elements && elements <= 1, "Invalid number of texture coordinates elements!\n(elements = %d)", elements); m_NativeFmt->m_components |= VB_HAS_UV0 << i; WriteCall(VertexLoader_TextCoord::GetFunction(tc[i], format, elements)); -- cgit v1.2.3 From 8da425b008b46ef90d649e55c6c0d4a0bc2b556b Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 24 Apr 2013 09:21:54 -0400 Subject: Formatting cleanup for VideoCommon. Block braces on new lines. Also killed off trailing whitespace and dangling elses. Spaced some things out to make them more readable (only in places where it looked like a bit of a clusterfuck). --- Source/Core/VideoCommon/Src/VertexLoader.cpp | 86 +++++++++++++++++++--------- 1 file changed, 59 insertions(+), 27 deletions(-) (limited to 'Source/Core/VideoCommon/Src/VertexLoader.cpp') diff --git a/Source/Core/VideoCommon/Src/VertexLoader.cpp b/Source/Core/VideoCommon/Src/VertexLoader.cpp index 38a36c3861..babaff83a5 100644 --- a/Source/Core/VideoCommon/Src/VertexLoader.cpp +++ b/Source/Core/VideoCommon/Src/VertexLoader.cpp @@ -214,7 +214,7 @@ void VertexLoader::CompileVertexTranslator() #ifdef USE_JIT if (m_compiledCode) - PanicAlert("Trying to recompile a vtx translator"); + PanicAlert("Trying to recompile a vertex translator"); m_compiledCode = GetCodePtr(); ABI_EmitPrologue(4); @@ -224,14 +224,17 @@ void VertexLoader::CompileVertexTranslator() // Reset component counters if present in vertex format only. if (m_VtxDesc.Tex0Coord || m_VtxDesc.Tex1Coord || m_VtxDesc.Tex2Coord || m_VtxDesc.Tex3Coord || - m_VtxDesc.Tex4Coord || m_VtxDesc.Tex5Coord || m_VtxDesc.Tex6Coord || m_VtxDesc.Tex7Coord) { + m_VtxDesc.Tex4Coord || m_VtxDesc.Tex5Coord || m_VtxDesc.Tex6Coord || m_VtxDesc.Tex7Coord) + { WriteSetVariable(32, &tcIndex, Imm32(0)); } - if (m_VtxDesc.Color0 || m_VtxDesc.Color1) { + if (m_VtxDesc.Color0 || m_VtxDesc.Color1) + { WriteSetVariable(32, &colIndex, Imm32(0)); } if (m_VtxDesc.Tex0MatIdx || m_VtxDesc.Tex1MatIdx || m_VtxDesc.Tex2MatIdx || m_VtxDesc.Tex3MatIdx || - m_VtxDesc.Tex4MatIdx || m_VtxDesc.Tex5MatIdx || m_VtxDesc.Tex6MatIdx || m_VtxDesc.Tex7MatIdx) { + m_VtxDesc.Tex4MatIdx || m_VtxDesc.Tex5MatIdx || m_VtxDesc.Tex6MatIdx || m_VtxDesc.Tex7MatIdx) + { WriteSetVariable(32, &s_texmtxwrite, Imm32(0)); WriteSetVariable(32, &s_texmtxread, Imm32(0)); } @@ -258,14 +261,16 @@ void VertexLoader::CompileVertexTranslator() int nat_offset = 0; PortableVertexDeclaration vtx_decl; memset(&vtx_decl, 0, sizeof(vtx_decl)); - for (int i = 0; i < 8; i++) { + for (int i = 0; i < 8; i++) + { vtx_decl.texcoord_offset[i] = -1; } // m_VBVertexStride for texmtx and posmtx is computed later when writing. // Position Matrix Index - if (m_VtxDesc.PosMatIdx) { + if (m_VtxDesc.PosMatIdx) + { WriteCall(PosMtx_ReadDirect_UByte); m_NativeFmt->m_components |= VB_HAS_POSMTXIDX; m_VertexSize += 1; @@ -281,11 +286,14 @@ void VertexLoader::CompileVertexTranslator() if (m_VtxDesc.Tex7MatIdx) {m_VertexSize += 1; m_NativeFmt->m_components |= VB_HAS_TEXMTXIDX7; WriteCall(TexMtx_ReadDirect_UByte); } // Write vertex position loader - if(g_ActiveConfig.bUseBBox) { + if(g_ActiveConfig.bUseBBox) + { WriteCall(UpdateBoundingBoxPrepare); WriteCall(VertexLoader_Position::GetFunction(m_VtxDesc.Position, m_VtxAttr.PosFormat, m_VtxAttr.PosElements)); WriteCall(UpdateBoundingBox); - } else { + } + else + { WriteCall(VertexLoader_Position::GetFunction(m_VtxDesc.Position, m_VtxAttr.PosFormat, m_VtxAttr.PosElements)); } m_VertexSize += VertexLoader_Position::GetSize(m_VtxDesc.Position, m_VtxAttr.PosFormat, m_VtxAttr.PosElements); @@ -317,7 +325,9 @@ void VertexLoader::CompileVertexTranslator() vtx_decl.normal_gl_size = 3; vtx_decl.normal_offset[0] = nat_offset; nat_offset += 12; - if (vtx_attr.NormalElements) { + + if (vtx_attr.NormalElements) + { vtx_decl.normal_offset[1] = nat_offset; nat_offset += 12; vtx_decl.normal_offset[2] = nat_offset; @@ -334,7 +344,8 @@ void VertexLoader::CompileVertexTranslator() vtx_decl.color_gl_type = VAR_UNSIGNED_BYTE; vtx_decl.color_offset[0] = -1; vtx_decl.color_offset[1] = -1; - for (int i = 0; i < 2; i++) { + for (int i = 0; i < 2; i++) + { m_NativeFmt->m_components |= VB_HAS_COL0 << i; switch (col[i]) { @@ -382,21 +393,26 @@ void VertexLoader::CompileVertexTranslator() break; } // Common for the three bottom cases - if (col[i] != NOT_PRESENT) { + if (col[i] != NOT_PRESENT) + { vtx_decl.color_offset[i] = nat_offset; nat_offset += 4; } } // Texture matrix indices (remove if corresponding texture coordinate isn't enabled) - for (int i = 0; i < 8; i++) { + for (int i = 0; i < 8; i++) + { vtx_decl.texcoord_offset[i] = -1; const int format = m_VtxAttr.texCoord[i].Format; const int elements = m_VtxAttr.texCoord[i].Elements; - if (tc[i] == NOT_PRESENT) { + if (tc[i] == NOT_PRESENT) + { m_NativeFmt->m_components &= ~(VB_HAS_UV0 << i); - } else { + } + else + { _assert_msg_(VIDEO, DIRECT <= tc[i] && tc[i] <= INDEX16, "Invalid texture coordinates!\n(tc[i] = %d)", tc[i]); _assert_msg_(VIDEO, FORMAT_UBYTE <= format && format <= FORMAT_FLOAT, "Invalid texture coordinates format!\n(format = %d)", format); _assert_msg_(VIDEO, 0 <= elements && elements <= 1, "Invalid number of texture coordinates elements!\n(elements = %d)", elements); @@ -406,8 +422,10 @@ void VertexLoader::CompileVertexTranslator() m_VertexSize += VertexLoader_TextCoord::GetSize(tc[i], format, elements); } - if (m_NativeFmt->m_components & (VB_HAS_TEXMTXIDX0 << i)) { - if (tc[i] != NOT_PRESENT) { + if (m_NativeFmt->m_components & (VB_HAS_TEXMTXIDX0 << i)) + { + if (tc[i] != NOT_PRESENT) + { // if texmtx is included, texcoord will always be 3 floats, z will be the texmtx index vtx_decl.texcoord_offset[i] = nat_offset; vtx_decl.texcoord_gl_type[i] = VAR_FLOAT; @@ -415,7 +433,8 @@ void VertexLoader::CompileVertexTranslator() nat_offset += 12; WriteCall(m_VtxAttr.texCoord[i].Elements ? TexMtx_Write_Float : TexMtx_Write_Float2); } - else { + else + { m_NativeFmt->m_components |= VB_HAS_UV0 << i; // have to include since using now vtx_decl.texcoord_offset[i] = nat_offset; vtx_decl.texcoord_gl_type[i] = VAR_FLOAT; @@ -424,8 +443,10 @@ void VertexLoader::CompileVertexTranslator() WriteCall(TexMtx_Write_Float4); } } - else { - if (tc[i] != NOT_PRESENT) { + else + { + if (tc[i] != NOT_PRESENT) + { vtx_decl.texcoord_offset[i] = nat_offset; vtx_decl.texcoord_gl_type[i] = VAR_FLOAT; vtx_decl.texcoord_size[i] = vtx_attr.texCoord[i].Elements ? 2 : 1; @@ -433,28 +454,35 @@ void VertexLoader::CompileVertexTranslator() } } - if (tc[i] == NOT_PRESENT) { + if (tc[i] == NOT_PRESENT) + { // if there's more tex coords later, have to write a dummy call int j = i + 1; - for (; j < 8; ++j) { - if (tc[j] != NOT_PRESENT) { + for (; j < 8; ++j) + { + if (tc[j] != NOT_PRESENT) + { WriteCall(VertexLoader_TextCoord::GetDummyFunction()); // important to get indices right! break; } } // tricky! - if (j == 8 && !((m_NativeFmt->m_components & VB_HAS_TEXMTXIDXALL) & (VB_HAS_TEXMTXIDXALL << (i + 1)))) { + if (j == 8 && !((m_NativeFmt->m_components & VB_HAS_TEXMTXIDXALL) & (VB_HAS_TEXMTXIDXALL << (i + 1)))) + { // no more tex coords and tex matrices, so exit loop break; } } } - if (m_VtxDesc.PosMatIdx) { + if (m_VtxDesc.PosMatIdx) + { WriteCall(PosMtx_Write); vtx_decl.posmtx_offset = nat_offset; nat_offset += 4; - } else { + } + else + { vtx_decl.posmtx_offset = -1; } @@ -574,7 +602,8 @@ void VertexLoader::RunVertices(int vtx_attr_group, int primitive, int const coun void VertexLoader::ConvertVertices ( int count ) { #ifdef USE_JIT - if (count > 0) { + if (count > 0) + { loop_counter = count; ((void (*)())(void*)m_compiledCode)(); } @@ -678,10 +707,13 @@ void VertexLoader::AppendToString(std::string *dest) const dest->append(StringFromFormat("%ib skin: %i P: %i %s-%s ", m_VertexSize, m_VtxDesc.PosMatIdx, m_VtxAttr.PosElements ? 3 : 2, posMode[m_VtxDesc.Position], posFormats[m_VtxAttr.PosFormat])); - if (m_VtxDesc.Normal) { + + if (m_VtxDesc.Normal) + { dest->append(StringFromFormat("Nrm: %i %s-%s ", m_VtxAttr.NormalElements, posMode[m_VtxDesc.Normal], posFormats[m_VtxAttr.NormalFormat])); } + u32 color_mode[2] = {m_VtxDesc.Color0, m_VtxDesc.Color1}; for (int i = 0; i < 2; i++) { -- cgit v1.2.3