mirror of
https://github.com/skyline-emu/skyline.git
synced 2025-02-18 17:26:21 +01:00
Transition tessellation state to pipeline cache key
Also adds dirty tracking and removes it from direct state while we're at it. Since we no longer use Vulkan structs directly there's no benefit to it.
This commit is contained in:
parent
ae5d419586
commit
9a6efb091c
@ -383,15 +383,14 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
|||||||
|
|
||||||
/* Tessellation State */
|
/* Tessellation State */
|
||||||
void TessellationState::EngineRegisters::DirtyBind(DirtyManager &manager, dirty::Handle handle) const {
|
void TessellationState::EngineRegisters::DirtyBind(DirtyManager &manager, dirty::Handle handle) const {
|
||||||
manager.Bind(handle, patchControlPoints, tessellationParameters);
|
manager.Bind(handle, patchSize, tessellationParameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
const vk::PipelineTessellationStateCreateInfo &TessellationState::Build() {
|
TessellationState::TessellationState(const EngineRegisters &engine) : engine{engine} {}
|
||||||
return tessellationState;
|
|
||||||
}
|
|
||||||
|
|
||||||
void TessellationState::SetPatchControlPoints(u32 patchControlPoints) {
|
void TessellationState::Update(Key &key) {
|
||||||
tessellationState.patchControlPoints = patchControlPoints;
|
key.patchSize = engine.patchSize;
|
||||||
|
key.SetTessellationParameters(engine.tessellationParameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
Shader::TessPrimitive ConvertShaderTessPrimitive(engine::TessellationParameters::DomainType domainType) {
|
Shader::TessPrimitive ConvertShaderTessPrimitive(engine::TessellationParameters::DomainType domainType) {
|
||||||
@ -416,12 +415,12 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TessellationState::SetParameters(engine::TessellationParameters params) {
|
// void TessellationState::SetParameters(engine::TessellationParameters params) {
|
||||||
// UpdateRuntimeInformation(runtimeInfo.tess_primitive, ConvertShaderTessPrimitive(params.domainType), maxwell3d::PipelineStage::TessellationEvaluation);
|
// UpdateRuntimeInformation(runtimeInfo.tess_primitive, ConvertShaderTessPrimitive(params.domainType), maxwell3d::PipelineStage::TessellationEvaluation);
|
||||||
// UpdateRuntimeInformation(runtimeInfo.tess_spacing, ConvertShaderTessSpacing(params.spacing), maxwell3d::PipelineStage::TessellationEvaluation);
|
// UpdateRuntimeInformation(runtimeInfo.tess_spacing, ConvertShaderTessSpacing(params.spacing), maxwell3d::PipelineStage::TessellationEvaluation);
|
||||||
// UpdateRuntimeInformation(runtimeInfo.tess_clockwise, params.outputPrimitive == engine::TessellationParameters::OutputPrimitives::TrianglesCW,
|
// UpdateRuntimeInformation(runtimeInfo.tess_clockwise, params.outputPrimitive == engine::TessellationParameters::OutputPrimitives::TrianglesCW,
|
||||||
// maxwell3d::PipelineStage::TessellationEvaluation);
|
// maxwell3d::PipelineStage::TessellationEvaluation);
|
||||||
}
|
// }
|
||||||
|
|
||||||
/* Rasterizer State */
|
/* Rasterizer State */
|
||||||
void RasterizationState::EngineRegisters::DirtyBind(DirtyManager &manager, dirty::Handle handle) const {
|
void RasterizationState::EngineRegisters::DirtyBind(DirtyManager &manager, dirty::Handle handle) const {
|
||||||
@ -774,6 +773,7 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
|||||||
colorRenderTargets{util::MergeInto<dirty::ManualDirtyState<ColorRenderTargetState>, engine::ColorTargetCount>(manager, engine.colorRenderTargetsRegisters, util::IncrementingT<size_t>{})},
|
colorRenderTargets{util::MergeInto<dirty::ManualDirtyState<ColorRenderTargetState>, engine::ColorTargetCount>(manager, engine.colorRenderTargetsRegisters, util::IncrementingT<size_t>{})},
|
||||||
depthRenderTarget{manager, engine.depthRenderTargetRegisters},
|
depthRenderTarget{manager, engine.depthRenderTargetRegisters},
|
||||||
vertexInput{manager, engine.vertexInputRegisters},
|
vertexInput{manager, engine.vertexInputRegisters},
|
||||||
|
tessellation{engine.tessellationRegisters},
|
||||||
rasterization{manager, engine.rasterizationRegisters},
|
rasterization{manager, engine.rasterizationRegisters},
|
||||||
depthStencil{manager, engine.depthStencilRegisters},
|
depthStencil{manager, engine.depthStencilRegisters},
|
||||||
colorBlend{manager, engine.colorBlendRegisters},
|
colorBlend{manager, engine.colorBlendRegisters},
|
||||||
@ -790,7 +790,7 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
|||||||
vertexInput.Update(key);
|
vertexInput.Update(key);
|
||||||
directState.inputAssembly.Update(key);
|
directState.inputAssembly.Update(key);
|
||||||
|
|
||||||
const auto &tessellationState{directState.tessellation.Build()};
|
tessellation.Update(key);
|
||||||
const auto &rasterizationState{rasterization.UpdateGet().rasterizationState};
|
const auto &rasterizationState{rasterization.UpdateGet().rasterizationState};
|
||||||
vk::PipelineMultisampleStateCreateInfo multisampleState{
|
vk::PipelineMultisampleStateCreateInfo multisampleState{
|
||||||
.rasterizationSamples = vk::SampleCountFlagBits::e1
|
.rasterizationSamples = vk::SampleCountFlagBits::e1
|
||||||
|
@ -14,6 +14,9 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
|||||||
u8 ztFormat : 5; //!< Use {Set, Get}ZtFormat. ZtFormat - 0xA as u8
|
u8 ztFormat : 5; //!< Use {Set, Get}ZtFormat. ZtFormat - 0xA as u8
|
||||||
engine::DrawTopology topology : 4;
|
engine::DrawTopology topology : 4;
|
||||||
bool primitiveRestartEnabled : 1;
|
bool primitiveRestartEnabled : 1;
|
||||||
|
engine::TessellationParameters::DomainType domainType : 2; //!< Use SetTessellationParameters
|
||||||
|
engine::TessellationParameters::Spacing spacing : 2; //!< Use SetTessellationParameters
|
||||||
|
engine::TessellationParameters::OutputPrimitives outputPrimitives : 2; //!< Use SetTessellationParameters
|
||||||
};
|
};
|
||||||
|
|
||||||
struct VertexBinding {
|
struct VertexBinding {
|
||||||
@ -25,6 +28,7 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
|||||||
};
|
};
|
||||||
static_assert(sizeof(VertexBinding) == 0x8);
|
static_assert(sizeof(VertexBinding) == 0x8);
|
||||||
|
|
||||||
|
u32 patchSize;
|
||||||
std::array<u8, engine::ColorTargetCount> ctFormats; //!< Use {Set, Get}CtFormat. ColorTarget::Format as u8
|
std::array<u8, engine::ColorTargetCount> ctFormats; //!< Use {Set, Get}CtFormat. ColorTarget::Format as u8
|
||||||
std::array<VertexBinding, engine::VertexStreamCount> vertexBindings; //!< Use {Set, Get}VertexBinding
|
std::array<VertexBinding, engine::VertexStreamCount> vertexBindings; //!< Use {Set, Get}VertexBinding
|
||||||
std::array<engine::VertexAttribute, engine::VertexAttributeCount> vertexAttributes;
|
std::array<engine::VertexAttribute, engine::VertexAttributeCount> vertexAttributes;
|
||||||
@ -43,6 +47,12 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
|||||||
vertexBindings[index].enable = stream.format.enable;
|
vertexBindings[index].enable = stream.format.enable;
|
||||||
vertexBindings[index].divisor = stream.frequency;
|
vertexBindings[index].divisor = stream.frequency;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetTessellationParameters(engine::TessellationParameters parameters) {
|
||||||
|
domainType = parameters.domainType;
|
||||||
|
spacing = parameters.spacing;
|
||||||
|
outputPrimitives = parameters.outputPrimitives;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class ColorRenderTargetState : dirty::ManualDirty {
|
class ColorRenderTargetState : dirty::ManualDirty {
|
||||||
@ -134,23 +144,22 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
|||||||
bool NeedsQuadConversion() const;
|
bool NeedsQuadConversion() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TessellationState {
|
class TessellationState {
|
||||||
private:
|
|
||||||
vk::PipelineTessellationStateCreateInfo tessellationState{};
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
struct EngineRegisters {
|
struct EngineRegisters {
|
||||||
const u32 &patchControlPoints;
|
const u32 &patchSize;
|
||||||
const engine::TessellationParameters &tessellationParameters;
|
const engine::TessellationParameters &tessellationParameters;
|
||||||
|
|
||||||
void DirtyBind(DirtyManager &manager, dirty::Handle handle) const;
|
void DirtyBind(DirtyManager &manager, dirty::Handle handle) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
const vk::PipelineTessellationStateCreateInfo &Build();
|
private:
|
||||||
|
EngineRegisters engine;
|
||||||
|
|
||||||
void SetPatchControlPoints(u32 controlPoints);
|
public:
|
||||||
|
TessellationState(const EngineRegisters &engine);
|
||||||
|
|
||||||
void SetParameters(engine::TessellationParameters parameters);
|
void Update(Key &key);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -158,7 +167,6 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
|||||||
*/
|
*/
|
||||||
struct DirectPipelineState {
|
struct DirectPipelineState {
|
||||||
InputAssemblyState inputAssembly;
|
InputAssemblyState inputAssembly;
|
||||||
TessellationState tessellation;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class RasterizationState : dirty::ManualDirty {
|
class RasterizationState : dirty::ManualDirty {
|
||||||
@ -268,6 +276,7 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
|||||||
std::array<dirty::ManualDirtyState<ColorRenderTargetState>, engine::ColorTargetCount> colorRenderTargets;
|
std::array<dirty::ManualDirtyState<ColorRenderTargetState>, engine::ColorTargetCount> colorRenderTargets;
|
||||||
dirty::ManualDirtyState<DepthRenderTargetState> depthRenderTarget;
|
dirty::ManualDirtyState<DepthRenderTargetState> depthRenderTarget;
|
||||||
dirty::ManualDirtyState<VertexInputState> vertexInput;
|
dirty::ManualDirtyState<VertexInputState> vertexInput;
|
||||||
|
TessellationState tessellation;
|
||||||
dirty::ManualDirtyState<RasterizationState> rasterization;
|
dirty::ManualDirtyState<RasterizationState> rasterization;
|
||||||
dirty::ManualDirtyState<DepthStencilState> depthStencil;
|
dirty::ManualDirtyState<DepthStencilState> depthStencil;
|
||||||
dirty::ManualDirtyState<ColorBlendState> colorBlend;
|
dirty::ManualDirtyState<ColorBlendState> colorBlend;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user