Skip to content
This repository has been archived by the owner on May 7, 2020. It is now read-only.

Commit

Permalink
Merge pull request #66 from alexmarsev/shaders
Browse files Browse the repository at this point in the history
Redesign shaders
  • Loading branch information
alexmarsev committed Dec 3, 2013
2 parents 0489e3f + 28369f4 commit 6fcf44a
Show file tree
Hide file tree
Showing 140 changed files with 4,782 additions and 3,843 deletions.
2 changes: 2 additions & 0 deletions build.bat
Expand Up @@ -434,6 +434,8 @@ IF /I "%NAME%" == "MPC-HC" (
)
COPY /Y /V "%VS_OUT_DIR%\D3DCompiler_43.dll" "%PCKG_NAME%\D3DCompiler_43.dll" >NUL
COPY /Y /V "%VS_OUT_DIR%\d3dx9_43.dll" "%PCKG_NAME%\d3dx9_43.dll" >NUL
IF NOT EXIST "%PCKG_NAME%\Shaders" MD "%PCKG_NAME%\Shaders"
COPY /Y /V "..\src\mpc-hc\res\shaders\external\*.hlsl" "%PCKG_NAME%\Shaders" >NUL
) ELSE (
COPY /Y /V "%VS_OUT_DIR%\*.ax" "%PCKG_NAME%\*.ax" >NUL
COPY /Y /V "%VS_OUT_DIR%\VSFilter.dll" "%PCKG_NAME%\VSFilter.dll" >NUL
Expand Down
1 change: 1 addition & 0 deletions distrib/mpc-hc_setup.iss
Expand Up @@ -248,6 +248,7 @@ Source: ..\COPYING.txt; DestDir: {app}; Components: main
Source: ..\docs\Authors.txt; DestDir: {app}; Components: main; Flags: ignoreversion
Source: ..\docs\Changelog.txt; DestDir: {app}; Components: main; Flags: ignoreversion
Source: ..\docs\Readme.txt; DestDir: {app}; Components: main; Flags: ignoreversion
Source: ..\src\mpc-hc\res\shaders\external\*.hlsl; DestDir: {app}\Shaders; Components: main; Flags: ignoreversion


[Icons]
Expand Down
9 changes: 9 additions & 0 deletions docs/Changelog.txt
Expand Up @@ -17,6 +17,14 @@ next version - not released yet
+ Ticket #3379, "Left Up" mouse keybinding now allows to move the player window by dragging the video area
+ Ticket #3614, Do medium jumps when pressing mouse navigation buttons on the seekbar
+ New option to auto-hide docked panels together with toolbars
+ Support pixel shader presets (with shortcuts and command line options)
* The storing mechanism of pixel shaders was redesigned:
- each pixel shader is now stored in its own file with .hlsl extension
- shader files are reloaded automatically when MPC-HC detects changes in them
- internal pixel shader editor was removed, you're supposed to use specialized external
editors from now on, but can still view compilation output in "Debug Shaders" window
- internal video renderers now always use the latest supported shader profile to compile
pixel shaders
* More flexible auto-hide controls in fullscreen configuration options
* Updated LAV Filters to 0.59.1.35:
- Ticket #3760, LAV Video: Fix a crash when opening some DVDs on 64-bit
Expand All @@ -26,6 +34,7 @@ next version - not released yet
* Updated Little CMS to v2.6b (git 579b3aa)
* Updated Unrar to v5.0.0.13
! Internal subtiles renderer: Vobsub/PGS/DVB subtitles are now rendered relative to the video frame
! Warnings were not displayed in pixel shader compilation output
! Ticket #1300/#2081, Toolbars auto-hiding now always works properly in multi-display configurations
! Ticket #3479, Improve the behavior of MPC-HC when some security tools prevent it
from initializing correctly
Expand Down
3 changes: 3 additions & 0 deletions include/mpc-hc_config.h
Expand Up @@ -44,6 +44,9 @@
#define USE_STATIC_MEDIAINFO 1
#endif

#define SHADERS_DIR _T("Shaders")
#define SHADERS_EXT _T(".hlsl")

// If you distribute your builds, please disable minidumps by defining ENABLE_MINIDUMP 0.
#define ENABLE_MINIDUMP 1

Expand Down
15 changes: 15 additions & 0 deletions src/DSUtil/DSUtil.h
Expand Up @@ -246,6 +246,7 @@ class CFilterInfo : public FILTER_INFO
#define SAFE_DELETE(p) { if (p) { delete (p); (p) = nullptr; } }
#define SAFE_DELETE_ARRAY(p) { if (p) { delete [] (p); (p) = nullptr; } }
#define SAFE_RELEASE(p) { if (p) { (p)->Release(); (p) = nullptr; } }
#define SAFE_CLOSE_HANDLE(p) { if (p) { if ((p) != INVALID_HANDLE_VALUE) VERIFY(CloseHandle(p)); (p) = nullptr; } }

#define ResStr(id) CString(MAKEINTRESOURCE(id))

Expand Down Expand Up @@ -280,3 +281,17 @@ inline int GCD(int a, int b)
}
return a;
}

