2015-05-11 01:56:48 +02:00
|
|
|
#include "stdafx.h"
|
|
|
|
|
#if defined (DX12_SUPPORT)
|
|
|
|
|
|
|
|
|
|
#include "D3D12PipelineState.h"
|
|
|
|
|
#include <d3dcompiler.h>
|
2015-05-15 20:00:48 +02:00
|
|
|
|
2015-05-11 01:56:48 +02:00
|
|
|
#pragma comment (lib, "d3dcompiler.lib")
|
|
|
|
|
|
2015-05-12 23:41:03 +02:00
|
|
|
#define TO_STRING(x) #x
|
|
|
|
|
|
2015-05-14 19:48:49 +02:00
|
|
|
void Shader::Compile(const std::string &code, SHADER_TYPE st)
|
2015-05-14 20:57:33 +02:00
|
|
|
{ HRESULT hr;
|
2015-05-11 18:48:07 +02:00
|
|
|
Microsoft::WRL::ComPtr<ID3DBlob> errorBlob;
|
|
|
|
|
switch (st)
|
|
|
|
|
{
|
|
|
|
|
case SHADER_TYPE::SHADER_TYPE_VERTEX:
|
2015-05-17 23:16:24 +02:00
|
|
|
hr = D3DCompile(code.c_str(), code.size(), "VertexProgram.hlsl", nullptr, nullptr, "main", "vs_5_0", 0, 0, &bytecode, errorBlob.GetAddressOf());
|
2015-05-11 18:48:07 +02:00
|
|
|
if (hr != S_OK)
|
|
|
|
|
LOG_ERROR(RSX, "VS build failed:%s", errorBlob->GetBufferPointer());
|
|
|
|
|
break;
|
|
|
|
|
case SHADER_TYPE::SHADER_TYPE_FRAGMENT:
|
2015-05-17 23:16:24 +02:00
|
|
|
hr = D3DCompile(code.c_str(), code.size(), "FragmentProgram.hlsl", nullptr, nullptr, "main", "ps_5_0", 0, 0, &bytecode, errorBlob.GetAddressOf());
|
2015-05-11 18:48:07 +02:00
|
|
|
if (hr != S_OK)
|
|
|
|
|
LOG_ERROR(RSX, "FS build failed:%s", errorBlob->GetBufferPointer());
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-05-12 21:55:20 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|