mirror of
https://github.com/KytyPS5/KytyPS5.git
synced 2026-10-28 13:56:59 +01:00
graphics: refactoring #2
This commit is contained in:
@@ -20,15 +20,18 @@ class CommandScheduler {
|
||||
public:
|
||||
static constexpr int BuffersNum = 8;
|
||||
|
||||
CommandScheduler(HW::Context& registers, HW::UserConfig& user_config, HW::Shader& shaders)
|
||||
: m_registers(registers), m_user_config(user_config), m_shaders(shaders) {}
|
||||
|
||||
void SetQueue(int queue) { m_queue = queue; }
|
||||
int Queue() const { return m_queue; }
|
||||
bool Active() const { return m_current >= 0 && m_current < BuffersNum; }
|
||||
void CheckActive() const { EXIT_IF(!Active()); }
|
||||
|
||||
CommandBuffer* Current() const {
|
||||
RenderCommandBuffer& Current() const {
|
||||
CheckActive();
|
||||
EXIT_IF(m_buffers[m_current] == nullptr);
|
||||
return m_buffers[m_current];
|
||||
return *m_buffers[m_current];
|
||||
}
|
||||
|
||||
void Init() {
|
||||
@@ -37,10 +40,10 @@ public:
|
||||
}
|
||||
for (auto& buf: m_buffers) {
|
||||
EXIT_IF(buf != nullptr);
|
||||
buf = new CommandBuffer(m_queue);
|
||||
buf = new RenderCommandBuffer(m_queue, m_registers, m_user_config, m_shaders);
|
||||
}
|
||||
m_current = 0;
|
||||
Current()->Begin();
|
||||
Current().Begin();
|
||||
}
|
||||
|
||||
void Flush() {
|
||||
@@ -48,18 +51,17 @@ public:
|
||||
BeginNext();
|
||||
}
|
||||
|
||||
CommandBuffer* FlushAndGetSubmitted() {
|
||||
auto* submitted = SubmitCurrent();
|
||||
CommandBuffer& FlushAndGetSubmitted() {
|
||||
auto& submitted = SubmitCurrent();
|
||||
BeginNext();
|
||||
return submitted;
|
||||
}
|
||||
|
||||
void CopyBuffers(std::array<CommandBuffer*, BuffersNum>* out) const {
|
||||
EXIT_IF(out == nullptr);
|
||||
void CopyBuffers(std::array<CommandBuffer*, BuffersNum>& out) const {
|
||||
for (int i = 0; i < BuffersNum; i++) {
|
||||
auto* buf = m_buffers[i];
|
||||
EXIT_IF(buf == nullptr);
|
||||
(*out)[i] = buf;
|
||||
out[i] = buf;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,27 +83,30 @@ public:
|
||||
if (!Active()) {
|
||||
return;
|
||||
}
|
||||
Current()->WaitForFenceAndReset();
|
||||
Current()->Begin();
|
||||
Current().WaitForFenceAndReset();
|
||||
Current().Begin();
|
||||
}
|
||||
|
||||
private:
|
||||
CommandBuffer* SubmitCurrent() {
|
||||
auto* submitted = Current();
|
||||
submitted->End();
|
||||
submitted->Execute();
|
||||
CommandBuffer& SubmitCurrent() {
|
||||
auto& submitted = Current();
|
||||
submitted.End();
|
||||
submitted.Execute();
|
||||
return submitted;
|
||||
}
|
||||
|
||||
void BeginNext() {
|
||||
m_current = (m_current + 1) % BuffersNum;
|
||||
Current()->WaitForFenceAndReset();
|
||||
Current()->Begin();
|
||||
Current().WaitForFenceAndReset();
|
||||
Current().Begin();
|
||||
}
|
||||
|
||||
CommandBuffer* m_buffers[BuffersNum] = {};
|
||||
int m_current = -1;
|
||||
int m_queue = -1;
|
||||
RenderCommandBuffer* m_buffers[BuffersNum] = {};
|
||||
int m_current = -1;
|
||||
int m_queue = -1;
|
||||
HW::Context& m_registers;
|
||||
HW::UserConfig& m_user_config;
|
||||
HW::Shader& m_shaders;
|
||||
};
|
||||
|
||||
class CommandProcessor {
|
||||
@@ -113,7 +118,7 @@ public:
|
||||
int64_t flip_arg = 0;
|
||||
};
|
||||
|
||||
CommandProcessor() = default;
|
||||
CommandProcessor(): m_scheduler(m_ctx, m_ucfg, m_sh_ctx) {}
|
||||
~CommandProcessor() { KYTY_NOT_IMPLEMENTED; }
|
||||
|
||||
KYTY_CLASS_NO_COPY(CommandProcessor);
|
||||
@@ -145,9 +150,9 @@ public:
|
||||
void RunLock() { m_run_mutex.Lock(); }
|
||||
void RunUnlock() { m_run_mutex.Unlock(); }
|
||||
|
||||
HW::Context* GetCtx() { return &m_ctx; }
|
||||
HW::UserConfig* GetUcfg() { return &m_ucfg; }
|
||||
HW::Shader* GetShCtx() { return &m_sh_ctx; }
|
||||
HW::Context& GetCtx() { return m_ctx; }
|
||||
HW::UserConfig& GetUcfg() { return m_ucfg; }
|
||||
HW::Shader& GetShCtx() { return m_sh_ctx; }
|
||||
|
||||
void SetIndexType(uint32_t index_type_and_size);
|
||||
void SetIndexBaseAddress(uint64_t index_base_addr);
|
||||
@@ -244,12 +249,9 @@ private:
|
||||
uint32_t interrupt_context_id);
|
||||
void FinishCommandProcessors();
|
||||
|
||||
CommandBuffer* CurrentBuffer() { return m_scheduler.Current(); }
|
||||
void CheckBuffer() const { m_scheduler.CheckActive(); }
|
||||
GpuResourceManager* GetGpuResources() const {
|
||||
EXIT_IF(g_render_ctx == nullptr);
|
||||
return g_render_ctx->GetGpuResources();
|
||||
}
|
||||
RenderCommandBuffer& CurrentBuffer() { return m_scheduler.Current(); }
|
||||
void CheckBuffer() const { m_scheduler.CheckActive(); }
|
||||
GpuResourceManager& GetGpuResources() const { return GetRenderContext().GetGpuResources(); }
|
||||
|
||||
HW::Context m_ctx;
|
||||
HW::UserConfig m_ucfg;
|
||||
|
||||
@@ -10,17 +10,17 @@ namespace Libs::Graphics {
|
||||
|
||||
class CommandProcessor;
|
||||
|
||||
using hw_ctx_parser_func_t = uint32_t (*)(CommandProcessor*, uint32_t, uint32_t, const uint32_t*,
|
||||
using hw_ctx_parser_func_t = uint32_t (*)(CommandProcessor&, uint32_t, uint32_t, const uint32_t*,
|
||||
uint32_t);
|
||||
using hw_uc_parser_func_t = uint32_t (*)(CommandProcessor*, uint32_t, uint32_t, const uint32_t*,
|
||||
using hw_uc_parser_func_t = uint32_t (*)(CommandProcessor&, uint32_t, uint32_t, const uint32_t*,
|
||||
uint32_t);
|
||||
using hw_sh_parser_func_t = uint32_t (*)(CommandProcessor*, uint32_t, uint32_t, const uint32_t*,
|
||||
using hw_sh_parser_func_t = uint32_t (*)(CommandProcessor&, uint32_t, uint32_t, const uint32_t*,
|
||||
uint32_t);
|
||||
using cp_op_parser_func_t = uint32_t (*)(CommandProcessor*, uint32_t, const uint32_t*, uint32_t,
|
||||
using cp_op_parser_func_t = uint32_t (*)(CommandProcessor&, uint32_t, const uint32_t*, uint32_t,
|
||||
uint32_t);
|
||||
using hw_ctx_indirect_func_t = void (*)(CommandProcessor*, uint32_t, uint32_t);
|
||||
using hw_uc_indirect_func_t = void (*)(CommandProcessor*, uint32_t, uint32_t);
|
||||
using hw_sh_indirect_func_t = void (*)(CommandProcessor*, uint32_t, uint32_t);
|
||||
using hw_ctx_indirect_func_t = void (*)(CommandProcessor&, uint32_t, uint32_t);
|
||||
using hw_uc_indirect_func_t = void (*)(CommandProcessor&, uint32_t, uint32_t);
|
||||
using hw_sh_indirect_func_t = void (*)(CommandProcessor&, uint32_t, uint32_t);
|
||||
|
||||
extern const std::array<hw_ctx_parser_func_t, Pm4::CX_NUM> g_hw_ctx_func;
|
||||
extern hw_ctx_indirect_func_t g_hw_ctx_indirect_func[Pm4::CX_NUM];
|
||||
@@ -36,136 +36,136 @@ void GraphicsInitJmpTablesCxIndirect();
|
||||
void GraphicsInitJmpTablesShIndirect();
|
||||
void GraphicsInitJmpTablesUcIndirect();
|
||||
|
||||
uint32_t HwCtxSetRenderControl(CommandProcessor*, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetDepthMetadataRegisters(CommandProcessor*, uint32_t, uint32_t, const uint32_t*,
|
||||
uint32_t HwCtxSetRenderControl(CommandProcessor&, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetDepthMetadataRegisters(CommandProcessor&, uint32_t, uint32_t, const uint32_t*,
|
||||
uint32_t);
|
||||
uint32_t HwCtxSetBorderColorTableAddr(CommandProcessor*, uint32_t, uint32_t, const uint32_t*,
|
||||
uint32_t HwCtxSetBorderColorTableAddr(CommandProcessor&, uint32_t, uint32_t, const uint32_t*,
|
||||
uint32_t);
|
||||
uint32_t HwCtxSetStencilClear(CommandProcessor*, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetDepthClear(CommandProcessor*, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetScreenScissor(CommandProcessor*, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetDepthRenderTarget(CommandProcessor*, uint32_t, uint32_t, const uint32_t*,
|
||||
uint32_t HwCtxSetStencilClear(CommandProcessor&, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetDepthClear(CommandProcessor&, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetScreenScissor(CommandProcessor&, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetDepthRenderTarget(CommandProcessor&, uint32_t, uint32_t, const uint32_t*,
|
||||
uint32_t);
|
||||
uint32_t HwCtxSetStencilInfo(CommandProcessor*, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetDepthHtileSurface(CommandProcessor*, uint32_t, uint32_t, const uint32_t*,
|
||||
uint32_t HwCtxSetStencilInfo(CommandProcessor&, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetDepthHtileSurface(CommandProcessor&, uint32_t, uint32_t, const uint32_t*,
|
||||
uint32_t);
|
||||
uint32_t HwCtxSetHardwareScreenOffset(CommandProcessor*, uint32_t, uint32_t, const uint32_t*,
|
||||
uint32_t HwCtxSetHardwareScreenOffset(CommandProcessor&, uint32_t, uint32_t, const uint32_t*,
|
||||
uint32_t);
|
||||
uint32_t HwCtxSetWindowOffset(CommandProcessor*, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetWindowScissor(CommandProcessor*, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetClipRect(CommandProcessor*, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetRenderTargetMask(CommandProcessor*, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetGenericScissor(CommandProcessor*, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetBlendColor(CommandProcessor*, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetCbDccControl(CommandProcessor*, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetStencilControl(CommandProcessor*, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetStencilMask(CommandProcessor*, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetPsInput(CommandProcessor*, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetSpiTmpringSize(CommandProcessor*, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetDepthControl(CommandProcessor*, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetEqaaControl(CommandProcessor*, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetColorControl(CommandProcessor*, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetDepthBounds(CommandProcessor*, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetPointState(CommandProcessor*, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetClipControl(CommandProcessor*, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetModeControl(CommandProcessor*, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetPolyOffsetRegisters(CommandProcessor*, uint32_t, uint32_t, const uint32_t*,
|
||||
uint32_t HwCtxSetWindowOffset(CommandProcessor&, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetWindowScissor(CommandProcessor&, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetClipRect(CommandProcessor&, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetRenderTargetMask(CommandProcessor&, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetGenericScissor(CommandProcessor&, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetBlendColor(CommandProcessor&, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetCbDccControl(CommandProcessor&, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetStencilControl(CommandProcessor&, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetStencilMask(CommandProcessor&, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetPsInput(CommandProcessor&, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetSpiTmpringSize(CommandProcessor&, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetDepthControl(CommandProcessor&, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetEqaaControl(CommandProcessor&, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetColorControl(CommandProcessor&, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetDepthBounds(CommandProcessor&, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetPointState(CommandProcessor&, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetClipControl(CommandProcessor&, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetModeControl(CommandProcessor&, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetPolyOffsetRegisters(CommandProcessor&, uint32_t, uint32_t, const uint32_t*,
|
||||
uint32_t);
|
||||
uint32_t HwCtxSetViewportTransformControl(CommandProcessor*, uint32_t, uint32_t, const uint32_t*,
|
||||
uint32_t HwCtxSetViewportTransformControl(CommandProcessor&, uint32_t, uint32_t, const uint32_t*,
|
||||
uint32_t);
|
||||
uint32_t HwCtxSetLineControl(CommandProcessor*, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetFovWindow(CommandProcessor*, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetScanModeControl(CommandProcessor*, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetScanModeControl1(CommandProcessor*, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetAaConfig(CommandProcessor*, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetAaSampleControl(CommandProcessor*, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetCentroidPriority(CommandProcessor*, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetAaMask(CommandProcessor*, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetVtxControl(CommandProcessor*, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetPaScExtendedControl(CommandProcessor*, uint32_t, uint32_t, const uint32_t*,
|
||||
uint32_t HwCtxSetLineControl(CommandProcessor&, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetFovWindow(CommandProcessor&, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetScanModeControl(CommandProcessor&, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetScanModeControl1(CommandProcessor&, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetAaConfig(CommandProcessor&, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetAaSampleControl(CommandProcessor&, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetCentroidPriority(CommandProcessor&, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetAaMask(CommandProcessor&, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetVtxControl(CommandProcessor&, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetPaScExtendedControl(CommandProcessor&, uint32_t, uint32_t, const uint32_t*,
|
||||
uint32_t);
|
||||
uint32_t HwCtxSetAlphaToMask(CommandProcessor*, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetDrawPayloadControl(CommandProcessor*, uint32_t, uint32_t, const uint32_t*,
|
||||
uint32_t HwCtxSetAlphaToMask(CommandProcessor&, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetDrawPayloadControl(CommandProcessor&, uint32_t, uint32_t, const uint32_t*,
|
||||
uint32_t);
|
||||
uint32_t HwCtxSetPrimitiveIdReset(CommandProcessor*, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetObjprimIdControl(CommandProcessor*, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetShaderStages(CommandProcessor*, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetGuardBands(CommandProcessor*, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetRenderTarget(CommandProcessor*, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetColorInfo(CommandProcessor*, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetBlendControl(CommandProcessor*, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetViewportScissor(CommandProcessor*, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetViewportZ(CommandProcessor*, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetViewportScaleOffset(CommandProcessor*, uint32_t, uint32_t, const uint32_t*,
|
||||
uint32_t HwCtxSetPrimitiveIdReset(CommandProcessor&, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetObjprimIdControl(CommandProcessor&, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetShaderStages(CommandProcessor&, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetGuardBands(CommandProcessor&, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetRenderTarget(CommandProcessor&, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetColorInfo(CommandProcessor&, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetBlendControl(CommandProcessor&, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetViewportScissor(CommandProcessor&, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetViewportZ(CommandProcessor&, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwCtxSetViewportScaleOffset(CommandProcessor&, uint32_t, uint32_t, const uint32_t*,
|
||||
uint32_t);
|
||||
uint32_t HwShSetPsUserSgpr(CommandProcessor*, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwShSetGsUserSgpr(CommandProcessor*, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwShSetHsUserSgpr(CommandProcessor*, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwShSetCsUserSgpr(CommandProcessor*, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwShSetPsUserAccumSgpr(CommandProcessor*, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwShSetGsUserAccumSgpr(CommandProcessor*, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwShSetHsUserAccumSgpr(CommandProcessor*, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwShSetCsUserAccumSgpr(CommandProcessor*, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwShSetCsRegisters(CommandProcessor*, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwShIgnoreRegisters(CommandProcessor*, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwUcSetPrimitiveType(CommandProcessor*, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwUcSetIndexType(CommandProcessor*, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwUcSetObjectId(CommandProcessor*, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwUcSetTextureGradientFactors(CommandProcessor*, uint32_t, uint32_t, const uint32_t*,
|
||||
uint32_t HwShSetPsUserSgpr(CommandProcessor&, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwShSetGsUserSgpr(CommandProcessor&, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwShSetHsUserSgpr(CommandProcessor&, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwShSetCsUserSgpr(CommandProcessor&, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwShSetPsUserAccumSgpr(CommandProcessor&, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwShSetGsUserAccumSgpr(CommandProcessor&, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwShSetHsUserAccumSgpr(CommandProcessor&, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwShSetCsUserAccumSgpr(CommandProcessor&, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwShSetCsRegisters(CommandProcessor&, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwShIgnoreRegisters(CommandProcessor&, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwUcSetPrimitiveType(CommandProcessor&, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwUcSetIndexType(CommandProcessor&, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwUcSetObjectId(CommandProcessor&, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwUcSetTextureGradientFactors(CommandProcessor&, uint32_t, uint32_t, const uint32_t*,
|
||||
uint32_t);
|
||||
uint32_t HwUcSetIaMultiVgtParam(CommandProcessor*, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwUcSetMultiPrimIbReset(CommandProcessor*, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwUcSetBorderColorTableAddr(CommandProcessor*, uint32_t, uint32_t, const uint32_t*,
|
||||
uint32_t HwUcSetIaMultiVgtParam(CommandProcessor&, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwUcSetMultiPrimIbReset(CommandProcessor&, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwUcSetBorderColorTableAddr(CommandProcessor&, uint32_t, uint32_t, const uint32_t*,
|
||||
uint32_t);
|
||||
uint32_t HwUcSetGeIndexOffset(CommandProcessor*, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwUcSetGdsOaRegisters(CommandProcessor*, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwUcSetGeIndexOffset(CommandProcessor&, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
uint32_t HwUcSetGdsOaRegisters(CommandProcessor&, uint32_t, uint32_t, const uint32_t*, uint32_t);
|
||||
|
||||
uint32_t CpOpNop(CommandProcessor*, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpSetBase(CommandProcessor*, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpClearState(CommandProcessor*, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpIndexBase(CommandProcessor*, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpIndexBufferSize(CommandProcessor*, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpDispatchDirect(CommandProcessor*, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpDispatchIndirect(CommandProcessor*, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpDrawIndirect(CommandProcessor*, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpDrawIndirectMulti(CommandProcessor*, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpDrawIndex(CommandProcessor*, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpDrawIndexOffset(CommandProcessor*, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpPfpSyncMe(CommandProcessor*, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpIndexType(CommandProcessor*, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpNumInstances(CommandProcessor*, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpDrawIndexAuto(CommandProcessor*, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpCondExec(CommandProcessor*, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpSetPredication(CommandProcessor*, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpWriteData(CommandProcessor*, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpIndirectBuffer(CommandProcessor*, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpCopyData(CommandProcessor*, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpEventWrite(CommandProcessor*, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpEventWriteEop(CommandProcessor*, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpEventWriteEos(CommandProcessor*, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpDmaData(CommandProcessor*, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpAcquireMem(CommandProcessor*, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpSetContextReg(CommandProcessor*, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpSetShaderReg(CommandProcessor*, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpSetUconfigReg(CommandProcessor*, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpIndirectCxRegs(CommandProcessor*, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpIndirectShRegs(CommandProcessor*, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpIndirectUcRegs(CommandProcessor*, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpWriteConstRam(CommandProcessor*, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpDumpConstRam(CommandProcessor*, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpIncrementCeCounter(CommandProcessor*, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpIncrementDeCounter(CommandProcessor*, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpWaitOnCeCounter(CommandProcessor*, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpWaitOnDeCounterDiff(CommandProcessor*, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpGetLodStats(CommandProcessor*, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpDispatchReset(CommandProcessor*, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpWaitRegMem32(CommandProcessor*, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpWaitFlipDone(CommandProcessor*, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpPushMarker(CommandProcessor*, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpPopMarker(CommandProcessor*, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpWaitRegMem64(CommandProcessor*, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpFlip(CommandProcessor*, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpReleaseMem(CommandProcessor*, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpNop(CommandProcessor&, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpSetBase(CommandProcessor&, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpClearState(CommandProcessor&, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpIndexBase(CommandProcessor&, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpIndexBufferSize(CommandProcessor&, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpDispatchDirect(CommandProcessor&, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpDispatchIndirect(CommandProcessor&, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpDrawIndirect(CommandProcessor&, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpDrawIndirectMulti(CommandProcessor&, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpDrawIndex(CommandProcessor&, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpDrawIndexOffset(CommandProcessor&, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpPfpSyncMe(CommandProcessor&, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpIndexType(CommandProcessor&, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpNumInstances(CommandProcessor&, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpDrawIndexAuto(CommandProcessor&, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpCondExec(CommandProcessor&, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpSetPredication(CommandProcessor&, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpWriteData(CommandProcessor&, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpIndirectBuffer(CommandProcessor&, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpCopyData(CommandProcessor&, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpEventWrite(CommandProcessor&, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpEventWriteEop(CommandProcessor&, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpEventWriteEos(CommandProcessor&, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpDmaData(CommandProcessor&, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpAcquireMem(CommandProcessor&, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpSetContextReg(CommandProcessor&, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpSetShaderReg(CommandProcessor&, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpSetUconfigReg(CommandProcessor&, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpIndirectCxRegs(CommandProcessor&, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpIndirectShRegs(CommandProcessor&, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpIndirectUcRegs(CommandProcessor&, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpWriteConstRam(CommandProcessor&, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpDumpConstRam(CommandProcessor&, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpIncrementCeCounter(CommandProcessor&, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpIncrementDeCounter(CommandProcessor&, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpWaitOnCeCounter(CommandProcessor&, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpWaitOnDeCounterDiff(CommandProcessor&, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpGetLodStats(CommandProcessor&, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpDispatchReset(CommandProcessor&, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpWaitRegMem32(CommandProcessor&, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpWaitFlipDone(CommandProcessor&, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpPushMarker(CommandProcessor&, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpPopMarker(CommandProcessor&, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpWaitRegMem64(CommandProcessor&, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpFlip(CommandProcessor&, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
uint32_t CpOpReleaseMem(CommandProcessor&, uint32_t, const uint32_t*, uint32_t, uint32_t);
|
||||
|
||||
} // namespace Libs::Graphics
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -122,8 +122,8 @@ public:
|
||||
void WaitForIdle();
|
||||
bool IsIdle();
|
||||
|
||||
void SetCp(CommandProcessor* cp) {
|
||||
m_cp = cp;
|
||||
void SetCp(CommandProcessor& cp) {
|
||||
m_cp = &cp;
|
||||
Start();
|
||||
}
|
||||
|
||||
@@ -171,8 +171,8 @@ public:
|
||||
void WaitForIdle();
|
||||
bool IsIdle();
|
||||
|
||||
void SetCp(CommandProcessor* cp) {
|
||||
m_cp = cp;
|
||||
void SetCp(CommandProcessor& cp) {
|
||||
m_cp = &cp;
|
||||
Start();
|
||||
}
|
||||
|
||||
@@ -382,7 +382,7 @@ void Gpu::Init() {
|
||||
m_gfx_cp = new CommandProcessor;
|
||||
m_gfx_ring = new GraphicsRing;
|
||||
m_gfx_cp->SetQueue(GraphicContext::QUEUE_GFX);
|
||||
m_gfx_ring->SetCp(m_gfx_cp);
|
||||
m_gfx_ring->SetCp(*m_gfx_cp);
|
||||
|
||||
EXIT_IF(GraphicContext::QUEUE_COMPUTE_NUM < 8);
|
||||
}
|
||||
@@ -400,7 +400,7 @@ ComputeRing* Gpu::GetRing(uint32_t ring_id) {
|
||||
if (m_compute_ring[v] == nullptr) {
|
||||
m_compute_ring[v] = new ComputeRing;
|
||||
m_compute_ring[v]->SetQueueId(queue_id);
|
||||
m_compute_ring[v]->SetCp(m_compute_cp[pipe_id]);
|
||||
m_compute_ring[v]->SetCp(*m_compute_cp[pipe_id]);
|
||||
}
|
||||
|
||||
return m_compute_ring[v];
|
||||
@@ -475,14 +475,12 @@ void CommandProcessor::BufferFlush() {
|
||||
}
|
||||
|
||||
void CommandProcessor::BufferFlushAndWait() {
|
||||
CommandBuffer* submitted = nullptr;
|
||||
|
||||
{
|
||||
auto& submitted = [&]() -> CommandBuffer& {
|
||||
Common::LockGuard lock(m_mutex);
|
||||
submitted = m_scheduler.FlushAndGetSubmitted();
|
||||
}
|
||||
return m_scheduler.FlushAndGetSubmitted();
|
||||
}();
|
||||
|
||||
submitted->WaitForFence();
|
||||
submitted.WaitForFence();
|
||||
}
|
||||
|
||||
void CommandProcessor::BufferWait() {
|
||||
@@ -493,7 +491,7 @@ void CommandProcessor::BufferWait() {
|
||||
std::array<CommandBuffer*, CommandScheduler::BuffersNum> buffers {};
|
||||
{
|
||||
Common::LockGuard lock(m_mutex);
|
||||
m_scheduler.CopyBuffers(&buffers);
|
||||
m_scheduler.CopyBuffers(buffers);
|
||||
}
|
||||
|
||||
for (auto* buf: buffers) {
|
||||
@@ -691,14 +689,14 @@ void CommandProcessor::DmaData(uint8_t engine, uint8_t dst_sel, uint8_t dst_cach
|
||||
EXIT("unsupported dmaData destination selector 0x%02" PRIx8 "\n", dst_sel);
|
||||
}
|
||||
if (src_sel == 2) {
|
||||
GetGpuResources()->FillBuffer(
|
||||
GetGpuResources().FillBuffer(
|
||||
CurrentBuffer(), dst_address_or_offset, num_bytes,
|
||||
static_cast<uint32_t>(src_address_or_offset_or_immediate & 0xffffffffu));
|
||||
return;
|
||||
}
|
||||
if (src_memory) {
|
||||
GetGpuResources()->CopyBuffer(CurrentBuffer(), dst_address_or_offset,
|
||||
src_address_or_offset_or_immediate, num_bytes);
|
||||
GetGpuResources().CopyBuffer(CurrentBuffer(), dst_address_or_offset,
|
||||
src_address_or_offset_or_immediate, num_bytes);
|
||||
return;
|
||||
}
|
||||
EXIT("unsupported dmaData source selector 0x%02" PRIx8 "\n", src_sel);
|
||||
@@ -960,11 +958,11 @@ void CommandProcessor::Run(uint32_t* data, uint32_t num_dw) {
|
||||
KYTY_PROFILER_BLOCK("CommandProcessor::Run");
|
||||
|
||||
struct RunScope {
|
||||
explicit RunScope(CommandProcessor* cp): prev(g_current_run_cp) { g_current_run_cp = cp; }
|
||||
explicit RunScope(CommandProcessor& cp): prev(g_current_run_cp) { g_current_run_cp = &cp; }
|
||||
~RunScope() { g_current_run_cp = prev; }
|
||||
|
||||
CommandProcessor* prev;
|
||||
} run_scope(this);
|
||||
} run_scope(*this);
|
||||
|
||||
auto* cmd = data;
|
||||
auto dw = num_dw;
|
||||
@@ -1033,7 +1031,7 @@ void CommandProcessor::Run(uint32_t* data, uint32_t num_dw) {
|
||||
EXIT("unknown op\n\t%05" PRIx32 ":\n\tcmd_id = %08" PRIx32 "\n", num_dw - dw, cmd_id);
|
||||
}
|
||||
|
||||
auto s = pfunc(this, cmd_id & ~1u, cmd, dw, num_dw);
|
||||
auto s = pfunc(*this, cmd_id & ~1u, cmd, dw, num_dw);
|
||||
|
||||
// LOGF("\t %05" PRIx32 ": %u\n", num_dw - dw, s);
|
||||
|
||||
@@ -1142,9 +1140,9 @@ void CommandProcessor::DrawIndex(uint32_t index_count, const void* index_addr, u
|
||||
"\n",
|
||||
vertex_offset_add, first_instance);
|
||||
}
|
||||
RenderDrawIndex(m_submit_id, CurrentBuffer(), &m_ctx, &m_ucfg, &m_sh_ctx, m_index_type_and_size,
|
||||
index_count, index_addr, flags, type, instance_count,
|
||||
render_target_slice_offset, vertex_offset_add, first_instance);
|
||||
RenderDrawIndex(m_submit_id, CurrentBuffer(), m_index_type_and_size, index_count, index_addr,
|
||||
flags, type, instance_count, render_target_slice_offset, vertex_offset_add,
|
||||
first_instance);
|
||||
}
|
||||
|
||||
void CommandProcessor::DrawIndexOffset(uint32_t index_offset, uint32_t index_count,
|
||||
@@ -1164,8 +1162,8 @@ void CommandProcessor::DrawIndexOffset(uint32_t index_offset, uint32_t index_cou
|
||||
auto* index_addr = reinterpret_cast<const void*>(
|
||||
m_index_base_addr + static_cast<uint64_t>(index_offset) * index_size);
|
||||
|
||||
RenderDrawIndex(m_submit_id, CurrentBuffer(), &m_ctx, &m_ucfg, &m_sh_ctx, m_index_type_and_size,
|
||||
index_count, index_addr, flags, 1, m_num_instances);
|
||||
RenderDrawIndex(m_submit_id, CurrentBuffer(), m_index_type_and_size, index_count, index_addr,
|
||||
flags, 1, m_num_instances);
|
||||
}
|
||||
|
||||
void CommandProcessor::DrawIndirect(uint32_t data_offset, uint32_t draw_initiator, bool indexed) {
|
||||
@@ -1393,8 +1391,8 @@ void CommandProcessor::DispatchDirect(uint32_t thread_group_x, uint32_t thread_g
|
||||
}
|
||||
}
|
||||
|
||||
RenderDispatchDirect(m_submit_id, CurrentBuffer(), &m_ctx, &m_sh_ctx, thread_group_x,
|
||||
thread_group_y, thread_group_z, mode);
|
||||
RenderDispatchDirect(m_submit_id, CurrentBuffer(), thread_group_x, thread_group_y,
|
||||
thread_group_z, mode);
|
||||
}
|
||||
|
||||
constexpr uint32_t DispatchInitiatorUseThreadDimensions = 1u << 5u;
|
||||
@@ -1442,9 +1440,8 @@ void CommandProcessor::DrawIndexAuto(uint32_t index_count, uint32_t flags,
|
||||
|
||||
CheckBuffer();
|
||||
|
||||
RenderDrawIndexAuto(m_submit_id, CurrentBuffer(), &m_ctx, &m_ucfg, &m_sh_ctx, index_count,
|
||||
flags, render_target_slice_offset, instance_count, first_vertex,
|
||||
first_instance);
|
||||
RenderDrawIndexAuto(m_submit_id, CurrentBuffer(), index_count, flags,
|
||||
render_target_slice_offset, instance_count, first_vertex, first_instance);
|
||||
}
|
||||
|
||||
void CommandProcessor::WaitFlipDone(uint32_t video_out_handle, uint32_t display_buffer_index) {
|
||||
@@ -1778,7 +1775,7 @@ void CommandProcessor::Flip() {
|
||||
LOGF("CommandProcessor::Flip()\n");
|
||||
}
|
||||
|
||||
auto* command = CurrentBuffer();
|
||||
auto& command = CurrentBuffer();
|
||||
auto request = Sync::PrepareDisplayBufferFlip(command, m_flip.handle, m_flip.index,
|
||||
m_flip.flip_mode, m_flip.flip_arg);
|
||||
Sync::WriteAtEndOfPipeOnlyFlip(m_submit_id, command, m_flip.handle, m_flip.index,
|
||||
@@ -1799,7 +1796,7 @@ void CommandProcessor::Flip(void* dst_gpu_addr, uint32_t value) {
|
||||
}
|
||||
|
||||
std::memcpy(dst_gpu_addr, &value, sizeof(value));
|
||||
auto* command = CurrentBuffer();
|
||||
auto& command = CurrentBuffer();
|
||||
auto request = Sync::PrepareDisplayBufferFlip(command, m_flip.handle, m_flip.index,
|
||||
m_flip.flip_mode, m_flip.flip_arg);
|
||||
Sync::WriteAtEndOfPipeWithFlip32(m_submit_id, command, static_cast<uint32_t*>(dst_gpu_addr),
|
||||
@@ -1827,7 +1824,7 @@ void CommandProcessor::FlipWithInterrupt(uint32_t eop_event_type, uint32_t cache
|
||||
EXIT("unknown event type\n");
|
||||
}
|
||||
std::memcpy(dst_gpu_addr, &value, sizeof(value));
|
||||
auto* command = CurrentBuffer();
|
||||
auto& command = CurrentBuffer();
|
||||
auto request = Sync::PrepareDisplayBufferFlip(command, m_flip.handle, m_flip.index,
|
||||
m_flip.flip_mode, m_flip.flip_arg);
|
||||
Sync::WriteAtEndOfPipeWithInterruptWriteBackFlip32(
|
||||
@@ -1843,10 +1840,10 @@ void CommandProcessor::PrepareCpuFlip() {
|
||||
EXIT("invalid graphics-thread CPU flip preparation\n");
|
||||
}
|
||||
struct RunScope {
|
||||
explicit RunScope(CommandProcessor* cp) { g_current_run_cp = cp; }
|
||||
explicit RunScope(CommandProcessor& cp) { g_current_run_cp = &cp; }
|
||||
~RunScope() { g_current_run_cp = nullptr; }
|
||||
};
|
||||
RunScope run_scope(this);
|
||||
RunScope run_scope(*this);
|
||||
|
||||
auto prepared_id = Presentation::DisplayBufferPrepareNextFlipOnGpu(CurrentBuffer());
|
||||
m_scheduler.Flush();
|
||||
|
||||
@@ -404,33 +404,33 @@ struct TextureBlockLayout {
|
||||
uint32_t block_size;
|
||||
};
|
||||
|
||||
static bool GetTextureBlockLayout(uint32_t format, uint32_t tile, TextureBlockLayout* out) {
|
||||
static bool GetTextureBlockLayout(uint32_t format, uint32_t tile, TextureBlockLayout& out) {
|
||||
uint32_t width_log2 = 0, height_log2 = 0;
|
||||
if (tile == 1 && Gen5Standard256BLayout(format, &out->bytes, &out->texel_width,
|
||||
&out->texel_height, &width_log2, &height_log2)) {
|
||||
out->block_size = 256;
|
||||
} else if (tile == 5 && Gen5Standard4KBLayout(format, &out->bytes, &out->texel_width,
|
||||
&out->texel_height, &width_log2, &height_log2)) {
|
||||
out->block_size = 4096;
|
||||
if (tile == 1 && Gen5Standard256BLayout(format, &out.bytes, &out.texel_width,
|
||||
&out.texel_height, &width_log2, &height_log2)) {
|
||||
out.block_size = 256;
|
||||
} else if (tile == 5 && Gen5Standard4KBLayout(format, &out.bytes, &out.texel_width,
|
||||
&out.texel_height, &width_log2, &height_log2)) {
|
||||
out.block_size = 4096;
|
||||
} else if ((tile == 9 || tile == 17) &&
|
||||
Gen5Standard64KBLayout(format, &out->bytes, &out->texel_width, &out->texel_height,
|
||||
Gen5Standard64KBLayout(format, &out.bytes, &out.texel_width, &out.texel_height,
|
||||
&width_log2, &height_log2)) {
|
||||
out->block_size = 65536;
|
||||
out.block_size = 65536;
|
||||
} else if (tile == 24 || tile == 27) {
|
||||
out->bytes = Prospero::NumBytesPerElement(format);
|
||||
out->texel_width = out->texel_height = 1;
|
||||
if (out->bytes == 0 || (tile == 24 && out->bytes > 8) ||
|
||||
!Gen5Thin64KBBlockSizeFromElementBytes(out->bytes, &out->block_width,
|
||||
&out->block_height)) {
|
||||
out.bytes = Prospero::NumBytesPerElement(format);
|
||||
out.texel_width = out.texel_height = 1;
|
||||
if (out.bytes == 0 || (tile == 24 && out.bytes > 8) ||
|
||||
!Gen5Thin64KBBlockSizeFromElementBytes(out.bytes, &out.block_width,
|
||||
&out.block_height)) {
|
||||
return false;
|
||||
}
|
||||
out->block_size = 65536;
|
||||
out.block_size = 65536;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
out->block_width = 1u << width_log2;
|
||||
out->block_height = 1u << height_log2;
|
||||
out.block_width = 1u << width_log2;
|
||||
out.block_height = 1u << height_log2;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -524,12 +524,12 @@ static void SetMacroMipLayout(const TextureBlockLayout& block, uint32_t tile, ui
|
||||
}
|
||||
|
||||
bool TileGetTextureVolumeLayout(uint32_t format, uint32_t width, uint32_t height, uint32_t depth,
|
||||
uint32_t levels, uint32_t tile, TileVolumeLayout* out) {
|
||||
if (out == nullptr || width == 0 || height == 0 || depth == 0 || levels == 0 || levels > 16) {
|
||||
uint32_t levels, uint32_t tile, TileVolumeLayout& out) {
|
||||
if (width == 0 || height == 0 || depth == 0 || levels == 0 || levels > 16) {
|
||||
return false;
|
||||
}
|
||||
TextureBlockLayout element {};
|
||||
if (!GetTextureBlockLayout(format, tile, &element)) return false;
|
||||
if (!GetTextureBlockLayout(format, tile, element)) return false;
|
||||
|
||||
TileBlockFamily family = TileBlockFamily::Count;
|
||||
switch (tile) {
|
||||
@@ -541,15 +541,15 @@ bool TileGetTextureVolumeLayout(uint32_t format, uint32_t width, uint32_t height
|
||||
default: return false;
|
||||
}
|
||||
TileBlockLayout block {};
|
||||
if (!TileGetBlockLayout(family, element.bytes, &block)) return false;
|
||||
if (!TileGetBlockLayout(family, element.bytes, block)) return false;
|
||||
|
||||
*out = {};
|
||||
out->family = family;
|
||||
out->bytes_per_element = element.bytes;
|
||||
out->texel_width = element.texel_width;
|
||||
out->texel_height = element.texel_height;
|
||||
out->block_depth = block.block_depth;
|
||||
out->first_tail_level = levels;
|
||||
out = {};
|
||||
out.family = family;
|
||||
out.bytes_per_element = element.bytes;
|
||||
out.texel_width = element.texel_width;
|
||||
out.texel_height = element.texel_height;
|
||||
out.block_depth = block.block_depth;
|
||||
out.first_tail_level = levels;
|
||||
const uint32_t width0 = (width + element.texel_width - 1u) / element.texel_width;
|
||||
const uint32_t height0 = (height + element.texel_height - 1u) / element.texel_height;
|
||||
const bool thick4 = family == TileBlockFamily::Standard4KB3D;
|
||||
@@ -568,37 +568,37 @@ bool TileGetTextureVolumeLayout(uint32_t format, uint32_t width, uint32_t height
|
||||
const uint32_t mip_height = std::max(ShiftCeil(height0, level), 1u);
|
||||
if (levels > 1 && mip_width <= tail_width && mip_height <= tail_height &&
|
||||
levels - level <= max_tail) {
|
||||
out->first_tail_level = level;
|
||||
out->block_slice_size += block.block_size;
|
||||
out.first_tail_level = level;
|
||||
out.block_slice_size += block.block_size;
|
||||
break;
|
||||
}
|
||||
out->level_widths[level] = AlignUp(mip_width, block.block_width);
|
||||
out->level_heights[level] = AlignUp(mip_height, block.block_height);
|
||||
out->level_sizes[level] = static_cast<uint64_t>(block.block_depth) *
|
||||
out->level_widths[level] * out->level_heights[level] *
|
||||
out.level_widths[level] = AlignUp(mip_width, block.block_width);
|
||||
out.level_heights[level] = AlignUp(mip_height, block.block_height);
|
||||
out.level_sizes[level] = static_cast<uint64_t>(block.block_depth) *
|
||||
out.level_widths[level] * out.level_heights[level] *
|
||||
element.bytes;
|
||||
out->block_slice_size += out->level_sizes[level];
|
||||
out.block_slice_size += out.level_sizes[level];
|
||||
}
|
||||
|
||||
const auto bytes_log2 = std::countr_zero(element.bytes);
|
||||
for (uint32_t level = out->first_tail_level; level < levels; ++level) {
|
||||
const auto index = level - out->first_tail_level;
|
||||
for (uint32_t level = out.first_tail_level; level < levels; ++level) {
|
||||
const auto index = level - out.first_tail_level;
|
||||
const auto tail = thick4 ? GEN5_MIP_TAIL_LOCATIONS_THICK_4KB[bytes_log2][index]
|
||||
: (thick64 ? GEN5_MIP_TAIL_LOCATIONS_THICK_64KB[bytes_log2][index]
|
||||
: GEN5_MIP_TAIL_LOCATIONS_THIN_64KB[bytes_log2][index]);
|
||||
out->level_sizes[level] = block.block_size;
|
||||
out->level_widths[level] = block.block_width;
|
||||
out->level_heights[level] = block.block_height;
|
||||
out->tail_x[level] = tail.x;
|
||||
out->tail_y[level] = tail.y;
|
||||
out.level_sizes[level] = block.block_size;
|
||||
out.level_widths[level] = block.block_width;
|
||||
out.level_heights[level] = block.block_height;
|
||||
out.tail_x[level] = tail.x;
|
||||
out.tail_y[level] = tail.y;
|
||||
}
|
||||
uint64_t offset = out->first_tail_level < levels ? block.block_size : 0;
|
||||
for (int32_t l = static_cast<int32_t>(out->first_tail_level) - 1; l >= 0; --l) {
|
||||
out->level_offsets[l] = offset;
|
||||
offset += out->level_sizes[l];
|
||||
uint64_t offset = out.first_tail_level < levels ? block.block_size : 0;
|
||||
for (int32_t l = static_cast<int32_t>(out.first_tail_level) - 1; l >= 0; --l) {
|
||||
out.level_offsets[l] = offset;
|
||||
offset += out.level_sizes[l];
|
||||
}
|
||||
out->total_size = out->block_slice_size * ShiftCeil(depth, std::countr_zero(block.block_depth));
|
||||
return offset == out->block_slice_size;
|
||||
out.total_size = out.block_slice_size * ShiftCeil(depth, std::countr_zero(block.block_depth));
|
||||
return offset == out.block_slice_size;
|
||||
}
|
||||
|
||||
static uint32_t Gen5Standard4KBOffsetInBlock(uint32_t x, uint32_t y, uint32_t bytes_per_element) {
|
||||
@@ -1047,8 +1047,8 @@ static constexpr uint32_t Depth64KB64XOffsetBytes(uint32_t x);
|
||||
static constexpr uint32_t Depth64KB64YOffsetBytes(uint32_t y);
|
||||
|
||||
bool TileGetBlockLayout(TileBlockFamily family, uint32_t bytes_per_element,
|
||||
TileBlockLayout* layout) {
|
||||
if (layout == nullptr || !std::has_single_bit(bytes_per_element) || bytes_per_element > 16) {
|
||||
TileBlockLayout& layout) {
|
||||
if (!std::has_single_bit(bytes_per_element) || bytes_per_element > 16) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1121,15 +1121,14 @@ bool TileGetBlockLayout(TileBlockFamily family, uint32_t bytes_per_element,
|
||||
result.block_size) {
|
||||
return false;
|
||||
}
|
||||
*layout = result;
|
||||
layout = result;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TileGetBlockOffset(const TileBlockLayout& layout, uint32_t x, uint32_t y, uint32_t z,
|
||||
uint32_t* byte_offset) {
|
||||
uint32_t& byte_offset) {
|
||||
TileBlockLayout expected {};
|
||||
if (byte_offset == nullptr ||
|
||||
!TileGetBlockLayout(layout.family, layout.bytes_per_element, &expected) ||
|
||||
if (!TileGetBlockLayout(layout.family, layout.bytes_per_element, expected) ||
|
||||
layout.block_size != expected.block_size || layout.block_width != expected.block_width ||
|
||||
layout.block_height != expected.block_height ||
|
||||
layout.block_depth != expected.block_depth || x >= layout.block_width ||
|
||||
@@ -1222,20 +1221,19 @@ bool TileGetBlockOffset(const TileBlockLayout& layout, uint32_t x, uint32_t y, u
|
||||
if (offset >= layout.block_size || offset % layout.bytes_per_element != 0) {
|
||||
return false;
|
||||
}
|
||||
*byte_offset = offset;
|
||||
byte_offset = offset;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TileGetBlockXor(const TileBlockLayout& layout, uint32_t block_x, uint32_t block_y,
|
||||
uint32_t* byte_offset) {
|
||||
uint32_t& byte_offset) {
|
||||
return TileGetBlockXor(layout, block_x, block_y, 0, byte_offset);
|
||||
}
|
||||
|
||||
bool TileGetBlockXor(const TileBlockLayout& layout, uint32_t block_x, uint32_t block_y,
|
||||
uint32_t block_z, uint32_t* byte_offset) {
|
||||
uint32_t block_z, uint32_t& byte_offset) {
|
||||
TileBlockLayout expected {};
|
||||
if (byte_offset == nullptr ||
|
||||
!TileGetBlockLayout(layout.family, layout.bytes_per_element, &expected) ||
|
||||
if (!TileGetBlockLayout(layout.family, layout.bytes_per_element, expected) ||
|
||||
layout.block_size != expected.block_size || layout.block_width != expected.block_width ||
|
||||
layout.block_height != expected.block_height ||
|
||||
layout.block_depth != expected.block_depth) {
|
||||
@@ -1246,8 +1244,8 @@ bool TileGetBlockXor(const TileBlockLayout& layout, uint32_t block_x, uint32_t b
|
||||
block_y > UINT32_MAX / layout.block_height) {
|
||||
return false;
|
||||
}
|
||||
*byte_offset = Depth64KB64XOffsetBytes(block_x * layout.block_width) ^
|
||||
Depth64KB64YOffsetBytes(block_y * layout.block_height);
|
||||
byte_offset = Depth64KB64XOffsetBytes(block_x * layout.block_width) ^
|
||||
Depth64KB64YOffsetBytes(block_y * layout.block_height);
|
||||
} else if (layout.family == TileBlockFamily::RenderTarget64KB) {
|
||||
if (block_x > UINT32_MAX / layout.block_width ||
|
||||
block_y > UINT32_MAX / layout.block_height) {
|
||||
@@ -1256,22 +1254,22 @@ bool TileGetBlockXor(const TileBlockLayout& layout, uint32_t block_x, uint32_t b
|
||||
const auto x = block_x * layout.block_width;
|
||||
const auto y = block_y * layout.block_height;
|
||||
switch (layout.bytes_per_element) {
|
||||
case 1: *byte_offset = Gen5RenderTargetOffsetInBlock<uint8_t>(x, y); break;
|
||||
case 2: *byte_offset = Gen5RenderTargetOffsetInBlock<uint16_t>(x, y); break;
|
||||
case 4: *byte_offset = Gen5RenderTargetOffsetInBlock<uint32_t>(x, y); break;
|
||||
case 8: *byte_offset = Gen5RenderTargetOffsetInBlock<uint64_t>(x, y); break;
|
||||
case 16: *byte_offset = Gen5RenderTargetOffsetInBlock<Uint128>(x, y); break;
|
||||
case 1: byte_offset = Gen5RenderTargetOffsetInBlock<uint8_t>(x, y); break;
|
||||
case 2: byte_offset = Gen5RenderTargetOffsetInBlock<uint16_t>(x, y); break;
|
||||
case 4: byte_offset = Gen5RenderTargetOffsetInBlock<uint32_t>(x, y); break;
|
||||
case 8: byte_offset = Gen5RenderTargetOffsetInBlock<uint64_t>(x, y); break;
|
||||
case 16: byte_offset = Gen5RenderTargetOffsetInBlock<Uint128>(x, y); break;
|
||||
default: return false;
|
||||
}
|
||||
} else {
|
||||
*byte_offset = 0;
|
||||
byte_offset = 0;
|
||||
}
|
||||
if (layout.family == TileBlockFamily::RenderTarget64KB ||
|
||||
layout.family == TileBlockFamily::Depth64KB) {
|
||||
*byte_offset ^= ((block_z & 8u) << 5u) ^ ((block_z & 4u) << 7u) ^ ((block_z & 2u) << 9u) ^
|
||||
((block_z & 1u) << 11u);
|
||||
byte_offset ^= ((block_z & 8u) << 5u) ^ ((block_z & 4u) << 7u) ^ ((block_z & 2u) << 9u) ^
|
||||
((block_z & 1u) << 11u);
|
||||
}
|
||||
return *byte_offset < layout.block_size && *byte_offset % layout.bytes_per_element == 0;
|
||||
return byte_offset < layout.block_size && byte_offset % layout.bytes_per_element == 0;
|
||||
}
|
||||
|
||||
static constexpr uint32_t Depth64KB8XOffsetBytes(uint32_t x) {
|
||||
@@ -1362,8 +1360,8 @@ static_assert(Depth64KB32XOffsetBytes(2) == 0x0010u);
|
||||
static_assert(Depth64KB32YOffsetBytes(1) == 0x0008u);
|
||||
static_assert((Depth64KB32XOffsetBytes(3) ^ Depth64KB32YOffsetBytes(5)) == 0x009cu);
|
||||
|
||||
bool TileGetHtileSize(uint32_t width, uint32_t height, TileSizeAlign* htile_size) {
|
||||
*htile_size = {};
|
||||
bool TileGetHtileSize(uint32_t width, uint32_t height, TileSizeAlign& htile_size) {
|
||||
htile_size = {};
|
||||
if (width == 0 || width > 16384 || height == 0 || height > 16384) {
|
||||
return false;
|
||||
}
|
||||
@@ -1374,13 +1372,13 @@ bool TileGetHtileSize(uint32_t width, uint32_t height, TileSizeAlign* htile_size
|
||||
if (size == 0 || size > UINT32_MAX) {
|
||||
return false;
|
||||
}
|
||||
*htile_size = {static_cast<uint32_t>(size), 32768};
|
||||
htile_size = {static_cast<uint32_t>(size), 32768};
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TileGetDepthSize(uint32_t width, uint32_t height, uint32_t pitch, uint32_t z_format,
|
||||
uint32_t stencil_format, bool htile, TileSizeAlign* stencil_size,
|
||||
TileSizeAlign* htile_size, TileSizeAlign* depth_size,
|
||||
uint32_t stencil_format, bool htile, TileSizeAlign& stencil_size,
|
||||
TileSizeAlign& htile_size, TileSizeAlign& depth_size,
|
||||
uint32_t num_fragments_log2) {
|
||||
EXIT_IF(pitch != 0);
|
||||
// Prospero derives uncompressed depth/stencil as independent 64 KiB block surfaces.
|
||||
@@ -1408,19 +1406,19 @@ bool TileGetDepthSize(uint32_t width, uint32_t height, uint32_t pitch, uint32_t
|
||||
AlignUp(height, stencil_block_height) * fragments
|
||||
: 0;
|
||||
TileSizeAlign calculated_htile {};
|
||||
const bool htile_valid = !htile || TileGetHtileSize(width, height, &calculated_htile);
|
||||
const bool htile_valid = !htile || TileGetHtileSize(width, height, calculated_htile);
|
||||
if (depth_bytes_total <= UINT32_MAX && stencil_bytes_total <= UINT32_MAX && htile_valid) {
|
||||
*depth_size = {static_cast<uint32_t>(depth_bytes_total), 65536};
|
||||
*stencil_size = stencil_format == 1
|
||||
depth_size = {static_cast<uint32_t>(depth_bytes_total), 65536};
|
||||
stencil_size = stencil_format == 1
|
||||
? TileSizeAlign {static_cast<uint32_t>(stencil_bytes_total), 65536}
|
||||
: TileSizeAlign {};
|
||||
*htile_size = calculated_htile;
|
||||
htile_size = calculated_htile;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
*depth_size = TileSizeAlign();
|
||||
*htile_size = TileSizeAlign();
|
||||
*stencil_size = TileSizeAlign();
|
||||
depth_size = TileSizeAlign();
|
||||
htile_size = TileSizeAlign();
|
||||
stencil_size = TileSizeAlign();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1443,9 +1441,9 @@ uint32_t TileGetDepthPitch(uint32_t width, uint32_t bytes_per_element,
|
||||
}
|
||||
|
||||
bool TileGetRenderTargetSize(uint32_t width, uint32_t height, uint32_t pitch,
|
||||
uint32_t bytes_per_element, TileSizeAlign* total_size,
|
||||
uint32_t bytes_per_element, TileSizeAlign& total_size,
|
||||
uint32_t num_fragments_log2) {
|
||||
*total_size = {};
|
||||
total_size = {};
|
||||
uint32_t block_width = 0;
|
||||
uint32_t block_height = 0;
|
||||
if (height == 0 || pitch == 0 ||
|
||||
@@ -1461,16 +1459,16 @@ bool TileGetRenderTargetSize(uint32_t width, uint32_t height, uint32_t pitch,
|
||||
if (size == 0 || size > UINT32_MAX) {
|
||||
return false;
|
||||
}
|
||||
total_size->size = static_cast<uint32_t>(size);
|
||||
total_size->align = 65536;
|
||||
total_size.size = static_cast<uint32_t>(size);
|
||||
total_size.align = 65536;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TileGetRenderTargetMipLayout(uint32_t width, uint32_t height, uint32_t pitch,
|
||||
uint32_t bytes_per_element, uint32_t levels,
|
||||
TileSizeAlign* total_size, TileSizeOffset* level_sizes,
|
||||
TileSizeAlign& total_size, TileSizeOffset* level_sizes,
|
||||
TilePaddedSize* padded_size) {
|
||||
*total_size = {};
|
||||
total_size = {};
|
||||
if (width == 0 || height == 0 || levels == 0 || levels > 16 ||
|
||||
pitch != TileGetRenderTargetPitch(width, bytes_per_element)) {
|
||||
return false;
|
||||
@@ -1494,9 +1492,9 @@ bool TileGetRenderTargetMipLayout(uint32_t width, uint32_t height, uint32_t pitc
|
||||
default: return false;
|
||||
}
|
||||
TileGetTextureSize(format, width, height, pitch, levels,
|
||||
Prospero::GpuEnumValue(Prospero::TileMode::kRenderTarget), total_size,
|
||||
Prospero::GpuEnumValue(Prospero::TileMode::kRenderTarget), &total_size,
|
||||
level_sizes, padded_size);
|
||||
return total_size->size != 0 && total_size->align == 65536;
|
||||
return total_size.size != 0 && total_size.align == 65536;
|
||||
}
|
||||
|
||||
void TileGetTextureSize(uint32_t format, uint32_t width, uint32_t height, uint32_t pitch,
|
||||
@@ -1529,7 +1527,7 @@ void TileGetTextureSize(uint32_t format, uint32_t width, uint32_t height, uint32
|
||||
}
|
||||
|
||||
TextureBlockLayout block {};
|
||||
if (GetTextureBlockLayout(format, tile, &block)) {
|
||||
if (GetTextureBlockLayout(format, tile, block)) {
|
||||
if (tile == 1) {
|
||||
SetMicroMipLayout(block, width, height, levels, total_size, level_sizes, padded_size);
|
||||
} else {
|
||||
@@ -1580,24 +1578,24 @@ void TileGetTextureSize(uint32_t format, uint32_t width, uint32_t height, uint32
|
||||
|
||||
void TileGetTextureTotalSize(uint32_t format, uint32_t width, uint32_t height, uint32_t depth,
|
||||
uint32_t pitch, uint32_t levels, uint32_t tile, bool volume_texture,
|
||||
TileSizeAlign* total_size) {
|
||||
TileSizeAlign& total_size) {
|
||||
EXIT_NOT_IMPLEMENTED(depth == 0);
|
||||
if (volume_texture) {
|
||||
TileVolumeLayout volume {};
|
||||
if (TileGetTextureVolumeLayout(format, width, height, depth, levels, tile, &volume)) {
|
||||
if (TileGetTextureVolumeLayout(format, width, height, depth, levels, tile, volume)) {
|
||||
EXIT_NOT_IMPLEMENTED(volume.total_size > UINT32_MAX);
|
||||
total_size->size = static_cast<uint32_t>(volume.total_size);
|
||||
total_size->align = tile == 5 ? 4096u : 65536u;
|
||||
total_size.size = static_cast<uint32_t>(volume.total_size);
|
||||
total_size.align = tile == 5 ? 4096u : 65536u;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
TileSizeAlign slice_size {};
|
||||
TileGetTextureSize(format, width, height, pitch, levels, tile, &slice_size, nullptr, nullptr);
|
||||
*total_size = slice_size;
|
||||
total_size = slice_size;
|
||||
const uint64_t total = static_cast<uint64_t>(slice_size.size) * depth;
|
||||
EXIT_NOT_IMPLEMENTED(total > 0xffffffffull);
|
||||
total_size->size = static_cast<uint32_t>(total);
|
||||
total_size.size = static_cast<uint32_t>(total);
|
||||
}
|
||||
|
||||
uint32_t TileGetTexturePitch(uint32_t format, uint32_t width, uint32_t levels, uint32_t tile) {
|
||||
|
||||
@@ -65,41 +65,41 @@ struct TileVolumeLayout {
|
||||
};
|
||||
|
||||
bool TileGetBlockLayout(TileBlockFamily family, uint32_t bytes_per_element,
|
||||
TileBlockLayout* layout);
|
||||
TileBlockLayout& layout);
|
||||
bool TileGetBlockOffset(const TileBlockLayout& layout, uint32_t x, uint32_t y, uint32_t z,
|
||||
uint32_t* byte_offset);
|
||||
uint32_t& byte_offset);
|
||||
bool TileGetBlockXor(const TileBlockLayout& layout, uint32_t block_x, uint32_t block_y,
|
||||
uint32_t* byte_offset);
|
||||
uint32_t& byte_offset);
|
||||
bool TileGetBlockXor(const TileBlockLayout& layout, uint32_t block_x, uint32_t block_y,
|
||||
uint32_t block_z, uint32_t* byte_offset);
|
||||
uint32_t block_z, uint32_t& byte_offset);
|
||||
bool TileIsStandard256BTextureSupported(uint32_t format);
|
||||
bool TileIsStandard4KBTextureSupported(uint32_t format);
|
||||
bool TileIsStandard64KBTextureSupported(uint32_t format);
|
||||
bool TileGetTextureVolumeLayout(uint32_t format, uint32_t width, uint32_t height, uint32_t depth,
|
||||
uint32_t levels, uint32_t tile, TileVolumeLayout* layout);
|
||||
uint32_t levels, uint32_t tile, TileVolumeLayout& layout);
|
||||
|
||||
bool TileGetHtileSize(uint32_t width, uint32_t height, TileSizeAlign* htile_size);
|
||||
bool TileGetHtileSize(uint32_t width, uint32_t height, TileSizeAlign& htile_size);
|
||||
bool TileGetDepthSize(uint32_t width, uint32_t height, uint32_t pitch, uint32_t z_format,
|
||||
uint32_t stencil_format, bool htile, TileSizeAlign* stencil_size,
|
||||
TileSizeAlign* htile_size, TileSizeAlign* depth_size,
|
||||
uint32_t stencil_format, bool htile, TileSizeAlign& stencil_size,
|
||||
TileSizeAlign& htile_size, TileSizeAlign& depth_size,
|
||||
uint32_t num_fragments_log2 = 0);
|
||||
uint32_t TileGetRenderTargetPitch(uint32_t width, uint32_t bytes_per_element,
|
||||
uint32_t num_fragments_log2 = 0);
|
||||
uint32_t TileGetDepthPitch(uint32_t width, uint32_t bytes_per_element,
|
||||
uint32_t num_fragments_log2 = 0);
|
||||
bool TileGetRenderTargetSize(uint32_t width, uint32_t height, uint32_t pitch,
|
||||
uint32_t bytes_per_element, TileSizeAlign* total_size,
|
||||
uint32_t bytes_per_element, TileSizeAlign& total_size,
|
||||
uint32_t num_fragments_log2 = 0);
|
||||
bool TileGetRenderTargetMipLayout(uint32_t width, uint32_t height, uint32_t pitch,
|
||||
uint32_t bytes_per_element, uint32_t levels,
|
||||
TileSizeAlign* total_size, TileSizeOffset* level_sizes,
|
||||
uint32_t bytes_per_element, uint32_t levels,
|
||||
TileSizeAlign& total_size, TileSizeOffset* level_sizes,
|
||||
TilePaddedSize* padded_size);
|
||||
void TileGetTextureSize(uint32_t format, uint32_t width, uint32_t height, uint32_t pitch,
|
||||
uint32_t levels, uint32_t tile, TileSizeAlign* total_size,
|
||||
TileSizeOffset* level_sizes, TilePaddedSize* padded_size);
|
||||
void TileGetTextureTotalSize(uint32_t format, uint32_t width, uint32_t height, uint32_t depth,
|
||||
uint32_t pitch, uint32_t levels, uint32_t tile, bool volume_texture,
|
||||
TileSizeAlign* total_size);
|
||||
TileSizeAlign& total_size);
|
||||
uint32_t TileGetTexturePitch(uint32_t format, uint32_t width, uint32_t levels, uint32_t tile);
|
||||
|
||||
} // namespace Libs::Graphics
|
||||
|
||||
Reference in New Issue
Block a user