@@ -204,7 +204,7 @@ WXLRESULT CRenderFrame::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lPa
// Let Core finish initializing before accepting any WM_CLOSE messages
if (!Core::IsRunning())
break;
// Use default action otherwise
// Use default action otherwise

default:
// By default let wxWidgets do what it normally does with this event
@@ -670,14 +670,15 @@ void CFrame::OnResize(wxSizeEvent& event)

// Make sure the logger pane is a sane size
if (!m_code_window && m_log_window && m_mgr->GetPane("Pane 1").IsShown() &&
!m_mgr->GetPane("Pane 1").IsFloating() && (m_log_window->x > GetClientRect().GetWidth() ||
m_log_window->y > GetClientRect().GetHeight()))
!m_mgr->GetPane("Pane 1").IsFloating() &&
(m_log_window->x > GetClientRect().GetWidth() ||
m_log_window->y > GetClientRect().GetHeight()))
{
ShowResizePane();
}
}

// Host messages
// Host messages

#ifdef _WIN32
WXLRESULT CFrame::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
@@ -735,7 +736,7 @@ void CFrame::OnHostMessage(wxCommandEvent& event)
case IDM_UPDATE_DISASM_DIALOG: // For breakpoints causing pausing
if (!m_code_window || Core::GetState() != Core::State::Paused)
return;
// fallthrough
// fallthrough

case IDM_UPDATE_GUI:
UpdateGUI();
@@ -856,10 +856,11 @@ void CFrame::DoStop()
}

wxMessageDialog m_StopDlg(
this, !m_tried_graceful_shutdown ? _("Do you want to stop the current emulation?") :
_("A shutdown is already in progress. Unsaved data "
"may be lost if you stop the current emulation "
"before it completes. Force stop?"),
this,
!m_tried_graceful_shutdown ? _("Do you want to stop the current emulation?") :
_("A shutdown is already in progress. Unsaved data "
"may be lost if you stop the current emulation "
"before it completes. Force stop?"),
_("Please confirm..."), wxYES_NO | wxSTAY_ON_TOP | wxICON_EXCLAMATION, wxDefaultPosition);

HotkeyManagerEmu::Enable(false);
@@ -1126,8 +1126,9 @@ void GameListCtrl::CompressSelection(bool _compress)
wxProgressDialog progressDialog(
_compress ? _("Compressing ISO") : _("Decompressing ISO"), _("Working..."),
1000, // Arbitrary number that's larger than the dialog's width in pixels
this, wxPD_APP_MODAL | wxPD_CAN_ABORT | wxPD_ELAPSED_TIME | wxPD_ESTIMATED_TIME |
wxPD_REMAINING_TIME | wxPD_SMOOTH);
this,
wxPD_APP_MODAL | wxPD_CAN_ABORT | wxPD_ELAPSED_TIME | wxPD_ESTIMATED_TIME |
wxPD_REMAINING_TIME | wxPD_SMOOTH);

CompressionProgress progress(0, items_to_compress.size(), "", &progressDialog);

@@ -256,9 +256,10 @@ void CISOProperties::CreateGUIControls()
_("Info"));

// GameConfig editing - Overrides and emulation state
wxStaticText* const OverrideText = new wxStaticText(
m_GameConfig, wxID_ANY, _("These settings override core Dolphin settings.\nUndetermined "
"means the game uses Dolphin's setting."));
wxStaticText* const OverrideText =
new wxStaticText(m_GameConfig, wxID_ANY,
_("These settings override core Dolphin settings.\nUndetermined "
"means the game uses Dolphin's setting."));

// Core
m_cpu_thread =
@@ -91,8 +91,9 @@ void CLogWindow::CreateGUIControls()
m_WrapLine->SetValue(wrap_lines);

// Log viewer
m_Log = CreateTextCtrl(this, wxID_ANY, wxTE_RICH | wxTE_MULTILINE | wxTE_READONLY |
(wrap_lines ? wxTE_WORDWRAP : wxTE_DONTWRAP));
m_Log = CreateTextCtrl(this, wxID_ANY,
wxTE_RICH | wxTE_MULTILINE | wxTE_READONLY |
(wrap_lines ? wxTE_WORDWRAP : wxTE_DONTWRAP));

// submit row
m_cmdline = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize,
@@ -77,6 +77,7 @@ class MainMenuBar::PopulatePerspectivesEvent final : public wxEvent
const std::vector<std::string>& PerspectiveNames() const { return m_perspective_names; }
int ActivePerspective() const { return m_active_perspective; }
wxEvent* Clone() const override { return new PopulatePerspectivesEvent(*this); }

private:
std::vector<std::string> m_perspective_names;
int m_active_perspective{};
@@ -7,7 +7,6 @@
#include <map>
#include <string>
#include <vector>
#include <vector>
#include <wx/dialog.h>

class NetPlayServer;
@@ -35,6 +35,7 @@ class PostProcessingConfigDiag : public wxDialog
public:
UserEventData(const std::string& data) : m_data(data) {}
const std::string& GetData() { return m_data; }

private:
const std::string m_data;
};
@@ -44,24 +44,49 @@ struct TASWiimoteReport
};

constexpr std::array<int, 12> s_gc_pad_buttons_bitmask{{
PAD_BUTTON_DOWN, PAD_BUTTON_UP, PAD_BUTTON_LEFT, PAD_BUTTON_RIGHT, PAD_BUTTON_A, PAD_BUTTON_B,
PAD_BUTTON_X, PAD_BUTTON_Y, PAD_TRIGGER_Z, PAD_TRIGGER_L, PAD_TRIGGER_R, PAD_BUTTON_START,
PAD_BUTTON_DOWN,
PAD_BUTTON_UP,
PAD_BUTTON_LEFT,
PAD_BUTTON_RIGHT,
PAD_BUTTON_A,
PAD_BUTTON_B,
PAD_BUTTON_X,
PAD_BUTTON_Y,
PAD_TRIGGER_Z,
PAD_TRIGGER_L,
PAD_TRIGGER_R,
PAD_BUTTON_START,
}};

constexpr std::array<int, 11> s_wii_buttons_bitmask{{
WiimoteEmu::Wiimote::PAD_DOWN, WiimoteEmu::Wiimote::PAD_UP, WiimoteEmu::Wiimote::PAD_LEFT,
WiimoteEmu::Wiimote::PAD_RIGHT, WiimoteEmu::Wiimote::BUTTON_A, WiimoteEmu::Wiimote::BUTTON_B,
WiimoteEmu::Wiimote::BUTTON_ONE, WiimoteEmu::Wiimote::BUTTON_TWO,
WiimoteEmu::Wiimote::BUTTON_PLUS, WiimoteEmu::Wiimote::BUTTON_MINUS,
WiimoteEmu::Wiimote::PAD_DOWN,
WiimoteEmu::Wiimote::PAD_UP,
WiimoteEmu::Wiimote::PAD_LEFT,
WiimoteEmu::Wiimote::PAD_RIGHT,
WiimoteEmu::Wiimote::BUTTON_A,
WiimoteEmu::Wiimote::BUTTON_B,
WiimoteEmu::Wiimote::BUTTON_ONE,
WiimoteEmu::Wiimote::BUTTON_TWO,
WiimoteEmu::Wiimote::BUTTON_PLUS,
WiimoteEmu::Wiimote::BUTTON_MINUS,
WiimoteEmu::Wiimote::BUTTON_HOME,
}};