namespace CStringUtils
{
struct IgnoreCaseLess {
bool operator()(const CString& str1, const CString& str2) const {
return str1.CompareNoCase(str2) < 0;
}
};
struct LogicalLess {
bool operator()(const CString& str1, const CString& str2) const {
return StrCmpLogicalW(str1, str2) < 0;
}
};
}
2 changes: 2 additions & 0 deletions src/DSUtil/DSUtil.vcxproj
Expand Up @@ -122,6 +122,7 @@
<ClCompile Include="MediaTypeEx.cpp" />
<ClCompile Include="MediaTypes.cpp" />
<ClCompile Include="NullRenderers.cpp" />
<ClCompile Include="PathUtils.cpp" />
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader>Create</PrecompiledHeader>
</ClCompile>
Expand All @@ -147,6 +148,7 @@
<ClInclude Include="MediaTypes.h" />
<ClInclude Include="Mpeg2Def.h" />
<ClInclude Include="NullRenderers.h" />
<ClInclude Include="PathUtils.h" />
<ClInclude Include="SharedInclude.h" />
<ClInclude Include="stdafx.h" />
<ClInclude Include="SysVersion.h" />
Expand Down
6 changes: 6 additions & 0 deletions src/DSUtil/DSUtil.vcxproj.filters
Expand Up @@ -68,6 +68,9 @@
<ClCompile Include="FileVersionInfo.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="PathUtils.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="DSMPropertyBag.h">
Expand Down Expand Up @@ -130,5 +133,8 @@
<ClInclude Include="FileVersionInfo.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="PathUtils.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>
145 changes: 145 additions & 0 deletions src/DSUtil/PathUtils.cpp
@@ -0,0 +1,145 @@
/*
* (C) 2013 see Authors.txt
*
* This file is part of MPC-HC.
*
* MPC-HC 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; either version 3 of the License, or
* (at your option) any later version.
*
* MPC-HC 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 for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

#include "stdafx.h"
#include "PathUtils.h"

namespace PathUtils
{
CString BaseName(LPCTSTR path)
{
CPath cp(path);
cp.RemoveBackslash();
cp.StripPath();
return cp;
}

CString DirName(LPCTSTR path)
{
CPath cp(path);
cp.RemoveBackslash();
cp.RemoveFileSpec();
return cp;
}

CString FileName(LPCTSTR path)
{
CPath cp(path);
cp.StripPath();
cp.RemoveExtension();
cp.RemoveBackslash();
return cp;
}

CString FileExt(LPCTSTR path)
{
return CPath(path).GetExtension();
}

CString GetModulePath(HMODULE hModule)
{
CString ret;
int pos, len = MAX_PATH - 1;
for (;;) {
pos = GetModuleFileName(hModule, ret.GetBuffer(len), len);
if (pos == len) {
// buffer was too small, enlarge it and try again
len *= 2;
ret.ReleaseBuffer(0);
continue;
}
ret.ReleaseBuffer(pos);
break;
}
ASSERT(!ret.IsEmpty());
return ret;
}

CString GetAfxModulePath(bool bWithModuleName/* = false*/)
{
CString ret = GetModulePath(AfxGetInstanceHandle());
if (!bWithModuleName) {
ret = DirName(ret);
}
return ret;
}

