[D3D12] Build and code format fixes

This commit is contained in:
Triang3l 2018-07-24 15:14:16 +03:00
parent 87aecfa1b8
commit c0ff73a588
4 changed files with 33 additions and 33 deletions

View File

@ -16,7 +16,7 @@
#include "xenia/gpu/gpu_flags.h"
DEFINE_bool(d3d12_shader_disasm, true,
"Disassemble translated shaders after compilation.");
"Disassemble translated shaders after compilation.");
namespace xe {
namespace gpu {
@ -52,11 +52,10 @@ bool D3D12Shader::Prepare() {
// TODO(Triang3l): Choose the appropriate optimization level based on compile
// time and how invariance is handled in vertex shaders.
ID3DBlob* error_blob = nullptr;
bool compiled =
SUCCEEDED(D3DCompile(translated_binary_.data(), translated_binary_.size(),
nullptr, nullptr, nullptr, "main", target,
D3DCOMPILE_OPTIMIZATION_LEVEL0, 0, &blob_,
&error_blob));
bool compiled = SUCCEEDED(
D3DCompile(translated_binary_.data(), translated_binary_.size(), nullptr,
nullptr, nullptr, "main", target,
D3DCOMPILE_OPTIMIZATION_LEVEL0, 0, &blob_, &error_blob));
if (!compiled) {
XELOGE("%s shader %.16llX compilation failed!", target, ucode_data_hash());
@ -65,14 +64,16 @@ bool D3D12Shader::Prepare() {
if (compiled) {
XELOGW("%s shader %.16llX compiled with warnings!", target,
ucode_data_hash());
XELOGW("%s", reinterpret_cast<const char*>(error_blob->GetBufferPointer()));
XELOGW("%s",
reinterpret_cast<const char*>(error_blob->GetBufferPointer()));
XELOGW("HLSL source:");
// The buffer isn't terminated.
translated_binary_.push_back(0);
XELOGW("%s", reinterpret_cast<const char*>(translated_binary_.data()));
translated_binary_.pop_back();
} else {
XELOGE("%s", reinterpret_cast<const char*>(error_blob->GetBufferPointer()));
XELOGE("%s",
reinterpret_cast<const char*>(error_blob->GetBufferPointer()));
XELOGE("HLSL source:");
translated_binary_.push_back(0);
XELOGE("%s", reinterpret_cast<const char*>(translated_binary_.data()));

View File

@ -13,6 +13,7 @@
#include "xenia/base/assert.h"
#include "xenia/base/logging.h"
#include "xenia/base/profiling.h"
#include "xenia/gpu/gpu_flags.h"
#include "xenia/gpu/hlsl_shader_translator.h"
@ -28,9 +29,7 @@ PipelineCache::PipelineCache(RegisterFile* register_file,
PipelineCache::~PipelineCache() { Shutdown(); }
void PipelineCache::Shutdown() {
ClearCache();
}
void PipelineCache::Shutdown() { ClearCache(); }
D3D12Shader* PipelineCache::LoadShader(ShaderType shader_type,
uint32_t guest_address,
@ -47,8 +46,8 @@ D3D12Shader* PipelineCache::LoadShader(ShaderType shader_type,
// Always create the shader and stash it away.
// We need to track it even if it fails translation so we know not to try
// again.
D3D12Shader* shader = new D3D12Shader(shader_type, data_hash, host_address,
dword_count);
D3D12Shader* shader =
new D3D12Shader(shader_type, data_hash, host_address, dword_count);
shader_map_.insert({data_hash, shader});
return shader;

View File

@ -165,23 +165,23 @@ std::vector<uint8_t> HlslShaderTranslator::CompleteTranslation() {
// Common declarations.
source.Append(
"cbuffer xe_system_constants : register(b0) {\n"
" float2 xe_viewport_inv_scale;\n"
" uint xe_vertex_index_endian;\n"
" uint xe_textures_are_3d;\n"
"};\n"
"\n"
"struct XeFloatConstantPage {\n"
" float4 c[16];\n"
"};\n"
"ConstantBuffer<XeFloatConstantPage> "
"xe_float_constants[16] : register(b1);\n"
"\n"
"cbuffer xe_loop_bool_constants : register(b17) {\n"
" uint xe_bool_constants[8];\n"
" uint xe_loop_constants[32];\n"
"};\n"
"\n");
"cbuffer xe_system_constants : register(b0) {\n"
" float2 xe_viewport_inv_scale;\n"
" uint xe_vertex_index_endian;\n"
" uint xe_textures_are_3d;\n"
"};\n"
"\n"
"struct XeFloatConstantPage {\n"
" float4 c[16];\n"
"};\n"
"ConstantBuffer<XeFloatConstantPage> "
"xe_float_constants[16] : register(b1);\n"
"\n"
"cbuffer xe_loop_bool_constants : register(b17) {\n"
" uint xe_bool_constants[8];\n"
" uint xe_loop_constants[32];\n"
"};\n"
"\n");
if (is_vertex_shader()) {
// Vertex fetching, output and prologue.
@ -307,8 +307,8 @@ std::vector<uint8_t> HlslShaderTranslator::CompleteTranslation() {
// Epilogue.
if (!cf_wrote_pc_) {
source.Append(
" xe_pc = 0xFFFFu;\n"
" break;\n");
" xe_pc = 0xFFFFu;\n"
" break;\n");
}
source.Append(
" default:\n"

View File

@ -13,9 +13,9 @@
// This must be included before D3D and DXGI for things like NOMINMAX.
#include "xenia/base/platform_win.h"
#include <dxgi1_4.h>
#include <d3d12.h>
#include <d3dcompiler.h>
#include <dxgi1_4.h>
#define XELOGD3D XELOGI