constexpr std::array<int, 15> s_cc_buttons_bitmask{{
WiimoteEmu::Classic::PAD_DOWN, WiimoteEmu::Classic::PAD_UP, WiimoteEmu::Classic::PAD_LEFT,
WiimoteEmu::Classic::PAD_RIGHT, WiimoteEmu::Classic::BUTTON_A, WiimoteEmu::Classic::BUTTON_B,
WiimoteEmu::Classic::BUTTON_X, WiimoteEmu::Classic::BUTTON_Y, WiimoteEmu::Classic::BUTTON_PLUS,
WiimoteEmu::Classic::BUTTON_MINUS, WiimoteEmu::Classic::TRIGGER_L,
WiimoteEmu::Classic::TRIGGER_R, WiimoteEmu::Classic::BUTTON_ZR, WiimoteEmu::Classic::BUTTON_ZL,
WiimoteEmu::Classic::PAD_DOWN,
WiimoteEmu::Classic::PAD_UP,
WiimoteEmu::Classic::PAD_LEFT,
WiimoteEmu::Classic::PAD_RIGHT,
WiimoteEmu::Classic::BUTTON_A,
WiimoteEmu::Classic::BUTTON_B,
WiimoteEmu::Classic::BUTTON_X,
WiimoteEmu::Classic::BUTTON_Y,
WiimoteEmu::Classic::BUTTON_PLUS,
WiimoteEmu::Classic::BUTTON_MINUS,
WiimoteEmu::Classic::TRIGGER_L,
WiimoteEmu::Classic::TRIGGER_R,
WiimoteEmu::Classic::BUTTON_ZR,
WiimoteEmu::Classic::BUTTON_ZL,
WiimoteEmu::Classic::BUTTON_HOME,
}};

@@ -328,8 +328,9 @@ static wxString shader_compile_before_start_desc =
"queue may reduce frame rates. Otherwise, if unsure, leave this unchecked.");

VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string& title)
: wxDialog(parent, wxID_ANY, wxString::Format(_("Dolphin %s Graphics Configuration"),
wxGetTranslation(StrToWxStr(title)))),
: wxDialog(parent, wxID_ANY,
wxString::Format(_("Dolphin %s Graphics Configuration"),
wxGetTranslation(StrToWxStr(title)))),
vconfig(g_Config)
{
// We don't need to load the config if the core is running, since it would have been done
@@ -131,8 +131,8 @@ ciface::Core::Device::Control* InputReference::Detect(const unsigned int ms,

// get starting state of all inputs,
// so we can ignore those that were activated at time of Detect start
std::vector<ciface::Core::Device::Input *>::const_iterator i = device->Inputs().begin(),
e = device->Inputs().end();
std::vector<ciface::Core::Device::Input*>::const_iterator i = device->Inputs().begin(),
e = device->Inputs().end();
for (std::vector<bool>::iterator state = states.begin(); i != e; ++i)
*state++ = ((*i)->GetState() > (1 - INPUT_DETECT_THRESHOLD));

@@ -405,6 +405,7 @@ class Parser
public:
explicit Parser(std::vector<Token> tokens_) : tokens(tokens_) { m_it = tokens.begin(); }
ParseResult Parse() { return Toplevel(); }

private:
std::vector<Token> tokens;
std::vector<Token>::iterator m_it;
@@ -98,6 +98,7 @@ class Device
}

std::string GetName() const override { return m_low.GetName() + *m_high.GetName().rbegin(); }

private:
Input& m_low;
Input& m_high;
@@ -33,6 +33,7 @@ class PipeDevice : public Core::Device
void UpdateInput() override;
std::string GetName() const override { return m_name; }
std::string GetSource() const override { return "Pipe"; }

private:
class PipeInput : public Input
{
@@ -41,6 +42,7 @@ class PipeDevice : public Core::Device
std::string GetName() const override { return m_name; }
ControlState GetState() const override { return m_state; }
void SetState(ControlState state) { m_state = state; }

private:
const std::string m_name;
ControlState m_state;
@@ -74,6 +74,7 @@ class evdevDevice : public Core::Device
std::string GetName() const override { return m_name; }
std::string GetSource() const override { return "evdev"; }
bool IsInteresting() const { return m_initialized && m_interesting; }

private:
const std::string m_devfile;
int m_fd;
@@ -137,8 +137,9 @@ static void ScanThreadFunc()
if (s_libusb_hotplug_enabled)
{
if (libusb_hotplug_register_callback(
s_libusb_context, (libusb_hotplug_event)(LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED |
LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT),
s_libusb_context,
(libusb_hotplug_event)(LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED |
LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT),
LIBUSB_HOTPLUG_ENUMERATE, 0x057e, 0x0337, LIBUSB_HOTPLUG_MATCH_ANY, HotplugCallback,
nullptr, &s_hotplug_handle) != LIBUSB_SUCCESS)
s_libusb_hotplug_enabled = false;
@@ -267,8 +268,9 @@ static bool CheckDeviceAccess(libusb_device* device)
{
if (dRet)
{
ERROR_LOG(SERIALINTERFACE, "Dolphin does not have access to this device: Bus %03d Device "
"%03d: ID ????:???? (couldn't get id).",
ERROR_LOG(SERIALINTERFACE,
"Dolphin does not have access to this device: Bus %03d Device "
"%03d: ID ????:???? (couldn't get id).",
bus, port);
}
else
@@ -38,6 +38,7 @@ class InputConfig

std::string GetGUIName() const { return m_gui_name; }
std::string GetProfileName() const { return m_profile_name; }

private:
std::vector<std::unique_ptr<ControllerEmu::EmulatedController>> m_controllers;
const std::string m_ini_name;
@@ -35,8 +35,7 @@ namespace DX11
#define CHECK(cond, Message, ...) \
if (!(cond)) \
{ \
PanicAlert("%s failed in %s at line %d: " Message, __func__, __FILE__, __LINE__, \
__VA_ARGS__); \
PanicAlert("%s failed in %s at line %d: " Message, __func__, __FILE__, __LINE__, __VA_ARGS__); \
}

class D3DTexture2D;
@@ -89,6 +89,7 @@ class UtilVertexBuffer
void EndAppendData() { context->Unmap(buf, 0); }
void AddWrapObserver(bool* observer) { observers.push_back(observer); }
inline ID3D11Buffer*& GetBuffer() { return buf; }

private:
ID3D11Buffer* buf = nullptr;
unsigned int offset = 0;
@@ -645,7 +646,10 @@ void drawShadedTexQuad(ID3D11ShaderResourceView* texture, const D3D11_RECT* rSou
void drawColorQuad(u32 Color, float z, float x1, float y1, float x2, float y2)
{
ColVertex coords[4] = {
{x1, y1, z, Color}, {x2, y1, z, Color}, {x1, y2, z, Color}, {x2, y2, z, Color},
{x1, y1, z, Color},
{x2, y1, z, Color},
{x1, y2, z, Color},
{x2, y2, z, Color},
};

if (cq_observer || draw_quad_data.x1 != x1 || draw_quad_data.y1 != y1 ||
@@ -23,19 +23,47 @@ VertexManager::CreateNativeVertexFormat(const PortableVertexDeclaration& vtx_dec

static const DXGI_FORMAT d3d_format_lookup[5 * 4 * 2] = {
// float formats
DXGI_FORMAT_R8_UNORM, DXGI_FORMAT_R8_SNORM, DXGI_FORMAT_R16_UNORM, DXGI_FORMAT_R16_SNORM,
DXGI_FORMAT_R32_FLOAT, DXGI_FORMAT_R8G8_UNORM, DXGI_FORMAT_R8G8_SNORM, DXGI_FORMAT_R16G16_UNORM,
DXGI_FORMAT_R16G16_SNORM, DXGI_FORMAT_R32G32_FLOAT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN,
DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_R32G32B32_FLOAT,
DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_SNORM, DXGI_FORMAT_R16G16B16A16_UNORM,
DXGI_FORMAT_R16G16B16A16_SNORM, DXGI_FORMAT_R32G32B32A32_FLOAT,
DXGI_FORMAT_R8_UNORM,
DXGI_FORMAT_R8_SNORM,
DXGI_FORMAT_R16_UNORM,
DXGI_FORMAT_R16_SNORM,
DXGI_FORMAT_R32_FLOAT,
DXGI_FORMAT_R8G8_UNORM,
DXGI_FORMAT_R8G8_SNORM,
DXGI_FORMAT_R16G16_UNORM,
DXGI_FORMAT_R16G16_SNORM,
DXGI_FORMAT_R32G32_FLOAT,
DXGI_FORMAT_UNKNOWN,
DXGI_FORMAT_UNKNOWN,
DXGI_FORMAT_UNKNOWN,
DXGI_FORMAT_UNKNOWN,
DXGI_FORMAT_R32G32B32_FLOAT,
DXGI_FORMAT_R8G8B8A8_UNORM,
DXGI_FORMAT_R8G8B8A8_SNORM,
DXGI_FORMAT_R16G16B16A16_UNORM,
DXGI_FORMAT_R16G16B16A16_SNORM,
DXGI_FORMAT_R32G32B32A32_FLOAT,

// integer formats
DXGI_FORMAT_R8_UINT, DXGI_FORMAT_R8_SINT, DXGI_FORMAT_R16_UINT, DXGI_FORMAT_R16_SINT,
DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_R8G8_UINT, DXGI_FORMAT_R8G8_SINT, DXGI_FORMAT_R16G16_UINT,
DXGI_FORMAT_R16G16_SINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN,
DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_R8G8B8A8_UINT,
DXGI_FORMAT_R8G8B8A8_SINT, DXGI_FORMAT_R16G16B16A16_UINT, DXGI_FORMAT_R16G16B16A16_SINT,
DXGI_FORMAT_R8_UINT,
DXGI_FORMAT_R8_SINT,
DXGI_FORMAT_R16_UINT,
DXGI_FORMAT_R16_SINT,
DXGI_FORMAT_UNKNOWN,
DXGI_FORMAT_R8G8_UINT,
DXGI_FORMAT_R8G8_SINT,
DXGI_FORMAT_R16G16_UINT,
DXGI_FORMAT_R16G16_SINT,
DXGI_FORMAT_UNKNOWN,
DXGI_FORMAT_UNKNOWN,
DXGI_FORMAT_UNKNOWN,
DXGI_FORMAT_UNKNOWN,
DXGI_FORMAT_UNKNOWN,
DXGI_FORMAT_UNKNOWN,
DXGI_FORMAT_R8G8B8A8_UINT,
DXGI_FORMAT_R8G8B8A8_SINT,
DXGI_FORMAT_R16G16B16A16_UINT,
DXGI_FORMAT_R16G16B16A16_SINT,
DXGI_FORMAT_UNKNOWN,
};

@@ -48,6 +48,7 @@ class VertexManager : public VertexManagerBase
protected:
void ResetBuffer(u32 stride) override;
u16* GetIndexBuffer() { return &LocalIBuffer[0]; }

private:
void PrepareDrawBuffers(u32 stride);
void Draw(u32 stride);
@@ -263,23 +263,27 @@ FramebufferManager::FramebufferManager(int targetWidth, int targetHeight, int ms
"vec4 sampleEFB(ivec3 pos) {\n"
" vec4 color = vec4(0.0, 0.0, 0.0, 0.0);\n"
" for(int i=0; i<" +
samples.str() + "; i++)\n"
" color += texelFetch(samp9, pos, i);\n"
" return color / " +
samples.str() + ";\n"
"}\n";
samples.str() +
"; i++)\n"
" color += texelFetch(samp9, pos, i);\n"
" return color / " +
samples.str() +
";\n"
"}\n";
}
else
{
sampler = "SAMPLER_BINDING(9) uniform sampler2DMS samp9;\n"
"vec4 sampleEFB(ivec3 pos) {\n"
" vec4 color = vec4(0.0, 0.0, 0.0, 0.0);\n"
" for(int i=0; i<" +
samples.str() + "; i++)\n"
" color += texelFetch(samp9, pos.xy, i);\n"
" return color / " +
samples.str() + ";\n"
"}\n";
samples.str() +
"; i++)\n"
" color += texelFetch(samp9, pos.xy, i);\n"
" return color / " +
samples.str() +
";\n"
"}\n";
}
}

@@ -316,21 +320,23 @@ FramebufferManager::FramebufferManager(int targetWidth, int targetHeight, int ms
layers << m_EFBLayers;
std::string gs = "layout(triangles) in;\n"
"layout(triangle_strip, max_vertices = " +
vertices.str() + ") out;\n"
"flat out int layer;\n"
"void main()\n"
"{\n"
" for (int j = 0; j < " +
layers.str() + "; ++j) {\n"
" for (int i = 0; i < 3; ++i) {\n"
" layer = j;\n"
" gl_Layer = j;\n"
" gl_Position = gl_in[i].gl_Position;\n"
" EmitVertex();\n"
" }\n"
" EndPrimitive();\n"
" }\n"
"}\n";
vertices.str() +
") out;\n"
"flat out int layer;\n"
"void main()\n"
"{\n"
" for (int j = 0; j < " +
layers.str() +
"; ++j) {\n"
" for (int i = 0; i < 3; ++i) {\n"
" layer = j;\n"
" gl_Layer = j;\n"
" gl_Position = gl_in[i].gl_Position;\n"
" EmitVertex();\n"
" }\n"
" EndPrimitive();\n"
" }\n"
"}\n";

ProgramShaderCache::CompileShader(m_pixel_format_shaders[0], vs, ps_rgb8_to_rgba6,
(m_EFBLayers > 1) ? gs : "");
@@ -1302,24 +1302,24 @@ void Renderer::ApplyBlendingState(const BlendingState state, bool force)
}
else
{
const GLenum src_factors[8] = {
GL_ZERO,
GL_ONE,
GL_DST_COLOR,
GL_ONE_MINUS_DST_COLOR,
useDualSource ? GL_SRC1_ALPHA : (GLenum)GL_SRC_ALPHA,
useDualSource ? GL_ONE_MINUS_SRC1_ALPHA : (GLenum)GL_ONE_MINUS_SRC_ALPHA,
GL_DST_ALPHA,
GL_ONE_MINUS_DST_ALPHA};
const GLenum dst_factors[8] = {
GL_ZERO,
GL_ONE,
GL_SRC_COLOR,
GL_ONE_MINUS_SRC_COLOR,
useDualSource ? GL_SRC1_ALPHA : (GLenum)GL_SRC_ALPHA,
useDualSource ? GL_ONE_MINUS_SRC1_ALPHA : (GLenum)GL_ONE_MINUS_SRC_ALPHA,
GL_DST_ALPHA,
GL_ONE_MINUS_DST_ALPHA};
const GLenum src_factors[8] = {GL_ZERO,
GL_ONE,
GL_DST_COLOR,
GL_ONE_MINUS_DST_COLOR,
useDualSource ? GL_SRC1_ALPHA : (GLenum)GL_SRC_ALPHA,
useDualSource ? GL_ONE_MINUS_SRC1_ALPHA :
(GLenum)GL_ONE_MINUS_SRC_ALPHA,
GL_DST_ALPHA,
GL_ONE_MINUS_DST_ALPHA};
const GLenum dst_factors[8] = {GL_ZERO,
GL_ONE,
GL_SRC_COLOR,
GL_ONE_MINUS_SRC_COLOR,
useDualSource ? GL_SRC1_ALPHA : (GLenum)GL_SRC_ALPHA,
useDualSource ? GL_ONE_MINUS_SRC1_ALPHA :
(GLenum)GL_ONE_MINUS_SRC_ALPHA,
GL_DST_ALPHA,
GL_ONE_MINUS_DST_ALPHA};

if (state.blendenable)
{
@@ -226,11 +226,13 @@ class BufferStorage : public StreamBuffer
// COHERENT_BIT is set so we don't have to use a MemoryBarrier on write
// CLIENT_STORAGE_BIT is set since we access the buffer more frequently on the client side then
// server side
glBufferStorage(m_buffertype, m_size, nullptr, GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT |
(coherent ? GL_MAP_COHERENT_BIT : 0));
m_pointer = (u8*)glMapBufferRange(
m_buffertype, 0, m_size, GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT |
(coherent ? GL_MAP_COHERENT_BIT : GL_MAP_FLUSH_EXPLICIT_BIT));
glBufferStorage(m_buffertype, m_size, nullptr,
GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT |
(coherent ? GL_MAP_COHERENT_BIT : 0));
m_pointer =
(u8*)glMapBufferRange(m_buffertype, 0, m_size,
GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT |
(coherent ? GL_MAP_COHERENT_BIT : GL_MAP_FLUSH_EXPLICIT_BIT));
}

~BufferStorage()
@@ -776,9 +776,9 @@ void Tev::Draw()
// Based on that, choose the index such that points which are far away from the z-axis use the
// 10th "k" value and such that central points use the first value.
float floatindex = 9.f - std::abs(offset) * 9.f;
floatindex = (floatindex < 0.f) ? 0.f : (floatindex > 9.f) ?
9.f :
floatindex; // TODO: This shouldn't be necessary!
floatindex = (floatindex < 0.f) ?
0.f :
(floatindex > 9.f) ? 9.f : floatindex; // TODO: This shouldn't be necessary!

// Get the two closest integer indices, look up the corresponding samples
const int indexlower = (int)floor(floatindex);
@@ -1216,7 +1216,7 @@ static void EncodeZ24(u8* dst, const u8* src, EFBCopyFormat format)
ENCODE_LOOP_SPANS
break;

// FIXME: handle RA8?
// FIXME: handle RA8?

case EFBCopyFormat::RGBA8:
SetBlockDimensions(2, 2, &sBlkCount, &tBlkCount, &sBlkSize, &tBlkSize);
@@ -1326,7 +1326,7 @@ static void EncodeZ24halfscale(u8* dst, const u8* src, EFBCopyFormat format)
ENCODE_LOOP_SPANS
break;

// FIXME: handle RA8?
// FIXME: handle RA8?

case EFBCopyFormat::RGBA8:
SetBlockDimensions(2, 2, &sBlkCount, &tBlkCount, &sBlkSize, &tBlkSize);
@@ -228,7 +228,8 @@ bool FramebufferManager::CreateEFBFramebuffer()
}

VkImageView framebuffer_attachments[] = {
m_efb_color_texture->GetView(), m_efb_depth_texture->GetView(),
m_efb_color_texture->GetView(),
m_efb_depth_texture->GetView(),
};

VkFramebufferCreateInfo framebuffer_info = {VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO,
@@ -52,8 +52,9 @@ bool PerfQuery::Initialize()
}

g_command_buffer_mgr->AddFencePointCallback(
this, std::bind(&PerfQuery::OnCommandBufferQueued, this, std::placeholders::_1,
std::placeholders::_2),
this,
std::bind(&PerfQuery::OnCommandBufferQueued, this, std::placeholders::_1,
std::placeholders::_2),
std::bind(&PerfQuery::OnCommandBufferExecuted, this, std::placeholders::_1));

return true;
@@ -116,6 +116,7 @@ class ShaderCache
VkShaderModule GetPassthroughVertexShader() const { return m_passthrough_vertex_shader; }
VkShaderModule GetScreenQuadGeometryShader() const { return m_screen_quad_geometry_shader; }
VkShaderModule GetPassthroughGeometryShader() const { return m_passthrough_geometry_shader; }

private:
bool CreatePipelineCache();
bool LoadPipelineCache();
@@ -365,7 +365,8 @@ const TBuiltInResource* GetCompilerResourceLimits()
/* .MaxCullDistances = */ 8,
/* .MaxCombinedClipAndCullDistances = */ 8,
/* .MaxSamples = */ 4,
/* .limits = */ {
/* .limits = */
{
/* .nonInductiveForLoops = */ 1,
/* .whileLoops = */ 1,
/* .doWhileLoops = */ 1,
@@ -22,8 +22,9 @@ StreamBuffer::StreamBuffer(VkBufferUsageFlags usage, size_t max_size)
{
// Add a callback that fires on fence point creation and signal
g_command_buffer_mgr->AddFencePointCallback(
this, std::bind(&StreamBuffer::OnCommandBufferQueued, this, std::placeholders::_1,
std::placeholders::_2),
this,
std::bind(&StreamBuffer::OnCommandBufferQueued, this, std::placeholders::_1,
std::placeholders::_2),
std::bind(&StreamBuffer::OnCommandBufferExecuted, this, std::placeholders::_1));
}

@@ -244,8 +244,9 @@ void TextureConverter::EncodeTextureToMemory(VkImageView src_texture, u8* dest_p
// complex down filtering to average all pixels and produce the correct result.
bool linear_filter =
(scale_by_half && !params.depth) || g_renderer->GetEFBScale() != 1 || params.y_scale > 1.0f;
draw.SetPSSampler(0, src_texture, linear_filter ? g_object_cache->GetLinearSampler() :
g_object_cache->GetPointSampler());
draw.SetPSSampler(0, src_texture,
linear_filter ? g_object_cache->GetLinearSampler() :
g_object_cache->GetPointSampler());

u32 render_width = bytes_per_row / sizeof(u32);
u32 render_height = num_blocks_y;
@@ -585,12 +585,18 @@ void UtilityShaderDraw::BindDescriptors()
if (set == VK_NULL_HANDLE)
PanicAlert("Failed to allocate descriptor set for utility draw");

set_writes[num_set_writes++] = {
VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET, nullptr, set, UBO_DESCRIPTOR_SET_BINDING_VS, 0, 1,
VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC, nullptr,
(m_vs_uniform_buffer.buffer != VK_NULL_HANDLE) ? &m_vs_uniform_buffer :
&dummy_uniform_buffer,
nullptr};
set_writes[num_set_writes++] = {VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET,
nullptr,
set,
UBO_DESCRIPTOR_SET_BINDING_VS,
0,
1,
VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC,
nullptr,
(m_vs_uniform_buffer.buffer != VK_NULL_HANDLE) ?
&m_vs_uniform_buffer :
&dummy_uniform_buffer,
nullptr};

if (g_vulkan_context->SupportsGeometryShaders())
{
@@ -606,12 +612,18 @@ void UtilityShaderDraw::BindDescriptors()
nullptr};
}

set_writes[num_set_writes++] = {
VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET, nullptr, set, UBO_DESCRIPTOR_SET_BINDING_PS, 0, 1,
VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC, nullptr,
(m_ps_uniform_buffer.buffer != VK_NULL_HANDLE) ? &m_ps_uniform_buffer :
&dummy_uniform_buffer,
nullptr};
set_writes[num_set_writes++] = {VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET,
nullptr,
set,
UBO_DESCRIPTOR_SET_BINDING_PS,
0,
1,
VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC,
nullptr,
(m_ps_uniform_buffer.buffer != VK_NULL_HANDLE) ?
&m_ps_uniform_buffer :
&dummy_uniform_buffer,
nullptr};

bind_descriptor_sets[DESCRIPTOR_SET_BIND_POINT_UNIFORM_BUFFERS] = set;
}
@@ -131,12 +131,14 @@ void VKTexture::CopyRectangleFromTexture(const AbstractTexture* src,
{
Texture2D* src_texture = static_cast<const VKTexture*>(src)->GetRawTexIdentifier();

ASSERT_MSG(VIDEO, static_cast<u32>(src_rect.GetWidth()) <= src_texture->GetWidth() &&
static_cast<u32>(src_rect.GetHeight()) <= src_texture->GetHeight(),
ASSERT_MSG(VIDEO,
static_cast<u32>(src_rect.GetWidth()) <= src_texture->GetWidth() &&
static_cast<u32>(src_rect.GetHeight()) <= src_texture->GetHeight(),
"Source rect is too large for CopyRectangleFromTexture");

ASSERT_MSG(VIDEO, static_cast<u32>(dst_rect.GetWidth()) <= m_config.width &&
static_cast<u32>(dst_rect.GetHeight()) <= m_config.height,
ASSERT_MSG(VIDEO,
static_cast<u32>(dst_rect.GetWidth()) <= m_config.width &&
static_cast<u32>(dst_rect.GetHeight()) <= m_config.height,
"Dest rect is too large for CopyRectangleFromTexture");

VkImageCopy image_copy = {
@@ -552,7 +552,8 @@ bool VulkanContext::CreateDevice(VkSurfaceKHR surface, bool enable_validation_la
present_queue_info.pQueuePriorities = queue_priorities;

std::array<VkDeviceQueueCreateInfo, 2> queue_infos = {{
graphics_queue_info, present_queue_info,
graphics_queue_info,
present_queue_info,
}};

device_info.queueCreateInfoCount = 1;
@@ -79,6 +79,7 @@ class AsyncRequests
void SetPassthrough(bool enable);

static AsyncRequests* GetInstance() { return &s_singleton; }

private:
void PullEventsInternal();
void HandleEvent(const Event& e);
@@ -253,8 +253,9 @@ static void BPWritten(const BPCmd& bp)

u32 height = static_cast<u32>(num_xfb_lines);

DEBUG_LOG(VIDEO, "RenderToXFB: destAddr: %08x | srcRect {%d %d %d %d} | fbWidth: %u | "
"fbStride: %u | fbHeight: %u | yScale: %f",
DEBUG_LOG(VIDEO,
"RenderToXFB: destAddr: %08x | srcRect {%d %d %d %d} | fbWidth: %u | "
"fbStride: %u | fbHeight: %u | yScale: %f",
destAddr, srcRect.left, srcRect.top, srcRect.right, srcRect.bottom,
bpmem.copyTexSrcWH.x + 1, destStride, height, yScale);

@@ -1002,27 +1003,28 @@ void GetBPRegInfo(const u8* data, std::string* name, std::string* desc)
SetRegName(BPMEM_TRIGGER_EFB_COPY);
UPE_Copy copy;
copy.Hex = cmddata;
*desc = StringFromFormat("Clamping: %s\n"
"Converting from RGB to YUV: %s\n"
"Target pixel format: 0x%X\n"
"Gamma correction: %s\n"
"Mipmap filter: %s\n"
"Vertical scaling: %s\n"
"Clear: %s\n"
"Frame to field: 0x%01X\n"
"Copy to XFB: %s\n"
"Intensity format: %s\n"
"Automatic color conversion: %s",
(copy.clamp0 && copy.clamp1) ? "Top and Bottom" : (copy.clamp0) ?
"Top only" :
(copy.clamp1) ? "Bottom only" : "None",
no_yes[copy.yuv], static_cast<int>(copy.tp_realFormat()),
(copy.gamma == 0) ? "1.0" : (copy.gamma == 1) ?
"1.7" :
(copy.gamma == 2) ? "2.2" : "Invalid value 0x3?",
no_yes[copy.half_scale], no_yes[copy.scale_invert], no_yes[copy.clear],
(u32)copy.frame_to_field, no_yes[copy.copy_to_xfb],
no_yes[copy.intensity_fmt], no_yes[copy.auto_conv]);
*desc = StringFromFormat(
"Clamping: %s\n"
"Converting from RGB to YUV: %s\n"
"Target pixel format: 0x%X\n"
"Gamma correction: %s\n"
"Mipmap filter: %s\n"
"Vertical scaling: %s\n"
"Clear: %s\n"
"Frame to field: 0x%01X\n"
"Copy to XFB: %s\n"
"Intensity format: %s\n"
"Automatic color conversion: %s",
(copy.clamp0 && copy.clamp1) ?
"Top and Bottom" :
(copy.clamp0) ? "Top only" : (copy.clamp1) ? "Bottom only" : "None",
no_yes[copy.yuv], static_cast<int>(copy.tp_realFormat()),
(copy.gamma == 0) ?
"1.0" :
(copy.gamma == 1) ? "1.7" : (copy.gamma == 2) ? "2.2" : "Invalid value 0x3?",
no_yes[copy.half_scale], no_yes[copy.scale_invert], no_yes[copy.clear],
(u32)copy.frame_to_field, no_yes[copy.copy_to_xfb], no_yes[copy.intensity_fmt],
no_yes[copy.auto_conv]);
}
break;

@@ -18,6 +18,7 @@ class FPSCounter
void Update();

float GetFPS() const { return m_fps; }

private:
u64 m_last_time = 0;
u64 m_time_since_update = 0;
@@ -19,6 +19,7 @@ class FramebufferManagerBase
virtual ~FramebufferManagerBase();

static unsigned int GetEFBLayers() { return m_EFBLayers; }

protected:
static unsigned int m_EFBLayers;
};
@@ -379,16 +379,18 @@ std::unique_ptr<HiresTexture> HiresTexture::Load(const std::string& base_filenam
const Level& first_mip = ret->m_levels[0];
if (first_mip.width * height != first_mip.height * width)
{
ERROR_LOG(VIDEO, "Invalid custom texture size %ux%u for texture %s. The aspect differs "
"from the native size %ux%u.",
ERROR_LOG(VIDEO,
"Invalid custom texture size %ux%u for texture %s. The aspect differs "
"from the native size %ux%u.",
first_mip.width, first_mip.height, first_mip_file.path.c_str(), width, height);
}

// Same deal if the custom texture isn't a multiple of the native size.
if (width != 0 && height != 0 && (first_mip.width % width || first_mip.height % height))
{
ERROR_LOG(VIDEO, "Invalid custom texture size %ux%u for texture %s. Please use an integer "
"upscaling factor based on the native size %ux%u.",
ERROR_LOG(VIDEO,
"Invalid custom texture size %ux%u for texture %s. Please use an integer "
"upscaling factor based on the native size %ux%u.",
first_mip.width, first_mip.height, first_mip_file.path.c_str(), width, height);
}

@@ -112,6 +112,7 @@ class NativeVertexFormat

u32 GetVertexStride() const { return vtx_decl.stride; }
const PortableVertexDeclaration& GetVertexDeclaration() const { return vtx_decl; }

protected:
// Let subclasses construct.
NativeVertexFormat() {}
@@ -50,6 +50,7 @@ class PerfQueryBase
// True if there are no further pending query results
// NOTE: Called from CPU thread
virtual bool IsFlushed() const { return true; }

protected:
// TODO: sloppy
volatile u32 m_query_count;
@@ -1194,7 +1194,10 @@ static void WriteTevRegular(ShaderCode& out, const char* components, int bias, i

const char* tevLerpBias[] = // indexed by 2*op+(shift==3)
{
"", " + 128", "", " + 127",
"",
" + 128",
"",
" + 127",
};

const char* tevBiasTable[] = {
@@ -87,6 +87,7 @@ class PostProcessingShaderImplementation
static std::vector<std::string> GetAnaglyphShaderList(APIType api_type);

PostProcessingShaderConfiguration* GetConfig() { return &m_config; }

protected:
// Timer for determining our time value
Common::Timer m_timer;
@@ -680,6 +680,7 @@ void ShaderCache::QueueVertexShaderCompile(const VertexShaderUid& uid, u32 prior
}

void Retrieve() override { shader_cache->InsertVertexShader(uid, std::move(shader)); }

private:
ShaderCache* shader_cache;
std::unique_ptr<AbstractShader> shader;
@@ -708,6 +709,7 @@ void ShaderCache::QueueVertexUberShaderCompile(const UberShader::VertexShaderUid
}

void Retrieve() override { shader_cache->InsertVertexUberShader(uid, std::move(shader)); }

private:
ShaderCache* shader_cache;
std::unique_ptr<AbstractShader> shader;
@@ -736,6 +738,7 @@ void ShaderCache::QueuePixelShaderCompile(const PixelShaderUid& uid, u32 priorit
}

void Retrieve() override { shader_cache->InsertPixelShader(uid, std::move(shader)); }

private:
ShaderCache* shader_cache;
std::unique_ptr<AbstractShader> shader;
@@ -764,6 +767,7 @@ void ShaderCache::QueuePixelUberShaderCompile(const UberShader::PixelShaderUid&
}

void Retrieve() override { shader_cache->InsertPixelUberShader(uid, std::move(shader)); }

private:
ShaderCache* shader_cache;
std::unique_ptr<AbstractShader> shader;
@@ -98,6 +98,7 @@ class ShaderUid : public ShaderGeneratorInterface
const uid_data* GetUidData() const { return &data; }
const u8* GetUidDataRaw() const { return &values[0]; }
size_t GetUidDataSize() const { return sizeof(values); }

private:
union
{
@@ -573,8 +573,10 @@ class ArbitraryMipmapDetector
auto x = j * 2;
auto y = i * 2;
const std::array<PixelRGBAf, 4> samples{{
Sample(src, src_shape, x, y), Sample(src, src_shape, x + 1, y),
Sample(src, src_shape, x, y + 1), Sample(src, src_shape, x + 1, y + 1),
Sample(src, src_shape, x, y),
Sample(src, src_shape, x + 1, y),
Sample(src, src_shape, x, y + 1),
Sample(src, src_shape, x + 1, y + 1),
}};

auto* dst_pixel = dst + (j + i * dst_shape.row_length) * 4;
@@ -259,17 +259,73 @@ void TexDecoder_SetTexFmtOverlayOptions(bool enable, bool center)

static const char* texfmt[] = {
// pixel
"I4", "I8", "IA4", "IA8", "RGB565", "RGB5A3", "RGBA8", "0x07", "C4", "C8", "C14X2", "0x0B",
"0x0C", "0x0D", "CMPR", "0x0F",
"I4",
"I8",
"IA4",
"IA8",
"RGB565",
"RGB5A3",
"RGBA8",
"0x07",
"C4",
"C8",
"C14X2",
"0x0B",
"0x0C",
"0x0D",
"CMPR",
"0x0F",
// Z-buffer
"0x10", "Z8", "0x12", "Z16", "0x14", "0x15", "Z24X8", "0x17", "0x18", "0x19", "0x1A", "0x1B",
"0x1C", "0x1D", "0x1E", "0x1F",
"0x10",
"Z8",
"0x12",
"Z16",
"0x14",
"0x15",
"Z24X8",
"0x17",
"0x18",
"0x19",
"0x1A",
"0x1B",
"0x1C",
"0x1D",
"0x1E",
"0x1F",
// pixel + copy
"CR4", "0x21", "CRA4", "CRA8", "0x24", "0x25", "CYUVA8", "CA8", "CR8", "CG8", "CB8", "CRG8",
"CGB8", "0x2D", "0x2E", "XFB",
"CR4",
"0x21",
"CRA4",
"CRA8",
"0x24",
"0x25",
"CYUVA8",
"CA8",
"CR8",
"CG8",
"CB8",
"CRG8",
"CGB8",
"0x2D",
"0x2E",
"XFB",
// Z + copy
"CZ4", "0x31", "0x32", "0x33", "0x34", "0x35", "0x36", "0x37", "0x38", "CZ8M", "CZ8L", "0x3B",
"CZ16L", "0x3D", "0x3E", "0x3F",
"CZ4",
"0x31",
"0x32",
"0x33",
"0x34",
"0x35",
"0x36",
"0x37",
"0x38",
"CZ8M",
"CZ8L",
"0x3B",
"CZ16L",
"0x3D",
"0x3E",
"0x3F",
};

static void TexDecoder_DrawOverlay(u8* dst, int width, int height, TextureFormat texformat)
@@ -924,9 +924,8 @@ ShaderCode GenPixelShader(APIType ApiType, const ShaderHostConfig& host_config,
" int3 color_D = selectColorInput(s, ss, %scolors_0, %scolors_1, color_d); // 10 "
"bits + sign\n"
"\n", // TODO: do we need to sign extend?
color_input_prefix,
color_input_prefix, color_input_prefix, color_input_prefix, color_input_prefix,
color_input_prefix, color_input_prefix, color_input_prefix);
color_input_prefix, color_input_prefix, color_input_prefix, color_input_prefix);
out.Write(
" int3 color;\n"
" if(color_bias != 3u) { // Normal mode\n"
@@ -998,9 +997,8 @@ ShaderCode GenPixelShader(APIType ApiType, const ShaderHostConfig& host_config,
" int alpha_D = selectAlphaInput(s, ss, %scolors_0, %scolors_1, alpha_d); // 10 bits + "
"sign\n"
"\n", // TODO: do we need to sign extend?
color_input_prefix,
color_input_prefix, color_input_prefix, color_input_prefix, color_input_prefix,
color_input_prefix, color_input_prefix, color_input_prefix);
color_input_prefix, color_input_prefix, color_input_prefix, color_input_prefix);
out.Write("\n"
" int alpha;\n"
" if(alpha_bias != 3u) { // Normal mode\n"
@@ -461,9 +461,9 @@ void VertexLoaderARM64::GenerateVertexLoader()
int elem_size = 1 << (m_VtxAttr.NormalFormat / 2);

int load_bytes = elem_size * 3;
int load_size = load_bytes == 1 ? 1 : load_bytes <= 2 ? 2 : load_bytes <= 4 ?
4 :
load_bytes <= 8 ? 8 : 16;
int load_size = load_bytes == 1 ?
1 :
load_bytes <= 2 ? 2 : load_bytes <= 4 ? 4 : load_bytes <= 8 ? 8 : 16;

offset = GetAddressImm(ARRAY_NORMAL, m_VtxDesc.Normal, EncodeRegTo64(scratch1_reg),
load_size << 3);
@@ -525,9 +525,9 @@ void VertexLoaderARM64::GenerateVertexLoader()

int elem_size = 1 << (m_VtxAttr.texCoord[i].Format / 2);
int load_bytes = elem_size * (elements + 2);
int load_size = load_bytes == 1 ? 1 : load_bytes <= 2 ? 2 : load_bytes <= 4 ?
4 :
load_bytes <= 8 ? 8 : 16;
int load_size = load_bytes == 1 ?
1 :
load_bytes <= 2 ? 2 : load_bytes <= 4 ? 4 : load_bytes <= 8 ? 8 : 16;
load_size <<= 3;

s32 offset =
@@ -611,6 +611,6 @@ void VertexLoaderARM64::GenerateVertexLoader()
int VertexLoaderARM64::RunVertices(DataReader src, DataReader dst, int count)
{
m_numLoadedVertices += count;
return ((int (*)(u8 * src, u8 * dst, int count))region)(src.GetPointer(), dst.GetPointer(),
count);
return ((int (*)(u8 * src, u8 * dst, int count)) region)(src.GetPointer(), dst.GetPointer(),
count);
}
@@ -81,13 +81,30 @@ std::string VertexLoaderBase::ToString() const
dest += ": ";

static constexpr std::array<const char*, 4> pos_mode{{
"Inv", "Dir", "I8", "I16",
"Inv",
"Dir",
"I8",
"I16",
}};
static constexpr std::array<const char*, 8> pos_formats{{
"u8", "s8", "u16", "s16", "flt", "Inv", "Inv", "Inv",
"u8",
"s8",
"u16",
"s16",
"flt",
"Inv",
"Inv",
"Inv",
}};
static constexpr std::array<const char*, 8> color_format{{
"565", "888", "888x", "4444", "6666", "8888", "Inv", "Inv",
"565",
"888",
"888x",
"4444",
"6666",
"8888",
"Inv",
"Inv",
}};

dest += StringFromFormat("%ib skin: %i P: %i %s-%s ", m_VertexSize, (u32)m_VtxDesc.PosMatIdx,
@@ -174,8 +191,9 @@ class VertexLoaderTester : public VertexLoaderBase

if (memcmp(buffer_a.data(), buffer_b.data(),
std::min(count_a, count_b) * m_native_vtx_decl.stride))
ERROR_LOG(VIDEO, "The two vertex loaders have loaded different data "
"(guru meditation 0x%016" PRIx64 ", 0x%08x, 0x%08x, 0x%08x).",
ERROR_LOG(VIDEO,
"The two vertex loaders have loaded different data "
"(guru meditation 0x%016" PRIx64 ", 0x%08x, 0x%08x, 0x%08x).",
m_VtxDesc.Hex, m_vat.g0.Hex, m_vat.g1.Hex, m_vat.g2.Hex);

memcpy(dst.GetPointer(), buffer_a.data(), count_a * m_native_vtx_decl.stride);
@@ -184,6 +202,7 @@ class VertexLoaderTester : public VertexLoaderBase
}
std::string GetName() const override { return "CompareLoader"; }
bool IsInitialized() override { return m_initialized; }

private:
bool m_initialized;

@@ -199,7 +218,7 @@ std::unique_ptr<VertexLoaderBase> VertexLoaderBase::CreateVertexLoader(const TVt
{
std::unique_ptr<VertexLoaderBase> loader;

//#define COMPARE_VERTEXLOADERS
//#define COMPARE_VERTEXLOADERS

#if defined(COMPARE_VERTEXLOADERS) && defined(_M_X86_64)
// first try: Any new VertexLoader vs the old one
@@ -33,6 +33,7 @@ class VertexLoaderUID

bool operator==(const VertexLoaderUID& rh) const { return vid == rh.vid; }
size_t GetHash() const { return hash; }

private:
size_t CalculateHash() const
{
@@ -78,141 +78,181 @@ void Pos_ReadIndex(VertexLoader* loader)
static TPipelineFunction tableReadPosition[4][8][2] = {
{
{
nullptr, nullptr,
nullptr,
nullptr,
},
{
nullptr, nullptr,
nullptr,
nullptr,
},
{
nullptr, nullptr,
nullptr,
nullptr,
},
{
nullptr, nullptr,
nullptr,
nullptr,
},
{
nullptr, nullptr,
nullptr,
nullptr,
},
},
{
{
Pos_ReadDirect<u8, 2>, Pos_ReadDirect<u8, 3>,
Pos_ReadDirect<u8, 2>,
Pos_ReadDirect<u8, 3>,
},
{
Pos_ReadDirect<s8, 2>, Pos_ReadDirect<s8, 3>,
Pos_ReadDirect<s8, 2>,
Pos_ReadDirect<s8, 3>,
},
{
Pos_ReadDirect<u16, 2>, Pos_ReadDirect<u16, 3>,
Pos_ReadDirect<u16, 2>,
Pos_ReadDirect<u16, 3>,
},
{
Pos_ReadDirect<s16, 2>, Pos_ReadDirect<s16, 3>,
Pos_ReadDirect<s16, 2>,
Pos_ReadDirect<s16, 3>,
},
{
Pos_ReadDirect<float, 2>, Pos_ReadDirect<float, 3>,
Pos_ReadDirect<float, 2>,
Pos_ReadDirect<float, 3>,
},
},
{
{
Pos_ReadIndex<u8, u8, 2>, Pos_ReadIndex<u8, u8, 3>,
Pos_ReadIndex<u8, u8, 2>,
Pos_ReadIndex<u8, u8, 3>,
},
{
Pos_ReadIndex<u8, s8, 2>, Pos_ReadIndex<u8, s8, 3>,
Pos_ReadIndex<u8, s8, 2>,
Pos_ReadIndex<u8, s8, 3>,
},
{
Pos_ReadIndex<u8, u16, 2>, Pos_ReadIndex<u8, u16, 3>,
Pos_ReadIndex<u8, u16, 2>,
Pos_ReadIndex<u8, u16, 3>,
},
{
Pos_ReadIndex<u8, s16, 2>, Pos_ReadIndex<u8, s16, 3>,
Pos_ReadIndex<u8, s16, 2>,
Pos_ReadIndex<u8, s16, 3>,
},
{
Pos_ReadIndex<u8, float, 2>, Pos_ReadIndex<u8, float, 3>,
Pos_ReadIndex<u8, float, 2>,
Pos_ReadIndex<u8, float, 3>,
},
},
{
{
Pos_ReadIndex<u16, u8, 2>, Pos_ReadIndex<u16, u8, 3>,
Pos_ReadIndex<u16, u8, 2>,
Pos_ReadIndex<u16, u8, 3>,
},
{
Pos_ReadIndex<u16, s8, 2>, Pos_ReadIndex<u16, s8, 3>,
Pos_ReadIndex<u16, s8, 2>,
Pos_ReadIndex<u16, s8, 3>,
},
{
Pos_ReadIndex<u16, u16, 2>, Pos_ReadIndex<u16, u16, 3>,
Pos_ReadIndex<u16, u16, 2>,
Pos_ReadIndex<u16, u16, 3>,
},
{
Pos_ReadIndex<u16, s16, 2>, Pos_ReadIndex<u16, s16, 3>,
Pos_ReadIndex<u16, s16, 2>,
Pos_ReadIndex<u16, s16, 3>,
},
{
Pos_ReadIndex<u16, float, 2>, Pos_ReadIndex<u16, float, 3>,
Pos_ReadIndex<u16, float, 2>,
Pos_ReadIndex<u16, float, 3>,
},
},
};

static int tableReadPositionVertexSize[4][8][2] = {
{
{
0, 0,
0,
0,
},
{
0, 0,
0,
0,
},
{
0, 0,
0,
0,
},
{
0, 0,
0,
0,
},
{
0, 0,
0,
0,
},
},
{
{
2, 3,
2,
3,
},
{
2, 3,
2,
3,
},
{
4, 6,
4,
6,
},
{
4, 6,
4,
6,
},
{
8, 12,
8,
12,
},
},
{
{
1, 1,
1,
1,
},
{
1, 1,
1,
1,
},
{
1, 1,
1,
1,
},
{
1, 1,
1,
1,
},
{
1, 1,
1,
1,
},
},
{
{
2, 2,
2,
2,
},
{
2, 2,
2,
2,
},
{
2, 2,
2,
2,
},
{
2, 2,
2,
2,
},
{
2, 2,
2,
2,
},
},
};
@@ -89,141 +89,181 @@ void TexCoord_ReadIndex(VertexLoader* loader)
static TPipelineFunction tableReadTexCoord[4][8][2] = {
{
{
nullptr, nullptr,
nullptr,
nullptr,
},
{
nullptr, nullptr,
nullptr,
nullptr,
},
{
nullptr, nullptr,
nullptr,
nullptr,
},
{
nullptr, nullptr,
nullptr,
nullptr,
},
{
nullptr, nullptr,
nullptr,
nullptr,
},
},
{
{
TexCoord_ReadDirect<u8, 1>, TexCoord_ReadDirect<u8, 2>,
TexCoord_ReadDirect<u8, 1>,
TexCoord_ReadDirect<u8, 2>,
},
{
TexCoord_ReadDirect<s8, 1>, TexCoord_ReadDirect<s8, 2>,
TexCoord_ReadDirect<s8, 1>,
TexCoord_ReadDirect<s8, 2>,
},
{
TexCoord_ReadDirect<u16, 1>, TexCoord_ReadDirect<u16, 2>,
TexCoord_ReadDirect<u16, 1>,
TexCoord_ReadDirect<u16, 2>,
},
{
TexCoord_ReadDirect<s16, 1>, TexCoord_ReadDirect<s16, 2>,
TexCoord_ReadDirect<s16, 1>,
TexCoord_ReadDirect<s16, 2>,
},
{
TexCoord_ReadDirect<float, 1>, TexCoord_ReadDirect<float, 2>,
TexCoord_ReadDirect<float, 1>,
TexCoord_ReadDirect<float, 2>,
},
},
{
{
TexCoord_ReadIndex<u8, u8, 1>, TexCoord_ReadIndex<u8, u8, 2>,
TexCoord_ReadIndex<u8, u8, 1>,
TexCoord_ReadIndex<u8, u8, 2>,
},
{
TexCoord_ReadIndex<u8, s8, 1>, TexCoord_ReadIndex<u8, s8, 2>,
TexCoord_ReadIndex<u8, s8, 1>,
TexCoord_ReadIndex<u8, s8, 2>,
},
{
TexCoord_ReadIndex<u8, u16, 1>, TexCoord_ReadIndex<u8, u16, 2>,
TexCoord_ReadIndex<u8, u16, 1>,
TexCoord_ReadIndex<u8, u16, 2>,
},
{
TexCoord_ReadIndex<u8, s16, 1>, TexCoord_ReadIndex<u8, s16, 2>,
TexCoord_ReadIndex<u8, s16, 1>,
TexCoord_ReadIndex<u8, s16, 2>,
},
{
TexCoord_ReadIndex<u8, float, 1>, TexCoord_ReadIndex<u8, float, 2>,
TexCoord_ReadIndex<u8, float, 1>,
TexCoord_ReadIndex<u8, float, 2>,
},
},
{
{
TexCoord_ReadIndex<u16, u8, 1>, TexCoord_ReadIndex<u16, u8, 2>,
TexCoord_ReadIndex<u16, u8, 1>,
TexCoord_ReadIndex<u16, u8, 2>,
},
{
TexCoord_ReadIndex<u16, s8, 1>, TexCoord_ReadIndex<u16, s8, 2>,
TexCoord_ReadIndex<u16, s8, 1>,
TexCoord_ReadIndex<u16, s8, 2>,
},
{
TexCoord_ReadIndex<u16, u16, 1>, TexCoord_ReadIndex<u16, u16, 2>,
TexCoord_ReadIndex<u16, u16, 1>,
TexCoord_ReadIndex<u16, u16, 2>,
},
{
TexCoord_ReadIndex<u16, s16, 1>, TexCoord_ReadIndex<u16, s16, 2>,
TexCoord_ReadIndex<u16, s16, 1>,
TexCoord_ReadIndex<u16, s16, 2>,
},
{
TexCoord_ReadIndex<u16, float, 1>, TexCoord_ReadIndex<u16, float, 2>,
TexCoord_ReadIndex<u16, float, 1>,
TexCoord_ReadIndex<u16, float, 2>,
},
},
};

static int tableReadTexCoordVertexSize[4][8][2] = {
{
{
0, 0,
0,
0,
},
{
0, 0,
0,
0,
},
{
0, 0,
0,
0,
},
{
0, 0,
0,
0,
},
{
0, 0,
0,
0,
},
},
{
{
1, 2,
1,
2,
},
{
1, 2,
1,
2,
},
{
2, 4,
2,
4,
},
{
2, 4,
2,
4,
},
{
4, 8,
4,
8,
},
},
{
{
1, 1,
1,
1,
},
{
1, 1,
1,
1,
},
{
1, 1,
1,
1,
},
{
1, 1,
1,
1,
},
{
1, 1,
1,
1,
},
},
{
{
2, 2,
2,
2,
},
{
2, 2,
2,
2,
},
{
2, 2,
2,
2,
},
{
2, 2,
2,
2,
},
{
2, 2,
2,
2,
},
},
};
@@ -9,8 +9,8 @@ if ! [ -x "$(command -v git)" ]; then
exit 1
fi

REQUIRED_CLANG_FORMAT_MAJOR=3
REQUIRED_CLANG_FORMAT_MINOR=8
REQUIRED_CLANG_FORMAT_MAJOR=5
REQUIRED_CLANG_FORMAT_MINOR=0

if ! [ -x "$(command -v clang-format)" ]; then
echo >&2 "error: clang-format is not installed"