summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends
diff options
context:
space:
mode:
authorMai <mathew1800@gmail.com>2022-11-23 22:40:03 +0000
committerGitHub <noreply@github.com>2022-11-23 22:40:03 +0000
commitd6437b7e461af0ef457c05be996d6fb30d7922ac (patch)
tree4a73b4b6ecb4fe3f172c7bbbdc729ddf0cde56d6 /Source/Core/VideoBackends
parentddf63bacb9fec7bdc9cc2df3601cddce2bc8f7af (diff)
parentf5d11c1e388768043516fdb54e71b72c26c3c22d (diff)
Merge pull request #11123 from Pokechu22/fmt-9.1.0
Externals: Update fmt to 9.1.0
Diffstat (limited to 'Source/Core/VideoBackends')
-rw-r--r--Source/Core/VideoBackends/D3D/D3DNativeVertexFormat.cpp80
-rw-r--r--Source/Core/VideoBackends/D3D/D3DVertexManager.h4
-rw-r--r--Source/Core/VideoBackends/D3D12/DX12VertexFormat.cpp20
-rw-r--r--Source/Core/VideoBackends/D3D12/DX12VertexFormat.h6
-rw-r--r--Source/Core/VideoBackends/Metal/MTLVertexFormat.mm18
-rw-r--r--Source/Core/VideoBackends/OGL/OGLNativeVertexFormat.cpp28
-rw-r--r--Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp17
-rw-r--r--Source/Core/VideoBackends/Vulkan/VKRenderer.cpp6
-rw-r--r--Source/Core/VideoBackends/Vulkan/VKVertexFormat.cpp14
-rw-r--r--Source/Core/VideoBackends/Vulkan/VKVertexFormat.h4
10 files changed, 86 insertions, 111 deletions
diff --git a/Source/Core/VideoBackends/D3D/D3DNativeVertexFormat.cpp b/Source/Core/VideoBackends/D3D/D3DNativeVertexFormat.cpp
index 08ed40353c..aca5a177fa 100644
--- a/Source/Core/VideoBackends/D3D/D3DNativeVertexFormat.cpp
+++ b/Source/Core/VideoBackends/D3D/D3DNativeVertexFormat.cpp
@@ -103,69 +103,18 @@ D3DVertexFormat::D3DVertexFormat(const PortableVertexDeclaration& vtx_decl)
: NativeVertexFormat(vtx_decl)
{
- const AttributeFormat* format = &vtx_decl.position;
- if (format->enable)
- {
- m_elems[m_num_elems].SemanticName = "TEXCOORD";
- m_elems[m_num_elems].SemanticIndex = SHADER_POSITION_ATTRIB;
- m_elems[m_num_elems].AlignedByteOffset = format->offset;
- m_elems[m_num_elems].Format = VarToD3D(format->type, format->components, format->integer);
- m_elems[m_num_elems].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
- ++m_num_elems;
- }
+ AddAttribute(vtx_decl.position, ShaderAttrib::Position);
- for (int i = 0; i < 3; i++)
- {
- format = &vtx_decl.normals[i];
- if (format->enable)
- {
- m_elems[m_num_elems].SemanticName = "TEXCOORD";
- m_elems[m_num_elems].SemanticIndex = SHADER_NORMAL_ATTRIB + i;
- m_elems[m_num_elems].AlignedByteOffset = format->offset;
- m_elems[m_num_elems].Format = VarToD3D(format->type, format->components, format->integer);
- m_elems[m_num_elems].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
- ++m_num_elems;
- }
- }
+ for (u32 i = 0; i < 3; i++)
+ AddAttribute(vtx_decl.normals[i], ShaderAttrib::Normal + i);
- for (int i = 0; i < 2; i++)
- {
- format = &vtx_decl.colors[i];
- if (format->enable)
- {
- m_elems[m_num_elems].SemanticName = "TEXCOORD";
- m_elems[m_num_elems].SemanticIndex = SHADER_COLOR0_ATTRIB + i;
- m_elems[m_num_elems].AlignedByteOffset = format->offset;
- m_elems[m_num_elems].Format = VarToD3D(format->type, format->components, format->integer);
- m_elems[m_num_elems].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
- ++m_num_elems;
- }
- }
+ for (u32 i = 0; i < 2; i++)
+ AddAttribute(vtx_decl.colors[i], ShaderAttrib::Color0 + i);
- for (int i = 0; i < 8; i++)
- {
- format = &vtx_decl.texcoords[i];
- if (format->enable)
- {
- m_elems[m_num_elems].SemanticName = "TEXCOORD";
- m_elems[m_num_elems].SemanticIndex = SHADER_TEXTURE0_ATTRIB + i;
- m_elems[m_num_elems].AlignedByteOffset = format->offset;
- m_elems[m_num_elems].Format = VarToD3D(format->type, format->components, format->integer);
- m_elems[m_num_elems].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
- ++m_num_elems;
- }
- }
+ for (u32 i = 0; i < 8; i++)
+ AddAttribute(vtx_decl.texcoords[i], ShaderAttrib::TexCoord0 + i);
- format = &vtx_decl.posmtx;
- if (format->enable)
- {
- m_elems[m_num_elems].SemanticName = "TEXCOORD";
- m_elems[m_num_elems].SemanticIndex = SHADER_POSMTX_ATTRIB;
- m_elems[m_num_elems].AlignedByteOffset = format->offset;
- m_elems[m_num_elems].Format = VarToD3D(format->type, format->components, format->integer);
- m_elems[m_num_elems].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
- ++m_num_elems;
- }
+ AddAttribute(vtx_decl.posmtx, ShaderAttrib::PositionMatrix);
}
D3DVertexFormat::~D3DVertexFormat()
@@ -201,4 +150,17 @@ ID3D11InputLayout* D3DVertexFormat::GetInputLayout(const void* vs_bytecode, size
return layout;
}
+void D3DVertexFormat::AddAttribute(const AttributeFormat& format, ShaderAttrib semantic_index)
+{
+ if (format.enable)
+ {
+ m_elems[m_num_elems].SemanticName = "TEXCOORD";
+ m_elems[m_num_elems].SemanticIndex = static_cast<u32>(semantic_index);
+ m_elems[m_num_elems].AlignedByteOffset = format.offset;
+ m_elems[m_num_elems].Format = VarToD3D(format.type, format.components, format.integer);
+ m_elems[m_num_elems].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
+ ++m_num_elems;
+ }
+}
+
} // namespace DX11
diff --git a/Source/Core/VideoBackends/D3D/D3DVertexManager.h b/Source/Core/VideoBackends/D3D/D3DVertexManager.h
index f61a264c88..669d670fed 100644
--- a/Source/Core/VideoBackends/D3D/D3DVertexManager.h
+++ b/Source/Core/VideoBackends/D3D/D3DVertexManager.h
@@ -12,6 +12,8 @@
#include "VideoCommon/NativeVertexFormat.h"
#include "VideoCommon/VertexManagerBase.h"
+enum class ShaderAttrib : u32;
+
namespace DX11
{
class D3DVertexFormat : public NativeVertexFormat
@@ -22,6 +24,8 @@ public:
ID3D11InputLayout* GetInputLayout(const void* vs_bytecode, size_t vs_bytecode_size);
private:
+ void AddAttribute(const AttributeFormat& format, ShaderAttrib semantic_index);
+
std::array<D3D11_INPUT_ELEMENT_DESC, 32> m_elems{};
UINT m_num_elems = 0;
diff --git a/Source/Core/VideoBackends/D3D12/DX12VertexFormat.cpp b/Source/Core/VideoBackends/D3D12/DX12VertexFormat.cpp
index 77082c091a..6ba3a8800d 100644
--- a/Source/Core/VideoBackends/D3D12/DX12VertexFormat.cpp
+++ b/Source/Core/VideoBackends/D3D12/DX12VertexFormat.cpp
@@ -59,14 +59,14 @@ void DXVertexFormat::GetInputLayoutDesc(D3D12_INPUT_LAYOUT_DESC* desc) const
desc->NumElements = m_num_attributes;
}
-void DXVertexFormat::AddAttribute(const char* semantic_name, u32 semantic_index, u32 slot,
+void DXVertexFormat::AddAttribute(const char* semantic_name, ShaderAttrib semantic_index, u32 slot,
DXGI_FORMAT format, u32 offset)
{
ASSERT(m_num_attributes < MAX_VERTEX_ATTRIBUTES);
auto* attr_desc = &m_attribute_descriptions[m_num_attributes];
attr_desc->SemanticName = semantic_name;
- attr_desc->SemanticIndex = semantic_index;
+ attr_desc->SemanticIndex = static_cast<u32>(semantic_index);
attr_desc->Format = format;
attr_desc->InputSlot = slot;
attr_desc->AlignedByteOffset = offset;
@@ -83,38 +83,38 @@ void DXVertexFormat::MapAttributes()
if (m_decl.position.enable)
{
AddAttribute(
- "TEXCOORD", SHADER_POSITION_ATTRIB, 0,
+ "TEXCOORD", ShaderAttrib::Position, 0,
VarToDXGIFormat(m_decl.position.type, m_decl.position.components, m_decl.position.integer),
m_decl.position.offset);
}
- for (uint32_t i = 0; i < 3; i++)
+ for (u32 i = 0; i < 3; i++)
{
if (m_decl.normals[i].enable)
{
- AddAttribute("TEXCOORD", SHADER_NORMAL_ATTRIB + i, 0,
+ AddAttribute("TEXCOORD", ShaderAttrib::Normal + i, 0,
VarToDXGIFormat(m_decl.normals[i].type, m_decl.normals[i].components,
m_decl.normals[i].integer),
m_decl.normals[i].offset);
}
}
- for (uint32_t i = 0; i < 2; i++)
+ for (u32 i = 0; i < 2; i++)
{
if (m_decl.colors[i].enable)
{
- AddAttribute("TEXCOORD", SHADER_COLOR0_ATTRIB + i, 0,
+ AddAttribute("TEXCOORD", ShaderAttrib::Color0 + i, 0,
VarToDXGIFormat(m_decl.colors[i].type, m_decl.colors[i].components,
m_decl.colors[i].integer),
m_decl.colors[i].offset);
}
}
- for (uint32_t i = 0; i < 8; i++)
+ for (u32 i = 0; i < 8; i++)
{
if (m_decl.texcoords[i].enable)
{
- AddAttribute("TEXCOORD", SHADER_TEXTURE0_ATTRIB + i, 0,
+ AddAttribute("TEXCOORD", ShaderAttrib::TexCoord0 + i, 0,
VarToDXGIFormat(m_decl.texcoords[i].type, m_decl.texcoords[i].components,
m_decl.texcoords[i].integer),
m_decl.texcoords[i].offset);
@@ -124,7 +124,7 @@ void DXVertexFormat::MapAttributes()
if (m_decl.posmtx.enable)
{
AddAttribute(
- "TEXCOORD", SHADER_POSMTX_ATTRIB, 0,
+ "TEXCOORD", ShaderAttrib::PositionMatrix, 0,
VarToDXGIFormat(m_decl.posmtx.type, m_decl.posmtx.components, m_decl.posmtx.integer),
m_decl.posmtx.offset);
}
diff --git a/Source/Core/VideoBackends/D3D12/DX12VertexFormat.h b/Source/Core/VideoBackends/D3D12/DX12VertexFormat.h
index 2122d6cf61..e4e1228f8f 100644
--- a/Source/Core/VideoBackends/D3D12/DX12VertexFormat.h
+++ b/Source/Core/VideoBackends/D3D12/DX12VertexFormat.h
@@ -9,6 +9,8 @@
#include "Common/CommonTypes.h"
#include "VideoCommon/NativeVertexFormat.h"
+enum class ShaderAttrib : u32;
+
namespace DX12
{
class DXVertexFormat : public NativeVertexFormat
@@ -22,8 +24,8 @@ public:
void GetInputLayoutDesc(D3D12_INPUT_LAYOUT_DESC* desc) const;
private:
- void AddAttribute(const char* semantic_name, u32 semantic_index, u32 slot, DXGI_FORMAT format,
- u32 offset);
+ void AddAttribute(const char* semantic_name, ShaderAttrib semantic_index, u32 slot,
+ DXGI_FORMAT format, u32 offset);
void MapAttributes();
std::array<D3D12_INPUT_ELEMENT_DESC, MAX_VERTEX_ATTRIBUTES> m_attribute_descriptions = {};
diff --git a/Source/Core/VideoBackends/Metal/MTLVertexFormat.mm b/Source/Core/VideoBackends/Metal/MTLVertexFormat.mm
index d9407402e2..5fffad8b57 100644
--- a/Source/Core/VideoBackends/Metal/MTLVertexFormat.mm
+++ b/Source/Core/VideoBackends/Metal/MTLVertexFormat.mm
@@ -113,18 +113,20 @@ static MTLVertexFormat ConvertFormat(ComponentFormat format, int count, bool int
// clang-format on
}
-static void SetAttribute(MTLVertexDescriptor* desc, u32 attribute, const AttributeFormat& format)
+static void SetAttribute(MTLVertexDescriptor* desc, ShaderAttrib attribute,
+ const AttributeFormat& format)
{
if (!format.enable)
return;
- MTLVertexAttributeDescriptor* attr_desc = [[desc attributes] objectAtIndexedSubscript:attribute];
+ MTLVertexAttributeDescriptor* attr_desc =
+ [[desc attributes] objectAtIndexedSubscript:(u32)attribute];
[attr_desc setFormat:ConvertFormat(format.type, format.components, format.integer)];
[attr_desc setOffset:format.offset];
[attr_desc setBufferIndex:0];
}
template <size_t N>
-static void SetAttributes(MTLVertexDescriptor* desc, u32 attribute,
+static void SetAttributes(MTLVertexDescriptor* desc, ShaderAttrib attribute,
const std::array<AttributeFormat, N>& format)
{
for (size_t i = 0; i < N; ++i)
@@ -135,9 +137,9 @@ Metal::VertexFormat::VertexFormat(const PortableVertexDeclaration& vtx_decl)
: NativeVertexFormat(vtx_decl), m_desc(MRCTransfer([MTLVertexDescriptor new]))
{
[[[m_desc layouts] objectAtIndexedSubscript:0] setStride:vtx_decl.stride];
- SetAttribute(m_desc, SHADER_POSITION_ATTRIB, vtx_decl.position);
- SetAttributes(m_desc, SHADER_NORMAL_ATTRIB, vtx_decl.normals);
- SetAttributes(m_desc, SHADER_COLOR0_ATTRIB, vtx_decl.colors);
- SetAttributes(m_desc, SHADER_TEXTURE0_ATTRIB, vtx_decl.texcoords);
- SetAttribute(m_desc, SHADER_POSMTX_ATTRIB, vtx_decl.posmtx);
+ SetAttribute(m_desc, ShaderAttrib::Position, vtx_decl.position);
+ SetAttributes(m_desc, ShaderAttrib::Normal, vtx_decl.normals);
+ SetAttributes(m_desc, ShaderAttrib::Color0, vtx_decl.colors);
+ SetAttributes(m_desc, ShaderAttrib::TexCoord0, vtx_decl.texcoords);
+ SetAttribute(m_desc, ShaderAttrib::PositionMatrix, vtx_decl.posmtx);
}
diff --git a/Source/Core/VideoBackends/OGL/OGLNativeVertexFormat.cpp b/Source/Core/VideoBackends/OGL/OGLNativeVertexFormat.cpp
index 1913b6dcd3..16bcabab4b 100644
--- a/Source/Core/VideoBackends/OGL/OGLNativeVertexFormat.cpp
+++ b/Source/Core/VideoBackends/OGL/OGLNativeVertexFormat.cpp
@@ -32,18 +32,18 @@ static inline GLuint VarToGL(ComponentFormat t)
return lookup[t];
}
-static void SetPointer(u32 attrib, u32 stride, const AttributeFormat& format)
+static void SetPointer(ShaderAttrib attrib, u32 stride, const AttributeFormat& format)
{
if (!format.enable)
return;
- glEnableVertexAttribArray(attrib);
+ glEnableVertexAttribArray(static_cast<GLuint>(attrib));
if (format.integer)
- glVertexAttribIPointer(attrib, format.components, VarToGL(format.type), stride,
- (u8*)nullptr + format.offset);
+ glVertexAttribIPointer(static_cast<GLuint>(attrib), format.components, VarToGL(format.type),
+ stride, (u8*)nullptr + format.offset);
else
- glVertexAttribPointer(attrib, format.components, VarToGL(format.type), true, stride,
- (u8*)nullptr + format.offset);
+ glVertexAttribPointer(static_cast<GLuint>(attrib), format.components, VarToGL(format.type),
+ true, stride, (u8*)nullptr + format.offset);
}
GLVertexFormat::GLVertexFormat(const PortableVertexDeclaration& vtx_decl)
@@ -65,18 +65,18 @@ GLVertexFormat::GLVertexFormat(const PortableVertexDeclaration& vtx_decl)
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vm->GetIndexBufferHandle());
glBindBuffer(GL_ARRAY_BUFFER, vm->GetVertexBufferHandle());
- SetPointer(SHADER_POSITION_ATTRIB, vertex_stride, vtx_decl.position);
+ SetPointer(ShaderAttrib::Position, vertex_stride, vtx_decl.position);
- for (int i = 0; i < 3; i++)
- SetPointer(SHADER_NORMAL_ATTRIB + i, vertex_stride, vtx_decl.normals[i]);
+ for (u32 i = 0; i < 3; i++)
+ SetPointer(ShaderAttrib::Normal + i, vertex_stride, vtx_decl.normals[i]);
- for (int i = 0; i < 2; i++)
- SetPointer(SHADER_COLOR0_ATTRIB + i, vertex_stride, vtx_decl.colors[i]);
+ for (u32 i = 0; i < 2; i++)
+ SetPointer(ShaderAttrib::Color0 + i, vertex_stride, vtx_decl.colors[i]);
- for (int i = 0; i < 8; i++)
- SetPointer(SHADER_TEXTURE0_ATTRIB + i, vertex_stride, vtx_decl.texcoords[i]);
+ for (u32 i = 0; i < 8; i++)
+ SetPointer(ShaderAttrib::TexCoord0 + i, vertex_stride, vtx_decl.texcoords[i]);
- SetPointer(SHADER_POSMTX_ATTRIB, vertex_stride, vtx_decl.posmtx);
+ SetPointer(ShaderAttrib::PositionMatrix, vertex_stride, vtx_decl.posmtx);
}
GLVertexFormat::~GLVertexFormat()
diff --git a/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp b/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp
index 31138c734f..22a917c8c5 100644
--- a/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp
+++ b/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp
@@ -133,23 +133,24 @@ void SHADER::SetProgramBindings(bool is_compute)
glBindFragDataLocationIndexed(glprogid, 0, 1, "ocol1");
}
// Need to set some attribute locations
- glBindAttribLocation(glprogid, SHADER_POSITION_ATTRIB, "rawpos");
+ glBindAttribLocation(glprogid, static_cast<GLuint>(ShaderAttrib::Position), "rawpos");
- glBindAttribLocation(glprogid, SHADER_POSMTX_ATTRIB, "posmtx");
+ glBindAttribLocation(glprogid, static_cast<GLuint>(ShaderAttrib::PositionMatrix), "posmtx");
- glBindAttribLocation(glprogid, SHADER_COLOR0_ATTRIB, "rawcolor0");
- glBindAttribLocation(glprogid, SHADER_COLOR1_ATTRIB, "rawcolor1");
+ glBindAttribLocation(glprogid, static_cast<GLuint>(ShaderAttrib::Color0), "rawcolor0");
+ glBindAttribLocation(glprogid, static_cast<GLuint>(ShaderAttrib::Color1), "rawcolor1");
- glBindAttribLocation(glprogid, SHADER_NORMAL_ATTRIB, "rawnormal");
- glBindAttribLocation(glprogid, SHADER_TANGENT_ATTRIB, "rawtangent");
- glBindAttribLocation(glprogid, SHADER_BINORMAL_ATTRIB, "rawbinormal");
+ glBindAttribLocation(glprogid, static_cast<GLuint>(ShaderAttrib::Normal), "rawnormal");
+ glBindAttribLocation(glprogid, static_cast<GLuint>(ShaderAttrib::Tangent), "rawtangent");
+ glBindAttribLocation(glprogid, static_cast<GLuint>(ShaderAttrib::Binormal), "rawbinormal");
}
for (int i = 0; i < 8; i++)
{
// Per documentation: OpenGL copies the name string when glBindAttribLocation is called, so an
// application may free its copy of the name string immediately after the function returns.
- glBindAttribLocation(glprogid, SHADER_TEXTURE0_ATTRIB + i, fmt::format("rawtex{}", i).c_str());
+ glBindAttribLocation(glprogid, static_cast<GLuint>(ShaderAttrib::TexCoord0 + i),
+ fmt::format("rawtex{}", i).c_str());
}
}
diff --git a/Source/Core/VideoBackends/Vulkan/VKRenderer.cpp b/Source/Core/VideoBackends/Vulkan/VKRenderer.cpp
index 23dba4613b..b1bf8db11a 100644
--- a/Source/Core/VideoBackends/Vulkan/VKRenderer.cpp
+++ b/Source/Core/VideoBackends/Vulkan/VKRenderer.cpp
@@ -310,13 +310,15 @@ void Renderer::BindBackbuffer(const ClearColor& clear_color)
}
else
{
- ERROR_LOG_FMT(VIDEO, "Unknown present error {:#010X}, please report.", res);
+ ERROR_LOG_FMT(VIDEO, "Unknown present error {:#010X} {}, please report.",
+ static_cast<u32>(res), VkResultToString(res));
m_swap_chain->RecreateSwapChain();
}
res = m_swap_chain->AcquireNextImage();
if (res != VK_SUCCESS)
- PanicAlertFmt("Failed to grab image from swap chain: {:#010X}", res);
+ PanicAlertFmt("Failed to grab image from swap chain: {:#010X} {}", static_cast<u32>(res),
+ VkResultToString(res));
}
// Transition from undefined (or present src, but it can be substituted) to
diff --git a/Source/Core/VideoBackends/Vulkan/VKVertexFormat.cpp b/Source/Core/VideoBackends/Vulkan/VKVertexFormat.cpp
index 6aa5ea14f1..65b63b32b9 100644
--- a/Source/Core/VideoBackends/Vulkan/VKVertexFormat.cpp
+++ b/Source/Core/VideoBackends/Vulkan/VKVertexFormat.cpp
@@ -66,14 +66,14 @@ void VertexFormat::MapAttributes()
if (m_decl.position.enable)
AddAttribute(
- SHADER_POSITION_ATTRIB, 0,
+ ShaderAttrib::Position, 0,
VarToVkFormat(m_decl.position.type, m_decl.position.components, m_decl.position.integer),
m_decl.position.offset);
for (uint32_t i = 0; i < 3; i++)
{
if (m_decl.normals[i].enable)
- AddAttribute(SHADER_NORMAL_ATTRIB + i, 0,
+ AddAttribute(ShaderAttrib::Normal + i, 0,
VarToVkFormat(m_decl.normals[i].type, m_decl.normals[i].components,
m_decl.normals[i].integer),
m_decl.normals[i].offset);
@@ -82,7 +82,7 @@ void VertexFormat::MapAttributes()
for (uint32_t i = 0; i < 2; i++)
{
if (m_decl.colors[i].enable)
- AddAttribute(SHADER_COLOR0_ATTRIB + i, 0,
+ AddAttribute(ShaderAttrib::Color0 + i, 0,
VarToVkFormat(m_decl.colors[i].type, m_decl.colors[i].components,
m_decl.colors[i].integer),
m_decl.colors[i].offset);
@@ -91,14 +91,14 @@ void VertexFormat::MapAttributes()
for (uint32_t i = 0; i < 8; i++)
{
if (m_decl.texcoords[i].enable)
- AddAttribute(SHADER_TEXTURE0_ATTRIB + i, 0,
+ AddAttribute(ShaderAttrib::TexCoord0 + i, 0,
VarToVkFormat(m_decl.texcoords[i].type, m_decl.texcoords[i].components,
m_decl.texcoords[i].integer),
m_decl.texcoords[i].offset);
}
if (m_decl.posmtx.enable)
- AddAttribute(SHADER_POSMTX_ATTRIB, 0,
+ AddAttribute(ShaderAttrib::PositionMatrix, 0,
VarToVkFormat(m_decl.posmtx.type, m_decl.posmtx.components, m_decl.posmtx.integer),
m_decl.posmtx.offset);
}
@@ -118,12 +118,12 @@ void VertexFormat::SetupInputState()
m_input_state_info.pVertexAttributeDescriptions = m_attribute_descriptions.data();
}
-void VertexFormat::AddAttribute(uint32_t location, uint32_t binding, VkFormat format,
+void VertexFormat::AddAttribute(ShaderAttrib location, uint32_t binding, VkFormat format,
uint32_t offset)
{
ASSERT(m_num_attributes < MAX_VERTEX_ATTRIBUTES);
- m_attribute_descriptions[m_num_attributes].location = location;
+ m_attribute_descriptions[m_num_attributes].location = static_cast<uint32_t>(location);
m_attribute_descriptions[m_num_attributes].binding = binding;
m_attribute_descriptions[m_num_attributes].format = format;
m_attribute_descriptions[m_num_attributes].offset = offset;
diff --git a/Source/Core/VideoBackends/Vulkan/VKVertexFormat.h b/Source/Core/VideoBackends/Vulkan/VKVertexFormat.h
index 545c0a4751..16dae3fa31 100644
--- a/Source/Core/VideoBackends/Vulkan/VKVertexFormat.h
+++ b/Source/Core/VideoBackends/Vulkan/VKVertexFormat.h
@@ -8,6 +8,8 @@
#include "VideoBackends/Vulkan/Constants.h"
#include "VideoCommon/NativeVertexFormat.h"
+enum class ShaderAttrib : u32;
+
namespace Vulkan
{
class VertexFormat : public ::NativeVertexFormat
@@ -23,7 +25,7 @@ public:
void SetupInputState();
private:
- void AddAttribute(uint32_t location, uint32_t binding, VkFormat format, uint32_t offset);
+ void AddAttribute(ShaderAttrib location, uint32_t binding, VkFormat format, uint32_t offset);
VkVertexInputBindingDescription m_binding_description = {};