diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index 603522a8..dcba65b5 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -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 diff --git a/app/src/main/cpp/skyline/gpu/interconnect/common/file_pipeline_state_accessor.cpp b/app/src/main/cpp/skyline/gpu/interconnect/common/file_pipeline_state_accessor.cpp new file mode 100644 index 00000000..39813a87 --- /dev/null +++ b/app/src/main/cpp/skyline/gpu/interconnect/common/file_pipeline_state_accessor.cpp @@ -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() {} +} diff --git a/app/src/main/cpp/skyline/gpu/interconnect/common/file_pipeline_state_accessor.h b/app/src/main/cpp/skyline/gpu/interconnect/common/file_pipeline_state_accessor.h new file mode 100644 index 00000000..e530d441 --- /dev/null +++ b/app/src/main/cpp/skyline/gpu/interconnect/common/file_pipeline_state_accessor.h @@ -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; + }; +}