mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-11-30 07:54:15 +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 */
|
||||
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() {
|
||||
return tessellationState;
|
||||
}
|
||||
TessellationState::TessellationState(const EngineRegisters &engine) : engine{engine} {}
|
||||
|
||||
void TessellationState::SetPatchControlPoints(u32 patchControlPoints) {
|
||||
tessellationState.patchControlPoints = patchControlPoints;
|
||||
void TessellationState::Update(Key &key) {
|
||||
key.patchSize = engine.patchSize;
|
||||
key.SetTessellationParameters(engine.tessellationParameters);
|
||||
}
|
||||
|
||||
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_spacing, ConvertShaderTessSpacing(params.spacing), maxwell3d::PipelineStage::TessellationEvaluation);
|
||||
// UpdateRuntimeInformation(runtimeInfo.tess_clockwise, params.outputPrimitive == engine::TessellationParameters::OutputPrimitives::TrianglesCW,
|
||||
// maxwell3d::PipelineStage::TessellationEvaluation);
|
||||
}
|
||||
// }
|
||||
|
||||
/* Rasterizer State */
|
||||
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>{})},
|
||||
depthRenderTarget{manager, engine.depthRenderTargetRegisters},
|
||||
vertexInput{manager, engine.vertexInputRegisters},
|
||||
tessellation{engine.tessellationRegisters},
|
||||
rasterization{manager, engine.rasterizationRegisters},
|
||||
depthStencil{manager, engine.depthStencilRegisters},
|
||||
colorBlend{manager, engine.colorBlendRegisters},
|
||||
@ -790,7 +790,7 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
||||
vertexInput.Update(key);
|
||||
directState.inputAssembly.Update(key);
|
||||
|
||||
const auto &tessellationState{directState.tessellation.Build()};
|
||||
tessellation.Update(key);
|
||||
const auto &rasterizationState{rasterization.UpdateGet().rasterizationState};
|
||||
vk::PipelineMultisampleStateCreateInfo multisampleState{
|
||||
.rasterizationSamples = vk::SampleCountFlagBits::e1
|
||||
|
@ -14,6 +14,9 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
||||
u8 ztFormat : 5; //!< Use {Set, Get}ZtFormat. ZtFormat - 0xA as u8
|
||||
engine::DrawTopology topology : 4;
|
||||
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 {
|
||||
@ -25,6 +28,7 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
||||
};
|
||||
static_assert(sizeof(VertexBinding) == 0x8);
|
||||
|
||||
u32 patchSize;
|
||||
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<engine::VertexAttribute, engine::VertexAttributeCount> vertexAttributes;
|
||||
@ -43,6 +47,12 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
||||
vertexBindings[index].enable = stream.format.enable;
|
||||
vertexBindings[index].divisor = stream.frequency;
|
||||
}
|
||||
|
||||
void SetTessellationParameters(engine::TessellationParameters parameters) {
|
||||
domainType = parameters.domainType;
|
||||
spacing = parameters.spacing;
|
||||
outputPrimitives = parameters.outputPrimitives;
|
||||
}
|
||||
};
|
||||
|
||||
class ColorRenderTargetState : dirty::ManualDirty {
|
||||
@ -134,23 +144,22 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
||||
bool NeedsQuadConversion() const;
|
||||
};
|
||||
|
||||
struct TessellationState {
|
||||
private:
|
||||
vk::PipelineTessellationStateCreateInfo tessellationState{};
|
||||
|
||||
class TessellationState {
|
||||
public:
|
||||
struct EngineRegisters {
|
||||
const u32 &patchControlPoints;
|
||||
const u32 &patchSize;
|
||||
const engine::TessellationParameters &tessellationParameters;
|
||||
|
||||
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 {
|
||||
InputAssemblyState inputAssembly;
|
||||
TessellationState tessellation;
|
||||
};
|
||||
|
||||
class RasterizationState : dirty::ManualDirty {
|
||||
@ -268,6 +276,7 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
||||
std::array<dirty::ManualDirtyState<ColorRenderTargetState>, engine::ColorTargetCount> colorRenderTargets;
|
||||
dirty::ManualDirtyState<DepthRenderTargetState> depthRenderTarget;
|
||||
dirty::ManualDirtyState<VertexInputState> vertexInput;
|
||||
TessellationState tessellation;
|
||||
dirty::ManualDirtyState<RasterizationState> rasterization;
|
||||
dirty::ManualDirtyState<DepthStencilState> depthStencil;
|
||||
dirty::ManualDirtyState<ColorBlendState> colorBlend;
|
||||
|
Loading…
Reference in New Issue
Block a user