Compile fixes for GCC
This commit is contained in:
parent
dc7b72b156
commit
a76ec6fc19
|
@ -10,10 +10,8 @@
|
|||
template<typename BackingDataType, typename DataType, unsigned BitIndex, unsigned BitCount>
|
||||
struct BitField
|
||||
{
|
||||
constexpr BitField() = default;
|
||||
#ifndef _MSC_VER
|
||||
BitField& operator=(const BitField& value) = delete;
|
||||
#endif
|
||||
// We have to delete the copy assignment operator otherwise we can't use this class in anonymous structs/unions.
|
||||
BitField& operator=(const BitField& rhs) = delete;
|
||||
|
||||
constexpr BackingDataType GetMask() const
|
||||
{
|
||||
|
|
|
@ -171,7 +171,7 @@ const CDImage::Index* CDImage::GetIndexForTrackPosition(u32 track_number, LBA tr
|
|||
|
||||
const Track& track = m_tracks[track_number - 1];
|
||||
if (track_pos >= track.length)
|
||||
return false;
|
||||
return nullptr;
|
||||
|
||||
return GetIndexForDiscPosition(track.start_lba + track_pos);
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ static void DecodeXA_ADPCMChunks(const u8* chunk_ptr, s16* samples, s32* last_sa
|
|||
constexpr u32 NUM_CHUNKS = 18;
|
||||
constexpr u32 CHUNK_SIZE_IN_BYTES = 128;
|
||||
constexpr u32 WORDS_PER_CHUNK = 28;
|
||||
constexpr u32 SAMPLES_PER_CHUNK = 28 * (IS_8BIT ? 4 : 8);
|
||||
constexpr u32 SAMPLES_PER_CHUNK = WORDS_PER_CHUNK * (IS_8BIT ? 4 : 8);
|
||||
|
||||
for (u32 i = 0; i < NUM_CHUNKS; i++)
|
||||
{
|
||||
|
|
|
@ -4,11 +4,7 @@
|
|||
#include <cstring>
|
||||
#include <type_traits>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <malloc.h> // _aligned_malloc
|
||||
#else
|
||||
#include <cstdlib>
|
||||
#endif
|
||||
#include <malloc.h> // _aligned_malloc, memalign
|
||||
|
||||
template<typename T, u32 CAPACITY>
|
||||
class FIFOQueue
|
||||
|
@ -35,7 +31,7 @@ public:
|
|||
T& Emplace(Args&&... args)
|
||||
{
|
||||
T& ref = PushAndGetReference();
|
||||
new (&ref) T(std::forward<Args>(args...));
|
||||
new (&ref) T(std::forward<Args...>(args...));
|
||||
return ref;
|
||||
}
|
||||
|
||||
|
@ -157,7 +153,7 @@ template<typename T, u32 CAPACITY>
|
|||
class InlineFIFOQueue : public FIFOQueue<T, CAPACITY>
|
||||
{
|
||||
public:
|
||||
InlineFIFOQueue() : FIFOQueue<T, CAPACITY>() { m_ptr = m_inline_data; }
|
||||
InlineFIFOQueue() : FIFOQueue<T, CAPACITY>() { this->m_ptr = m_inline_data; }
|
||||
|
||||
private:
|
||||
T m_inline_data[CAPACITY] = {};
|
||||
|
@ -172,20 +168,20 @@ public:
|
|||
if constexpr (ALIGNMENT > 0)
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
m_ptr = static_cast<T*>(_aligned_malloc(sizeof(T) * CAPACITY, ALIGNMENT));
|
||||
this->m_ptr = static_cast<T*>(_aligned_malloc(sizeof(T) * CAPACITY, ALIGNMENT));
|
||||
#else
|
||||
m_ptr = static_cast<T*>(memalign(ALIGNMENT, sizeof(T) * CAPACITY));
|
||||
this->m_ptr = static_cast<T*>(memalign(ALIGNMENT, sizeof(T) * CAPACITY));
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ptr = static_cast<T*>(std::malloc(sizeof(T) * CAPACITY));
|
||||
this->m_ptr = static_cast<T*>(std::malloc(sizeof(T) * CAPACITY));
|
||||
}
|
||||
|
||||
if (!m_ptr)
|
||||
if (!this->m_ptr)
|
||||
Panic("Heap allocation failed");
|
||||
|
||||
std::memset(m_ptr, 0, sizeof(T) * CAPACITY);
|
||||
std::memset(this->m_ptr, 0, sizeof(T) * CAPACITY);
|
||||
}
|
||||
|
||||
~HeapFIFOQueue()
|
||||
|
@ -193,14 +189,14 @@ public:
|
|||
if constexpr (ALIGNMENT > 0)
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
_aligned_free(m_ptr);
|
||||
_aligned_free(this->m_ptr);
|
||||
#else
|
||||
free(m_ptr);
|
||||
free(this->m_ptr);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
free(m_ptr);
|
||||
free(this->m_ptr);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -74,7 +74,7 @@ public:
|
|||
if (m_mode == Mode::Read)
|
||||
{
|
||||
if (m_error || (m_error |= !m_stream->Read2(value_ptr, sizeof(T))) == true)
|
||||
*value_ptr = {};
|
||||
std::memset(value_ptr, 0, sizeof(*value_ptr));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -48,8 +48,8 @@ void CDROM::SoftReset()
|
|||
m_location_pending = false;
|
||||
m_filter_file_number = 0;
|
||||
m_filter_channel_number = 0;
|
||||
m_last_sector_header = {};
|
||||
m_last_sector_subheader = {};
|
||||
std::memset(&m_last_sector_header, 0, sizeof(m_last_sector_header));
|
||||
std::memset(&m_last_sector_subheader, 0, sizeof(m_last_sector_subheader));
|
||||
|
||||
m_next_cd_audio_volume_matrix[0][0] = 0x80;
|
||||
m_next_cd_audio_volume_matrix[0][1] = 0x00;
|
||||
|
@ -95,8 +95,8 @@ bool CDROM::DoState(StateWrapper& sw)
|
|||
sw.Do(&m_location_pending);
|
||||
sw.Do(&m_filter_file_number);
|
||||
sw.Do(&m_filter_channel_number);
|
||||
sw.DoPOD(&m_last_sector_header);
|
||||
sw.DoPOD(&m_last_sector_subheader);
|
||||
sw.DoBytes(&m_last_sector_header, sizeof(m_last_sector_header));
|
||||
sw.DoBytes(&m_last_sector_subheader, sizeof(m_last_sector_subheader));
|
||||
sw.Do(&m_cd_audio_volume_matrix);
|
||||
sw.Do(&m_next_cd_audio_volume_matrix);
|
||||
sw.Do(&m_xa_last_samples);
|
||||
|
|
|
@ -539,7 +539,7 @@ void Core::Execute()
|
|||
m_downcount -= 1;
|
||||
|
||||
// now executing the instruction we previously fetched
|
||||
m_current_instruction = m_next_instruction;
|
||||
m_current_instruction.bits = m_next_instruction.bits;
|
||||
m_current_instruction_pc = m_regs.pc;
|
||||
m_current_instruction_in_branch_delay_slot = m_next_instruction_is_branch_delay_slot;
|
||||
m_current_instruction_was_branch_taken = m_branch_was_taken;
|
||||
|
|
|
@ -31,7 +31,7 @@ bool DMA::Initialize(System* system, Bus* bus, InterruptController* interrupt_co
|
|||
void DMA::Reset()
|
||||
{
|
||||
m_transfer_in_progress = false;
|
||||
m_state = {};
|
||||
std::memset(&m_state, 0, sizeof(m_state));
|
||||
m_DPCR.bits = 0x07654321;
|
||||
m_DICR.bits = 0;
|
||||
}
|
||||
|
|
|
@ -6,9 +6,12 @@
|
|||
#include "stb_image_write.h"
|
||||
#include "system.h"
|
||||
#include "timers.h"
|
||||
#include <cmath>
|
||||
#include <imgui.h>
|
||||
Log_SetChannel(GPU);
|
||||
|
||||
const GPU::GP0CommandHandlerTable GPU::s_GP0_command_handler_table = GPU::GenerateGP0CommandHandlerTable();
|
||||
|
||||
GPU::GPU() = default;
|
||||
|
||||
GPU::~GPU() = default;
|
||||
|
@ -32,7 +35,7 @@ void GPU::SoftReset()
|
|||
m_GPUSTAT.bits = 0x14802000;
|
||||
m_drawing_area = {};
|
||||
m_drawing_offset = {};
|
||||
m_crtc_state = {};
|
||||
std::memset(&m_crtc_state, 0, sizeof(m_crtc_state));
|
||||
m_crtc_state.regs.display_address_start = 0;
|
||||
m_crtc_state.regs.horizontal_display_range = 0xC60260;
|
||||
m_crtc_state.regs.vertical_display_range = 0x3FC10;
|
||||
|
@ -493,7 +496,7 @@ void GPU::WriteGP0(u32 value)
|
|||
const u32 command = m_GP0_buffer[0] >> 24;
|
||||
if ((this->*s_GP0_command_handler_table[command])(command_ptr, static_cast<u32>(m_GP0_buffer.size())))
|
||||
{
|
||||
DebugAssert((command_ptr - m_GP0_buffer.data()) == m_GP0_buffer.size());
|
||||
DebugAssert(static_cast<size_t>(command_ptr - m_GP0_buffer.data()) == m_GP0_buffer.size());
|
||||
m_GP0_buffer.clear();
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include "types.h"
|
||||
#include <array>
|
||||
#include <deque>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
class StateWrapper;
|
||||
|
@ -355,7 +356,7 @@ protected:
|
|||
private:
|
||||
using GP0CommandHandler = bool (GPU::*)(const u32*&, u32);
|
||||
using GP0CommandHandlerTable = std::array<GP0CommandHandler, 256>;
|
||||
static constexpr GP0CommandHandlerTable GenerateGP0CommandHandlerTable();
|
||||
static GP0CommandHandlerTable GenerateGP0CommandHandlerTable();
|
||||
|
||||
// Rendering commands, returns false if not enough data is provided
|
||||
bool HandleUnknownGP0Command(const u32*& command_ptr, u32 command_size);
|
||||
|
|
|
@ -12,7 +12,7 @@ static constexpr u32 ReplaceZero(u32 value, u32 value_for_zero)
|
|||
return value == 0 ? value_for_zero : value;
|
||||
}
|
||||
|
||||
constexpr GPU::GP0CommandHandlerTable GPU::GenerateGP0CommandHandlerTable()
|
||||
GPU::GP0CommandHandlerTable GPU::GenerateGP0CommandHandlerTable()
|
||||
{
|
||||
GP0CommandHandlerTable table = {};
|
||||
for (u32 i = 0; i < static_cast<u32>(table.size()); i++)
|
||||
|
@ -45,8 +45,6 @@ constexpr GPU::GP0CommandHandlerTable GPU::GenerateGP0CommandHandlerTable()
|
|||
return table;
|
||||
}
|
||||
|
||||
constexpr GPU::GP0CommandHandlerTable GPU::s_GP0_command_handler_table = GPU::GenerateGP0CommandHandlerTable();
|
||||
|
||||
bool GPU::HandleUnknownGP0Command(const u32*& command_ptr, u32 command_size)
|
||||
{
|
||||
const u32 command = *(command_ptr++) >> 24;
|
||||
|
@ -85,7 +83,7 @@ bool GPU::HandleSetDrawModeCommand(const u32*& command_ptr, u32 command_size)
|
|||
|
||||
// 0..10 bits match GPUSTAT
|
||||
const u32 MASK = ((1 << 11) - 1);
|
||||
m_GPUSTAT.bits = (m_GPUSTAT.bits & ~MASK) | param & MASK;
|
||||
m_GPUSTAT.bits = (m_GPUSTAT.bits & ~MASK) | (param & MASK);
|
||||
m_GPUSTAT.texture_disable = (param & (1 << 11)) != 0;
|
||||
m_render_state.texture_x_flip = (param & (1 << 12)) != 0;
|
||||
m_render_state.texture_y_flip = (param & (1 << 13)) != 0;
|
||||
|
@ -337,7 +335,7 @@ bool GPU::HandleCopyRectangleVRAMToCPUCommand(const u32*& command_ptr, u32 comma
|
|||
|
||||
if (m_debug_options.dump_vram_to_cpu_copies)
|
||||
{
|
||||
DumpVRAMToFile(SmallString::FromFormat("vram_to_cpu_copy_%u.png", s_cpu_to_vram_dump_id++), width, height,
|
||||
DumpVRAMToFile(SmallString::FromFormat("vram_to_cpu_copy_%u.png", s_vram_to_cpu_dump_id++), width, height,
|
||||
sizeof(u16) * width, temp.data(), true);
|
||||
}
|
||||
|
||||
|
|
|
@ -78,7 +78,6 @@ void GPU_HW::LoadVertices(RenderCommand rc, u32 num_vertices, const u32* command
|
|||
m_batch.vertices.push_back(m_batch.vertices.back());
|
||||
|
||||
u32 buffer_pos = 1;
|
||||
const bool textured = rc.texture_enable;
|
||||
const u32 color = rc.color_for_first_vertex;
|
||||
const VertexPosition vp{command_ptr[buffer_pos++]};
|
||||
const s32 pos_left = vp.x;
|
||||
|
@ -520,9 +519,9 @@ void GPU_HW::DispatchRenderCommand(RenderCommand rc, u32 num_vertices, const u32
|
|||
const u32 max_added_vertices = num_vertices + 2;
|
||||
const bool buffer_overflow = (m_batch.vertices.size() + max_added_vertices) >= MAX_BATCH_VERTEX_COUNT;
|
||||
const bool rc_changed =
|
||||
m_batch.render_command_bits != rc.bits && m_batch.transparency_enable != rc_transparency_enable ||
|
||||
m_batch.render_command_bits != rc.bits && (m_batch.transparency_enable != rc_transparency_enable ||
|
||||
m_batch.texture_enable != rc_texture_enable || m_batch.texture_blending_enable != rc_texture_blend_enable ||
|
||||
m_batch.primitive != rc_primitive;
|
||||
m_batch.primitive != rc_primitive);
|
||||
const bool restart_line_strip = (rc_primitive == HWRenderBatch::Primitive::LineStrip);
|
||||
const bool needs_flush =
|
||||
!IsFlushed() && (m_render_state.IsTextureColorModeChanged() || m_render_state.IsTransparencyModeChanged() ||
|
||||
|
|
|
@ -515,7 +515,6 @@ void GPU_HW_OpenGL::ReadVRAM(u32 x, u32 y, u32 width, u32 height, void* buffer)
|
|||
// downscaling to 1xIR.
|
||||
if (m_resolution_scale > 1)
|
||||
{
|
||||
const u32 texture_width = m_vram_texture->GetWidth();
|
||||
const u32 texture_height = m_vram_texture->GetHeight();
|
||||
const u32 scaled_x = x * m_resolution_scale;
|
||||
const u32 scaled_y = y * m_resolution_scale;
|
||||
|
|
|
@ -50,12 +50,13 @@ void Core::Initialize() {}
|
|||
|
||||
void Core::Reset()
|
||||
{
|
||||
m_regs = {};
|
||||
std::memset(&m_regs, 0, sizeof(m_regs));
|
||||
}
|
||||
|
||||
bool Core::DoState(StateWrapper& sw)
|
||||
{
|
||||
sw.DoPOD(&m_regs);
|
||||
sw.DoArray(m_regs.dr32, NUM_DATA_REGS);
|
||||
sw.DoArray(m_regs.cr32, NUM_CONTROL_REGS);
|
||||
return !sw.HasError();
|
||||
}
|
||||
|
||||
|
|
|
@ -134,7 +134,7 @@ void MDEC::DMAWrite(const u32* words, u32 word_count)
|
|||
|
||||
void MDEC::SoftReset()
|
||||
{
|
||||
m_status = {};
|
||||
m_status.bits = 0;
|
||||
m_enable_dma_in = false;
|
||||
m_enable_dma_out = false;
|
||||
m_data_in_fifo.Clear();
|
||||
|
|
|
@ -205,7 +205,7 @@ void SPU::WriteRegister(u32 offset, u16 value)
|
|||
{
|
||||
Log_DebugPrintf("SPU control register <- 0x%04X", ZeroExtend32(value));
|
||||
m_SPUCNT.bits = value;
|
||||
m_SPUSTAT.mode = m_SPUCNT.mode;
|
||||
m_SPUSTAT.mode = m_SPUCNT.mode.GetValue();
|
||||
m_SPUSTAT.dma_read_write_request = m_SPUCNT.ram_transfer_mode >= RAMTransferMode::DMAWrite;
|
||||
|
||||
if (!m_SPUCNT.irq9_enable)
|
||||
|
|
|
@ -361,7 +361,7 @@ void Timers::DrawDebugWindow()
|
|||
ImGui::NextColumn();
|
||||
ImGui::Text("%s%s", clock_source_names[i][cs.mode.clock_source], cs.external_counting_enabled ? " (External)" : "");
|
||||
ImGui::NextColumn();
|
||||
ImGui::Text("%s", cs.mode.reached_target ? "Target " : "", cs.mode.reached_overflow ? "Overflow" : "");
|
||||
ImGui::Text("%s%s", cs.mode.reached_target ? "Target " : "", cs.mode.reached_overflow ? "Overflow" : "");
|
||||
ImGui::NextColumn();
|
||||
ImGui::PopStyleColor();
|
||||
}
|
||||
|
|
|
@ -720,7 +720,7 @@ void SDLInterface::DrawPoweredOffWindow()
|
|||
ImVec2(APP_ICON_WIDTH, APP_ICON_HEIGHT));
|
||||
ImGui::SetCursorPosY(APP_ICON_HEIGHT + 32);
|
||||
|
||||
static const ImVec2 button_size(200.0f, 40.0f);
|
||||
static const ImVec2 button_size(static_cast<float>(BUTTON_WIDTH), static_cast<float>(BUTTON_HEIGHT));
|
||||
constexpr float button_left = static_cast<float>((WINDOW_WIDTH - BUTTON_WIDTH) / 2);
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 8.0f);
|
||||
|
|
Loading…
Reference in New Issue