CString GetProgramPath(bool bWithExeName/* = false*/)
{
CString ret = GetModulePath(nullptr);
if (!bWithExeName) {
ret = DirName(ret);
}
return ret;
}

CString CombinePaths(LPCTSTR dir, LPCTSTR path)
{
CPath cp;
cp.Combine(dir, path);
return cp;
}

bool IsInDir(LPCTSTR path, LPCTSTR dir)
{
return !!CPath(path).IsPrefix(dir);
}

CString ToRelative(LPCTSTR dir, const LPCTSTR path, bool* pbRelative/* = nullptr*/)
{
CPath cp;
BOOL rel = cp.RelativePathTo(dir, FILE_ATTRIBUTE_DIRECTORY, path, 0);
if (pbRelative) {
*pbRelative = !!rel;
}
return cp;
}

bool IsRelative(LPCTSTR path)
{
return !!CPath(path).IsRelative();
}

bool Exists(LPCTSTR path)
{
return GetFileAttributes(path) != INVALID_FILE_ATTRIBUTES;
}

bool IsFile(LPCTSTR path)
{
DWORD attr = GetFileAttributes(path);
return (attr != INVALID_FILE_ATTRIBUTES) && !(attr & FILE_ATTRIBUTE_DIRECTORY);
}

bool IsDir(LPCTSTR path)
{
DWORD attr = GetFileAttributes(path);
return (attr != INVALID_FILE_ATTRIBUTES) && (attr & FILE_ATTRIBUTE_DIRECTORY);
}

bool CreateDirRecursive(LPCTSTR path)
{
bool ret = IsDir(path) || CreateDirectory(path, nullptr);
if (!ret) {
ret = CreateDirRecursive(DirName(path)) && CreateDirectory(path, nullptr);
}
return ret;
}
}
40 changes: 40 additions & 0 deletions src/DSUtil/PathUtils.h
@@ -0,0 +1,40 @@
/*
* (C) 2013 see Authors.txt
*
* This file is part of MPC-HC.
*
* MPC-HC 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; either version 3 of the License, or
* (at your option) any later version.
*
* MPC-HC 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 for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

#pragma once

namespace PathUtils
{
CString BaseName(LPCTSTR path);
CString DirName(LPCTSTR path);
CString FileName(LPCTSTR path);
CString FileExt(LPCTSTR path);
CString GetModulePath(HMODULE hModule);
CString GetAfxModulePath(bool bWithModuleName = false);
CString GetProgramPath(bool bWithExeName = false);
CString CombinePaths(LPCTSTR dir, LPCTSTR path);
bool IsInDir(LPCTSTR path, LPCTSTR dir);
CString ToRelative(LPCTSTR dir, const LPCTSTR path, bool* pbRelative = nullptr);
bool IsRelative(LPCTSTR path);
bool Exists(LPCTSTR path);
bool IsFile(LPCTSTR path);
bool IsDir(LPCTSTR path);
bool CreateDirRecursive(LPCTSTR path);
}
2 changes: 1 addition & 1 deletion src/MPCTestAPI/MPCTestAPIDlg.cpp
Expand Up @@ -352,7 +352,7 @@ void CRegisterCopyDataDlg::OnBnClickedButtonSendcommand()
Senddata(CMD_DECREASEVOLUME, m_txtCommand);
break;
case 21:
Senddata(CMD_SHADER_TOGGLE, m_txtCommand);
//Senddata(CMD_SHADER_TOGGLE, m_txtCommand);
break;
case 22:
Senddata(CMD_CLOSEAPP, m_txtCommand);
Expand Down
2 changes: 1 addition & 1 deletion src/filters/renderer/VideoRenderers/DX9RenderingEngine.cpp
Expand Up @@ -1713,7 +1713,7 @@ HRESULT CDX9RenderingEngine::SetCustomPixelShader(LPCSTR pSrcData, LPCSTR pTarge
return S_OK;
}

if (!pSrcData || !pTarget) {
if (!pSrcData) {
return E_INVALIDARG;
}

Expand Down

0 comments on commit 6fcf44a

Please sign in to comment.