Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/mpc-hc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/filters/renderer/VideoRenderers/PixelShaderCompiler.cpp')
-rw-r--r--src/filters/renderer/VideoRenderers/PixelShaderCompiler.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/filters/renderer/VideoRenderers/PixelShaderCompiler.cpp b/src/filters/renderer/VideoRenderers/PixelShaderCompiler.cpp
index 0a3caaf96..164730b83 100644
--- a/src/filters/renderer/VideoRenderers/PixelShaderCompiler.cpp
+++ b/src/filters/renderer/VideoRenderers/PixelShaderCompiler.cpp
@@ -1,6 +1,6 @@
/*
* (C) 2003-2006 Gabest
- * (C) 2006-2014 see Authors.txt
+ * (C) 2006-2016 see Authors.txt
*
* This file is part of MPC-HC.
*
@@ -22,13 +22,14 @@
#include "stdafx.h"
#include "PixelShaderCompiler.h"
#include "../../../mpc-hc/resource.h"
-#include <share.h>
+#include <d3d9.h>
CPixelShaderCompiler::CPixelShaderCompiler(IDirect3DDevice9* pD3DDev, bool fStaySilent)
: m_hDll(nullptr)
, m_pD3DCompile(nullptr)
, m_pD3DDisassemble(nullptr)
, m_pD3DDev(pD3DDev)
+ , m_Cache(pD3DDev)
{
m_hDll = LoadLibrary(D3DCOMPILER_DLL);
@@ -120,6 +121,11 @@ HRESULT CPixelShaderCompiler::InternalCompile(
} else {
defProfileVal = "-1";
}
+
+ if (ppPixelShader && SUCCEEDED(m_Cache.CreatePixelShader(defProfileVal, pSrcData, SrcDataSize, ppPixelShader))) {
+ return S_OK;
+ }
+
D3D_SHADER_MACRO macros[] = { { defProfile, defProfileVal }, { 0 } };
CComPtr<ID3DBlob> pShaderBlob, pErrorBlob;
@@ -145,6 +151,9 @@ HRESULT CPixelShaderCompiler::InternalCompile(
if (FAILED(hr)) {
return hr;
}
+
+ m_Cache.SavePixelShader(defProfileVal, pSrcData, SrcDataSize,
+ (void*)pShaderBlob->GetBufferPointer(), pShaderBlob->GetBufferSize());
}
if (pDisasm) {