diff --git a/Source/Core/VideoCommon/Src/LookUpTables.cpp b/Source/Core/VideoCommon/Src/LookUpTables.cpp index 852f4bb20a..99453f0ffc 100644 --- a/Source/Core/VideoCommon/Src/LookUpTables.cpp +++ b/Source/Core/VideoCommon/Src/LookUpTables.cpp @@ -28,15 +28,18 @@ int lut6to8[64]; float lutu8tosfloat[256]; float lutu8toufloat[256]; float luts8tosfloat[256]; +float shiftLookup[32]; void InitLUTs() { - for (int i = 0; i < 64; i++) - lut6to8[i] = (i*255) / 63; - for (int i = 0; i < 256; i++) - { - lutu8tosfloat[i] = (float)(i - 128) / 127.0f; - lutu8toufloat[i] = (float)(i) / 255.0f; - luts8tosfloat[i] = ((float)(signed char)(char)i) / 127.0f; - } + for (int i = 0; i < 32; i++) + shiftLookup[i] = 1.0f / float(1 << i); + for (int i = 0; i < 64; i++) + lut6to8[i] = (i*255) / 63; + for (int i = 0; i < 256; i++) + { + lutu8tosfloat[i] = (float)(i - 128) / 127.0f; + lutu8toufloat[i] = (float)(i) / 255.0f; + luts8tosfloat[i] = ((float)(signed char)(char)i) / 127.0f; + } } diff --git a/Source/Core/VideoCommon/Src/LookUpTables.h b/Source/Core/VideoCommon/Src/LookUpTables.h index 8b76d85269..4509f70bef 100644 --- a/Source/Core/VideoCommon/Src/LookUpTables.h +++ b/Source/Core/VideoCommon/Src/LookUpTables.h @@ -27,6 +27,7 @@ extern int lut6to8[64]; extern float lutu8tosfloat[256]; extern float lutu8toufloat[256]; extern float luts8tosfloat[256]; +extern float shiftLookup[32]; void InitLUTs(); diff --git a/Source/Plugins/Plugin_VideoDX9/Src/VertexHandler.cpp b/Source/Plugins/Plugin_VideoDX9/Src/VertexHandler.cpp index b07014f31b..96a742e86c 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/VertexHandler.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/VertexHandler.cpp @@ -31,9 +31,6 @@ using namespace D3D; -//TODO(ector): remove and calculate inline? -float shiftLookup[32]; - IndexGenerator indexGen; Collection CVertexHandler::collection; @@ -65,10 +62,6 @@ const D3DVERTEXELEMENT9 decl[] = void CVertexHandler::Init() { collection = C_NOTHING; - - for (int i = 0; i < 31; i++) - shiftLookup[i] = 1.0f / float(1 << i); - fakeVBuffer = new D3DVertex[65536]; fakeIBuffer = new u16[65536]; CreateDeviceObjects(); diff --git a/Source/Plugins/Plugin_VideoDX9/Src/VertexHandler.h b/Source/Plugins/Plugin_VideoDX9/Src/VertexHandler.h index f9ac2e751a..65e778b76a 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/VertexHandler.h +++ b/Source/Plugins/Plugin_VideoDX9/Src/VertexHandler.h @@ -22,8 +22,6 @@ #include "VertexLoader.h" #include "DecodedVArray.h" -extern float shiftLookup[32]; - struct UV { float u,v,w; diff --git a/Source/Plugins/Plugin_VideoDX9/Src/VertexLoader.cpp b/Source/Plugins/Plugin_VideoDX9/Src/VertexLoader.cpp index 98878567af..0e0f4f21d6 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/VertexLoader.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/VertexLoader.cpp @@ -20,6 +20,7 @@ #include "x64Emitter.h" #include "Common.h" +#include "LookUpTables.h" #include "Profiler.h" #include "VertexHandler.h" #include "VertexLoader.h" diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp index 92dfca6a16..a935fd9202 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp @@ -387,10 +387,10 @@ void Renderer::ProcessMessages() int time_left = (int)(it->dwTimeStamp - timeGetTime()); int alpha = 255; - if(time_left<1024) + if (time_left < 1024) { - alpha=time_left>>2; - if(time_left<0) alpha=0; + alpha = time_left >> 2; + if (time_left < 0) alpha = 0; } alpha <<= 24; diff --git a/Source/Plugins/Plugin_VideoOGL/Src/TextureMngr.cpp b/Source/Plugins/Plugin_VideoOGL/Src/TextureMngr.cpp index 039c3b8015..b6f1da4d33 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/TextureMngr.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/TextureMngr.cpp @@ -137,7 +137,6 @@ void TextureMngr::Shutdown() void TextureMngr::Cleanup() { TexCache::iterator iter = textures.begin(); - while (iter != textures.end()) { if (frameCount > 20 + iter->second.frameCount) { if (!iter->second.isRenderTarget) { diff --git a/Source/Plugins/Plugin_VideoOGL/Src/VertexLoader.cpp b/Source/Plugins/Plugin_VideoOGL/Src/VertexLoader.cpp index a5b13cd879..7d6cce7a0d 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/VertexLoader.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/VertexLoader.cpp @@ -56,9 +56,6 @@ static int colIndex; #endif TVtxDesc VertexManager::s_GlobalVtxDesc; -float VertexManager::shiftLookup[32]; - - // ============================================================================== // Direct @@ -259,9 +256,9 @@ int VertexLoader::ComputeVertexSize() } // Note the use of CallCdeclFunction3I etc. -// This is a horrible hack that is necessary because Opengl32.dll is based way, way above the 32-bit address space -// that is within reach of a CALL, and just doing &fn gives us these high uncallable addresses. So we want to grab -// the function pointers from the import table instead. +// This is a horrible hack that is necessary because in 64-bit mode, Opengl32.dll is based way, way above the 32-bit +// address space that is within reach of a CALL, and just doing &fn gives us these high uncallable addresses. So we +// want to grab the function pointers from the import table instead. // This problem does not apply to glew functions, only core opengl32 functions. @@ -362,7 +359,7 @@ void VertexLoader::ProcessFormat() } WriteCall(pFunc); - int sizePro=0; + int sizePro = 0; switch (m_VtxAttr.NormalFormat) { case FORMAT_UBYTE: sizePro=1; break; @@ -385,7 +382,7 @@ void VertexLoader::ProcessFormat() for (int i = 0; i < 2; i++) { SetupColor(i, col[i], m_VtxAttr.color[i].Comp, m_VtxAttr.color[i].Elements); - if (col[i] != NOT_PRESENT ) + if (col[i] != NOT_PRESENT) m_VBVertexStride+=4; } @@ -399,7 +396,7 @@ void VertexLoader::ProcessFormat() for (int i = 0; i < 8; i++) { SetupTexCoord(i, tc[i], m_VtxAttr.texCoord[i].Format, m_VtxAttr.texCoord[i].Elements, m_VtxAttr.texCoord[i].Frac); - if( m_components&(VB_HAS_TEXMTXIDX0< 0) + if (v - startv > 0) VertexManager::AddVertices(primitive, v-startv+extraverts); VertexManager::Flush(); // Why does this need to be so complicated? @@ -823,5 +767,5 @@ void VertexLoader::RunVertices(int primitive, int count) } if (startv < count) - VertexManager::AddVertices(primitive, count-startv+extraverts); + VertexManager::AddVertices(primitive, count - startv + extraverts); } diff --git a/Source/Plugins/Plugin_VideoOGL/Src/VertexLoader.h b/Source/Plugins/Plugin_VideoOGL/Src/VertexLoader.h index c5fc7bbb77..6e2ca14931 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/VertexLoader.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/VertexLoader.h @@ -32,6 +32,39 @@ using namespace std; #define LOADERDECL __cdecl typedef void (LOADERDECL *TPipelineFunction)(void*); +// m_components +enum { + VB_HAS_POSMTXIDX =(1<<1), + VB_HAS_TEXMTXIDX0=(1<<2), + VB_HAS_TEXMTXIDX1=(1<<3), + VB_HAS_TEXMTXIDX2=(1<<4), + VB_HAS_TEXMTXIDX3=(1<<5), + VB_HAS_TEXMTXIDX4=(1<<6), + VB_HAS_TEXMTXIDX5=(1<<7), + VB_HAS_TEXMTXIDX6=(1<<8), + VB_HAS_TEXMTXIDX7=(1<<9), + VB_HAS_TEXMTXIDXALL=(0xff<<2), + //VB_HAS_POS=0, // Implied, it always has pos! don't bother testing + VB_HAS_NRM0=(1<<10), + VB_HAS_NRM1=(1<<11), + VB_HAS_NRM2=(1<<12), + VB_HAS_NRMALL=(7<<10), + + VB_HAS_COL0=(1<<13), + VB_HAS_COL1=(1<<14), + + VB_HAS_UV0=(1<<15), + VB_HAS_UV1=(1<<16), + VB_HAS_UV2=(1<<17), + VB_HAS_UV3=(1<<18), + VB_HAS_UV4=(1<<19), + VB_HAS_UV5=(1<<20), + VB_HAS_UV6=(1<<21), + VB_HAS_UV7=(1<<22), + VB_HAS_UVALL=(0xff<<15), + VB_HAS_UVTEXMTXSHIFT=13, +}; + // There are 8 of these. Most games only use the first, and just reconfigure it all the time // as needed, unfortunately. class VertexLoader @@ -44,38 +77,6 @@ public: NRM_THREE = 3 }; - // m_components - enum { - VB_HAS_POSMTXIDX =(1<<1), - VB_HAS_TEXMTXIDX0=(1<<2), - VB_HAS_TEXMTXIDX1=(1<<3), - VB_HAS_TEXMTXIDX2=(1<<4), - VB_HAS_TEXMTXIDX3=(1<<5), - VB_HAS_TEXMTXIDX4=(1<<6), - VB_HAS_TEXMTXIDX5=(1<<7), - VB_HAS_TEXMTXIDX6=(1<<8), - VB_HAS_TEXMTXIDX7=(1<<9), - VB_HAS_TEXMTXIDXALL=(0xff<<2), - //VB_HAS_POS=0, // Implied, it always has pos! don't bother testing - VB_HAS_NRM0=(1<<10), - VB_HAS_NRM1=(1<<11), - VB_HAS_NRM2=(1<<12), - VB_HAS_NRMALL=(7<<10), - - VB_HAS_COL0=(1<<13), - VB_HAS_COL1=(1<<14), - - VB_HAS_UV0=(1<<15), - VB_HAS_UV1=(1<<16), - VB_HAS_UV2=(1<<17), - VB_HAS_UV3=(1<<18), - VB_HAS_UV4=(1<<19), - VB_HAS_UV5=(1<<20), - VB_HAS_UV6=(1<<21), - VB_HAS_UV7=(1<<22), - VB_HAS_UVALL=(0xff<<15), - VB_HAS_UVTEXMTXSHIFT=13, - }; private: TPipelineFunction m_PipelineStates[32]; diff --git a/Source/Plugins/Plugin_VideoOGL/Src/VertexManager.cpp b/Source/Plugins/Plugin_VideoOGL/Src/VertexManager.cpp index b28423c31e..5dc13fd79a 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/VertexManager.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/VertexManager.cpp @@ -15,14 +15,11 @@ static GLuint s_vboBuffers[0x40] = {0}; static int s_nCurVBOIndex = 0; // current free buffer -static GLenum s_prevprimitive = 0; // current primitive type static u8 *s_pBaseBufferPointer = NULL; static vector< pair > s_vStoredPrimitives; // every element, mode and count to be passed to glDrawArrays +static u32 s_prevcomponents; // previous state set u8* VertexManager::s_pCurBufferPointer = NULL; -u32 VertexManager::s_prevvbstride; -u32 VertexManager::s_prevcomponents; // previous state set - const GLenum c_primitiveType[8] = { @@ -45,14 +42,9 @@ bool VertexManager::Init() s_GlobalVtxDesc.Hex = 0; s_prevcomponents = 0; - s_prevvbstride = 12; // just pos - s_prevprimitive = 0; s_pBaseBufferPointer = (u8*)AllocateMemoryPages(MAX_BUFFER_SIZE); s_pCurBufferPointer = s_pBaseBufferPointer; - for (u32 i = 0; i < ARRAYSIZE(shiftLookup); i++) - shiftLookup[i] = 1.0f / float(1 << i); - s_nCurVBOIndex = 0; glGenBuffers(ARRAYSIZE(s_vboBuffers), s_vboBuffers); for (u32 i = 0; i < ARRAYSIZE(s_vboBuffers); ++i) { @@ -80,7 +72,7 @@ void VertexManager::Destroy() void VertexManager::ResetBuffer() { - s_nCurVBOIndex = (s_nCurVBOIndex+1)%ARRAYSIZE(s_vboBuffers); + s_nCurVBOIndex = (s_nCurVBOIndex + 1) % ARRAYSIZE(s_vboBuffers); s_pCurBufferPointer = s_pBaseBufferPointer; s_vStoredPrimitives.resize(0); } @@ -88,20 +80,19 @@ void VertexManager::ResetBuffer() void VertexManager::ResetComponents() { s_prevcomponents = 0; - s_prevvbstride = 12; // just pos - s_prevprimitive = 0; glDisableVertexAttribArray(SHADER_POSMTX_ATTRIB); glDisableClientState(GL_NORMAL_ARRAY); glDisableVertexAttribArray(SHADER_NORM1_ATTRIB); glDisableVertexAttribArray(SHADER_NORM2_ATTRIB); glDisableClientState(GL_COLOR_ARRAY); glDisableClientState(GL_SECONDARY_COLOR_ARRAY); - for (int i = 0; i < 8; ++i) glDisableClientState(GL_TEXTURE_COORD_ARRAY); + for (int i = 0; i < 8; i++) + glDisableClientState(GL_TEXTURE_COORD_ARRAY); } int VertexManager::GetRemainingSize() { - return MAX_BUFFER_SIZE - (int)(s_pCurBufferPointer-s_pBaseBufferPointer); + return MAX_BUFFER_SIZE - (int)(s_pCurBufferPointer - s_pBaseBufferPointer); } void VertexManager::AddVertices(int primitive, int numvertices) @@ -122,8 +113,8 @@ void VertexManager::Flush() if (s_vStoredPrimitives.size() == 0) return; - _assert_( fnSetupVertexPointers != NULL ); - _assert_( s_pCurBufferPointer != s_pBaseBufferPointer ); + _assert_(fnSetupVertexPointers != NULL); + _assert_(s_pCurBufferPointer != s_pBaseBufferPointer); #ifdef _DEBUG PRIM_LOG("frame%d:\ncomps=0x%x, texgen=%d, numchan=%d, dualtex=%d, ztex=%d, proj=%d, cole=%d, alpe=%d, ze=%d\n", g_Config.iSaveTargetId, s_prevcomponents, xfregs.numTexGens, @@ -135,6 +126,7 @@ void VertexManager::Flush() ch = &xfregs.colChans[i].alpha; PRIM_LOG("alpchan%d: matsrc=%d, light=0x%x, ambsrc=%d, diffunc=%d, attfunc=%d\n", i, ch->matsource, ch->GetFullLightMask(), ch->ambsource, ch->diffusefunc, ch->attnfunc); } + for (int i = 0; i < xfregs.numTexGens; ++i) { TexMtxInfo tinfo = xfregs.texcoords[i].texmtxinfo; if (tinfo.texgentype != XF_TEXGEN_EMBOSS_MAP ) tinfo.hex &= 0x7ff; @@ -183,7 +175,7 @@ void VertexManager::Flush() for (int i = 0; i < 8; i++) { if (usedtextures & (1 << i)) { glActiveTexture(GL_TEXTURE0+i); - + FourTexUnits &tex = bpmem.tex[i>>2]; TextureMngr::TCacheEntry* tentry = TextureMngr::Load(i, (tex.texImage3[i&3].image_base/* & 0x1FFFFF*/) << 5, tex.texImage0[i&3].width+1, tex.texImage0[i&3].height+1, @@ -193,9 +185,9 @@ void VertexManager::Flush() // texture loaded fine, set dims for pixel shader if (tentry->isNonPow2) { PixelShaderMngr::SetTexDims(i, tentry->w, tentry->h, tentry->mode.wrap_s, tentry->mode.wrap_t); - nonpow2tex |= 1<mode.wrap_s > 0 ) nonpow2tex |= 1<<(8+i); - if (tentry->mode.wrap_t > 0 ) nonpow2tex |= 1<<(16+i); + nonpow2tex |= 1 << i; + if (tentry->mode.wrap_s > 0) nonpow2tex |= 1 << (8 + i); + if (tentry->mode.wrap_t > 0) nonpow2tex |= 1 << (16 + i); TextureMngr::EnableTexRECT(i); } // if texture is power of two, set to ones (since don't need scaling) @@ -226,7 +218,7 @@ void VertexManager::Flush() FRAGMENTSHADER* ps = PixelShaderMngr::GetShader(); VERTEXSHADER* vs = VertexShaderMngr::GetShader(s_prevcomponents); - _assert_( ps != NULL && vs != NULL ); + _assert_(ps != NULL && vs != NULL); bool bRestoreBuffers = false; if (Renderer::GetZBufferTarget()) { @@ -241,9 +233,9 @@ void VertexManager::Flush() glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT); bRestoreBuffers = true; } - } - else + } else { Renderer::SetRenderMode(Renderer::RM_Normal); + } // set global constants VertexShaderMngr::SetConstants(*vs); @@ -258,8 +250,7 @@ void VertexManager::Flush() #endif int offset = 0; - vector< pair >::iterator it; - for (it = s_vStoredPrimitives.begin(); it != s_vStoredPrimitives.end(); ++it) { + for (vector< pair >::const_iterator it = s_vStoredPrimitives.begin(); it != s_vStoredPrimitives.end(); ++it) { glDrawArrays(it->first, offset, it->second); offset += it->second; } @@ -323,3 +314,59 @@ void VertexManager::LoadCPReg(u32 SubCmd, u32 Value) case 0xB0: arraystrides[SubCmd & 0xF] = Value & 0xFF; break; } } + +void VertexManager::EnableComponents(u32 components) +{ + if (s_prevcomponents != components) { + VertexManager::Flush(); + + // matrices + if ((components & VB_HAS_POSMTXIDX) != (s_prevcomponents & VB_HAS_POSMTXIDX)) { + if (components & VB_HAS_POSMTXIDX) + glEnableVertexAttribArray(SHADER_POSMTX_ATTRIB); + else + glDisableVertexAttribArray(SHADER_POSMTX_ATTRIB); + } + + // normals + if ((components & VB_HAS_NRM0) != (s_prevcomponents & VB_HAS_NRM0)) { + if (components & VB_HAS_NRM0) + glEnableClientState(GL_NORMAL_ARRAY); + else + glDisableClientState(GL_NORMAL_ARRAY); + } + if ((components & VB_HAS_NRM1) != (s_prevcomponents & VB_HAS_NRM1)) { + if (components & VB_HAS_NRM1) { + glEnableVertexAttribArray(SHADER_NORM1_ATTRIB); + glEnableVertexAttribArray(SHADER_NORM2_ATTRIB); + } + else { + glDisableVertexAttribArray(SHADER_NORM1_ATTRIB); + glDisableVertexAttribArray(SHADER_NORM2_ATTRIB); + } + } + + // color + for (int i = 0; i < 2; ++i) { + if ((components & (VB_HAS_COL0 << i)) != (s_prevcomponents & (VB_HAS_COL0 << i))) { + if (components & (VB_HAS_COL0 << 0)) + glEnableClientState(i ? GL_SECONDARY_COLOR_ARRAY : GL_COLOR_ARRAY); + else + glDisableClientState(i ? GL_SECONDARY_COLOR_ARRAY : GL_COLOR_ARRAY); + } + } + + // tex + for (int i = 0; i < 8; ++i) { + if ((components & (VB_HAS_UV0 << i)) != (s_prevcomponents & (VB_HAS_UV0 << i))) { + glClientActiveTexture(GL_TEXTURE0 + i); + if (components & (VB_HAS_UV0 << i)) + glEnableClientState(GL_TEXTURE_COORD_ARRAY); + else + glDisableClientState(GL_TEXTURE_COORD_ARRAY); + } + } + + s_prevcomponents = components; + } +} \ No newline at end of file diff --git a/Source/Plugins/Plugin_VideoOGL/Src/VertexManager.h b/Source/Plugins/Plugin_VideoOGL/Src/VertexManager.h index 426fafa443..c801066107 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/VertexManager.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/VertexManager.h @@ -49,12 +49,10 @@ public: static TVtxDesc &GetVtxDesc() {return s_GlobalVtxDesc; } static void LoadCPReg(u32 SubCmd, u32 Value); + static void EnableComponents(u32 components); // TODO - don't expose these like this. - static u32 s_prevvbstride; - static u32 s_prevcomponents; // previous state set static u8* s_pCurBufferPointer; - static float shiftLookup[32]; }; #endif // _VERTEXMANAGER_H \ No newline at end of file diff --git a/Source/Plugins/Plugin_VideoOGL/Src/VertexShader.cpp b/Source/Plugins/Plugin_VideoOGL/Src/VertexShader.cpp index f75d275c73..eb043f4ac8 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/VertexShader.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/VertexShader.cpp @@ -111,7 +111,7 @@ char *GenerateVertexShader(u32 components, bool has_zbuffer_target) // uniforms - // bool bTexMtx = ((components & VertexLoader::VB_HAS_TEXMTXIDXALL)<= 32 ? (posmtx-32) : posmtx;\n"); WRITE(p, "float3 N0 = "I_NORMALMATRICES".T[normidx].t.xyz, N1 = "I_NORMALMATRICES".T[normidx+1].t.xyz, N2 = "I_NORMALMATRICES".T[normidx+2].t.xyz;\n"); } - if (components & VertexLoader::VB_HAS_NRM0) + if (components & VB_HAS_NRM0) WRITE(p, "half3 _norm0 = half3(dot(N0, rawnorm0), dot(N1, rawnorm0), dot(N2, rawnorm0));\n" "half3 norm0 = normalize(_norm0);\n"); - if (components & VertexLoader::VB_HAS_NRM1) + if (components & VB_HAS_NRM1) WRITE(p, "half3 _norm1 = half3(dot(N0, rawnorm1), dot(N1, rawnorm1), dot(N2, rawnorm1));\n"); //"half3 norm1 = normalize(_norm1);\n"); - if (components & VertexLoader::VB_HAS_NRM2) + if (components & VB_HAS_NRM2) WRITE(p, "half3 _norm2 = half3(dot(N0, rawnorm2), dot(N1, rawnorm2), dot(N2, rawnorm2));\n"); //"half3 norm2 = normalize(_norm2);\n"); } else { WRITE(p, "float4 pos = float4(dot("I_POSNORMALMATRIX".T0, rawpos), dot("I_POSNORMALMATRIX".T1, rawpos), dot("I_POSNORMALMATRIX".T2, rawpos), 1);\n"); - if (components & VertexLoader::VB_HAS_NRM0) + if (components & VB_HAS_NRM0) WRITE(p, "half3 _norm0 = half3(dot("I_POSNORMALMATRIX".N0.xyz, rawnorm0), dot("I_POSNORMALMATRIX".N1.xyz, rawnorm0), dot("I_POSNORMALMATRIX".N2.xyz, rawnorm0));\n" "half3 norm0 = normalize(_norm0);\n"); - if (components & VertexLoader::VB_HAS_NRM1) + if (components & VB_HAS_NRM1) WRITE(p, "half3 _norm1 = half3(dot("I_POSNORMALMATRIX".N0.xyz, rawnorm1), dot("I_POSNORMALMATRIX".N1.xyz, rawnorm1), dot("I_POSNORMALMATRIX".N2.xyz, rawnorm1));\n"); //"half3 norm1 = normalize(_norm1);\n"); - if (components & VertexLoader::VB_HAS_NRM2) + if (components & VB_HAS_NRM2) WRITE(p, "half3 _norm2 = half3(dot("I_POSNORMALMATRIX".N0.xyz, rawnorm2), dot("I_POSNORMALMATRIX".N1.xyz, rawnorm2), dot("I_POSNORMALMATRIX".N2.xyz, rawnorm2));\n"); //"half3 norm2 = normalize(_norm2);\n"); } - if (!(components & VertexLoader::VB_HAS_NRM0)) + if (!(components & VB_HAS_NRM0)) WRITE(p, "half3 _norm0 = half3(0,0,0), norm0= half3(0,0,0);\n"); WRITE(p, "o.pos = float4(dot("I_PROJECTION".T0, pos), dot("I_PROJECTION".T1, pos), dot("I_PROJECTION".T2, pos), dot("I_PROJECTION".T3, pos));\n"); @@ -198,7 +198,7 @@ char *GenerateVertexShader(u32 components, bool has_zbuffer_target) WRITE(p, "{\n"); if (color.matsource) {// from vertex - if (components & (VertexLoader::VB_HAS_COL0<