summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2019-12-24 21:11:08 +0100
committerReinUsesLisp <reinuseslisp@airmail.cc>2019-12-24 22:24:08 +0100
commitb9e3f5eb36318f269257ab60f446b72a63aecc3c (patch)
tree9fe62261d7be8240b51ce16abf8315416f9b226f /src
parentfixed_pipeline_state: Define structure and loaders (diff)
downloadyuzu-b9e3f5eb36318f269257ab60f446b72a63aecc3c.tar
yuzu-b9e3f5eb36318f269257ab60f446b72a63aecc3c.tar.gz
yuzu-b9e3f5eb36318f269257ab60f446b72a63aecc3c.tar.bz2
yuzu-b9e3f5eb36318f269257ab60f446b72a63aecc3c.tar.lz
yuzu-b9e3f5eb36318f269257ab60f446b72a63aecc3c.tar.xz
yuzu-b9e3f5eb36318f269257ab60f446b72a63aecc3c.tar.zst
yuzu-b9e3f5eb36318f269257ab60f446b72a63aecc3c.zip
Diffstat (limited to 'src')
-rw-r--r--src/video_core/renderer_vulkan/fixed_pipeline_state.cpp41
-rw-r--r--src/video_core/renderer_vulkan/fixed_pipeline_state.h91
2 files changed, 92 insertions, 40 deletions
diff --git a/src/video_core/renderer_vulkan/fixed_pipeline_state.cpp b/src/video_core/renderer_vulkan/fixed_pipeline_state.cpp
index f75c348fe..5a490f6ef 100644
--- a/src/video_core/renderer_vulkan/fixed_pipeline_state.cpp
+++ b/src/video_core/renderer_vulkan/fixed_pipeline_state.cpp
@@ -125,39 +125,39 @@ constexpr FixedPipelineState::Rasterizer GetRasterizerState(const Maxwell& regs)
} // Anonymous namespace
-std::size_t FixedPipelineState::VertexBinding::Hash() const {
+std::size_t FixedPipelineState::VertexBinding::Hash() const noexcept {
return (index << stride) ^ divisor;
}
-bool FixedPipelineState::VertexBinding::operator==(const VertexBinding& rhs) const {
+bool FixedPipelineState::VertexBinding::operator==(const VertexBinding& rhs) const noexcept {
return std::tie(index, stride, divisor) == std::tie(rhs.index, rhs.stride, rhs.divisor);
}
-std::size_t FixedPipelineState::VertexAttribute::Hash() const {
+std::size_t FixedPipelineState::VertexAttribute::Hash() const noexcept {
return static_cast<std::size_t>(index) ^ (static_cast<std::size_t>(buffer) << 13) ^
(static_cast<std::size_t>(type) << 22) ^ (static_cast<std::size_t>(size) << 31) ^
(static_cast<std::size_t>(offset) << 36);
}
-bool FixedPipelineState::VertexAttribute::operator==(const VertexAttribute& rhs) const {
+bool FixedPipelineState::VertexAttribute::operator==(const VertexAttribute& rhs) const noexcept {
return std::tie(index, buffer, type, size, offset) ==
std::tie(rhs.index, rhs.buffer, rhs.type, rhs.size, rhs.offset);
}
-std::size_t FixedPipelineState::StencilFace::Hash() const {
+std::size_t FixedPipelineState::StencilFace::Hash() const noexcept {
return static_cast<std::size_t>(action_stencil_fail) ^
(static_cast<std::size_t>(action_depth_fail) << 4) ^
(static_cast<std::size_t>(action_depth_fail) << 20) ^
(static_cast<std::size_t>(action_depth_pass) << 36);
}
-bool FixedPipelineState::StencilFace::operator==(const StencilFace& rhs) const {
+bool FixedPipelineState::StencilFace::operator==(const StencilFace& rhs) const noexcept {
return std::tie(action_stencil_fail, action_depth_fail, action_depth_pass, test_func) ==
std::tie(rhs.action_stencil_fail, rhs.action_depth_fail, rhs.action_depth_pass,
rhs.test_func);
}
-std::size_t FixedPipelineState::BlendingAttachment::Hash() const {
+std::size_t FixedPipelineState::BlendingAttachment::Hash() const noexcept {
return static_cast<std::size_t>(enable) ^ (static_cast<std::size_t>(rgb_equation) << 5) ^
(static_cast<std::size_t>(src_rgb_func) << 10) ^
(static_cast<std::size_t>(dst_rgb_func) << 15) ^
@@ -170,14 +170,15 @@ std::size_t FixedPipelineState::BlendingAttachment::Hash() const {
(static_cast<std::size_t>(components[3]) << 38);
}
-bool FixedPipelineState::BlendingAttachment::operator==(const BlendingAttachment& rhs) const {
+bool FixedPipelineState::BlendingAttachment::operator==(const BlendingAttachment& rhs) const
+ noexcept {
return std::tie(enable, rgb_equation, src_rgb_func, dst_rgb_func, a_equation, src_a_func,
dst_a_func, components) ==
std::tie(rhs.enable, rhs.rgb_equation, rhs.src_rgb_func, rhs.dst_rgb_func,
rhs.a_equation, rhs.src_a_func, rhs.dst_a_func, rhs.components);
}
-std::size_t FixedPipelineState::VertexInput::Hash() const {
+std::size_t FixedPipelineState::VertexInput::Hash() const noexcept {
std::size_t hash = num_bindings ^ (num_attributes << 32);
for (std::size_t i = 0; i < num_bindings; ++i) {
boost::hash_combine(hash, bindings[i].Hash());
@@ -188,37 +189,37 @@ std::size_t FixedPipelineState::VertexInput::Hash() const {
return hash;
}
-bool FixedPipelineState::VertexInput::operator==(const VertexInput& rhs) const {
+bool FixedPipelineState::VertexInput::operator==(const VertexInput& rhs) const noexcept {
return std::equal(bindings.begin(), bindings.begin() + num_bindings, rhs.bindings.begin(),
rhs.bindings.begin() + rhs.num_bindings) &&
std::equal(attributes.begin(), attributes.begin() + num_attributes,
rhs.attributes.begin(), rhs.attributes.begin() + rhs.num_attributes);
}
-std::size_t FixedPipelineState::InputAssembly::Hash() const {
+std::size_t FixedPipelineState::InputAssembly::Hash() const noexcept {
std::size_t point_size_int = 0;
std::memcpy(&point_size_int, &point_size, sizeof(point_size));
return (static_cast<std::size_t>(topology) << 24) ^ (point_size_int << 32) ^
static_cast<std::size_t>(primitive_restart_enable);
}
-bool FixedPipelineState::InputAssembly::operator==(const InputAssembly& rhs) const {
+bool FixedPipelineState::InputAssembly::operator==(const InputAssembly& rhs) const noexcept {
return std::tie(topology, primitive_restart_enable, point_size) ==
std::tie(rhs.topology, rhs.primitive_restart_enable, rhs.point_size);
}
-std::size_t FixedPipelineState::Tessellation::Hash() const {
+std::size_t FixedPipelineState::Tessellation::Hash() const noexcept {
return static_cast<std::size_t>(patch_control_points) ^
(static_cast<std::size_t>(primitive) << 6) ^ (static_cast<std::size_t>(spacing) << 8) ^
(static_cast<std::size_t>(clockwise) << 10);
}
-bool FixedPipelineState::Tessellation::operator==(const Tessellation& rhs) const {
+bool FixedPipelineState::Tessellation::operator==(const Tessellation& rhs) const noexcept {
return std::tie(patch_control_points, primitive, spacing, clockwise) ==
std::tie(rhs.patch_control_points, rhs.primitive, rhs.spacing, rhs.clockwise);
}
-std::size_t FixedPipelineState::Rasterizer::Hash() const {
+std::size_t FixedPipelineState::Rasterizer::Hash() const noexcept {
return static_cast<std::size_t>(cull_enable) ^
(static_cast<std::size_t>(depth_bias_enable) << 1) ^
(static_cast<std::size_t>(ndc_minus_one_to_one) << 2) ^
@@ -226,13 +227,13 @@ std::size_t FixedPipelineState::Rasterizer::Hash() const {
(static_cast<std::size_t>(front_face) << 48);
}
-bool FixedPipelineState::Rasterizer::operator==(const Rasterizer& rhs) const {
+bool FixedPipelineState::Rasterizer::operator==(const Rasterizer& rhs) const noexcept {
return std::tie(cull_enable, depth_bias_enable, ndc_minus_one_to_one, cull_face, front_face) ==
std::tie(rhs.cull_enable, rhs.depth_bias_enable, rhs.ndc_minus_one_to_one, rhs.cull_face,
rhs.front_face);
}
-std::size_t FixedPipelineState::DepthStencil::Hash() const {
+std::size_t FixedPipelineState::DepthStencil::Hash() const noexcept {
std::size_t hash = static_cast<std::size_t>(depth_test_enable) ^
(static_cast<std::size_t>(depth_write_enable) << 1) ^
(static_cast<std::size_t>(depth_bounds_enable) << 2) ^
@@ -243,7 +244,7 @@ std::size_t FixedPipelineState::DepthStencil::Hash() const {
return hash;
}
-bool FixedPipelineState::DepthStencil::operator==(const DepthStencil& rhs) const {
+bool FixedPipelineState::DepthStencil::operator==(const DepthStencil& rhs) const noexcept {
return std::tie(depth_test_enable, depth_write_enable, depth_bounds_enable, depth_test_function,
stencil_enable, front_stencil, back_stencil) ==
std::tie(rhs.depth_test_enable, rhs.depth_write_enable, rhs.depth_bounds_enable,
@@ -251,7 +252,7 @@ bool FixedPipelineState::DepthStencil::operator==(const DepthStencil& rhs) const
rhs.back_stencil);
}
-std::size_t FixedPipelineState::ColorBlending::Hash() const {
+std::size_t FixedPipelineState::ColorBlending::Hash() const noexcept {
std::size_t hash = attachments_count << 13;
for (std::size_t rt = 0; rt < static_cast<std::size_t>(attachments_count); ++rt) {
boost::hash_combine(hash, attachments[rt].Hash());
@@ -259,7 +260,7 @@ std::size_t FixedPipelineState::ColorBlending::Hash() const {
return hash;
}
-bool FixedPipelineState::ColorBlending::operator==(const ColorBlending& rhs) const {
+bool FixedPipelineState::ColorBlending::operator==(const ColorBlending& rhs) const noexcept {
return std::equal(attachments.begin(), attachments.begin() + attachments_count,
rhs.attachments.begin(), rhs.attachments.begin() + rhs.attachments_count);
}
diff --git a/src/video_core/renderer_vulkan/fixed_pipeline_state.h b/src/video_core/renderer_vulkan/fixed_pipeline_state.h
index 01f82be68..04152c0d4 100644
--- a/src/video_core/renderer_vulkan/fixed_pipeline_state.h
+++ b/src/video_core/renderer_vulkan/fixed_pipeline_state.h
@@ -30,8 +30,13 @@ struct FixedPipelineState {
u32 stride;
u32 divisor;
- std::size_t Hash() const;
- bool operator==(const VertexBinding& rhs) const;
+ std::size_t Hash() const noexcept;
+
+ bool operator==(const VertexBinding& rhs) const noexcept;
+
+ bool operator!=(const VertexBinding& rhs) const noexcept {
+ return !operator==(rhs);
+ }
};
struct VertexAttribute {
@@ -46,8 +51,13 @@ struct FixedPipelineState {
Maxwell::VertexAttribute::Size size;
u32 offset;
- std::size_t Hash() const;
- bool operator==(const VertexAttribute& rhs) const;
+ std::size_t Hash() const noexcept;
+
+ bool operator==(const VertexAttribute& rhs) const noexcept;
+
+ bool operator!=(const VertexAttribute& rhs) const noexcept {
+ return !operator==(rhs);
+ }
};
struct StencilFace {
@@ -63,8 +73,13 @@ struct FixedPipelineState {
Maxwell::StencilOp action_depth_pass;
Maxwell::ComparisonOp test_func;
- std::size_t Hash() const;
- bool operator==(const StencilFace& rhs) const;
+ std::size_t Hash() const noexcept;
+
+ bool operator==(const StencilFace& rhs) const noexcept;
+
+ bool operator!=(const StencilFace& rhs) const noexcept {
+ return !operator==(rhs);
+ }
};
struct BlendingAttachment {
@@ -89,8 +104,13 @@ struct FixedPipelineState {
Maxwell::Blend::Factor dst_a_func;
std::array<bool, 4> components;
- std::size_t Hash() const;
- bool operator==(const BlendingAttachment& rhs) const;
+ std::size_t Hash() const noexcept;
+
+ bool operator==(const BlendingAttachment& rhs) const noexcept;
+
+ bool operator!=(const BlendingAttachment& rhs) const noexcept {
+ return !operator==(rhs);
+ }
};
struct VertexInput {
@@ -99,8 +119,13 @@ struct FixedPipelineState {
std::array<VertexBinding, Maxwell::NumVertexArrays> bindings;
std::array<VertexAttribute, Maxwell::NumVertexAttributes> attributes;
- std::size_t Hash() const;
- bool operator==(const VertexInput& rhs) const;
+ std::size_t Hash() const noexcept;
+
+ bool operator==(const VertexInput& rhs) const noexcept;
+
+ bool operator!=(const VertexInput& rhs) const noexcept {
+ return !operator==(rhs);
+ }
};
struct InputAssembly {
@@ -114,8 +139,13 @@ struct FixedPipelineState {
bool primitive_restart_enable;
float point_size;
- std::size_t Hash() const;
- bool operator==(const InputAssembly& rhs) const;
+ std::size_t Hash() const noexcept;
+
+ bool operator==(const InputAssembly& rhs) const noexcept;
+
+ bool operator!=(const InputAssembly& rhs) const noexcept {
+ return !operator==(rhs);
+ }
};
struct Tessellation {
@@ -130,8 +160,13 @@ struct FixedPipelineState {
Maxwell::TessellationSpacing spacing;
bool clockwise;
- std::size_t Hash() const;
- bool operator==(const Tessellation& rhs) const;
+ std::size_t Hash() const noexcept;
+
+ bool operator==(const Tessellation& rhs) const noexcept;
+
+ bool operator!=(const Tessellation& rhs) const noexcept {
+ return !operator==(rhs);
+ }
};
struct Rasterizer {
@@ -148,8 +183,13 @@ struct FixedPipelineState {
Maxwell::Cull::CullFace cull_face;
Maxwell::Cull::FrontFace front_face;
- std::size_t Hash() const;
- bool operator==(const Rasterizer& rhs) const;
+ std::size_t Hash() const noexcept;
+
+ bool operator==(const Rasterizer& rhs) const noexcept;
+
+ bool operator!=(const Rasterizer& rhs) const noexcept {
+ return !operator==(rhs);
+ }
};
struct DepthStencil {
@@ -171,8 +211,13 @@ struct FixedPipelineState {
StencilFace front_stencil;
StencilFace back_stencil;
- std::size_t Hash() const;
- bool operator==(const DepthStencil& rhs) const;
+ std::size_t Hash() const noexcept;
+
+ bool operator==(const DepthStencil& rhs) const noexcept;
+
+ bool operator!=(const DepthStencil& rhs) const noexcept {
+ return !operator==(rhs);
+ }
};
struct ColorBlending {
@@ -185,11 +230,17 @@ struct FixedPipelineState {
std::size_t attachments_count;
std::array<BlendingAttachment, Maxwell::NumRenderTargets> attachments;
- std::size_t Hash() const;
- bool operator==(const ColorBlending& rhs) const;
+ std::size_t Hash() const noexcept;
+
+ bool operator==(const ColorBlending& rhs) const noexcept;
+
+ bool operator!=(const ColorBlending& rhs) const noexcept {
+ return !operator==(rhs);
+ }
};
std::size_t Hash() const noexcept;
+
bool operator==(const FixedPipelineState& rhs) const noexcept;
bool operator!=(const FixedPipelineState& rhs) const noexcept {