Remove YBaseLib dependency

This commit is contained in:
Connor McLaughlin
2020-01-10 13:31:12 +10:00
parent 1c2c4c8489
commit 71c1e243fe
112 changed files with 6888 additions and 522 deletions

View File

@ -1,6 +1,6 @@
#include "shader_compiler.h"
#include "YBaseLib/Log.h"
#include "YBaseLib/String.h"
#include "../log.h"
#include "../string_util.h"
#include <array>
#include <d3dcompiler.h>
#include <fstream>
@ -54,33 +54,32 @@ ComPtr<ID3DBlob> CompileShader(Type type, D3D_FEATURE_LEVEL feature_level, std::
D3DCompile(code.data(), code.size(), "0", nullptr, nullptr, "main", target, debug ? flags_debug : flags_non_debug,
0, blob.GetAddressOf(), error_blob.GetAddressOf());
String error_string;
std::string error_string;
if (error_blob)
{
error_string.AppendString(static_cast<const char*>(error_blob->GetBufferPointer()),
static_cast<uint32>(error_blob->GetBufferSize()));
error_string.append(static_cast<const char*>(error_blob->GetBufferPointer()), error_blob->GetBufferSize());
error_blob.Reset();
}
if (FAILED(hr))
{
Log_ErrorPrintf("Failed to compile '%s':\n%s", target, error_string.GetCharArray());
Log_ErrorPrintf("Failed to compile '%s':\n%s", target, error_string.c_str());
std::ofstream ofs(SmallString::FromFormat("bad_shader_%u.txt", s_next_bad_shader_id++),
std::ofstream ofs(StringUtil::StdStringFromFormat("bad_shader_%u.txt", s_next_bad_shader_id++).c_str(),
std::ofstream::out | std::ofstream::binary);
if (ofs.is_open())
{
ofs << code;
ofs << "\n\nCompile as " << target << " failed: " << hr << "\n";
ofs.write(error_string.GetCharArray(), error_string.GetLength());
ofs.write(error_string.c_str(), error_string.size());
ofs.close();
}
return {};
}
if (!error_string.IsEmpty())
Log_WarningPrintf("'%s' compiled with warnings:\n%s", target, error_string.GetCharArray());
if (!error_string.empty())
Log_WarningPrintf("'%s' compiled with warnings:\n%s", target, error_string.c_str());
return blob;
}

View File

@ -1,5 +1,5 @@
#pragma once
#include "YBaseLib/Windows/WindowsHeaders.h"
#include "../windows_headers.h"
#include <d3d11.h>
#include <string_view>
#include <type_traits>

View File

@ -1,5 +1,6 @@
#include "staging_texture.h"
#include "YBaseLib/Log.h"
#include "../log.h"
#include "../assert.h"
Log_SetChannel(D3D11);
namespace D3D11 {

View File

@ -1,6 +1,6 @@
#pragma once
#include "../types.h"
#include "YBaseLib/Windows/WindowsHeaders.h"
#include "../windows_headers.h"
#include <cstring>
#include <d3d11.h>
#include <wrl/client.h>

View File

@ -1,5 +1,7 @@
#include "stream_buffer.h"
#include "YBaseLib/Log.h"
#include "../align.h"
#include "../assert.h"
#include "../log.h"
Log_SetChannel(D3D11);
namespace D3D11 {

View File

@ -1,6 +1,6 @@
#pragma once
#include "../types.h"
#include "YBaseLib/Windows/WindowsHeaders.h"
#include "../windows_headers.h"
#include <d3d11.h>
#include <wrl/client.h>

View File

@ -1,5 +1,5 @@
#include "texture.h"
#include "YBaseLib/Log.h"
#include "../log.h"
Log_SetChannel(D3D11);
namespace D3D11 {

View File

@ -1,6 +1,6 @@
#pragma once
#include "../types.h"
#include "YBaseLib/Windows/WindowsHeaders.h"
#include "../windows_headers.h"
#include <d3d11.h>
#include <wrl/client.h>