Introduce a pipeline state accessor that reads from a bundle

This commit is contained in:
Billy Laws 2022-12-10 15:41:02 +00:00
parent 7dd3a1db0f
commit 06bf1b38af
3 changed files with 51 additions and 0 deletions

View File

@ -210,6 +210,7 @@ add_library(skyline SHARED
${source_DIR}/skyline/gpu/interconnect/common/textures.cpp
${source_DIR}/skyline/gpu/interconnect/common/shader_cache.cpp
${source_DIR}/skyline/gpu/interconnect/common/pipeline_state_bundle.cpp
${source_DIR}/skyline/gpu/interconnect/common/file_pipeline_state_accessor.cpp
${source_DIR}/skyline/gpu/shaders/helper_shaders.cpp
${source_DIR}/skyline/soc/smmu.cpp
${source_DIR}/skyline/soc/host1x/syncpoint.cpp

View File

@ -0,0 +1,22 @@
// SPDX-License-Identifier: MPL-2.0
// Copyright © 2022 Skyline Team and Contributors (https://github.com/skyline-emu/)
#include "file_pipeline_state_accessor.h"
namespace skyline::gpu::interconnect::maxwell3d {
FilePipelineStateAccessor::FilePipelineStateAccessor(PipelineStateBundle &bundle) : bundle{bundle} {}
Shader::TextureType FilePipelineStateAccessor::GetTextureType(u32 index) const {
return bundle.LookupTextureType(index);
}
u32 FilePipelineStateAccessor::GetConstantBufferValue(u32 shaderStage, u32 index, u32 offset) const {
return bundle.LookupConstantBufferValue(shaderStage, index, offset);
}
ShaderBinary FilePipelineStateAccessor::GetShaderBinary(u32 pipelineStage) const {
return bundle.GetShaderBinary(pipelineStage);
}
void FilePipelineStateAccessor::MarkComplete() {}
}

View File

@ -0,0 +1,28 @@
// SPDX-License-Identifier: MPL-2.0
// Copyright © 2022 Skyline Team and Contributors (https://github.com/skyline-emu/)
#pragma once
#include "pipeline_state_accessor.h"
#include "pipeline_state_bundle.h"
namespace skyline::gpu::interconnect::maxwell3d {
/**
* @brief Implements the PipelineStateAccessor interface for pipelines loaded from a file
*/
class FilePipelineStateAccessor : public PipelineStateAccessor {
private:
PipelineStateBundle &bundle;
public:
FilePipelineStateAccessor(PipelineStateBundle &bundle);
Shader::TextureType GetTextureType(u32 index) const override;
u32 GetConstantBufferValue(u32 shaderStage, u32 index, u32 offset) const override;
ShaderBinary GetShaderBinary(u32 pipelineStage) const override;
void MarkComplete() override;
};
}