Files
vba10/Filter/ShaderManager.cpp

98 lines
1.8 KiB
C++
Raw Permalink Normal View History

2015-09-23 12:07:07 +00:00
#include "ShaderManager.h"
2015-09-24 02:19:07 +00:00
#include "../TextureLoader.h"
2015-09-23 14:10:28 +00:00
#include "xBR2_PS.h"
2015-09-23 12:07:07 +00:00
#include "xBR5_PS.h"
2015-09-24 02:19:07 +00:00
#include "hq2x_PS.h"
2015-09-24 02:53:47 +00:00
#include "hq3x_PS.h"
#include "hq4x_PS.h"
2015-09-23 12:07:07 +00:00
using namespace VBA10;
using namespace Microsoft::WRL;
ShaderManager *ShaderManager::instance = nullptr;
2015-09-24 02:19:07 +00:00
ShaderManager::ShaderManager(ID3D11Device1 *device, ID3D11DeviceContext1 *context):device(device), context(context)
2015-09-23 12:07:07 +00:00
{
ShaderManager::instance = this;
}
ShaderManager *ShaderManager::GetInstance()
{
return ShaderManager::instance;
}
void ShaderManager::LoadShader(int selection)
{
2015-09-24 02:19:07 +00:00
2015-09-24 02:53:47 +00:00
HRESULT test;
const BYTE* shaderByteCode;
size_t shaderSize;
this->lutSRV = nullptr;
2015-09-24 02:19:07 +00:00
2015-09-24 02:53:47 +00:00
if (selection == 2)
2015-09-23 14:10:28 +00:00
{
2015-09-24 02:53:47 +00:00
shaderByteCode = HQ2X_PS;
shaderSize = sizeof(HQ2X_PS);
2015-09-23 14:10:28 +00:00
2015-09-24 02:53:47 +00:00
//load the Look up table (texture)
LoadTextureFromFile(
this->device.Get(),
L"Filter/hq2x.dds",
this->lutResource.GetAddressOf(),
this->lutSRV.GetAddressOf()
);
2015-09-24 02:19:07 +00:00
}
2015-09-24 02:53:47 +00:00
else if (selection == 3)
2015-09-23 12:07:07 +00:00
{
2015-09-24 02:53:47 +00:00
shaderByteCode = XBR2_PS;
shaderSize = sizeof(XBR2_PS);
2015-09-24 02:19:07 +00:00
}
2015-09-24 02:53:47 +00:00
else if (selection == 4)
{
shaderByteCode = HQ3X_PS;
shaderSize = sizeof(HQ3X_PS);
//load the Look up table (texture)
LoadTextureFromFile(
this->device.Get(),
L"Filter/hq3x.dds",
this->lutResource.GetAddressOf(),
this->lutSRV.GetAddressOf()
);
}
else if (selection == 5)
{
shaderByteCode = XBR5_PS;
shaderSize = sizeof(XBR5_PS);
}
else
{
shaderByteCode = HQ4X_PS;
shaderSize = sizeof(HQ4X_PS);
//load the Look up table (texture)
LoadTextureFromFile(
this->device.Get(),
L"Filter/hq4x.dds",
this->lutResource.GetAddressOf(),
this->lutSRV.GetAddressOf()
);
}
if (FAILED(test = this->device->CreatePixelShader(
shaderByteCode,
shaderSize,
NULL,
&this->ps)))
2015-09-24 02:19:07 +00:00
{
2015-09-23 12:07:07 +00:00
}
2015-09-24 02:53:47 +00:00
2015-09-23 12:07:07 +00:00
2015-09-24 02:19:07 +00:00
2015-09-23 12:07:07 +00:00
}