mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-11-27 04:04:14 +01:00
Finish off transform feedback implementation
This commit is contained in:
parent
36fd885b49
commit
b72720e8db
@ -272,9 +272,11 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
|||||||
u32 vertexOffset;
|
u32 vertexOffset;
|
||||||
u32 firstInstance;
|
u32 firstInstance;
|
||||||
bool indexed;
|
bool indexed;
|
||||||
|
bool transformFeedbackEnable;
|
||||||
};
|
};
|
||||||
auto *drawParams{ctx.executor.allocator->EmplaceUntracked<DrawParams>(DrawParams{stateUpdater,
|
auto *drawParams{ctx.executor.allocator->EmplaceUntracked<DrawParams>(DrawParams{stateUpdater,
|
||||||
count, first, instanceCount, vertexOffset, firstInstance, indexed})};
|
count, first, instanceCount, vertexOffset, firstInstance, indexed,
|
||||||
|
ctx.gpu.traits.supportsTransformFeedback ? transformFeedbackEnable : false})};
|
||||||
|
|
||||||
const auto &surfaceClip{clearEngineRegisters.surfaceClip};
|
const auto &surfaceClip{clearEngineRegisters.surfaceClip};
|
||||||
vk::Rect2D scissor{
|
vk::Rect2D scissor{
|
||||||
@ -285,11 +287,16 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
|||||||
ctx.executor.AddSubpass([drawParams](vk::raii::CommandBuffer &commandBuffer, const std::shared_ptr<FenceCycle> &, GPU &gpu, vk::RenderPass, u32) {
|
ctx.executor.AddSubpass([drawParams](vk::raii::CommandBuffer &commandBuffer, const std::shared_ptr<FenceCycle> &, GPU &gpu, vk::RenderPass, u32) {
|
||||||
drawParams->stateUpdater.RecordAll(gpu, commandBuffer);
|
drawParams->stateUpdater.RecordAll(gpu, commandBuffer);
|
||||||
|
|
||||||
|
if (drawParams->transformFeedbackEnable)
|
||||||
|
commandBuffer.beginTransformFeedbackEXT(0, {}, {});
|
||||||
|
|
||||||
if (drawParams->indexed)
|
if (drawParams->indexed)
|
||||||
commandBuffer.drawIndexed(drawParams->count, drawParams->instanceCount, drawParams->first, static_cast<i32>(drawParams->vertexOffset), drawParams->firstInstance);
|
commandBuffer.drawIndexed(drawParams->count, drawParams->instanceCount, drawParams->first, static_cast<i32>(drawParams->vertexOffset), drawParams->firstInstance);
|
||||||
else
|
else
|
||||||
commandBuffer.draw(drawParams->count, drawParams->instanceCount, drawParams->first, drawParams->firstInstance);
|
commandBuffer.draw(drawParams->count, drawParams->instanceCount, drawParams->first, drawParams->firstInstance);
|
||||||
|
|
||||||
|
if (drawParams->transformFeedbackEnable)
|
||||||
|
commandBuffer.endTransformFeedbackEXT(0, {}, {});
|
||||||
}, scissor, {}, activeState.GetColorAttachments(), activeState.GetDepthAttachment(), !ctx.gpu.traits.quirks.relaxedRenderPassCompatibility);
|
}, scissor, {}, activeState.GetColorAttachments(), activeState.GetDepthAttachment(), !ctx.gpu.traits.quirks.relaxedRenderPassCompatibility);
|
||||||
|
|
||||||
constantBuffers.ResetQuickBind();
|
constantBuffers.ResetQuickBind();
|
||||||
|
@ -84,6 +84,6 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
|||||||
|
|
||||||
void Clear(engine::ClearSurface &clearSurface);
|
void Clear(engine::ClearSurface &clearSurface);
|
||||||
|
|
||||||
void Draw(engine::DrawTopology topology, bool indexed, u32 count, u32 first, u32 instanceCount, u32 vertexOffset, u32 firstInstance);
|
void Draw(engine::DrawTopology topology, bool transformFeedbackEnable, bool indexed, u32 count, u32 first, u32 instanceCount, u32 vertexOffset, u32 firstInstance);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -959,15 +959,17 @@ namespace skyline::soc::gm20b::engine::maxwell3d::type {
|
|||||||
};
|
};
|
||||||
static_assert(sizeof(StreamOutBuffer) == (sizeof(u32) * 8));
|
static_assert(sizeof(StreamOutBuffer) == (sizeof(u32) * 8));
|
||||||
|
|
||||||
struct TransformFeedbackBufferState {
|
struct StreamOutControl {
|
||||||
u32 bufferIndex;
|
u8 streamSelect : 2;
|
||||||
u32 varyingCount;
|
u32 _pad0_ : 30;
|
||||||
u32 stride;
|
u8 componentCount : 8;
|
||||||
|
u32 _pad1_ : 24;
|
||||||
|
u32 strideBytes;
|
||||||
u32 _pad_;
|
u32 _pad_;
|
||||||
};
|
};
|
||||||
static_assert(sizeof(TransformFeedbackBufferState) == (sizeof(u32) * 4));
|
static_assert(sizeof(StreamOutControl) == (sizeof(u32) * 4));
|
||||||
|
|
||||||
constexpr static size_t TransformFeedbackVaryingCount{0x80};
|
constexpr static size_t StreamOutLayoutSelectAttributeCount{0x80};
|
||||||
|
|
||||||
struct VertexStream {
|
struct VertexStream {
|
||||||
union {
|
union {
|
||||||
|
@ -23,6 +23,7 @@ namespace skyline::soc::gm20b::engine::maxwell3d {
|
|||||||
.rasterizationRegisters = {*registers.rasterEnable, *registers.frontPolygonMode, *registers.backPolygonMode, *registers.oglCullEnable, *registers.oglCullFace, *registers.windowOrigin, *registers.oglFrontFace, *registers.viewportClipControl, *registers.polyOffset, *registers.provokingVertex, *registers.pointSize, *registers.zClipRange},
|
.rasterizationRegisters = {*registers.rasterEnable, *registers.frontPolygonMode, *registers.backPolygonMode, *registers.oglCullEnable, *registers.oglCullFace, *registers.windowOrigin, *registers.oglFrontFace, *registers.viewportClipControl, *registers.polyOffset, *registers.provokingVertex, *registers.pointSize, *registers.zClipRange},
|
||||||
.depthStencilRegisters = {*registers.depthTestEnable, *registers.depthWriteEnable, *registers.depthFunc, *registers.depthBoundsTestEnable, *registers.stencilTestEnable, *registers.twoSidedStencilTestEnable, *registers.stencilOps, *registers.stencilBack},
|
.depthStencilRegisters = {*registers.depthTestEnable, *registers.depthWriteEnable, *registers.depthFunc, *registers.depthBoundsTestEnable, *registers.stencilTestEnable, *registers.twoSidedStencilTestEnable, *registers.stencilOps, *registers.stencilBack},
|
||||||
.colorBlendRegisters = {*registers.logicOp, *registers.singleCtWriteControl, *registers.ctWrites, *registers.blendStatePerTargetEnable, *registers.blendPerTargets, *registers.blend},
|
.colorBlendRegisters = {*registers.logicOp, *registers.singleCtWriteControl, *registers.ctWrites, *registers.blendStatePerTargetEnable, *registers.blendPerTargets, *registers.blend},
|
||||||
|
.transformFeedbackRegisters = {*registers.streamOutputEnable, *registers.streamOutControls, *registers.streamOutLayoutSelect},
|
||||||
.globalShaderConfigRegisters = {*registers.postVtgShaderAttributeSkipMask, *registers.bindlessTexture, *registers.apiMandatedEarlyZEnable},
|
.globalShaderConfigRegisters = {*registers.postVtgShaderAttributeSkipMask, *registers.bindlessTexture, *registers.apiMandatedEarlyZEnable},
|
||||||
.ctSelect = *registers.ctSelect
|
.ctSelect = *registers.ctSelect
|
||||||
};
|
};
|
||||||
@ -33,7 +34,7 @@ namespace skyline::soc::gm20b::engine::maxwell3d {
|
|||||||
.pipelineRegisters = MakePipelineStateRegisters(registers),
|
.pipelineRegisters = MakePipelineStateRegisters(registers),
|
||||||
.vertexBuffersRegisters = util::MergeInto<REGTYPE(VertexBufferState), type::VertexStreamCount>(*registers.vertexStreams, *registers.vertexStreamLimits),
|
.vertexBuffersRegisters = util::MergeInto<REGTYPE(VertexBufferState), type::VertexStreamCount>(*registers.vertexStreams, *registers.vertexStreamLimits),
|
||||||
.indexBufferRegisters = {*registers.indexBuffer},
|
.indexBufferRegisters = {*registers.indexBuffer},
|
||||||
.transformFeedbackBuffersRegisters = util::MergeInto<REGTYPE(TransformFeedbackBufferState), type::StreamOutBufferCount>(*registers.streamOutBuffers, *registers.streamOutEnable),
|
.transformFeedbackBuffersRegisters = util::MergeInto<REGTYPE(TransformFeedbackBufferState), type::StreamOutBufferCount>(*registers.streamOutBuffers, *registers.streamOutputEnable),
|
||||||
.viewportsRegisters = util::MergeInto<REGTYPE(ViewportState), type::ViewportCount>(registers.viewports[0], registers.viewportClips[0], *registers.viewports, *registers.viewportClips, *registers.windowOrigin, *registers.viewportScaleOffsetEnable),
|
.viewportsRegisters = util::MergeInto<REGTYPE(ViewportState), type::ViewportCount>(registers.viewports[0], registers.viewportClips[0], *registers.viewports, *registers.viewportClips, *registers.windowOrigin, *registers.viewportScaleOffsetEnable),
|
||||||
.scissorsRegisters = util::MergeInto<REGTYPE(ScissorState), type::ViewportCount>(*registers.scissors),
|
.scissorsRegisters = util::MergeInto<REGTYPE(ScissorState), type::ViewportCount>(*registers.scissors),
|
||||||
.lineWidthRegisters = {*registers.lineWidth, *registers.lineWidthAliased, *registers.aliasedLineWidthEnable},
|
.lineWidthRegisters = {*registers.lineWidth, *registers.lineWidthAliased, *registers.aliasedLineWidthEnable},
|
||||||
@ -74,7 +75,7 @@ namespace skyline::soc::gm20b::engine::maxwell3d {
|
|||||||
__attribute__((always_inline)) void Maxwell3D::FlushDeferredDraw() {
|
__attribute__((always_inline)) void Maxwell3D::FlushDeferredDraw() {
|
||||||
if (batchEnableState.drawActive) {
|
if (batchEnableState.drawActive) {
|
||||||
batchEnableState.drawActive = false;
|
batchEnableState.drawActive = false;
|
||||||
interconnect.Draw(deferredDraw.drawTopology, deferredDraw.indexed, deferredDraw.drawCount, deferredDraw.drawFirst, deferredDraw.instanceCount, deferredDraw.drawBaseVertex, deferredDraw.drawBaseInstance);
|
interconnect.Draw(deferredDraw.drawTopology, *registers.streamOutputEnable, deferredDraw.indexed, deferredDraw.drawCount, deferredDraw.drawFirst, deferredDraw.instanceCount, deferredDraw.drawBaseVertex, deferredDraw.drawBaseInstance);
|
||||||
deferredDraw.instanceCount = 1;
|
deferredDraw.instanceCount = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -346,7 +347,7 @@ namespace skyline::soc::gm20b::engine::maxwell3d {
|
|||||||
registers.globalBaseInstanceIndex = globalBaseInstanceIndex;
|
registers.globalBaseInstanceIndex = globalBaseInstanceIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
interconnect.Draw(topology, false, vertexArrayCount, vertexArrayStart, instanceCount, 0, globalBaseInstanceIndex);
|
interconnect.Draw(topology, *registers.streamOutputEnable, false, vertexArrayCount, vertexArrayStart, instanceCount, 0, globalBaseInstanceIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Maxwell3D::DrawIndexedInstanced(bool setRegs, u32 drawTopology, u32 indexBufferCount, u32 instanceCount, u32 globalBaseVertexIndex, u32 indexBufferFirst, u32 globalBaseInstanceIndex) {
|
void Maxwell3D::DrawIndexedInstanced(bool setRegs, u32 drawTopology, u32 indexBufferCount, u32 instanceCount, u32 globalBaseVertexIndex, u32 indexBufferFirst, u32 globalBaseInstanceIndex) {
|
||||||
@ -359,6 +360,6 @@ namespace skyline::soc::gm20b::engine::maxwell3d {
|
|||||||
registers.globalBaseInstanceIndex = globalBaseInstanceIndex;
|
registers.globalBaseInstanceIndex = globalBaseInstanceIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
interconnect.Draw(topology, true, indexBufferCount, indexBufferFirst, instanceCount, globalBaseVertexIndex, globalBaseInstanceIndex);
|
interconnect.Draw(topology, *registers.streamOutputEnable, true, indexBufferCount, indexBufferFirst, instanceCount, globalBaseVertexIndex, globalBaseInstanceIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -119,8 +119,8 @@ namespace skyline::soc::gm20b::engine::maxwell3d {
|
|||||||
Register<0xDF, u32> rasterEnable;
|
Register<0xDF, u32> rasterEnable;
|
||||||
|
|
||||||
Register<0xE0, std::array<type::StreamOutBuffer, type::StreamOutBufferCount>> streamOutBuffers;
|
Register<0xE0, std::array<type::StreamOutBuffer, type::StreamOutBufferCount>> streamOutBuffers;
|
||||||
Register<0x1C0, std::array<type::TransformFeedbackBufferState, type::StreamOutBufferCount>> transformFeedbackBufferStates;
|
Register<0x1C0, std::array<type::StreamOutControl, type::StreamOutBufferCount>> streamOutControls;
|
||||||
Register<0x1D1, u32> streamOutEnable;
|
Register<0x1D1, u32> streamOutputEnable;
|
||||||
|
|
||||||
Register<0x200, std::array<type::ColorTarget, type::ColorTargetCount>> colorTargets;
|
Register<0x200, std::array<type::ColorTarget, type::ColorTargetCount>> colorTargets;
|
||||||
Register<0x280, std::array<type::Viewport, type::ViewportCount>> viewports;
|
Register<0x280, std::array<type::Viewport, type::ViewportCount>> viewports;
|
||||||
@ -354,7 +354,7 @@ namespace skyline::soc::gm20b::engine::maxwell3d {
|
|||||||
|
|
||||||
Register<0x982, type::BindlessTexture> bindlessTexture; //!< The index of the constant buffer containing bindless texture descriptors
|
Register<0x982, type::BindlessTexture> bindlessTexture; //!< The index of the constant buffer containing bindless texture descriptors
|
||||||
|
|
||||||
Register<0xA00, std::array<u32, (type::TransformFeedbackVaryingCount / sizeof(u32)) * type::StreamOutBufferCount>> transformFeedbackVaryings;
|
Register<0xA00, std::array<std::array<u8, type::StreamOutLayoutSelectAttributeCount>, type::StreamOutBufferCount>> streamOutLayoutSelect;
|
||||||
};
|
};
|
||||||
static_assert(sizeof(Registers) == (EngineMethodsEnd * sizeof(u32)));
|
static_assert(sizeof(Registers) == (EngineMethodsEnd * sizeof(u32)));
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
Loading…
Reference in New Issue
Block a user