mirror of
https://github.com/skyline-emu/skyline.git
synced 2025-01-17 10:47:55 +03:00
Tidy up Maxwell 3D regs a bit
This commit is contained in:
parent
405d26fc22
commit
e77e4891dc
@ -19,19 +19,19 @@ namespace skyline::gpu {
|
|||||||
using DescriptorSizes = std::array<vk::DescriptorPoolSize, 5>;
|
using DescriptorSizes = std::array<vk::DescriptorPoolSize, 5>;
|
||||||
constexpr DescriptorSizes BaseDescriptorSizes{
|
constexpr DescriptorSizes BaseDescriptorSizes{
|
||||||
vk::DescriptorPoolSize{
|
vk::DescriptorPoolSize{
|
||||||
.descriptorCount = maxwell3d::PipelineStageConstantBufferCount,
|
.descriptorCount = maxwell3d::ShaderStageConstantBufferCount,
|
||||||
.type = vk::DescriptorType::eUniformBuffer,
|
.type = vk::DescriptorType::eUniformBuffer,
|
||||||
},
|
},
|
||||||
vk::DescriptorPoolSize{
|
vk::DescriptorPoolSize{
|
||||||
.descriptorCount = maxwell3d::PipelineStageCount * 5,
|
.descriptorCount = maxwell3d::ShaderStageCount * 5,
|
||||||
.type = vk::DescriptorType::eStorageBuffer,
|
.type = vk::DescriptorType::eStorageBuffer,
|
||||||
},
|
},
|
||||||
vk::DescriptorPoolSize{
|
vk::DescriptorPoolSize{
|
||||||
.descriptorCount = maxwell3d::PipelineStageCount * 5,
|
.descriptorCount = maxwell3d::ShaderStageCount * 5,
|
||||||
.type = vk::DescriptorType::eCombinedImageSampler,
|
.type = vk::DescriptorType::eCombinedImageSampler,
|
||||||
},
|
},
|
||||||
vk::DescriptorPoolSize{
|
vk::DescriptorPoolSize{
|
||||||
.descriptorCount = maxwell3d::PipelineStageCount,
|
.descriptorCount = maxwell3d::ShaderStageCount,
|
||||||
.type = vk::DescriptorType::eStorageImage,
|
.type = vk::DescriptorType::eStorageImage,
|
||||||
},
|
},
|
||||||
vk::DescriptorPoolSize{
|
vk::DescriptorPoolSize{
|
||||||
|
@ -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};
|
auto &view{*selectorState.UpdateGet(ctx).view};
|
||||||
boundConstantBuffers[static_cast<size_t>(stage)][index] = {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] = {};
|
boundConstantBuffers[static_cast<size_t>(stage)][index] = {};
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -48,7 +48,7 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
|||||||
dirty::ManualDirtyState<ConstantBufferSelectorState> selectorState;
|
dirty::ManualDirtyState<ConstantBufferSelectorState> selectorState;
|
||||||
|
|
||||||
public:
|
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);
|
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 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);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,7 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
|||||||
constantBuffers.Load(ctx, data, offset);
|
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)
|
if (enable)
|
||||||
constantBuffers.Bind(ctx, stage, index);
|
constantBuffers.Bind(ctx, stage, index);
|
||||||
else
|
else
|
||||||
|
@ -58,7 +58,7 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
|||||||
/**
|
/**
|
||||||
* @brief Binds the constant buffer selector to the given pipeline stage
|
* @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);
|
void Clear(engine::ClearSurface &clearSurface);
|
||||||
|
|
||||||
|
@ -823,19 +823,18 @@ namespace skyline::soc::gm20b::engine::maxwell3d::type {
|
|||||||
};
|
};
|
||||||
static_assert(sizeof(SemaphoreInfo) == sizeof(u32));
|
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
|
* @brief All the pipeline stages that Maxwell3D supports for draws
|
||||||
*/
|
*/
|
||||||
enum class PipelineStage {
|
enum class ShaderStage {
|
||||||
Vertex = 0,
|
Vertex = 0,
|
||||||
TessellationControl = 1,
|
TessellationControl = 1,
|
||||||
TessellationEvaluation = 2,
|
TessellationEvaluation = 2,
|
||||||
Geometry = 3,
|
Geometry = 3,
|
||||||
Fragment = 4,
|
Fragment = 4,
|
||||||
};
|
};
|
||||||
static_assert(static_cast<size_t>(PipelineStage::Fragment) + 1 == PipelineStageCount);
|
|
||||||
|
|
||||||
struct ConstantBufferSelector {
|
struct ConstantBufferSelector {
|
||||||
u32 size : 17;
|
u32 size : 17;
|
||||||
@ -864,24 +863,10 @@ namespace skyline::soc::gm20b::engine::maxwell3d::type {
|
|||||||
};
|
};
|
||||||
static_assert(sizeof(BindlessTexture) == sizeof(u32));
|
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
|
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
|
* @brief The arguments to set a shader program for a pipeline stage
|
||||||
*/
|
*/
|
||||||
|
@ -153,25 +153,6 @@ namespace skyline::soc::gm20b::engine::maxwell3d {
|
|||||||
|
|
||||||
if (!redundant) {
|
if (!redundant) {
|
||||||
dirtyManager.MarkDirty(method);
|
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) {
|
switch (method) {
|
||||||
@ -275,11 +256,11 @@ namespace skyline::soc::gm20b::engine::maxwell3d {
|
|||||||
|
|
||||||
#define PIPELINE_CALLBACKS(z, idx, data) \
|
#define PIPELINE_CALLBACKS(z, idx, data) \
|
||||||
ENGINE_ARRAY_STRUCT_CASE(bindGroups, idx, constantBuffer, { \
|
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)
|
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
|
#undef PIPELINE_CALLBACKS
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -224,7 +224,7 @@ namespace skyline::soc::gm20b::engine::maxwell3d {
|
|||||||
|
|
||||||
Register<0x544, u32> clipDistanceEnable;
|
Register<0x544, u32> clipDistanceEnable;
|
||||||
Register<0x545, u32> sampleCounterEnable;
|
Register<0x545, u32> sampleCounterEnable;
|
||||||
Register<0x546, float> pointSpriteSize;
|
Register<0x546, float> pointSize;
|
||||||
Register<0x547, u32> zCullStatCountersEnable;
|
Register<0x547, u32> zCullStatCountersEnable;
|
||||||
Register<0x548, u32> pointSpriteEnable;
|
Register<0x548, u32> pointSpriteEnable;
|
||||||
Register<0x54A, u32> shaderExceptions;
|
Register<0x54A, u32> shaderExceptions;
|
||||||
@ -357,7 +357,7 @@ namespace skyline::soc::gm20b::engine::maxwell3d {
|
|||||||
};
|
};
|
||||||
Register<0x8E3, LoadConstantBuffer> loadConstantBuffer;
|
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
|
Register<0x982, type::BindlessTexture> bindlessTexture; //!< The index of the constant buffer containing bindless texture descriptors
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user