2013-11-10 03:19:46 +01:00
|
|
|
#include "Core.h"
|
|
|
|
#include <fstream>
|
2013-11-22 14:09:47 +01:00
|
|
|
#include <map>
|
2013-11-29 10:25:27 +01:00
|
|
|
#include "../FileLoader/GeneralLoader.h"
|
|
|
|
#include "Resource\OysterResource.h"
|
2013-11-10 03:19:46 +01:00
|
|
|
|
2013-11-15 11:05:19 +01:00
|
|
|
const char* ShaderFunction = "main";
|
2013-11-10 03:19:46 +01:00
|
|
|
|
|
|
|
namespace Oyster
|
|
|
|
{
|
2013-11-20 10:22:01 +01:00
|
|
|
namespace Graphics
|
2013-11-10 03:19:46 +01:00
|
|
|
{
|
2013-11-20 10:22:01 +01:00
|
|
|
namespace
|
2013-11-10 03:19:46 +01:00
|
|
|
{
|
2013-11-20 10:22:01 +01:00
|
|
|
std::vector<ID3D11PixelShader*> PS;
|
|
|
|
std::map<std::wstring,int> PSMap;
|
2013-11-10 03:19:46 +01:00
|
|
|
|
2013-11-20 10:22:01 +01:00
|
|
|
std::vector<ID3D11GeometryShader*> GS;
|
|
|
|
std::map<std::wstring,int> GSMap;
|
2013-11-10 03:19:46 +01:00
|
|
|
|
2013-11-20 10:22:01 +01:00
|
|
|
std::vector<ID3D11ComputeShader*> CS;
|
|
|
|
std::map<std::wstring,int> CSMap;
|
2013-11-10 03:19:46 +01:00
|
|
|
|
2013-11-29 10:25:27 +01:00
|
|
|
std::vector<ID3D11DomainShader*> DS;
|
|
|
|
std::map<std::wstring,int> DSMap;
|
|
|
|
|
|
|
|
std::vector<ID3D11HullShader*> HS;
|
|
|
|
std::map<std::wstring,int> HSMap;
|
|
|
|
|
2013-11-20 10:22:01 +01:00
|
|
|
std::vector<ID3D11VertexShader*> VS;
|
2013-12-18 20:28:06 +01:00
|
|
|
std::vector<Core::PipelineManager::ShaderData> VData;
|
2013-11-20 10:22:01 +01:00
|
|
|
std::map<std::wstring,int> VSMap;
|
2013-12-18 20:28:06 +01:00
|
|
|
|
|
|
|
Core::PipelineManager::RenderPass Current;
|
2013-11-10 03:19:46 +01:00
|
|
|
}
|
2013-11-20 10:22:01 +01:00
|
|
|
|
|
|
|
#pragma region Init
|
2013-12-18 20:28:06 +01:00
|
|
|
bool Core::PipelineManager::Init(std::wstring filename, ShaderType type, std::wstring name)
|
2013-11-20 10:22:01 +01:00
|
|
|
{
|
2013-11-29 10:25:27 +01:00
|
|
|
void* data;
|
|
|
|
bool ForceReload;
|
|
|
|
#if defined (_DEBUG) | defined (DEBUG)
|
|
|
|
ForceReload = true;
|
|
|
|
#else
|
|
|
|
ForceReload = false;
|
|
|
|
#endif
|
|
|
|
switch (type)
|
2013-11-20 10:22:01 +01:00
|
|
|
{
|
2013-12-18 20:28:06 +01:00
|
|
|
case Oyster::Graphics::Core::PipelineManager::Vertex:
|
2013-11-29 10:25:27 +01:00
|
|
|
if(!VSMap.count(name) || ForceReload)
|
2013-11-20 10:22:01 +01:00
|
|
|
{
|
2013-11-29 10:25:27 +01:00
|
|
|
data = Resource::OysterResource::LoadResource(filename.c_str(),Loading::LoadShaderV, -1, ForceReload);
|
|
|
|
if(data)
|
2013-11-20 10:22:01 +01:00
|
|
|
{
|
2014-01-08 07:01:59 +01:00
|
|
|
if(ForceReload && VSMap.count(name))
|
|
|
|
{
|
|
|
|
VS[VSMap[name]] = (ID3D11VertexShader*)data;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
VSMap[name] = VS.size();
|
|
|
|
VS.push_back((ID3D11VertexShader*)data);
|
|
|
|
}
|
2013-11-20 10:22:01 +01:00
|
|
|
}
|
|
|
|
}
|
2013-11-29 10:25:27 +01:00
|
|
|
break;
|
2013-12-18 20:28:06 +01:00
|
|
|
case Oyster::Graphics::Core::PipelineManager::Hull:
|
2013-11-29 10:25:27 +01:00
|
|
|
data = Resource::OysterResource::LoadResource(filename.c_str(),Loading::LoadShaderH, -1, ForceReload);
|
|
|
|
if(!HSMap.count(name) || ForceReload)
|
2013-11-20 10:22:01 +01:00
|
|
|
{
|
2013-11-29 10:25:27 +01:00
|
|
|
if(data!=0)
|
|
|
|
{
|
2014-01-08 07:01:59 +01:00
|
|
|
if(ForceReload && HSMap.count(name))
|
|
|
|
{
|
|
|
|
HS[HSMap[name]] = (ID3D11HullShader*)data;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
HSMap[name] = HS.size();
|
|
|
|
HS.push_back((ID3D11HullShader*)data);
|
|
|
|
}
|
|
|
|
|
2013-11-29 10:25:27 +01:00
|
|
|
}
|
2013-11-20 10:22:01 +01:00
|
|
|
}
|
2013-11-10 03:19:46 +01:00
|
|
|
break;
|
2013-12-18 20:28:06 +01:00
|
|
|
case Oyster::Graphics::Core::PipelineManager::Domain:
|
2013-11-29 10:25:27 +01:00
|
|
|
data = Resource::OysterResource::LoadResource(filename.c_str(),Loading::LoadShaderD, -1, ForceReload);
|
|
|
|
if(!DSMap.count(name) || ForceReload)
|
2013-11-20 10:22:01 +01:00
|
|
|
{
|
2013-11-29 10:25:27 +01:00
|
|
|
if(data!=0)
|
|
|
|
{
|
2014-01-08 07:01:59 +01:00
|
|
|
if(ForceReload && DSMap.count(name))
|
|
|
|
{
|
|
|
|
DS[DSMap[name]] = (ID3D11DomainShader*)data;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
DSMap[name] = DS.size();
|
|
|
|
DS.push_back((ID3D11DomainShader*)data);
|
|
|
|
}
|
2013-11-29 10:25:27 +01:00
|
|
|
}
|
2013-11-20 10:22:01 +01:00
|
|
|
}
|
2013-11-29 10:25:27 +01:00
|
|
|
break;
|
2013-12-18 20:28:06 +01:00
|
|
|
case Oyster::Graphics::Core::PipelineManager::Geometry:
|
2013-11-29 10:25:27 +01:00
|
|
|
data = Resource::OysterResource::LoadResource(filename.c_str(),Loading::LoadShaderG, -1, ForceReload);
|
|
|
|
if(!GSMap.count(name) || ForceReload)
|
2013-11-10 03:19:46 +01:00
|
|
|
{
|
2013-11-29 10:25:27 +01:00
|
|
|
if(data!=0)
|
|
|
|
{
|
2014-01-08 07:01:59 +01:00
|
|
|
if(ForceReload && GSMap.count(name))
|
|
|
|
{
|
|
|
|
GS[GSMap[name]] = (ID3D11GeometryShader*)data;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
GSMap[name] = GS.size();
|
|
|
|
GS.push_back((ID3D11GeometryShader*)data);
|
|
|
|
}
|
2013-11-29 10:25:27 +01:00
|
|
|
}
|
2013-11-10 03:19:46 +01:00
|
|
|
}
|
2013-11-29 10:25:27 +01:00
|
|
|
break;
|
2013-12-18 20:28:06 +01:00
|
|
|
case Oyster::Graphics::Core::PipelineManager::Pixel:
|
2013-11-29 10:25:27 +01:00
|
|
|
data = Resource::OysterResource::LoadResource(filename.c_str(),Loading::LoadShaderP, -1, ForceReload);
|
|
|
|
if(!PSMap.count(name) || ForceReload)
|
2013-11-20 10:22:01 +01:00
|
|
|
{
|
2013-11-29 10:25:27 +01:00
|
|
|
if(data!=0)
|
|
|
|
{
|
2014-01-08 07:01:59 +01:00
|
|
|
if(ForceReload && PSMap.count(name))
|
|
|
|
{
|
|
|
|
PS[PSMap[name]] = (ID3D11PixelShader*)data;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
PSMap[name] = PS.size();
|
|
|
|
PS.push_back((ID3D11PixelShader*)data);
|
|
|
|
}
|
2013-11-29 10:25:27 +01:00
|
|
|
}
|
2013-11-20 10:22:01 +01:00
|
|
|
}
|
2013-11-29 10:25:27 +01:00
|
|
|
break;
|
2013-12-18 20:28:06 +01:00
|
|
|
case Oyster::Graphics::Core::PipelineManager::Compute:
|
2013-11-29 10:25:27 +01:00
|
|
|
data = Resource::OysterResource::LoadResource(filename.c_str(),Loading::LoadShaderC, -1, ForceReload);
|
|
|
|
if(!CSMap.count(name) || ForceReload)
|
2013-11-20 10:22:01 +01:00
|
|
|
{
|
2013-11-29 10:25:27 +01:00
|
|
|
if(data!=0)
|
|
|
|
{
|
2014-01-08 07:01:59 +01:00
|
|
|
if(ForceReload && CSMap.count(name))
|
|
|
|
{
|
|
|
|
CS[CSMap[name]] = (ID3D11ComputeShader*)data;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
CSMap[name] = CS.size();
|
|
|
|
CS.push_back((ID3D11ComputeShader*)data);
|
|
|
|
}
|
|
|
|
|
2013-11-29 10:25:27 +01:00
|
|
|
}
|
2013-11-20 10:22:01 +01:00
|
|
|
}
|
2013-11-10 03:19:46 +01:00
|
|
|
break;
|
2013-11-29 10:25:27 +01:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
2013-11-10 03:19:46 +01:00
|
|
|
|
2013-12-18 20:28:06 +01:00
|
|
|
void* Core::PipelineManager::CreateShader(Core::PipelineManager::ShaderData data, Core::PipelineManager::ShaderType type)
|
2013-11-29 10:25:27 +01:00
|
|
|
{
|
2013-11-20 10:22:01 +01:00
|
|
|
|
2013-11-29 10:25:27 +01:00
|
|
|
HRESULT hr;
|
|
|
|
switch (type)
|
|
|
|
{
|
2013-12-18 20:28:06 +01:00
|
|
|
case Oyster::Graphics::Core::PipelineManager::Vertex:
|
2013-11-29 10:25:27 +01:00
|
|
|
ID3D11VertexShader* vs;
|
|
|
|
hr = Core::device->CreateVertexShader(data.data,data.size,NULL,&vs);
|
|
|
|
if(hr == S_OK)
|
|
|
|
VData.push_back(data);
|
|
|
|
return vs;
|
|
|
|
break;
|
2013-12-18 20:28:06 +01:00
|
|
|
case Oyster::Graphics::Core::PipelineManager::Hull:
|
2013-11-29 10:25:27 +01:00
|
|
|
ID3D11HullShader* hs;
|
|
|
|
Core::device->CreateHullShader(data.data,data.size,NULL,&hs);
|
|
|
|
delete[] data.data;
|
|
|
|
return hs;
|
|
|
|
break;
|
2013-12-18 20:28:06 +01:00
|
|
|
case Oyster::Graphics::Core::PipelineManager::Domain:
|
2013-11-29 10:25:27 +01:00
|
|
|
ID3D11DomainShader* ds;
|
|
|
|
Core::device->CreateDomainShader(data.data,data.size,NULL,&ds);
|
|
|
|
delete[] data.data;
|
|
|
|
return ds;
|
|
|
|
break;
|
2013-12-18 20:28:06 +01:00
|
|
|
case Oyster::Graphics::Core::PipelineManager::Geometry:
|
2013-11-29 10:25:27 +01:00
|
|
|
ID3D11GeometryShader* gs;
|
|
|
|
Core::device->CreateGeometryShader(data.data,data.size,NULL,&gs);
|
|
|
|
delete[] data.data;
|
|
|
|
return gs;
|
|
|
|
break;
|
2013-12-18 20:28:06 +01:00
|
|
|
case Oyster::Graphics::Core::PipelineManager::Pixel:
|
2013-11-29 10:25:27 +01:00
|
|
|
ID3D11PixelShader* ps;
|
|
|
|
Core::device->CreatePixelShader(data.data,data.size,NULL,&ps);
|
|
|
|
delete[] data.data;
|
|
|
|
return ps;
|
|
|
|
break;
|
2013-12-18 20:28:06 +01:00
|
|
|
case Oyster::Graphics::Core::PipelineManager::Compute:
|
2013-11-29 10:25:27 +01:00
|
|
|
ID3D11ComputeShader* cs;
|
|
|
|
Core::device->CreateComputeShader(data.data,data.size,NULL,&cs);
|
|
|
|
delete[] data.data;
|
|
|
|
return cs;
|
2013-11-10 03:19:46 +01:00
|
|
|
break;
|
|
|
|
}
|
2013-11-29 10:25:27 +01:00
|
|
|
return NULL;
|
2013-11-10 03:19:46 +01:00
|
|
|
}
|
2013-11-20 10:22:01 +01:00
|
|
|
#pragma endregion
|
2013-11-10 03:19:46 +01:00
|
|
|
|
2013-12-18 20:28:06 +01:00
|
|
|
void Core::PipelineManager::CreateInputLayout(const D3D11_INPUT_ELEMENT_DESC *desc, int ElementCount,int VertexIndex,ID3D11InputLayout *&Layout)
|
2013-11-10 03:19:46 +01:00
|
|
|
{
|
2013-11-20 10:22:01 +01:00
|
|
|
if(VertexIndex==-1)
|
2013-11-10 03:19:46 +01:00
|
|
|
{
|
2013-11-20 10:22:01 +01:00
|
|
|
Layout=0;
|
|
|
|
return;
|
2013-11-10 03:19:46 +01:00
|
|
|
}
|
2013-11-20 10:22:01 +01:00
|
|
|
Core::device->CreateInputLayout(desc,ElementCount,VData[VertexIndex].data,VData[VertexIndex].size,&Layout);
|
|
|
|
}
|
2013-11-10 03:19:46 +01:00
|
|
|
|
2013-11-20 10:22:01 +01:00
|
|
|
#pragma region Get
|
2013-12-18 20:28:06 +01:00
|
|
|
int Core::PipelineManager::Get::Pixel(std::wstring Name)
|
2013-11-20 10:22:01 +01:00
|
|
|
{
|
|
|
|
if(PSMap.count(Name))
|
|
|
|
return PSMap[Name];
|
|
|
|
return -1;
|
|
|
|
}
|
2013-11-10 03:19:46 +01:00
|
|
|
|
2013-12-18 20:28:06 +01:00
|
|
|
int Core::PipelineManager::Get::Vertex(std::wstring Name)
|
2013-11-20 10:22:01 +01:00
|
|
|
{
|
|
|
|
if(VSMap.count(Name))
|
|
|
|
return VSMap[Name];
|
|
|
|
return -1;
|
|
|
|
}
|
2013-12-18 20:28:06 +01:00
|
|
|
int Core::PipelineManager::Get::Geometry(std::wstring Name)
|
2013-11-20 10:22:01 +01:00
|
|
|
{
|
|
|
|
if(GSMap.count(Name))
|
|
|
|
return GSMap[Name];
|
|
|
|
return -1;
|
|
|
|
}
|
2013-11-10 03:19:46 +01:00
|
|
|
|
2013-12-18 20:28:06 +01:00
|
|
|
int Core::PipelineManager::Get::Compute(std::wstring Name)
|
2013-11-20 10:22:01 +01:00
|
|
|
{
|
|
|
|
if(CSMap.count(Name))
|
|
|
|
return CSMap[Name];
|
|
|
|
return -1;
|
|
|
|
}
|
2013-12-18 20:28:06 +01:00
|
|
|
int Core::PipelineManager::Get::Hull(std::wstring Name)
|
2013-11-20 10:22:01 +01:00
|
|
|
{
|
|
|
|
return -1;
|
|
|
|
}
|
2013-12-18 20:28:06 +01:00
|
|
|
int Core::PipelineManager::Get::Domain(std::wstring Name)
|
2013-11-20 10:22:01 +01:00
|
|
|
{
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
#pragma endregion
|
2013-11-10 03:19:46 +01:00
|
|
|
|
2013-11-20 10:22:01 +01:00
|
|
|
#pragma region Set
|
2013-12-18 20:28:06 +01:00
|
|
|
void Core::PipelineManager::Set::Pixel(int Index)
|
2013-11-20 10:22:01 +01:00
|
|
|
{
|
2013-12-18 20:28:06 +01:00
|
|
|
if(Current.Shaders.Pixel != Index)
|
|
|
|
{
|
|
|
|
if(Index==-1)
|
|
|
|
{
|
|
|
|
Core::deviceContext->PSSetShader( NULL,NULL,0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Core::deviceContext->PSSetShader( PS[Index],NULL,0);
|
|
|
|
}
|
|
|
|
Current.Shaders.Pixel=Index;
|
|
|
|
}
|
2013-11-10 03:19:46 +01:00
|
|
|
}
|
2013-12-18 20:28:06 +01:00
|
|
|
|
|
|
|
void Core::PipelineManager::Set::Vertex(int Index)
|
2013-11-20 10:22:01 +01:00
|
|
|
{
|
2013-12-18 20:28:06 +01:00
|
|
|
if(Current.Shaders.Vertex != Index)
|
|
|
|
{
|
|
|
|
if(Index==-1)
|
|
|
|
{
|
|
|
|
Core::deviceContext->VSSetShader( NULL,NULL,0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Core::deviceContext->VSSetShader( VS[Index],NULL,0);
|
|
|
|
}
|
|
|
|
Current.Shaders.Vertex = Index;
|
|
|
|
}
|
2013-11-20 10:22:01 +01:00
|
|
|
}
|
2013-12-18 20:28:06 +01:00
|
|
|
|
|
|
|
void Core::PipelineManager::Set::Geometry(int Index)
|
2013-11-20 10:22:01 +01:00
|
|
|
{
|
2013-12-18 20:28:06 +01:00
|
|
|
if(Current.Shaders.Geometry != Index)
|
|
|
|
{
|
|
|
|
if(Index==-1)
|
|
|
|
{
|
|
|
|
Core::deviceContext->GSSetShader( NULL,NULL,0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Core::deviceContext->GSSetShader( GS[Index],NULL,0);
|
|
|
|
}
|
|
|
|
Current.Shaders.Geometry = Index;
|
|
|
|
}
|
2013-11-20 10:22:01 +01:00
|
|
|
}
|
2013-12-18 20:28:06 +01:00
|
|
|
|
|
|
|
void Core::PipelineManager::Set::Compute(int Index)
|
2013-11-20 10:22:01 +01:00
|
|
|
{
|
2013-12-18 20:28:06 +01:00
|
|
|
if(Current.Shaders.Compute != Index)
|
|
|
|
{
|
|
|
|
if(Index==-1)
|
|
|
|
{
|
|
|
|
Core::deviceContext->CSSetShader( NULL,NULL,0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Core::deviceContext->CSSetShader( CS[Index],NULL,0);
|
|
|
|
}
|
|
|
|
Current.Shaders.Compute = Index;
|
|
|
|
}
|
2013-11-20 10:22:01 +01:00
|
|
|
}
|
|
|
|
/// \todo set Hull
|
2013-12-18 20:28:06 +01:00
|
|
|
void Core::PipelineManager::Set::Hull(int Index)
|
2013-11-10 03:19:46 +01:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2013-11-20 10:22:01 +01:00
|
|
|
/// \todo set Domain
|
2013-12-18 20:28:06 +01:00
|
|
|
void Core::PipelineManager::Set::Domain(int Index)
|
2013-11-20 10:22:01 +01:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
#pragma endregion
|
2013-11-10 03:19:46 +01:00
|
|
|
|
2013-11-20 10:22:01 +01:00
|
|
|
/// \todo smart Set ie. not resetting the shader
|
|
|
|
/// \todo research states
|
|
|
|
/// \todo smart buffer set
|
2013-12-18 20:28:06 +01:00
|
|
|
void Core::PipelineManager::SetRenderPass(RenderPass se)
|
2013-11-20 10:22:01 +01:00
|
|
|
{
|
2013-12-18 20:28:06 +01:00
|
|
|
CleanPipeline();
|
2013-11-20 10:22:01 +01:00
|
|
|
Set::Pixel(se.Shaders.Pixel);
|
|
|
|
Set::Vertex(se.Shaders.Vertex);
|
|
|
|
Set::Geometry(se.Shaders.Geometry);
|
|
|
|
Set::Compute(se.Shaders.Compute);
|
|
|
|
Core::deviceContext->IASetInputLayout(se.IAStage.Layout);
|
|
|
|
Core::deviceContext->IASetPrimitiveTopology(se.IAStage.Topology);
|
2013-12-18 20:28:06 +01:00
|
|
|
if(se.CBuffers.Vertex.size())
|
|
|
|
{
|
|
|
|
deviceContext->VSSetConstantBuffers(0,se.CBuffers.Vertex.size(),&se.CBuffers.Vertex[0]);
|
|
|
|
}
|
|
|
|
if(se.CBuffers.Pixel.size())
|
|
|
|
{
|
|
|
|
deviceContext->PSSetConstantBuffers(0,se.CBuffers.Pixel.size(),&se.CBuffers.Pixel[0]);
|
|
|
|
}
|
|
|
|
if(se.CBuffers.Geometry.size())
|
|
|
|
{
|
|
|
|
deviceContext->GSSetConstantBuffers(0,se.CBuffers.Geometry.size(),&se.CBuffers.Geometry[0]);
|
|
|
|
}
|
|
|
|
if(se.CBuffers.Compute.size())
|
|
|
|
{
|
|
|
|
deviceContext->CSSetConstantBuffers(0,se.CBuffers.Compute.size(),&se.CBuffers.Compute[0]);
|
|
|
|
}
|
2013-11-20 10:22:01 +01:00
|
|
|
Core::deviceContext->RSSetState(se.RenderStates.Rasterizer);
|
|
|
|
Core::deviceContext->PSSetSamplers(0,se.RenderStates.SampleCount,se.RenderStates.SampleState);
|
2013-11-28 14:34:52 +01:00
|
|
|
Core::deviceContext->OMSetDepthStencilState(se.RenderStates.DepthStencil,0);
|
2013-11-20 10:22:01 +01:00
|
|
|
float test[4] = {0};
|
|
|
|
Core::deviceContext->OMSetBlendState(se.RenderStates.BlendState,test,-1);
|
2013-12-18 20:28:06 +01:00
|
|
|
|
|
|
|
if(se.SRV.Vertex.size())
|
|
|
|
{
|
|
|
|
Core::deviceContext->VSSetShaderResources(0,se.SRV.Vertex.size(),&se.SRV.Vertex[0]);
|
|
|
|
}
|
|
|
|
if(se.SRV.Geometry.size())
|
|
|
|
{
|
|
|
|
Core::deviceContext->GSSetShaderResources(0,se.SRV.Geometry.size(),&se.SRV.Geometry[0]);
|
|
|
|
}
|
|
|
|
if(se.SRV.Pixel.size())
|
|
|
|
{
|
|
|
|
Core::deviceContext->PSSetShaderResources(0,se.SRV.Pixel.size(),&se.SRV.Pixel[0]);
|
|
|
|
}
|
|
|
|
if(se.SRV.Compute.size())
|
|
|
|
{
|
|
|
|
Core::deviceContext->CSSetShaderResources(0,se.SRV.Compute.size(),&se.SRV.Compute[0]);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(se.RTV.size())
|
|
|
|
{
|
|
|
|
if(se.UAV.Pixel.size())
|
|
|
|
{
|
|
|
|
deviceContext->OMSetRenderTargetsAndUnorderedAccessViews(se.RTV.size(),&se.RTV[0],se.depth,se.RTV.size(),se.UAV.Pixel.size(),&se.UAV.Pixel[0],0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
deviceContext->OMSetRenderTargets(se.RTV.size(),&se.RTV[0],se.depth);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if(se.UAV.Pixel.size())
|
|
|
|
{
|
|
|
|
deviceContext->OMSetRenderTargetsAndUnorderedAccessViews(0,NULL,se.depth,0,se.UAV.Pixel.size(),&se.UAV.Pixel[0],0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(se.UAV.Compute.size())
|
|
|
|
{
|
|
|
|
deviceContext->CSSetUnorderedAccessViews(0,se.UAV.Compute.size(),&se.UAV.Compute[0],0);
|
|
|
|
}
|
2013-11-20 10:22:01 +01:00
|
|
|
}
|
2013-11-29 10:25:27 +01:00
|
|
|
|
2013-12-18 20:28:06 +01:00
|
|
|
void Core::PipelineManager::Clean()
|
2013-11-29 10:25:27 +01:00
|
|
|
{
|
2013-12-05 14:56:34 +01:00
|
|
|
for(int i = 0; i < (int)VData.size(); ++i)
|
2013-11-29 10:25:27 +01:00
|
|
|
{
|
|
|
|
delete[] VData[i].data;
|
|
|
|
}
|
|
|
|
}
|
2013-12-18 20:28:06 +01:00
|
|
|
|
|
|
|
void Core::PipelineManager::CleanPipeline()
|
|
|
|
{
|
2014-01-08 07:01:59 +01:00
|
|
|
//deviceContext->VSSetShaderResources(0,16,Core::srvNULL);
|
|
|
|
//deviceContext->GSSetShaderResources(0,16,Core::srvNULL);
|
|
|
|
//deviceContext->PSSetShaderResources(0,16,Core::srvNULL);
|
2013-12-18 20:28:06 +01:00
|
|
|
deviceContext->CSSetShaderResources(0,16,Core::srvNULL);
|
|
|
|
deviceContext->CSSetUnorderedAccessViews(0,8,Core::uavNULL,NULL);
|
|
|
|
deviceContext->OMSetRenderTargets(8,Core::rtvNULL, NULL);
|
|
|
|
}
|
2013-11-10 03:19:46 +01:00
|
|
|
}
|
|
|
|
}
|