[D3D12] Remove context_ from PipelineCache

This commit is contained in:
Triang3l 2018-08-01 18:41:07 +03:00
parent a627ef3d66
commit 6d2441a9ee
3 changed files with 6 additions and 11 deletions

View File

@ -366,8 +366,7 @@ bool D3D12CommandProcessor::SetupContext() {
return false; return false;
} }
pipeline_cache_ = pipeline_cache_ = std::make_unique<PipelineCache>(this, register_file_);
std::make_unique<PipelineCache>(this, register_file_, context);
return true; return true;
} }

View File

@ -25,11 +25,8 @@ namespace gpu {
namespace d3d12 { namespace d3d12 {
PipelineCache::PipelineCache(D3D12CommandProcessor* command_processor, PipelineCache::PipelineCache(D3D12CommandProcessor* command_processor,
RegisterFile* register_file, RegisterFile* register_file)
ui::d3d12::D3D12Context* context) : command_processor_(command_processor), register_file_(register_file) {
: command_processor_(command_processor),
register_file_(register_file),
context_(context) {
shader_translator_.reset(new HlslShaderTranslator()); shader_translator_.reset(new HlslShaderTranslator());
// Set pipeline state description values we never change. // Set pipeline state description values we never change.
@ -633,7 +630,8 @@ PipelineCache::Pipeline* PipelineCache::GetPipeline(uint64_t hash_key) {
// TODO(Triang3l): Cache create pipelines using CachedPSO. // TODO(Triang3l): Cache create pipelines using CachedPSO.
auto device = context_->GetD3D12Provider()->GetDevice(); auto device =
command_processor_->GetD3D12Context()->GetD3D12Provider()->GetDevice();
ID3D12PipelineState* state; ID3D12PipelineState* state;
if (FAILED(device->CreateGraphicsPipelineState(&update_desc_, if (FAILED(device->CreateGraphicsPipelineState(&update_desc_,
IID_PPV_ARGS(&state)))) { IID_PPV_ARGS(&state)))) {

View File

@ -18,7 +18,6 @@
#include "xenia/gpu/register_file.h" #include "xenia/gpu/register_file.h"
#include "xenia/gpu/shader_translator.h" #include "xenia/gpu/shader_translator.h"
#include "xenia/gpu/xenos.h" #include "xenia/gpu/xenos.h"
#include "xenia/ui/d3d12/d3d12_context.h"
namespace xe { namespace xe {
namespace gpu { namespace gpu {
@ -35,7 +34,7 @@ class PipelineCache {
}; };
PipelineCache(D3D12CommandProcessor* command_processor, PipelineCache(D3D12CommandProcessor* command_processor,
RegisterFile* register_file, ui::d3d12::D3D12Context* context); RegisterFile* register_file);
~PipelineCache(); ~PipelineCache();
void Shutdown(); void Shutdown();
@ -80,7 +79,6 @@ class PipelineCache {
D3D12CommandProcessor* command_processor_; D3D12CommandProcessor* command_processor_;
RegisterFile* register_file_; RegisterFile* register_file_;
ui::d3d12::D3D12Context* context_;
// Reusable shader translator. // Reusable shader translator.
std::unique_ptr<ShaderTranslator> shader_translator_ = nullptr; std::unique_ptr<ShaderTranslator> shader_translator_ = nullptr;