Tidy up Maxwell 3D regs a bit

This commit is contained in:
Billy Laws 2022-09-10 20:29:47 +01:00
parent 405d26fc22
commit e77e4891dc
8 changed files with 18 additions and 52 deletions

View File

@ -19,19 +19,19 @@ namespace skyline::gpu {
using DescriptorSizes = std::array<vk::DescriptorPoolSize, 5>;
constexpr DescriptorSizes BaseDescriptorSizes{
vk::DescriptorPoolSize{
.descriptorCount = maxwell3d::PipelineStageConstantBufferCount,
.descriptorCount = maxwell3d::ShaderStageConstantBufferCount,
.type = vk::DescriptorType::eUniformBuffer,
},
vk::DescriptorPoolSize{
.descriptorCount = maxwell3d::PipelineStageCount * 5,
.descriptorCount = maxwell3d::ShaderStageCount * 5,
.type = vk::DescriptorType::eStorageBuffer,
},
vk::DescriptorPoolSize{
.descriptorCount = maxwell3d::PipelineStageCount * 5,
.descriptorCount = maxwell3d::ShaderStageCount * 5,
.type = vk::DescriptorType::eCombinedImageSampler,
},
vk::DescriptorPoolSize{
.descriptorCount = maxwell3d::PipelineStageCount,
.descriptorCount = maxwell3d::ShaderStageCount,
.type = vk::DescriptorType::eStorageImage,
},
vk::DescriptorPoolSize{

View File

@ -70,12 +70,12 @@ namespace skyline::gpu::interconnect::maxwell3d {
}
}
void ConstantBuffers::Bind(InterconnectContext &ctx, engine::PipelineStage stage, size_t index) {
void ConstantBuffers::Bind(InterconnectContext &ctx, engine::ShaderStage stage, size_t index) {
auto &view{*selectorState.UpdateGet(ctx).view};
boundConstantBuffers[static_cast<size_t>(stage)][index] = {view};
}
void ConstantBuffers::Unbind(engine::PipelineStage stage, size_t index) {
void ConstantBuffers::Unbind(engine::ShaderStage stage, size_t index) {
boundConstantBuffers[static_cast<size_t>(stage)][index] = {};
}
}

View File

@ -48,7 +48,7 @@ namespace skyline::gpu::interconnect::maxwell3d {
dirty::ManualDirtyState<ConstantBufferSelectorState> selectorState;
public:
std::array<std::array<ConstantBuffer, engine::PipelineStageConstantBufferCount>, engine::PipelineStageCount> boundConstantBuffers;
std::array<std::array<ConstantBuffer, engine::ShaderStageConstantBufferCount>, engine::ShaderStageCount> boundConstantBuffers;
ConstantBuffers(DirtyManager &manager, const ConstantBufferSelectorState::EngineRegisters &constantBufferSelectorRegisters);
@ -56,8 +56,8 @@ namespace skyline::gpu::interconnect::maxwell3d {
void Load(InterconnectContext &ctx, span<u32> data, u32 offset);
void Bind(InterconnectContext &ctx, engine::PipelineStage stage, size_t index);
void Bind(InterconnectContext &ctx, engine::ShaderStage stage, size_t index);
void Unbind(engine::PipelineStage stage, size_t index);
void Unbind(engine::ShaderStage stage, size_t index);
};
}

View File

@ -79,7 +79,7 @@ namespace skyline::gpu::interconnect::maxwell3d {
constantBuffers.Load(ctx, data, offset);
}
void Maxwell3D::BindConstantBuffer(engine::PipelineStage stage, u32 index, bool enable) {
void Maxwell3D::BindConstantBuffer(engine::ShaderStage stage, u32 index, bool enable) {
if (enable)
constantBuffers.Bind(ctx, stage, index);
else

View File

@ -58,7 +58,7 @@ namespace skyline::gpu::interconnect::maxwell3d {
/**
* @brief Binds the constant buffer selector to the given pipeline stage
*/
void BindConstantBuffer(engine::PipelineStage stage, u32 index, bool enable);
void BindConstantBuffer(engine::ShaderStage stage, u32 index, bool enable);
void Clear(engine::ClearSurface &clearSurface);

View File

@ -823,19 +823,18 @@ namespace skyline::soc::gm20b::engine::maxwell3d::type {
};
static_assert(sizeof(SemaphoreInfo) == sizeof(u32));
constexpr static size_t PipelineStageCount{5}; //!< Amount of pipeline stages on Maxwell 3D
constexpr static size_t ShaderStageCount{5}; //!< Amount of pipeline stages on Maxwell 3D
/**
* @brief All the pipeline stages that Maxwell3D supports for draws
*/
enum class PipelineStage {
enum class ShaderStage {
Vertex = 0,
TessellationControl = 1,
TessellationEvaluation = 2,
Geometry = 3,
Fragment = 4,
};
static_assert(static_cast<size_t>(PipelineStage::Fragment) + 1 == PipelineStageCount);
struct ConstantBufferSelector {
u32 size : 17;
@ -864,24 +863,10 @@ namespace skyline::soc::gm20b::engine::maxwell3d::type {
};
static_assert(sizeof(BindlessTexture) == sizeof(u32));
constexpr static size_t PipelineStageConstantBufferCount{18}; //!< Maximum amount of constant buffers that can be bound to a single pipeline stage
constexpr static size_t ShaderStageConstantBufferCount{18}; //!< Maximum amount of constant buffers that can be bound to a single pipeline stage
constexpr static size_t PipelineCount{6}; //!< Amount of shader stages on Maxwell 3D
/**
* @brief All the shader programs stages that Maxwell3D supports for draws
* @note As opposed to pipeline stages, there are two shader programs for the vertex stage
*/
enum class ShaderStage {
VertexA = 0,
VertexB = 1,
TessellationControl = 2,
TessellationEvaluation = 3,
Geometry = 4,
Fragment = 5,
};
static_assert(static_cast<size_t>(ShaderStage::Fragment) + 1 == ShaderStageCount);
/**
* @brief The arguments to set a shader program for a pipeline stage
*/

View File

@ -153,25 +153,6 @@ namespace skyline::soc::gm20b::engine::maxwell3d {
if (!redundant) {
dirtyManager.MarkDirty(method);
switch (method) {
ENGINE_CASE(primitiveRestartEnable, {
interconnect.directState.inputAssembly.SetPrimitiveRestart(primitiveRestartEnable != 0);
})
ENGINE_CASE(tessellationParameters, {
interconnect.directState.tessellation.SetParameters(tessellationParameters);
})
ENGINE_CASE(patchSize, {
interconnect.directState.tessellation.SetPatchControlPoints(patchSize);
})
default:
break;
}
}
switch (method) {
@ -275,11 +256,11 @@ namespace skyline::soc::gm20b::engine::maxwell3d {
#define PIPELINE_CALLBACKS(z, idx, data) \
ENGINE_ARRAY_STRUCT_CASE(bindGroups, idx, constantBuffer, { \
interconnect.BindConstantBuffer(static_cast<type::PipelineStage>(idx), constantBuffer.shaderSlot, constantBuffer.valid); \
interconnect.BindConstantBuffer(static_cast<type::ShaderStage>(idx), constantBuffer.shaderSlot, constantBuffer.valid); \
})
BOOST_PP_REPEAT(5, PIPELINE_CALLBACKS, 0)
static_assert(type::PipelineStageCount == 5 && type::PipelineStageCount < BOOST_PP_LIMIT_REPEAT);
static_assert(type::ShaderStageCount == 5 && type::ShaderStageCount < BOOST_PP_LIMIT_REPEAT);
#undef PIPELINE_CALLBACKS
default:
break;

View File

@ -224,7 +224,7 @@ namespace skyline::soc::gm20b::engine::maxwell3d {
Register<0x544, u32> clipDistanceEnable;
Register<0x545, u32> sampleCounterEnable;
Register<0x546, float> pointSpriteSize;
Register<0x546, float> pointSize;
Register<0x547, u32> zCullStatCountersEnable;
Register<0x548, u32> pointSpriteEnable;
Register<0x54A, u32> shaderExceptions;
@ -357,7 +357,7 @@ namespace skyline::soc::gm20b::engine::maxwell3d {
};
Register<0x8E3, LoadConstantBuffer> loadConstantBuffer;
Register<0x900, std::array<type::BindGroup, type::PipelineStageCount>> bindGroups; //!< Binds constant buffers to pipeline stages
Register<0x900, std::array<type::BindGroup, type::ShaderStageCount>> bindGroups; //!< Binds constant buffers to pipeline stages
Register<0x982, type::BindlessTexture> bindlessTexture; //!< The index of the constant buffer containing bindless texture descriptors