mirror of
https://github.com/InoriRus/Kyty.git
synced 2026-08-28 05:06:40 +00:00
add support of clang 14.0.3
This commit is contained in:
@@ -149,7 +149,7 @@ int KYTY_SYSV_ABI GraphicsSetPsShader(uint32_t* cmd, uint64_t size, const uint32
|
||||
printf("\t ps_regs.m_cbShaderMask = %08" PRIx32 "\n", ps_regs[11]);
|
||||
|
||||
cmd[0] = KYTY_PM4(size, Pm4::IT_NOP, Pm4::R_PS);
|
||||
memcpy(&cmd[1], ps_regs, 12 * 4);
|
||||
memcpy(&cmd[1], ps_regs, static_cast<size_t>(12) * 4);
|
||||
}
|
||||
|
||||
return OK;
|
||||
@@ -190,7 +190,7 @@ int KYTY_SYSV_ABI GraphicsSetPsShader350(uint32_t* cmd, uint64_t size, const uin
|
||||
printf("\t ps_regs.m_cbShaderMask = %08" PRIx32 "\n", ps_regs[11]);
|
||||
|
||||
cmd[0] = KYTY_PM4(size, Pm4::IT_NOP, Pm4::R_PS);
|
||||
memcpy(&cmd[1], ps_regs, 12 * 4);
|
||||
memcpy(&cmd[1], ps_regs, static_cast<size_t>(12) * 4);
|
||||
}
|
||||
|
||||
// printf("ok\n");
|
||||
@@ -222,7 +222,7 @@ int KYTY_SYSV_ABI GraphicsUpdatePsShader(uint32_t* cmd, uint64_t size, const uin
|
||||
printf("\t ps_regs.m_cbShaderMask = %08" PRIx32 "\n", ps_regs[11]);
|
||||
|
||||
cmd[0] = KYTY_PM4(size, Pm4::IT_NOP, Pm4::R_PS_UPDATE);
|
||||
memcpy(&cmd[1], ps_regs, 12 * 4);
|
||||
memcpy(&cmd[1], ps_regs, static_cast<size_t>(12) * 4);
|
||||
|
||||
return OK;
|
||||
}
|
||||
@@ -251,7 +251,7 @@ int KYTY_SYSV_ABI GraphicsUpdatePsShader350(uint32_t* cmd, uint64_t size, const
|
||||
printf("\t ps_regs.m_cbShaderMask = %08" PRIx32 "\n", ps_regs[11]);
|
||||
|
||||
cmd[0] = KYTY_PM4(size, Pm4::IT_NOP, Pm4::R_PS_UPDATE);
|
||||
memcpy(&cmd[1], ps_regs, 12 * 4);
|
||||
memcpy(&cmd[1], ps_regs, static_cast<size_t>(12) * 4);
|
||||
|
||||
return OK;
|
||||
}
|
||||
@@ -276,7 +276,7 @@ int KYTY_SYSV_ABI GraphicsSetCsShaderWithModifier(uint32_t* cmd, uint64_t size,
|
||||
|
||||
cmd[0] = KYTY_PM4(size, Pm4::IT_NOP, Pm4::R_CS);
|
||||
cmd[1] = shader_modifier;
|
||||
memcpy(&cmd[2], cs_regs, 7 * 4);
|
||||
memcpy(&cmd[2], cs_regs, static_cast<size_t>(7) * 4);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "Emulator/Graphics/GraphicsRender.h"
|
||||
|
||||
#include "Kyty/Core/Common.h"
|
||||
#include "Kyty/Core/DbgAssert.h"
|
||||
#include "Kyty/Core/File.h"
|
||||
#include "Kyty/Core/Hash.h"
|
||||
@@ -49,6 +50,7 @@ struct VulkanDescriptor
|
||||
VkDescriptorSet descriptor_set = nullptr;
|
||||
};
|
||||
|
||||
// Pack structs to guarantee the uniquess of object representation
|
||||
#pragma pack(push, 1)
|
||||
|
||||
struct PipelineStencilStaticState
|
||||
@@ -1813,11 +1815,11 @@ static VulkanPipeline* CreatePipelineInternal(VkRenderPass render_pass, const Sh
|
||||
create_info.pNext = nullptr;
|
||||
create_info.flags = 0;
|
||||
|
||||
create_info.codeSize = vs_shader.Size() * 4;
|
||||
create_info.codeSize = static_cast<size_t>(vs_shader.Size()) * 4;
|
||||
create_info.pCode = vs_shader.GetDataConst();
|
||||
vkCreateShaderModule(gctx->device, &create_info, nullptr, &vert_shader_module);
|
||||
|
||||
create_info.codeSize = ps_shader.Size() * 4;
|
||||
create_info.codeSize = static_cast<size_t>(ps_shader.Size()) * 4;
|
||||
create_info.pCode = ps_shader.GetDataConst();
|
||||
vkCreateShaderModule(gctx->device, &create_info, nullptr, &frag_shader_module);
|
||||
|
||||
@@ -2169,7 +2171,7 @@ static VulkanPipeline* CreatePipelineInternal(const ShaderComputeInputInfo* inpu
|
||||
create_info.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO;
|
||||
create_info.pNext = nullptr;
|
||||
create_info.flags = 0;
|
||||
create_info.codeSize = cs_shader.Size() * 4;
|
||||
create_info.codeSize = static_cast<size_t>(cs_shader.Size()) * 4;
|
||||
create_info.pCode = cs_shader.GetDataConst();
|
||||
vkCreateShaderModule(gctx->device, &create_info, nullptr, &comp_shader_module);
|
||||
|
||||
@@ -2231,6 +2233,7 @@ static VulkanPipeline* CreatePipelineInternal(const ShaderComputeInputInfo* inpu
|
||||
|
||||
bool PipelineStaticParameters::operator==(const PipelineStaticParameters& other) const
|
||||
{
|
||||
// NOLINTNEXTLINE(bugprone-suspicious-memory-comparison,cert-exp42-c,cert-flp37-c)
|
||||
return (0 == memcmp(this, &other, sizeof(struct PipelineStaticParameters)));
|
||||
}
|
||||
|
||||
@@ -4162,7 +4165,7 @@ static void PrepareGdsPointers(const ShaderGdsResources& gds_pointers, uint32_t*
|
||||
|
||||
if (gds_pointers.pointers_num > 0)
|
||||
{
|
||||
(*sgprs) += 4 * ((gds_pointers.pointers_num - 1) / 4 + 1);
|
||||
(*sgprs) += static_cast<ptrdiff_t>(4 * ((gds_pointers.pointers_num - 1) / 4 + 1));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4351,11 +4354,11 @@ void GraphicsRenderDrawIndex(uint64_t submit_id, CommandBuffer* buffer, HW::Hard
|
||||
{
|
||||
case 0:
|
||||
index_type = VK_INDEX_TYPE_UINT16;
|
||||
index_size = 2 * index_count;
|
||||
index_size = 2 * static_cast<uint64_t>(index_count);
|
||||
break;
|
||||
case 1:
|
||||
index_type = VK_INDEX_TYPE_UINT32;
|
||||
index_size = 4 * index_count;
|
||||
index_size = 4 * static_cast<uint64_t>(index_count);
|
||||
break;
|
||||
default: EXIT("unknown index_type_and_size: %u\n", index_type_and_size);
|
||||
}
|
||||
@@ -4395,7 +4398,7 @@ void GraphicsRenderDrawIndex(uint64_t submit_id, CommandBuffer* buffer, HW::Hard
|
||||
{
|
||||
const auto& b = vs_input_info.buffers[i];
|
||||
uint64_t addr = b.addr;
|
||||
uint64_t size = b.stride * b.num_records;
|
||||
uint64_t size = static_cast<uint64_t>(b.stride) * b.num_records;
|
||||
|
||||
auto* vertices = static_cast<VulkanBuffer*>(
|
||||
GpuMemoryCreateObject(submit_id, g_render_ctx->GetGraphicCtx(), nullptr, addr, size, VertexBufferGpuObject()));
|
||||
@@ -4520,7 +4523,7 @@ void GraphicsRenderDrawIndexAuto(uint64_t submit_id, CommandBuffer* buffer, HW::
|
||||
{
|
||||
const auto& b = vs_input_info.buffers[i];
|
||||
uint64_t addr = b.addr;
|
||||
uint64_t size = b.stride * b.num_records;
|
||||
uint64_t size = static_cast<uint64_t>(b.stride) * b.num_records;
|
||||
|
||||
auto* vertices = static_cast<VulkanBuffer*>(
|
||||
GpuMemoryCreateObject(submit_id, g_render_ctx->GetGraphicCtx(), nullptr, addr, size, VertexBufferGpuObject()));
|
||||
|
||||
@@ -616,18 +616,18 @@ void CommandProcessor::WriteConstRam(uint32_t offset, const uint32_t* src, uint3
|
||||
{
|
||||
Core::LockGuard lock(m_mutex);
|
||||
|
||||
memcpy(m_const_ram + offset / 4, src, dw_num * 4);
|
||||
memcpy(m_const_ram + offset / 4, src, static_cast<size_t>(dw_num) * 4);
|
||||
}
|
||||
|
||||
void CommandProcessor::DumpConstRam(uint32_t* dst, uint32_t offset, uint32_t dw_num)
|
||||
{
|
||||
Core::LockGuard lock(m_mutex);
|
||||
|
||||
GpuMemoryCheckAccessViolation(reinterpret_cast<uint64_t>(dst), dw_num * 4);
|
||||
GpuMemoryCheckAccessViolation(reinterpret_cast<uint64_t>(dst), static_cast<size_t>(dw_num) * 4);
|
||||
|
||||
memcpy(dst, m_const_ram + offset / 4, dw_num * 4);
|
||||
memcpy(dst, m_const_ram + offset / 4, static_cast<size_t>(dw_num) * 4);
|
||||
|
||||
GraphicsRenderMemoryFlush(reinterpret_cast<uint64_t>(dst), dw_num * 4);
|
||||
GraphicsRenderMemoryFlush(reinterpret_cast<uint64_t>(dst), static_cast<size_t>(dw_num) * 4);
|
||||
}
|
||||
|
||||
void CommandProcessor::WaitRegMem(uint32_t func, bool me, bool mem, const uint32_t* addr, uint32_t ref, uint32_t mask, uint32_t poll)
|
||||
@@ -651,11 +651,11 @@ void CommandProcessor::WriteData(uint32_t* dst, const uint32_t* src, uint32_t dw
|
||||
|
||||
EXIT_NOT_IMPLEMENTED(write_control != 0x04100500);
|
||||
|
||||
GpuMemoryCheckAccessViolation(reinterpret_cast<uint64_t>(dst), dw_num * 4);
|
||||
GpuMemoryCheckAccessViolation(reinterpret_cast<uint64_t>(dst), static_cast<size_t>(dw_num) * 4);
|
||||
|
||||
memcpy(dst, src, dw_num * 4);
|
||||
memcpy(dst, src, static_cast<size_t>(dw_num) * 4);
|
||||
|
||||
GraphicsRenderMemoryFlush(reinterpret_cast<uint64_t>(dst), dw_num * 4);
|
||||
GraphicsRenderMemoryFlush(reinterpret_cast<uint64_t>(dst), static_cast<size_t>(dw_num) * 4);
|
||||
}
|
||||
|
||||
void GraphicsRing::Submit(uint32_t* cmd_draw_buffer, uint32_t num_draw_dw, uint32_t* cmd_const_buffer, uint32_t num_const_dw, int handle,
|
||||
@@ -940,7 +940,7 @@ void CommandProcessor::Run(uint32_t* data, uint32_t num_dw)
|
||||
|
||||
if (num_dw > 0)
|
||||
{
|
||||
GraphicsRenderMemoryFree(reinterpret_cast<uint64_t>(data), num_dw * 4);
|
||||
GraphicsRenderMemoryFree(reinterpret_cast<uint64_t>(data), static_cast<size_t>(num_dw) * 4);
|
||||
}
|
||||
|
||||
auto* cmd = data;
|
||||
@@ -1596,7 +1596,7 @@ KYTY_HW_CTX_PARSER(hw_ctx_set_aa_sample_control)
|
||||
|
||||
HW::AaSampleControl r;
|
||||
|
||||
memcpy(r.locations, buffer, 16 * 4);
|
||||
memcpy(r.locations, buffer, static_cast<size_t>(16) * 4);
|
||||
|
||||
r.centroid_priority = static_cast<uint64_t>(buffer[18]) | (static_cast<uint64_t>(buffer[19]) << 32u);
|
||||
|
||||
|
||||
@@ -59,13 +59,10 @@ static OverlapType GetOverlapType(uint64_t vaddr_a, uint64_t size_a, uint64_t va
|
||||
return OverlapType::Equals;
|
||||
}
|
||||
|
||||
uint64_t vaddr_last_a = vaddr_a + size_a - 1;
|
||||
uint64_t vaddr_last_b = vaddr_b + size_b - 1;
|
||||
|
||||
bool a_b = addr_in_block(vaddr_a, size_a, vaddr_b);
|
||||
bool a_lb = addr_in_block(vaddr_a, size_a, vaddr_last_b);
|
||||
bool a_lb = addr_in_block(vaddr_a, size_a, vaddr_b + size_b - 1);
|
||||
bool b_a = addr_in_block(vaddr_b, size_b, vaddr_a);
|
||||
bool b_la = addr_in_block(vaddr_b, size_b, vaddr_last_a);
|
||||
bool b_la = addr_in_block(vaddr_b, size_b, vaddr_a + size_a - 1);
|
||||
|
||||
if (a_b && a_lb)
|
||||
{
|
||||
|
||||
@@ -2144,8 +2144,11 @@ static bool SpirvDisassemble(const uint32_t* src_binary, size_t src_binary_size,
|
||||
|
||||
std::string disassembly;
|
||||
if (!core.Disassemble(src_binary, src_binary_size, &disassembly,
|
||||
uint32_t(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER) | SPV_BINARY_TO_TEXT_OPTION_FRIENDLY_NAMES |
|
||||
SPV_BINARY_TO_TEXT_OPTION_COMMENT | SPV_BINARY_TO_TEXT_OPTION_INDENT | SPV_BINARY_TO_TEXT_OPTION_COLOR))
|
||||
static_cast<uint32_t>(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER) |
|
||||
static_cast<uint32_t>(SPV_BINARY_TO_TEXT_OPTION_FRIENDLY_NAMES) |
|
||||
static_cast<uint32_t>(SPV_BINARY_TO_TEXT_OPTION_COMMENT) |
|
||||
static_cast<uint32_t>(SPV_BINARY_TO_TEXT_OPTION_INDENT) |
|
||||
static_cast<uint32_t>(SPV_BINARY_TO_TEXT_OPTION_COLOR)))
|
||||
{
|
||||
*dst_disassembly = disassembly.c_str();
|
||||
|
||||
@@ -2242,7 +2245,7 @@ static const ShaderBinaryInfo* GetBinaryInfo(const uint32_t* code)
|
||||
|
||||
if (code[0] == 0xBEEB03FF)
|
||||
{
|
||||
return reinterpret_cast<const ShaderBinaryInfo*>(code + (code[1] + 1) * 2);
|
||||
return reinterpret_cast<const ShaderBinaryInfo*>(code + static_cast<size_t>(code[1] + 1) * 2);
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
|
||||
@@ -162,8 +162,8 @@ public:
|
||||
|
||||
if (tile_bytes > 512)
|
||||
{
|
||||
tile_split_slice = element_offset / (512 * 8);
|
||||
element_offset %= (512 * 8);
|
||||
tile_split_slice = element_offset / (static_cast<uint64_t>(512) * 8);
|
||||
element_offset %= (static_cast<uint64_t>(512) * 8);
|
||||
tile_bytes = 512;
|
||||
}
|
||||
|
||||
@@ -304,7 +304,7 @@ static void Detile32(const Tiler32* t, uint32_t width, uint32_t height, uint32_t
|
||||
uint32_t start_y = p->start_y;
|
||||
uint32_t width = p->width;
|
||||
uint32_t height = p->height;
|
||||
uint32_t dst_pitch = p->dst_pitch;
|
||||
uint64_t dst_pitch = p->dst_pitch;
|
||||
bool neo = p->neo;
|
||||
|
||||
for (uint32_t y = start_y; y < height; y++)
|
||||
@@ -359,7 +359,7 @@ static void Detile32(const Tiler1d* t, uint32_t width, uint32_t height, uint32_t
|
||||
for (uint32_t y = 0; y < height; y++)
|
||||
{
|
||||
uint32_t x = 0;
|
||||
uint64_t linear_offset = y * dst_pitch * 4;
|
||||
uint64_t linear_offset = y * static_cast<uint64_t>(dst_pitch) * 4;
|
||||
|
||||
for (; x + 1 < width; x += 2)
|
||||
{
|
||||
@@ -382,7 +382,7 @@ static void Detile64(const Tiler1d* t, uint32_t width, uint32_t height, uint32_t
|
||||
for (uint32_t y = 0; y < height; y++)
|
||||
{
|
||||
uint32_t x = 0;
|
||||
uint64_t linear_offset = y * dst_pitch * 8;
|
||||
uint64_t linear_offset = y * static_cast<uint64_t>(dst_pitch) * 8;
|
||||
|
||||
for (; x + 1 < width; x += 2)
|
||||
{
|
||||
@@ -405,7 +405,7 @@ static void Detile128(const Tiler1d* t, uint32_t width, uint32_t height, uint32_
|
||||
for (uint32_t y = 0; y < height; y++)
|
||||
{
|
||||
uint32_t x = 0;
|
||||
uint64_t linear_offset = y * dst_pitch * 16;
|
||||
uint64_t linear_offset = y * static_cast<uint64_t>(dst_pitch) * 16;
|
||||
|
||||
for (; x + 1 < width; x += 2)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user