mirror of
https://github.com/InoriRus/Kyty.git
synced 2026-08-28 05:06:40 +00:00
add stencil support
This commit is contained in:
@@ -12,6 +12,8 @@
|
||||
|
||||
namespace Kyty::Libs::Graphics {
|
||||
|
||||
class CommandBuffer;
|
||||
|
||||
struct VulkanSwapchain
|
||||
{
|
||||
VkSwapchainKHR swapchain = nullptr;
|
||||
@@ -102,6 +104,11 @@ struct VulkanBuffer
|
||||
VkBufferUsageFlags usage = 0;
|
||||
};
|
||||
|
||||
struct StorageVulkanBuffer: public VulkanBuffer
|
||||
{
|
||||
CommandBuffer* cmd_buffer = nullptr;
|
||||
};
|
||||
|
||||
} // namespace Kyty::Libs::Graphics
|
||||
|
||||
#endif // KYTY_EMU_ENABLED
|
||||
|
||||
@@ -36,16 +36,16 @@ public:
|
||||
|
||||
[[nodiscard]] bool IsInvalid() const;
|
||||
|
||||
void Allocate();
|
||||
void Free();
|
||||
void Begin() const;
|
||||
void End() const;
|
||||
void Execute();
|
||||
void ExecuteWithSemaphore();
|
||||
VulkanFramebuffer* BeginRenderPass(RenderColorInfo* color, RenderDepthInfo* depth) const;
|
||||
void EndRenderPass() const;
|
||||
void WaitForFence();
|
||||
void WaitForFenceAndReset();
|
||||
void Allocate();
|
||||
void Free();
|
||||
void Begin() const;
|
||||
void End() const;
|
||||
void Execute();
|
||||
void ExecuteWithSemaphore();
|
||||
void BeginRenderPass(VulkanFramebuffer* framebuffer, RenderColorInfo* color, RenderDepthInfo* depth) const;
|
||||
void EndRenderPass() const;
|
||||
void WaitForFence();
|
||||
void WaitForFenceAndReset();
|
||||
|
||||
[[nodiscard]] uint32_t GetIndex() const { return m_index; }
|
||||
VulkanCommandPool* GetPool() { return m_pool; }
|
||||
@@ -85,6 +85,7 @@ void GraphicsRenderDispatchDirect(CommandBuffer* buffer, HardwareContext* ctx, u
|
||||
uint32_t thread_group_z, uint32_t mode);
|
||||
void GraphicsRenderMemoryBarrier(CommandBuffer* buffer);
|
||||
void GraphicsRenderRenderTextureBarrier(CommandBuffer* buffer, uint64_t vaddr, uint64_t size);
|
||||
void GraphicsRenderMemoryFree(uint64_t vaddr, uint64_t size);
|
||||
|
||||
void DeleteFramebuffer(VideoOutVulkanImage* image);
|
||||
void DeleteFramebuffer(DepthStencilVulkanImage* image);
|
||||
|
||||
@@ -9,24 +9,31 @@
|
||||
|
||||
namespace Kyty::Libs::Graphics {
|
||||
|
||||
struct ColorInfo
|
||||
{
|
||||
bool fmask_compression_enable = false;
|
||||
uint32_t fmask_compression_mode = 0;
|
||||
bool cmask_fast_clear_enable = false;
|
||||
bool dcc_compression_enable = false;
|
||||
bool neo_mode = false;
|
||||
uint32_t cmask_tile_mode = 0;
|
||||
uint32_t cmask_tile_mode_neo = 0;
|
||||
uint32_t format = 0;
|
||||
uint32_t channel_type = 0;
|
||||
uint32_t channel_order = 0;
|
||||
};
|
||||
|
||||
struct RenderTarget
|
||||
{
|
||||
uint64_t base_addr = 0;
|
||||
uint32_t pitch_div8_minus1 = 0;
|
||||
uint32_t fmask_pitch_div8_minus1 = 0;
|
||||
uint32_t slice_div64_minus1 = 0;
|
||||
uint32_t base_array_slice_index = 0;
|
||||
uint32_t last_array_slice_index = 0;
|
||||
bool fmask_compression_enable = false;
|
||||
uint32_t fmask_compression_mode = 0;
|
||||
bool cmask_fast_clear_enable = false;
|
||||
bool dcc_compression_enable = false;
|
||||
bool neo_mode = false;
|
||||
uint32_t cmask_tile_mode = 0;
|
||||
uint32_t cmask_tile_mode_neo = 0;
|
||||
uint32_t format = 0;
|
||||
uint32_t channel_type = 0;
|
||||
uint32_t channel_order = 0;
|
||||
uint64_t base_addr = 0;
|
||||
uint32_t pitch_div8_minus1 = 0;
|
||||
uint32_t fmask_pitch_div8_minus1 = 0;
|
||||
uint32_t slice_div64_minus1 = 0;
|
||||
uint32_t base_array_slice_index = 0;
|
||||
uint32_t last_array_slice_index = 0;
|
||||
|
||||
ColorInfo color_info;
|
||||
|
||||
bool force_dest_alpha_to_one = false;
|
||||
uint32_t tile_mode = 0;
|
||||
uint32_t fmask_tile_mode = 0;
|
||||
@@ -155,6 +162,28 @@ struct DepthControl
|
||||
uint8_t stencilfunc_bf = 0;
|
||||
};
|
||||
|
||||
struct StencilControl
|
||||
{
|
||||
uint8_t stencil_fail = 0;
|
||||
uint8_t stencil_zpass = 0;
|
||||
uint8_t stencil_zfail = 0;
|
||||
uint8_t stencil_fail_bf = 0;
|
||||
uint8_t stencil_zpass_bf = 0;
|
||||
uint8_t stencil_zfail_bf = 0;
|
||||
};
|
||||
|
||||
struct StencilMask
|
||||
{
|
||||
uint8_t stencil_testval = 0;
|
||||
uint8_t stencil_mask = 0;
|
||||
uint8_t stencil_writemask = 0;
|
||||
uint8_t stencil_opval = 0;
|
||||
uint8_t stencil_testval_bf = 0;
|
||||
uint8_t stencil_mask_bf = 0;
|
||||
uint8_t stencil_writemask_bf = 0;
|
||||
uint8_t stencil_opval_bf = 0;
|
||||
};
|
||||
|
||||
struct ModeControl
|
||||
{
|
||||
bool cull_front = false;
|
||||
@@ -343,7 +372,8 @@ public:
|
||||
|
||||
void Reset() { *this = HardwareContext(); }
|
||||
|
||||
void SetRenderTarget(uint32_t slot, const RenderTarget& target) { m_render_targets[slot] = target; }
|
||||
void SetRenderTarget(uint32_t slot, const RenderTarget& target) { m_render_targets[slot] = target; }
|
||||
void SetColorInfo(uint32_t slot, const ColorInfo& color_info) { m_render_targets[slot].color_info = color_info; }
|
||||
[[nodiscard]] const RenderTarget& GetRenderTargets(uint32_t slot) const { return m_render_targets[slot]; }
|
||||
|
||||
void SetBlendControl(uint32_t slot, const BlendControl& control) { m_blend_control[slot] = control; }
|
||||
@@ -411,7 +441,16 @@ public:
|
||||
m_vs.vs_embedded = true;
|
||||
}
|
||||
|
||||
void SetPsShader(const PsStageRegisters* ps_regs) { m_ps.ps_regs = *ps_regs; }
|
||||
void SetPsShader(const PsStageRegisters* ps_regs)
|
||||
{
|
||||
m_ps.ps_regs = *ps_regs;
|
||||
m_ps.ps_embedded = false;
|
||||
}
|
||||
void SetPsEmbedded(uint32_t id)
|
||||
{
|
||||
m_ps.ps_embedded_id = id;
|
||||
m_ps.ps_embedded = true;
|
||||
}
|
||||
|
||||
void SetCsShader(const CsStageRegisters* cs_regs, uint32_t shader_modifier)
|
||||
{
|
||||
@@ -419,18 +458,22 @@ public:
|
||||
m_cs.cs_shader_modifier = shader_modifier;
|
||||
}
|
||||
|
||||
[[nodiscard]] const BlendColor& GetBlendColor() const { return m_blend_color; }
|
||||
void SetBlendColor(const BlendColor& color) { m_blend_color = color; }
|
||||
[[nodiscard]] const ClipControl& GetClipControl() const { return m_clip_control; }
|
||||
void SetClipControl(const ClipControl& control) { m_clip_control = control; }
|
||||
[[nodiscard]] const RenderControl& GetRenderControl() const { return m_render_control; }
|
||||
void SetRenderControl(const RenderControl& control) { m_render_control = control; }
|
||||
[[nodiscard]] const DepthControl& GetDepthControl() const { return m_depth_control; }
|
||||
void SetDepthControl(const DepthControl& control) { m_depth_control = control; }
|
||||
[[nodiscard]] const ModeControl& GetModeControl() const { return m_mode_control; }
|
||||
void SetModeControl(const ModeControl& control) { m_mode_control = control; }
|
||||
[[nodiscard]] const EqaaControl& GetEqaaControl() const { return m_eqaa_control; }
|
||||
void SetEqaaControl(const EqaaControl& control) { m_eqaa_control = control; }
|
||||
[[nodiscard]] const BlendColor& GetBlendColor() const { return m_blend_color; }
|
||||
void SetBlendColor(const BlendColor& color) { m_blend_color = color; }
|
||||
[[nodiscard]] const ClipControl& GetClipControl() const { return m_clip_control; }
|
||||
void SetClipControl(const ClipControl& control) { m_clip_control = control; }
|
||||
[[nodiscard]] const RenderControl& GetRenderControl() const { return m_render_control; }
|
||||
void SetRenderControl(const RenderControl& control) { m_render_control = control; }
|
||||
[[nodiscard]] const DepthControl& GetDepthControl() const { return m_depth_control; }
|
||||
void SetDepthControl(const DepthControl& control) { m_depth_control = control; }
|
||||
[[nodiscard]] const ModeControl& GetModeControl() const { return m_mode_control; }
|
||||
void SetModeControl(const ModeControl& control) { m_mode_control = control; }
|
||||
[[nodiscard]] const EqaaControl& GetEqaaControl() const { return m_eqaa_control; }
|
||||
void SetEqaaControl(const EqaaControl& control) { m_eqaa_control = control; }
|
||||
[[nodiscard]] const StencilControl& GetStencilControl() const { return m_stencil_control; }
|
||||
void SetStencilControl(const StencilControl& control) { m_stencil_control = control; }
|
||||
[[nodiscard]] const StencilMask& GetStencilMask() const { return m_stencil_mask; }
|
||||
void SetStencilMask(const StencilMask& mask) { m_stencil_mask = mask; }
|
||||
|
||||
void SetVsUserSgpr(uint32_t id, uint32_t value, UserSgprType type)
|
||||
{
|
||||
@@ -460,8 +503,10 @@ public:
|
||||
[[nodiscard]] const VertexShaderInfo& GetVs() const { return m_vs; }
|
||||
[[nodiscard]] const ComputeShaderInfo& GetCs() const { return m_cs; }
|
||||
|
||||
[[nodiscard]] float GetDepthClearValue() const { return m_depth_clear_value; }
|
||||
void SetDepthClearValue(float clear_value) { m_depth_clear_value = clear_value; }
|
||||
[[nodiscard]] float GetDepthClearValue() const { return m_depth_clear_value; }
|
||||
void SetDepthClearValue(float clear_value) { m_depth_clear_value = clear_value; }
|
||||
[[nodiscard]] uint8_t GetStencilClearValue() const { return m_stencil_clear_value; }
|
||||
void SetStencilClearValue(uint8_t clear_value) { m_stencil_clear_value = clear_value; }
|
||||
|
||||
private:
|
||||
BlendControl m_blend_control[8];
|
||||
@@ -479,7 +524,10 @@ private:
|
||||
DepthRenderTarget m_depth_render_target;
|
||||
RenderControl m_render_control;
|
||||
DepthControl m_depth_control;
|
||||
float m_depth_clear_value = 0.0f;
|
||||
StencilControl m_stencil_control;
|
||||
StencilMask m_stencil_mask;
|
||||
float m_depth_clear_value = 0.0f;
|
||||
uint8_t m_stencil_clear_value = 0;
|
||||
|
||||
ModeControl m_mode_control;
|
||||
EqaaControl m_eqaa_control;
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
namespace Kyty::Libs::Graphics {
|
||||
|
||||
class CommandBuffer;
|
||||
struct GraphicContext;
|
||||
struct VulkanMemory;
|
||||
struct VulkanBuffer;
|
||||
@@ -39,6 +40,12 @@ enum class GpuMemoryObjectType : uint64_t
|
||||
Max
|
||||
};
|
||||
|
||||
enum class GpuMemoryScenario
|
||||
{
|
||||
Common,
|
||||
GenerateMips,
|
||||
};
|
||||
|
||||
struct GpuMemoryObject
|
||||
{
|
||||
GpuMemoryObjectType type = GpuMemoryObjectType::Invalid;
|
||||
@@ -50,8 +57,8 @@ class GpuObject
|
||||
public:
|
||||
using create_func_t = void* (*)(GraphicContext* ctx, const uint64_t* params, const uint64_t* vaddr, const uint64_t* size, int vaddr_num,
|
||||
VulkanMemory* mem);
|
||||
using create_from_objects_func_t = void* (*)(GraphicContext* ctx, const uint64_t* params, const Vector<GpuMemoryObject>& objects,
|
||||
VulkanMemory* mem);
|
||||
using create_from_objects_func_t = void* (*)(GraphicContext* ctx, CommandBuffer* buffer, const uint64_t* params,
|
||||
GpuMemoryScenario scenario, const Vector<GpuMemoryObject>& objects, VulkanMemory* mem);
|
||||
using write_back_func_t = void (*)(GraphicContext* ctx, void* obj, const uint64_t* vaddr, const uint64_t* size, int vaddr_num);
|
||||
using delete_func_t = void (*)(GraphicContext* ctx, void* obj, VulkanMemory* mem);
|
||||
using update_func_t = void (*)(GraphicContext* ctx, const uint64_t* params, void* obj, const uint64_t* vaddr, const uint64_t* size,
|
||||
@@ -81,16 +88,18 @@ public:
|
||||
void GpuMemoryInit();
|
||||
|
||||
void GpuMemorySetAllocatedRange(uint64_t vaddr, uint64_t size);
|
||||
void GpuMemoryFree(GraphicContext* ctx, uint64_t vaddr, uint64_t size);
|
||||
void* GpuMemoryCreateObject(GraphicContext* ctx, uint64_t vaddr, uint64_t size, const GpuObject& info);
|
||||
void* GpuMemoryCreateObject(GraphicContext* ctx, const uint64_t* vaddr, const uint64_t* size, int vaddr_num, const GpuObject& info);
|
||||
void GpuMemoryFree(GraphicContext* ctx, uint64_t vaddr, uint64_t size, bool unmap);
|
||||
void* GpuMemoryCreateObject(GraphicContext* ctx, CommandBuffer* buffer, uint64_t vaddr, uint64_t size, const GpuObject& info);
|
||||
void* GpuMemoryCreateObject(GraphicContext* ctx, CommandBuffer* buffer, const uint64_t* vaddr, const uint64_t* size, int vaddr_num,
|
||||
const GpuObject& info);
|
||||
void GpuMemoryResetHash(GraphicContext* ctx, const uint64_t* vaddr, const uint64_t* size, int vaddr_num, GpuMemoryObjectType type);
|
||||
void GpuMemoryDbgDump();
|
||||
void GpuMemoryFlush(GraphicContext* ctx);
|
||||
void GpuMemoryFrameDone();
|
||||
void GpuMemoryWriteBack(GraphicContext* ctx);
|
||||
bool GpuMemoryCheckAccessViolation(uint64_t vaddr, uint64_t size);
|
||||
|
||||
Vector<GpuMemoryObject> GpuMemoryFindObjects(uint64_t vaddr, uint64_t size);
|
||||
Vector<GpuMemoryObject> GpuMemoryFindObjects(uint64_t vaddr, uint64_t size, bool exact);
|
||||
|
||||
bool VulkanAllocate(GraphicContext* ctx, VulkanMemory* mem);
|
||||
void VulkanFree(GraphicContext* ctx, VulkanMemory* mem);
|
||||
|
||||
@@ -40,7 +40,7 @@ public:
|
||||
bool Equal(const uint64_t* other) const override;
|
||||
|
||||
[[nodiscard]] create_func_t GetCreateFunc() const override;
|
||||
[[nodiscard]] create_from_objects_func_t GetCreateFromObjectsFunc() const override { return nullptr; };
|
||||
[[nodiscard]] create_from_objects_func_t GetCreateFromObjectsFunc() const override;
|
||||
[[nodiscard]] write_back_func_t GetWriteBackFunc() const override { return nullptr; };
|
||||
[[nodiscard]] delete_func_t GetDeleteFunc() const override;
|
||||
[[nodiscard]] update_func_t GetUpdateFunc() const override;
|
||||
|
||||
@@ -10,6 +10,9 @@
|
||||
|
||||
namespace Kyty::Libs::Graphics {
|
||||
|
||||
struct StorageVulkanBuffer;
|
||||
class CommandBuffer;
|
||||
|
||||
class StorageBufferGpuObject: public GpuObject
|
||||
{
|
||||
public:
|
||||
@@ -31,6 +34,8 @@ public:
|
||||
[[nodiscard]] update_func_t GetUpdateFunc() const override;
|
||||
};
|
||||
|
||||
void StorageBufferSet(CommandBuffer* cmd_buffer, StorageVulkanBuffer* buffer);
|
||||
|
||||
} // namespace Kyty::Libs::Graphics
|
||||
|
||||
#endif // KYTY_EMU_ENABLED
|
||||
|
||||
@@ -21,13 +21,13 @@ public:
|
||||
static constexpr int PARAM_NEO = 5;
|
||||
static constexpr int PARAM_SWIZZLE = 6;
|
||||
|
||||
StorageTextureObject(uint32_t dfmt, uint32_t nfmt, uint32_t width, uint32_t height, uint32_t pitch, uint32_t levels, uint32_t tile,
|
||||
bool neo, uint32_t swizzle)
|
||||
StorageTextureObject(uint32_t dfmt, uint32_t nfmt, uint32_t width, uint32_t height, uint32_t pitch, uint32_t base_level,
|
||||
uint32_t levels, uint32_t tile, bool neo, uint32_t swizzle)
|
||||
{
|
||||
params[PARAM_DFMT_NFMT] = (static_cast<uint64_t>(dfmt) << 32u) | nfmt;
|
||||
params[PARAM_PITCH] = pitch;
|
||||
params[PARAM_WIDTH_HEIGHT] = (static_cast<uint64_t>(width) << 32u) | height;
|
||||
params[PARAM_LEVELS] = levels;
|
||||
params[PARAM_LEVELS] = (static_cast<uint64_t>(base_level) << 32u) | levels;
|
||||
params[PARAM_TILE] = tile;
|
||||
params[PARAM_NEO] = neo ? 1 : 0;
|
||||
params[PARAM_SWIZZLE] = swizzle;
|
||||
|
||||
@@ -21,13 +21,13 @@ public:
|
||||
static constexpr int PARAM_NEO = 5;
|
||||
static constexpr int PARAM_SWIZZLE = 6;
|
||||
|
||||
TextureObject(uint32_t dfmt, uint32_t nfmt, uint32_t width, uint32_t height, uint32_t pitch, uint32_t levels, uint32_t tile, bool neo,
|
||||
uint32_t swizzle)
|
||||
TextureObject(uint32_t dfmt, uint32_t nfmt, uint32_t width, uint32_t height, uint32_t pitch, uint32_t base_level, uint32_t levels,
|
||||
uint32_t tile, bool neo, uint32_t swizzle)
|
||||
{
|
||||
params[PARAM_DFMT_NFMT] = (static_cast<uint64_t>(dfmt) << 32u) | nfmt;
|
||||
params[PARAM_PITCH] = pitch;
|
||||
params[PARAM_WIDTH_HEIGHT] = (static_cast<uint64_t>(width) << 32u) | height;
|
||||
params[PARAM_LEVELS] = levels;
|
||||
params[PARAM_LEVELS] = (static_cast<uint64_t>(base_level) << 32u) | levels;
|
||||
params[PARAM_TILE] = tile;
|
||||
params[PARAM_NEO] = neo ? 1 : 0;
|
||||
params[PARAM_SWIZZLE] = swizzle;
|
||||
|
||||
@@ -111,6 +111,10 @@ constexpr uint32_t DB_HTILE_DATA_BASE = 0x5;
|
||||
constexpr uint32_t DB_HTILE_DATA_BASE_BASE_256B_SHIFT = 0;
|
||||
constexpr uint32_t DB_HTILE_DATA_BASE_BASE_256B_MASK = 0xFFFFFFFF;
|
||||
|
||||
constexpr uint32_t DB_STENCIL_CLEAR = 0xA;
|
||||
constexpr uint32_t DB_STENCIL_CLEAR_CLEAR_SHIFT = 0;
|
||||
constexpr uint32_t DB_STENCIL_CLEAR_CLEAR_MASK = 0xFF;
|
||||
|
||||
constexpr uint32_t DB_DEPTH_CLEAR = 0xB;
|
||||
constexpr uint32_t DB_DEPTH_CLEAR_DEPTH_CLEAR_SHIFT = 0;
|
||||
constexpr uint32_t DB_DEPTH_CLEAR_DEPTH_CLEAR_MASK = 0xFFFFFFFF;
|
||||
@@ -181,6 +185,40 @@ constexpr uint32_t CB_BLEND_GREEN = 0x106;
|
||||
constexpr uint32_t CB_BLEND_BLUE = 0x107;
|
||||
constexpr uint32_t CB_BLEND_ALPHA = 0x108;
|
||||
|
||||
constexpr uint32_t DB_STENCIL_CONTROL = 0x10B;
|
||||
constexpr uint32_t DB_STENCIL_CONTROL_STENCILFAIL_SHIFT = 0;
|
||||
constexpr uint32_t DB_STENCIL_CONTROL_STENCILFAIL_MASK = 0xF;
|
||||
constexpr uint32_t DB_STENCIL_CONTROL_STENCILZPASS_SHIFT = 4;
|
||||
constexpr uint32_t DB_STENCIL_CONTROL_STENCILZPASS_MASK = 0xF;
|
||||
constexpr uint32_t DB_STENCIL_CONTROL_STENCILZFAIL_SHIFT = 8;
|
||||
constexpr uint32_t DB_STENCIL_CONTROL_STENCILZFAIL_MASK = 0xF;
|
||||
constexpr uint32_t DB_STENCIL_CONTROL_STENCILFAIL_BF_SHIFT = 12;
|
||||
constexpr uint32_t DB_STENCIL_CONTROL_STENCILFAIL_BF_MASK = 0xF;
|
||||
constexpr uint32_t DB_STENCIL_CONTROL_STENCILZPASS_BF_SHIFT = 16;
|
||||
constexpr uint32_t DB_STENCIL_CONTROL_STENCILZPASS_BF_MASK = 0xF;
|
||||
constexpr uint32_t DB_STENCIL_CONTROL_STENCILZFAIL_BF_SHIFT = 20;
|
||||
constexpr uint32_t DB_STENCIL_CONTROL_STENCILZFAIL_BF_MASK = 0xF;
|
||||
|
||||
constexpr uint32_t DB_STENCILREFMASK = 0x10C;
|
||||
constexpr uint32_t DB_STENCILREFMASK_STENCILTESTVAL_SHIFT = 0;
|
||||
constexpr uint32_t DB_STENCILREFMASK_STENCILTESTVAL_MASK = 0xFF;
|
||||
constexpr uint32_t DB_STENCILREFMASK_STENCILMASK_SHIFT = 8;
|
||||
constexpr uint32_t DB_STENCILREFMASK_STENCILMASK_MASK = 0xFF;
|
||||
constexpr uint32_t DB_STENCILREFMASK_STENCILWRITEMASK_SHIFT = 16;
|
||||
constexpr uint32_t DB_STENCILREFMASK_STENCILWRITEMASK_MASK = 0xFF;
|
||||
constexpr uint32_t DB_STENCILREFMASK_STENCILOPVAL_SHIFT = 24;
|
||||
constexpr uint32_t DB_STENCILREFMASK_STENCILOPVAL_MASK = 0xFF;
|
||||
|
||||
constexpr uint32_t DB_STENCILREFMASK_BF = 0x10D;
|
||||
constexpr uint32_t DB_STENCILREFMASK_BF_STENCILTESTVAL_BF_SHIFT = 0;
|
||||
constexpr uint32_t DB_STENCILREFMASK_BF_STENCILTESTVAL_BF_MASK = 0xFF;
|
||||
constexpr uint32_t DB_STENCILREFMASK_BF_STENCILMASK_BF_SHIFT = 8;
|
||||
constexpr uint32_t DB_STENCILREFMASK_BF_STENCILMASK_BF_MASK = 0xFF;
|
||||
constexpr uint32_t DB_STENCILREFMASK_BF_STENCILWRITEMASK_BF_SHIFT = 16;
|
||||
constexpr uint32_t DB_STENCILREFMASK_BF_STENCILWRITEMASK_BF_MASK = 0xFF;
|
||||
constexpr uint32_t DB_STENCILREFMASK_BF_STENCILOPVAL_BF_SHIFT = 24;
|
||||
constexpr uint32_t DB_STENCILREFMASK_BF_STENCILOPVAL_BF_MASK = 0xFF;
|
||||
|
||||
constexpr uint32_t PA_CL_VPORT_XSCALE = 0x10F;
|
||||
|
||||
constexpr uint32_t SPI_PS_INPUT_CNTL_0 = 0x191;
|
||||
@@ -282,6 +320,7 @@ constexpr uint32_t DB_HTILE_SURFACE_DST_OUTSIDE_ZERO_TO_ONE_MASK = 0x1;
|
||||
constexpr uint32_t VGT_SHADER_STAGES_EN = 0x2D5;
|
||||
|
||||
constexpr uint32_t CB_COLOR0_BASE = 0x318;
|
||||
constexpr uint32_t CB_COLOR0_INFO = 0x31C;
|
||||
|
||||
constexpr uint32_t SPI_SHADER_PGM_RSRC1_PS = 0xA;
|
||||
constexpr uint32_t SPI_SHADER_PGM_RSRC1_PS_VGPRS_SHIFT = 0;
|
||||
|
||||
@@ -42,6 +42,7 @@ enum class ShaderInstructionType
|
||||
Exp,
|
||||
ImageLoad,
|
||||
ImageSample,
|
||||
ImageStore,
|
||||
ImageStoreMip,
|
||||
SAddcU32,
|
||||
SAddI32,
|
||||
@@ -137,6 +138,7 @@ enum class ShaderInstructionType
|
||||
VCmpxGeU32,
|
||||
VCmpxGtU32,
|
||||
VCmpxNeU32,
|
||||
VCmpxNeqF32,
|
||||
VCndmaskB32,
|
||||
VCosF32,
|
||||
VCvtF32F16,
|
||||
@@ -394,18 +396,24 @@ public:
|
||||
{ return m_instructions.Contains(type, [](auto inst, auto type) { return inst.type == type; }); });
|
||||
}
|
||||
|
||||
[[nodiscard]] bool IsEmbedded() const { return m_embedded; }
|
||||
void SetEmbedded(bool embedded) { this->m_embedded = embedded; }
|
||||
[[nodiscard]] uint32_t GetEmbeddedId() const { return m_embedded_id; }
|
||||
void SetEmbeddedId(uint32_t embedded_id) { m_embedded_id = embedded_id; }
|
||||
[[nodiscard]] bool IsVsEmbedded() const { return m_vs_embedded; }
|
||||
void SetVsEmbedded(bool embedded) { this->m_vs_embedded = embedded; }
|
||||
[[nodiscard]] uint32_t GetVsEmbeddedId() const { return m_vs_embedded_id; }
|
||||
void SetVsEmbeddedId(uint32_t embedded_id) { m_vs_embedded_id = embedded_id; }
|
||||
[[nodiscard]] bool IsPsEmbedded() const { return m_ps_embedded; }
|
||||
void SetPsEmbedded(bool embedded) { this->m_ps_embedded = embedded; }
|
||||
[[nodiscard]] uint32_t GetPsEmbeddedId() const { return m_ps_embedded_id; }
|
||||
void SetPsEmbeddedId(uint32_t embedded_id) { m_ps_embedded_id = embedded_id; }
|
||||
|
||||
private:
|
||||
Vector<ShaderInstruction> m_instructions;
|
||||
Vector<ShaderLabel> m_labels;
|
||||
ShaderType m_type = ShaderType::Unknown;
|
||||
Vector<ShaderDebugPrintf> m_debug_printfs;
|
||||
uint32_t m_embedded_id = 0;
|
||||
bool m_embedded = false;
|
||||
uint32_t m_vs_embedded_id = 0;
|
||||
uint32_t m_ps_embedded_id = 0;
|
||||
bool m_vs_embedded = false;
|
||||
bool m_ps_embedded = false;
|
||||
};
|
||||
|
||||
struct ShaderId
|
||||
|
||||
@@ -18,6 +18,7 @@ struct ShaderComputeInputInfo;
|
||||
String SpirvGenerateSource(const ShaderCode& code, const ShaderVertexInputInfo* vs_input_info, const ShaderPixelInputInfo* ps_input_info,
|
||||
const ShaderComputeInputInfo* cs_input_info);
|
||||
String SpirvGetEmbeddedVs(uint32_t id);
|
||||
String SpirvGetEmbeddedPs(uint32_t id);
|
||||
|
||||
} // namespace Kyty::Libs::Graphics
|
||||
|
||||
|
||||
@@ -56,6 +56,7 @@ public:
|
||||
ExceptionType type = ExceptionType::Unknown;
|
||||
AccessViolationType access_violation_type = AccessViolationType::Unknown;
|
||||
uint64_t access_violation_vaddr = 0;
|
||||
uint64_t exception_address = 0;
|
||||
};
|
||||
|
||||
using handler_func_t = void (*)(const ExceptionInfo*);
|
||||
@@ -70,6 +71,8 @@ public:
|
||||
bool Install(uint64_t base_address, uint64_t handler_addr, uint64_t image_size, handler_func_t func);
|
||||
bool Uninstall();
|
||||
|
||||
static bool InstallVectored(handler_func_t func);
|
||||
|
||||
private:
|
||||
ExceptionHandlerPrivate* m_p = nullptr;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user