mirror of
https://github.com/skyline-emu/skyline.git
synced 2025-03-03 22:55:21 +03:00
Transition input assembly state to pipeline cache key
This commit is contained in:
parent
3f9161fb74
commit
ae5d419586
@ -320,8 +320,11 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
|||||||
manager.Bind(handle, primitiveRestartEnable);
|
manager.Bind(handle, primitiveRestartEnable);
|
||||||
}
|
}
|
||||||
|
|
||||||
const vk::PipelineInputAssemblyStateCreateInfo &InputAssemblyState::Build() {
|
InputAssemblyState::InputAssemblyState(const EngineRegisters &engine) : engine{engine} {}
|
||||||
return inputAssemblyState;
|
|
||||||
|
void InputAssemblyState::Update(Key &key) {
|
||||||
|
key.topology = currentEngineTopology;
|
||||||
|
key.primitiveRestartEnabled = engine.primitiveRestartEnable & 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::pair<vk::PrimitiveTopology, Shader::InputTopology> ConvertPrimitiveTopology(engine::DrawTopology topology) {
|
static std::pair<vk::PrimitiveTopology, Shader::InputTopology> ConvertPrimitiveTopology(engine::DrawTopology topology) {
|
||||||
@ -359,9 +362,6 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
|||||||
void InputAssemblyState::SetPrimitiveTopology(engine::DrawTopology topology) {
|
void InputAssemblyState::SetPrimitiveTopology(engine::DrawTopology topology) {
|
||||||
currentEngineTopology = topology;
|
currentEngineTopology = topology;
|
||||||
|
|
||||||
Shader::InputTopology geometryTopology{};
|
|
||||||
std::tie(inputAssemblyState.topology, geometryTopology) = ConvertPrimitiveTopology(topology);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if (shaderTopology == ShaderCompiler::InputTopology::Points)
|
if (shaderTopology == ShaderCompiler::InputTopology::Points)
|
||||||
UpdateRuntimeInformation(runtimeInfo.fixed_state_point_size, std::make_optional(pointSpriteSize), maxwell3d::PipelineStage::Vertex, maxwell3d::PipelineStage::Geometry);
|
UpdateRuntimeInformation(runtimeInfo.fixed_state_point_size, std::make_optional(pointSpriteSize), maxwell3d::PipelineStage::Vertex, maxwell3d::PipelineStage::Geometry);
|
||||||
@ -380,9 +380,6 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
|||||||
return currentEngineTopology == engine::DrawTopology::Quads;
|
return currentEngineTopology == engine::DrawTopology::Quads;
|
||||||
}
|
}
|
||||||
|
|
||||||
void InputAssemblyState::SetPrimitiveRestart(bool enabled) {
|
|
||||||
inputAssemblyState.primitiveRestartEnable = enabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Tessellation State */
|
/* Tessellation State */
|
||||||
void TessellationState::EngineRegisters::DirtyBind(DirtyManager &manager, dirty::Handle handle) const {
|
void TessellationState::EngineRegisters::DirtyBind(DirtyManager &manager, dirty::Handle handle) const {
|
||||||
@ -779,7 +776,8 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
|||||||
vertexInput{manager, engine.vertexInputRegisters},
|
vertexInput{manager, engine.vertexInputRegisters},
|
||||||
rasterization{manager, engine.rasterizationRegisters},
|
rasterization{manager, engine.rasterizationRegisters},
|
||||||
depthStencil{manager, engine.depthStencilRegisters},
|
depthStencil{manager, engine.depthStencilRegisters},
|
||||||
colorBlend{manager, engine.colorBlendRegisters} {}
|
colorBlend{manager, engine.colorBlendRegisters},
|
||||||
|
directState{engine.inputAssemblyRegisters} {}
|
||||||
|
|
||||||
void PipelineState::Flush(InterconnectContext &ctx, StateUpdateBuilder &builder) {
|
void PipelineState::Flush(InterconnectContext &ctx, StateUpdateBuilder &builder) {
|
||||||
boost::container::static_vector<TextureView *, engine::ColorTargetCount> colorAttachments;
|
boost::container::static_vector<TextureView *, engine::ColorTargetCount> colorAttachments;
|
||||||
@ -790,7 +788,8 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
|||||||
TextureView *depthAttachment{depthRenderTarget.UpdateGet(ctx, key).view.get()};
|
TextureView *depthAttachment{depthRenderTarget.UpdateGet(ctx, key).view.get()};
|
||||||
|
|
||||||
vertexInput.Update(key);
|
vertexInput.Update(key);
|
||||||
const auto &inputAssemblyState{directState.inputAssembly.Build()};
|
directState.inputAssembly.Update(key);
|
||||||
|
|
||||||
const auto &tessellationState{directState.tessellation.Build()};
|
const auto &tessellationState{directState.tessellation.Build()};
|
||||||
const auto &rasterizationState{rasterization.UpdateGet().rasterizationState};
|
const auto &rasterizationState{rasterization.UpdateGet().rasterizationState};
|
||||||
vk::PipelineMultisampleStateCreateInfo multisampleState{
|
vk::PipelineMultisampleStateCreateInfo multisampleState{
|
||||||
|
@ -6,12 +6,14 @@
|
|||||||
#include <boost/container/static_vector.hpp>
|
#include <boost/container/static_vector.hpp>
|
||||||
#include <gpu/texture/texture.h>
|
#include <gpu/texture/texture.h>
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
#include "soc/gm20b/engines/maxwell/types.h"
|
||||||
|
|
||||||
namespace skyline::gpu::interconnect::maxwell3d {
|
namespace skyline::gpu::interconnect::maxwell3d {
|
||||||
class Key {
|
struct Key {
|
||||||
private:
|
|
||||||
struct {
|
struct {
|
||||||
u8 ztFormat : 5; // ZtFormat - 0xA as u8
|
u8 ztFormat : 5; //!< Use {Set, Get}ZtFormat. ZtFormat - 0xA as u8
|
||||||
|
engine::DrawTopology topology : 4;
|
||||||
|
bool primitiveRestartEnabled : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct VertexBinding {
|
struct VertexBinding {
|
||||||
@ -23,10 +25,8 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
|||||||
};
|
};
|
||||||
static_assert(sizeof(VertexBinding) == 0x8);
|
static_assert(sizeof(VertexBinding) == 0x8);
|
||||||
|
|
||||||
std::array<u8, engine::ColorTargetCount> ctFormats; //!< ColorTarget::Format as u8
|
std::array<u8, engine::ColorTargetCount> ctFormats; //!< Use {Set, Get}CtFormat. ColorTarget::Format as u8
|
||||||
std::array<VertexBinding, engine::VertexStreamCount> vertexBindings;
|
std::array<VertexBinding, engine::VertexStreamCount> vertexBindings; //!< Use {Set, Get}VertexBinding
|
||||||
|
|
||||||
public:
|
|
||||||
std::array<engine::VertexAttribute, engine::VertexAttributeCount> vertexAttributes;
|
std::array<engine::VertexAttribute, engine::VertexAttributeCount> vertexAttributes;
|
||||||
|
|
||||||
void SetCtFormat(size_t index, engine::ColorTarget::Format format) {
|
void SetCtFormat(size_t index, engine::ColorTarget::Format format) {
|
||||||
@ -109,11 +109,7 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
|||||||
void Flush(Key &key);
|
void Flush(Key &key);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct InputAssemblyState {
|
class InputAssemblyState {
|
||||||
private:
|
|
||||||
vk::PipelineInputAssemblyStateCreateInfo inputAssemblyState{};
|
|
||||||
engine::DrawTopology currentEngineTopology{};
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
struct EngineRegisters {
|
struct EngineRegisters {
|
||||||
const u32 &primitiveRestartEnable;
|
const u32 &primitiveRestartEnable;
|
||||||
@ -121,19 +117,21 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
|||||||
void DirtyBind(DirtyManager &manager, dirty::Handle handle) const;
|
void DirtyBind(DirtyManager &manager, dirty::Handle handle) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private:
|
||||||
|
EngineRegisters engine;
|
||||||
|
vk::PipelineInputAssemblyStateCreateInfo inputAssemblyState{};
|
||||||
|
engine::DrawTopology currentEngineTopology{};
|
||||||
|
|
||||||
const vk::PipelineInputAssemblyStateCreateInfo &Build();
|
public:
|
||||||
|
InputAssemblyState(const EngineRegisters &engine);
|
||||||
|
|
||||||
|
void Update(Key &key);
|
||||||
|
|
||||||
/**
|
|
||||||
* @note Calling this *REQUIRES* manually marking the pipeline as dirty
|
|
||||||
*/
|
|
||||||
void SetPrimitiveTopology(engine::DrawTopology topology);
|
void SetPrimitiveTopology(engine::DrawTopology topology);
|
||||||
|
|
||||||
engine::DrawTopology GetPrimitiveTopology() const;
|
engine::DrawTopology GetPrimitiveTopology() const;
|
||||||
|
|
||||||
bool NeedsQuadConversion() const;
|
bool NeedsQuadConversion() const;
|
||||||
|
|
||||||
void SetPrimitiveRestart(bool enable);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TessellationState {
|
struct TessellationState {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user