Reorder GraphicsContext Members

All members are now placed at the start of sections they are relevant to rather than  at the start of the class.
This commit is contained in:
PixelyIon 2021-11-12 01:03:27 +05:30
parent 107d337d77
commit 8803616673

View File

@ -23,6 +23,13 @@ namespace skyline::gpu::interconnect {
soc::gm20b::ChannelContext &channelCtx; soc::gm20b::ChannelContext &channelCtx;
gpu::interconnect::CommandExecutor &executor; gpu::interconnect::CommandExecutor &executor;
public:
GraphicsContext(GPU &gpu, soc::gm20b::ChannelContext &channelCtx, gpu::interconnect::CommandExecutor &executor) : gpu(gpu), channelCtx(channelCtx), executor(executor) {
scissors.fill(DefaultScissor);
}
/* Render Targets + Render Target Control */
private:
struct RenderTarget { struct RenderTarget {
bool disabled{true}; //!< If this RT has been disabled and will be an unbound attachment instead bool disabled{true}; //!< If this RT has been disabled and will be an unbound attachment instead
union { union {
@ -43,22 +50,8 @@ namespace skyline::gpu::interconnect {
std::array<RenderTarget, maxwell3d::RenderTargetCount> renderTargets{}; //!< The target textures to render into as color attachments std::array<RenderTarget, maxwell3d::RenderTargetCount> renderTargets{}; //!< The target textures to render into as color attachments
maxwell3d::RenderTargetControl renderTargetControl{}; maxwell3d::RenderTargetControl renderTargetControl{};
std::array<vk::Viewport, maxwell3d::ViewportCount> viewports;
vk::ClearColorValue clearColorValue{}; //!< The value written to a color buffer being cleared
std::array<vk::Rect2D, maxwell3d::ViewportCount> scissors; //!< The scissors applied to viewports/render targets for masking writes during draws or clears
constexpr static vk::Rect2D DefaultScissor{
.extent.height = std::numeric_limits<i32>::max(),
.extent.width = std::numeric_limits<i32>::max(),
}; //!< A scissor which displays the entire viewport, utilized when the viewport scissor is disabled
public: public:
GraphicsContext(GPU &gpu, soc::gm20b::ChannelContext &channelCtx, gpu::interconnect::CommandExecutor &executor) : gpu(gpu), channelCtx(channelCtx), executor(executor) {
scissors.fill(DefaultScissor);
}
/* Render Targets + Render Target Control */
void SetRenderTargetAddressHigh(size_t index, u32 high) { void SetRenderTargetAddressHigh(size_t index, u32 high) {
auto &renderTarget{renderTargets.at(index)}; auto &renderTarget{renderTargets.at(index)};
renderTarget.gpuAddressHigh = high; renderTarget.gpuAddressHigh = high;
@ -227,7 +220,10 @@ namespace skyline::gpu::interconnect {
} }
/* Viewport Transforms */ /* Viewport Transforms */
private:
std::array<vk::Viewport, maxwell3d::ViewportCount> viewports;
public:
/** /**
* @url https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#vertexpostproc-viewport * @url https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#vertexpostproc-viewport
* @note Comments are written in the way of getting the same viewport transformations to be done on the host rather than deriving the host structure values from the guest submitted values, fundamentally the same thing but it is consistent with not assuming a certain guest API * @note Comments are written in the way of getting the same viewport transformations to be done on the host rather than deriving the host structure values from the guest submitted values, fundamentally the same thing but it is consistent with not assuming a certain guest API
@ -251,7 +247,10 @@ namespace skyline::gpu::interconnect {
} }
/* Buffer Clears */ /* Buffer Clears */
private:
vk::ClearColorValue clearColorValue{}; //!< The value written to a color buffer being cleared
public:
void UpdateClearColorValue(size_t index, u32 value) { void UpdateClearColorValue(size_t index, u32 value) {
clearColorValue.uint32.at(index) = value; clearColorValue.uint32.at(index) = value;
} }
@ -305,7 +304,14 @@ namespace skyline::gpu::interconnect {
} }
/* Viewport Scissors */ /* Viewport Scissors */
private:
std::array<vk::Rect2D, maxwell3d::ViewportCount> scissors; //!< The scissors applied to viewports/render targets for masking writes during draws or clears
constexpr static vk::Rect2D DefaultScissor{
.extent.height = std::numeric_limits<i32>::max(),
.extent.width = std::numeric_limits<i32>::max(),
}; //!< A scissor which displays the entire viewport, utilized when the viewport scissor is disabled
public:
void SetScissor(size_t index, std::optional<maxwell3d::Scissor> scissor) { void SetScissor(size_t index, std::optional<maxwell3d::Scissor> scissor) {
scissors.at(index) = scissor ? vk::Rect2D{ scissors.at(index) = scissor ? vk::Rect2D{
.offset.x = scissor->horizontal.minimum, .offset.x = scissor->horizontal.minimum,