From b406e4e1f2c696ba5f6bec04ea2e6a8cc03a02d1 Mon Sep 17 00:00:00 2001 From: Jules Blok Date: Sun, 14 Dec 2014 21:23:13 +0100 Subject: [PATCH] VideoCommon: Add a separate constants buffer for the geometry shader. --- .../VideoBackends/D3D/GeometryShaderCache.cpp | 26 ++++++ .../VideoBackends/D3D/GeometryShaderCache.h | 1 + .../Core/VideoBackends/D3D/VertexManager.cpp | 2 +- Source/Core/VideoBackends/D3D/main.cpp | 3 + .../VideoBackends/OGL/ProgramShaderCache.cpp | 14 +++- Source/Core/VideoBackends/OGL/main.cpp | 3 + Source/Core/VideoCommon/BPStructs.cpp | 2 + Source/Core/VideoCommon/CMakeLists.txt | 1 + Source/Core/VideoCommon/ConstantManager.h | 5 +- Source/Core/VideoCommon/GeometryShaderGen.cpp | 9 +- .../VideoCommon/GeometryShaderManager.cpp | 82 +++++++++++++++++++ .../Core/VideoCommon/GeometryShaderManager.h | 29 +++++++ Source/Core/VideoCommon/ShaderGenCommon.h | 6 +- Source/Core/VideoCommon/VertexManagerBase.cpp | 2 + .../Core/VideoCommon/VertexShaderManager.cpp | 12 --- Source/Core/VideoCommon/VideoCommon.vcxproj | 2 + .../VideoCommon/VideoCommon.vcxproj.filters | 6 ++ Source/Core/VideoCommon/VideoState.cpp | 4 + Source/Core/VideoCommon/XFStructs.cpp | 3 + 19 files changed, 189 insertions(+), 23 deletions(-) create mode 100644 Source/Core/VideoCommon/GeometryShaderManager.cpp create mode 100644 Source/Core/VideoCommon/GeometryShaderManager.h diff --git a/Source/Core/VideoBackends/D3D/GeometryShaderCache.cpp b/Source/Core/VideoBackends/D3D/GeometryShaderCache.cpp index 29172f91a1..6f87e124e7 100644 --- a/Source/Core/VideoBackends/D3D/GeometryShaderCache.cpp +++ b/Source/Core/VideoBackends/D3D/GeometryShaderCache.cpp @@ -17,6 +17,8 @@ #include "VideoCommon/Debugger.h" #include "VideoCommon/GeometryShaderGen.h" +#include "VideoCommon/GeometryShaderManager.h" +#include "VideoCommon/Statistics.h" #include "VideoCommon/VideoConfig.h" namespace DX11 @@ -37,6 +39,22 @@ ID3D11GeometryShader* GeometryShaderCache::GetCopyGeometryShader() { return Copy ID3D11Buffer* gscbuf = nullptr; +ID3D11Buffer* &GeometryShaderCache::GetConstantBuffer() +{ + // TODO: divide the global variables of the generated shaders into about 5 constant buffers to speed this up + if (GeometryShaderManager::dirty) + { + D3D11_MAPPED_SUBRESOURCE map; + D3D::context->Map(gscbuf, 0, D3D11_MAP_WRITE_DISCARD, 0, &map); + memcpy(map.pData, &GeometryShaderManager::constants, sizeof(GeometryShaderConstants)); + D3D::context->Unmap(gscbuf, 0); + GeometryShaderManager::dirty = false; + + ADDSTAT(stats.thisFrame.bytesUniformStreamed, sizeof(GeometryShaderConstants)); + } + return gscbuf; +} + // this class will load the precompiled shaders into our cache class GeometryShaderCacheInserter : public LinearDiskCacheReader { @@ -113,6 +131,12 @@ const char copy_shader_code[] = { void GeometryShaderCache::Init() { + unsigned int gbsize = ((sizeof(GeometryShaderConstants))&(~0xf)) + 0x10; // must be a multiple of 16 + D3D11_BUFFER_DESC gbdesc = CD3D11_BUFFER_DESC(gbsize, D3D11_BIND_CONSTANT_BUFFER, D3D11_USAGE_DYNAMIC, D3D11_CPU_ACCESS_WRITE); + HRESULT hr = D3D::device->CreateBuffer(&gbdesc, nullptr, &gscbuf); + CHECK(hr == S_OK, "Create geometry shader constant buffer (size=%u)", gbsize); + D3D::SetDebugObjectName((ID3D11DeviceChild*)gscbuf, "geometry shader constant buffer used to emulate the GX pipeline"); + // used when drawing clear quads ClearGeometryShader = D3D::CompileAndCreateGeometryShader(clear_shader_code); CHECK(ClearGeometryShader != nullptr, "Create clear geometry shader"); @@ -152,6 +176,8 @@ void GeometryShaderCache::Clear() void GeometryShaderCache::Shutdown() { + SAFE_RELEASE(gscbuf); + SAFE_RELEASE(ClearGeometryShader); SAFE_RELEASE(CopyGeometryShader); diff --git a/Source/Core/VideoBackends/D3D/GeometryShaderCache.h b/Source/Core/VideoBackends/D3D/GeometryShaderCache.h index 9d38922d04..0c44554412 100644 --- a/Source/Core/VideoBackends/D3D/GeometryShaderCache.h +++ b/Source/Core/VideoBackends/D3D/GeometryShaderCache.h @@ -25,6 +25,7 @@ public: static ID3D11GeometryShader* GeometryShaderCache::GetCopyGeometryShader(); static ID3D11GeometryShader* GetActiveShader() { return last_entry->shader; } + static ID3D11Buffer* &GetConstantBuffer(); private: struct GSCacheEntry diff --git a/Source/Core/VideoBackends/D3D/VertexManager.cpp b/Source/Core/VideoBackends/D3D/VertexManager.cpp index abc7f18e33..29fcf1c365 100644 --- a/Source/Core/VideoBackends/D3D/VertexManager.cpp +++ b/Source/Core/VideoBackends/D3D/VertexManager.cpp @@ -140,7 +140,7 @@ void VertexManager::Draw(u32 stride) if (current_primitive_type == PRIMITIVE_TRIANGLES) { D3D::stateman->SetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP); - D3D::stateman->SetGeometryConstants(VertexShaderCache::GetConstantBuffer()); + D3D::stateman->SetGeometryConstants(GeometryShaderCache::GetConstantBuffer()); D3D::stateman->SetGeometryShader(g_ActiveConfig.iStereoMode > 0 ? GeometryShaderCache::GetActiveShader() : nullptr); D3D::stateman->Apply(); diff --git a/Source/Core/VideoBackends/D3D/main.cpp b/Source/Core/VideoBackends/D3D/main.cpp index 22782cc41c..0126ab8b1d 100644 --- a/Source/Core/VideoBackends/D3D/main.cpp +++ b/Source/Core/VideoBackends/D3D/main.cpp @@ -28,6 +28,7 @@ #include "VideoCommon/BPStructs.h" #include "VideoCommon/CommandProcessor.h" #include "VideoCommon/Fifo.h" +#include "VideoCommon/GeometryShaderManager.h" #include "VideoCommon/IndexGenerator.h" #include "VideoCommon/OnScreenDisplay.h" #include "VideoCommon/OpcodeDecoding.h" @@ -187,6 +188,7 @@ void VideoBackend::Video_Prepare() OpcodeDecoder_Init(); VertexShaderManager::Init(); PixelShaderManager::Init(); + GeometryShaderManager::Init(); CommandProcessor::Init(); PixelEngine::Init(); BBox::Init(); @@ -205,6 +207,7 @@ void VideoBackend::Shutdown() // VideoCommon Fifo_Shutdown(); CommandProcessor::Shutdown(); + GeometryShaderManager::Shutdown(); PixelShaderManager::Shutdown(); VertexShaderManager::Shutdown(); OpcodeDecoder_Shutdown(); diff --git a/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp b/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp index 439c4c9040..08b22e8071 100644 --- a/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp +++ b/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp @@ -13,6 +13,7 @@ #include "VideoCommon/Debugger.h" #include "VideoCommon/DriverDetails.h" +#include "VideoCommon/GeometryShaderManager.h" #include "VideoCommon/ImageWrite.h" #include "VideoCommon/PixelShaderManager.h" #include "VideoCommon/Statistics.h" @@ -71,11 +72,14 @@ void SHADER::SetProgramVariables() GLint PSBlock_id = glGetUniformBlockIndex(glprogid, "PSBlock"); GLint VSBlock_id = glGetUniformBlockIndex(glprogid, "VSBlock"); + GLint GSBlock_id = glGetUniformBlockIndex(glprogid, "GSBlock"); if (PSBlock_id != -1) glUniformBlockBinding(glprogid, PSBlock_id, 1); if (VSBlock_id != -1) glUniformBlockBinding(glprogid, VSBlock_id, 2); + if (GSBlock_id != -1) + glUniformBlockBinding(glprogid, GSBlock_id, 3); // Bind Texture Sampler for (int a = 0; a <= 9; ++a) @@ -133,7 +137,7 @@ void SHADER::Bind() void ProgramShaderCache::UploadConstants() { - if (PixelShaderManager::dirty || VertexShaderManager::dirty) + if (PixelShaderManager::dirty || VertexShaderManager::dirty || GeometryShaderManager::dirty) { auto buffer = s_buffer->Map(s_ubo_buffer_size, s_ubo_align); @@ -143,14 +147,20 @@ void ProgramShaderCache::UploadConstants() memcpy(buffer.first + ROUND_UP(sizeof(PixelShaderConstants), s_ubo_align), &VertexShaderManager::constants, sizeof(VertexShaderConstants)); + memcpy(buffer.first + ROUND_UP(sizeof(PixelShaderConstants), s_ubo_align) + ROUND_UP(sizeof(VertexShaderConstants), s_ubo_align), + &GeometryShaderManager::constants, sizeof(GeometryShaderConstants)); + s_buffer->Unmap(s_ubo_buffer_size); glBindBufferRange(GL_UNIFORM_BUFFER, 1, s_buffer->m_buffer, buffer.second, sizeof(PixelShaderConstants)); glBindBufferRange(GL_UNIFORM_BUFFER, 2, s_buffer->m_buffer, buffer.second + ROUND_UP(sizeof(PixelShaderConstants), s_ubo_align), sizeof(VertexShaderConstants)); + glBindBufferRange(GL_UNIFORM_BUFFER, 3, s_buffer->m_buffer, buffer.second + ROUND_UP(sizeof(PixelShaderConstants), s_ubo_align) + ROUND_UP(sizeof(VertexShaderConstants), s_ubo_align), + sizeof(GeometryShaderConstants)); PixelShaderManager::dirty = false; VertexShaderManager::dirty = false; + GeometryShaderManager::dirty = false; ADDSTAT(stats.thisFrame.bytesUniformStreamed, s_ubo_buffer_size); } @@ -419,7 +429,7 @@ void ProgramShaderCache::Init() // then the UBO will fail. glGetIntegerv(GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, &s_ubo_align); - s_ubo_buffer_size = ROUND_UP(sizeof(PixelShaderConstants), s_ubo_align) + ROUND_UP(sizeof(VertexShaderConstants), s_ubo_align); + s_ubo_buffer_size = ROUND_UP(sizeof(PixelShaderConstants), s_ubo_align) + ROUND_UP(sizeof(VertexShaderConstants), s_ubo_align) + ROUND_UP(sizeof(GeometryShaderConstants), s_ubo_align); // We multiply by *4*4 because we need to get down to basic machine units. // So multiply by four to get how many floats we have from vec4s diff --git a/Source/Core/VideoBackends/OGL/main.cpp b/Source/Core/VideoBackends/OGL/main.cpp index eb486c811b..addfcf0533 100644 --- a/Source/Core/VideoBackends/OGL/main.cpp +++ b/Source/Core/VideoBackends/OGL/main.cpp @@ -65,6 +65,7 @@ Make AA apply instantly during gameplay if possible #include "VideoCommon/BPStructs.h" #include "VideoCommon/CommandProcessor.h" #include "VideoCommon/Fifo.h" +#include "VideoCommon/GeometryShaderManager.h" #include "VideoCommon/ImageWrite.h" #include "VideoCommon/IndexGenerator.h" #include "VideoCommon/LookUpTables.h" @@ -202,6 +203,7 @@ void VideoBackend::Video_Prepare() IndexGenerator::Init(); VertexShaderManager::Init(); PixelShaderManager::Init(); + GeometryShaderManager::Init(); ProgramShaderCache::Init(); g_texture_cache = new TextureCache(); g_sampler_cache = new SamplerCache(); @@ -243,6 +245,7 @@ void VideoBackend::Video_Cleanup() ProgramShaderCache::Shutdown(); VertexShaderManager::Shutdown(); PixelShaderManager::Shutdown(); + GeometryShaderManager::Shutdown(); delete g_perf_query; g_perf_query = nullptr; delete g_vertex_manager; diff --git a/Source/Core/VideoCommon/BPStructs.cpp b/Source/Core/VideoCommon/BPStructs.cpp index ec7854bace..8996784760 100644 --- a/Source/Core/VideoCommon/BPStructs.cpp +++ b/Source/Core/VideoCommon/BPStructs.cpp @@ -14,6 +14,7 @@ #include "VideoCommon/BPFunctions.h" #include "VideoCommon/BPStructs.h" #include "VideoCommon/Fifo.h" +#include "VideoCommon/GeometryShaderManager.h" #include "VideoCommon/PerfQueryBase.h" #include "VideoCommon/PixelEngine.h" #include "VideoCommon/PixelShaderManager.h" @@ -125,6 +126,7 @@ static void BPWritten(const BPCmd& bp) case BPMEM_SCISSOROFFSET: // Scissor Offset SetScissor(); VertexShaderManager::SetViewportChanged(); + GeometryShaderManager::SetViewportChanged(); return; case BPMEM_LINEPTWIDTH: // Line Width SetLineWidth(); diff --git a/Source/Core/VideoCommon/CMakeLists.txt b/Source/Core/VideoCommon/CMakeLists.txt index 0dfd12b732..95ebaf7433 100644 --- a/Source/Core/VideoCommon/CMakeLists.txt +++ b/Source/Core/VideoCommon/CMakeLists.txt @@ -10,6 +10,7 @@ set(SRCS BoundingBox.cpp FPSCounter.cpp FramebufferManagerBase.cpp GeometryShaderGen.cpp + GeometryShaderManager.cpp HiresTextures.cpp ImageWrite.cpp IndexGenerator.cpp diff --git a/Source/Core/VideoCommon/ConstantManager.h b/Source/Core/VideoCommon/ConstantManager.h index 93c228bc98..9039a1b220 100644 --- a/Source/Core/VideoCommon/ConstantManager.h +++ b/Source/Core/VideoCommon/ConstantManager.h @@ -43,6 +43,9 @@ struct VertexShaderConstants float4 normalmatrices[32]; float4 posttransformmatrices[64]; float4 pixelcentercorrection; - float4 stereoparams; }; +struct GeometryShaderConstants +{ + float4 stereoparams; +}; diff --git a/Source/Core/VideoCommon/GeometryShaderGen.cpp b/Source/Core/VideoCommon/GeometryShaderGen.cpp index 57009aedaa..2762dcd73b 100644 --- a/Source/Core/VideoCommon/GeometryShaderGen.cpp +++ b/Source/Core/VideoCommon/GeometryShaderGen.cpp @@ -43,11 +43,12 @@ static inline void GenerateGeometryShader(T& out, u32 components, API_TYPE ApiTy // uniforms if (ApiType == API_OPENGL) - out.Write("layout(std140%s) uniform VSBlock {\n", g_ActiveConfig.backend_info.bSupportsBindingLayout ? ", binding = 2" : ""); + out.Write("layout(std140%s) uniform GSBlock {\n", g_ActiveConfig.backend_info.bSupportsBindingLayout ? ", binding = 3" : ""); else - out.Write("cbuffer VSBlock {\n"); - out.Write(s_shader_uniforms); - out.Write("};\n"); + out.Write("cbuffer GSBlock {\n"); + out.Write( + "\tfloat4 " I_STEREOPARAMS";\n" + "};\n"); uid_data->numTexGens = xfmem.numTexGen.numTexGens; uid_data->pixel_lighting = g_ActiveConfig.bEnablePixelLighting; diff --git a/Source/Core/VideoCommon/GeometryShaderManager.cpp b/Source/Core/VideoCommon/GeometryShaderManager.cpp new file mode 100644 index 0000000000..f754961cbc --- /dev/null +++ b/Source/Core/VideoCommon/GeometryShaderManager.cpp @@ -0,0 +1,82 @@ +// Copyright 2013 Dolphin Emulator Project +// Licensed under GPLv2 +// Refer to the license.txt file included. + +#include +#include + +#include "VideoCommon/GeometryShaderGen.h" +#include "VideoCommon/GeometryShaderManager.h" +#include "VideoCommon/VideoCommon.h" +#include "VideoCommon/VideoConfig.h" +#include "VideoCommon/XFMemory.h" + +// track changes +static bool s_projection_changed, s_viewport_changed; + +GeometryShaderConstants GeometryShaderManager::constants; +bool GeometryShaderManager::dirty; + +void GeometryShaderManager::Init() +{ + memset(&constants, 0, sizeof(constants)); + + Dirty(); +} + +void GeometryShaderManager::Shutdown() +{ +} + +void GeometryShaderManager::Dirty() +{ + s_projection_changed = true; + s_viewport_changed = true; + + dirty = true; +} + +// Syncs the shader constant buffers with xfmem +void GeometryShaderManager::SetConstants() +{ + if (s_projection_changed) + { + s_projection_changed = false; + + if (g_ActiveConfig.iStereoMode > 0 && xfmem.projection.type == GX_PERSPECTIVE) + { + float offset = (g_ActiveConfig.iStereoSeparation / 1000.0f) * (g_ActiveConfig.iStereoSeparationPercent / 100.0f); + constants.stereoparams[0] = (g_ActiveConfig.bStereoSwapEyes) ? offset : -offset; + constants.stereoparams[1] = (g_ActiveConfig.bStereoSwapEyes) ? -offset : offset; + constants.stereoparams[2] = (g_ActiveConfig.iStereoConvergence / 10.0f) * (g_ActiveConfig.iStereoConvergencePercent / 100.0f); + } + else + { + constants.stereoparams[0] = constants.stereoparams[1] = 0; + } + } + + dirty = true; +} + +void GeometryShaderManager::SetViewportChanged() +{ + s_viewport_changed = true; +} + +void GeometryShaderManager::SetProjectionChanged() +{ + s_projection_changed = true; +} + +void GeometryShaderManager::DoState(PointerWrap &p) +{ + p.Do(dirty); + + if (p.GetMode() == PointerWrap::MODE_READ) + { + // Reload current state from global GPU state + // NOTE: This requires that all GPU memory has been loaded already. + Dirty(); + } +} diff --git a/Source/Core/VideoCommon/GeometryShaderManager.h b/Source/Core/VideoCommon/GeometryShaderManager.h new file mode 100644 index 0000000000..d9d8af959f --- /dev/null +++ b/Source/Core/VideoCommon/GeometryShaderManager.h @@ -0,0 +1,29 @@ +// Copyright 2013 Dolphin Emulator Project +// Licensed under GPLv2 +// Refer to the license.txt file included. + +#pragma once + +#include "VideoCommon/ConstantManager.h" +#include "VideoCommon/GeometryShaderGen.h" + +class PointerWrap; + +// The non-API dependent parts. +class GeometryShaderManager +{ +public: + static void Init(); + static void Dirty(); + static void Shutdown(); + static void DoState(PointerWrap &p); + + // constant management + static void SetConstants(); + + static void SetViewportChanged(); + static void SetProjectionChanged(); + + static GeometryShaderConstants constants; + static bool dirty; +}; diff --git a/Source/Core/VideoCommon/ShaderGenCommon.h b/Source/Core/VideoCommon/ShaderGenCommon.h index 618d262374..a73290fa44 100644 --- a/Source/Core/VideoCommon/ShaderGenCommon.h +++ b/Source/Core/VideoCommon/ShaderGenCommon.h @@ -279,7 +279,8 @@ static inline void GenerateVSOutputStruct(T& object, API_TYPE api_type) #define I_NORMALMATRICES "cnmtx" #define I_POSTTRANSFORMMATRICES "cpostmtx" #define I_PIXELCENTERCORRECTION "cpixelcenter" -#define I_STEREOPARAMS "cstereo" + +#define I_STEREOPARAMS "cstereo" static const char s_shader_uniforms[] = "\tfloat4 " I_POSNORMALMATRIX"[6];\n" @@ -290,5 +291,4 @@ static const char s_shader_uniforms[] = "\tfloat4 " I_TRANSFORMMATRICES"[64];\n" "\tfloat4 " I_NORMALMATRICES"[32];\n" "\tfloat4 " I_POSTTRANSFORMMATRICES"[64];\n" - "\tfloat4 " I_PIXELCENTERCORRECTION";\n" - "\tfloat4 " I_STEREOPARAMS";\n"; + "\tfloat4 " I_PIXELCENTERCORRECTION";\n"; diff --git a/Source/Core/VideoCommon/VertexManagerBase.cpp b/Source/Core/VideoCommon/VertexManagerBase.cpp index 84e0bb5efe..7484039137 100644 --- a/Source/Core/VideoCommon/VertexManagerBase.cpp +++ b/Source/Core/VideoCommon/VertexManagerBase.cpp @@ -2,6 +2,7 @@ #include "VideoCommon/BPStructs.h" #include "VideoCommon/Debugger.h" +#include "VideoCommon/GeometryShaderManager.h" #include "VideoCommon/IndexGenerator.h" #include "VideoCommon/MainBase.h" #include "VideoCommon/NativeVertexFormat.h" @@ -223,6 +224,7 @@ void VertexManager::Flush() // set global constants VertexShaderManager::SetConstants(); PixelShaderManager::SetConstants(); + GeometryShaderManager::SetConstants(); bool useDstAlpha = !g_ActiveConfig.bDstAlphaPass && bpmem.dstalpha.enable && diff --git a/Source/Core/VideoCommon/VertexShaderManager.cpp b/Source/Core/VideoCommon/VertexShaderManager.cpp index 84cf2d2a01..542328e523 100644 --- a/Source/Core/VideoCommon/VertexShaderManager.cpp +++ b/Source/Core/VideoCommon/VertexShaderManager.cpp @@ -512,18 +512,6 @@ void VertexShaderManager::SetConstants() memcpy(constants.projection, correctedMtx.data, 4*16); } - if (g_ActiveConfig.iStereoMode > 0 && xfmem.projection.type == GX_PERSPECTIVE) - { - float offset = (g_ActiveConfig.iStereoSeparation / 1000.0f) * (g_ActiveConfig.iStereoSeparationPercent / 100.0f); - constants.stereoparams[0] = (g_ActiveConfig.bStereoSwapEyes) ? offset : -offset; - constants.stereoparams[1] = (g_ActiveConfig.bStereoSwapEyes) ? -offset : offset; - constants.stereoparams[2] = (g_ActiveConfig.iStereoConvergence / 10.0f) * (g_ActiveConfig.iStereoConvergencePercent / 100.0f); - } - else - { - constants.stereoparams[0] = constants.stereoparams[1] = 0; - } - dirty = true; } } diff --git a/Source/Core/VideoCommon/VideoCommon.vcxproj b/Source/Core/VideoCommon/VideoCommon.vcxproj index 237becb45e..65488aa4fa 100644 --- a/Source/Core/VideoCommon/VideoCommon.vcxproj +++ b/Source/Core/VideoCommon/VideoCommon.vcxproj @@ -61,6 +61,7 @@ + @@ -112,6 +113,7 @@ + diff --git a/Source/Core/VideoCommon/VideoCommon.vcxproj.filters b/Source/Core/VideoCommon/VideoCommon.vcxproj.filters index 971bf59bbf..cd4901f303 100644 --- a/Source/Core/VideoCommon/VideoCommon.vcxproj.filters +++ b/Source/Core/VideoCommon/VideoCommon.vcxproj.filters @@ -146,6 +146,9 @@ Shader Generators + + Shader Managers + @@ -284,6 +287,9 @@ Shader Generators + + Shader Managers + diff --git a/Source/Core/VideoCommon/VideoState.cpp b/Source/Core/VideoCommon/VideoState.cpp index a36a5d9d33..337bfd04a0 100644 --- a/Source/Core/VideoCommon/VideoState.cpp +++ b/Source/Core/VideoCommon/VideoState.cpp @@ -8,6 +8,7 @@ #include "VideoCommon/CommandProcessor.h" #include "VideoCommon/CPMemory.h" #include "VideoCommon/Fifo.h" +#include "VideoCommon/GeometryShaderManager.h" #include "VideoCommon/PixelEngine.h" #include "VideoCommon/PixelShaderManager.h" #include "VideoCommon/TextureDecoder.h" @@ -50,6 +51,9 @@ static void DoState(PointerWrap &p) VertexShaderManager::DoState(p); p.DoMarker("VertexShaderManager"); + GeometryShaderManager::DoState(p); + p.DoMarker("GeometryShaderManager"); + VertexManager::DoState(p); p.DoMarker("VertexManager"); diff --git a/Source/Core/VideoCommon/XFStructs.cpp b/Source/Core/VideoCommon/XFStructs.cpp index 927fed8077..34820af640 100644 --- a/Source/Core/VideoCommon/XFStructs.cpp +++ b/Source/Core/VideoCommon/XFStructs.cpp @@ -7,6 +7,7 @@ #include "VideoCommon/CPMemory.h" #include "VideoCommon/DataReader.h" #include "VideoCommon/Fifo.h" +#include "VideoCommon/GeometryShaderManager.h" #include "VideoCommon/PixelShaderManager.h" #include "VideoCommon/VertexManagerBase.h" #include "VideoCommon/VertexShaderManager.h" @@ -110,6 +111,7 @@ static void XFRegWritten(int transferSize, u32 baseAddress, DataReader src) VertexManager::Flush(); VertexShaderManager::SetViewportChanged(); PixelShaderManager::SetViewportChanged(); + GeometryShaderManager::SetViewportChanged(); nextAddress = XFMEM_SETVIEWPORT + 6; break; @@ -123,6 +125,7 @@ static void XFRegWritten(int transferSize, u32 baseAddress, DataReader src) case XFMEM_SETPROJECTION+6: VertexManager::Flush(); VertexShaderManager::SetProjectionChanged(); + GeometryShaderManager::SetProjectionChanged(); nextAddress = XFMEM_SETPROJECTION + 7; break;