summaryrefslogtreecommitdiffstats
path: root/src/video_core/renderer_vulkan
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2023-01-03 16:01:25 +0100
committerFernando Sahmkow <fsahmkow27@gmail.com>2023-01-04 20:39:42 +0100
commita0c697124ced080f58866825e2e323e8682bbd7f (patch)
tree73830fc46134be10d7feffc3da11aa9f0ea58ffb /src/video_core/renderer_vulkan
parentTexture Cache: Implement async texture downloads. (diff)
downloadyuzu-a0c697124ced080f58866825e2e323e8682bbd7f.tar
yuzu-a0c697124ced080f58866825e2e323e8682bbd7f.tar.gz
yuzu-a0c697124ced080f58866825e2e323e8682bbd7f.tar.bz2
yuzu-a0c697124ced080f58866825e2e323e8682bbd7f.tar.lz
yuzu-a0c697124ced080f58866825e2e323e8682bbd7f.tar.xz
yuzu-a0c697124ced080f58866825e2e323e8682bbd7f.tar.zst
yuzu-a0c697124ced080f58866825e2e323e8682bbd7f.zip
Diffstat (limited to 'src/video_core/renderer_vulkan')
-rw-r--r--src/video_core/renderer_vulkan/vk_rasterizer.cpp27
-rw-r--r--src/video_core/renderer_vulkan/vk_state_tracker.cpp2
2 files changed, 14 insertions, 15 deletions
diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp
index fc746fe2c..242bf9602 100644
--- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp
+++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp
@@ -431,21 +431,21 @@ void RasterizerVulkan::FlushRegion(VAddr addr, u64 size, VideoCommon::CacheType
if (addr == 0 || size == 0) {
return;
}
- if (bool(which & VideoCommon::CacheType::TextureCache)) {
+ if (True(which & VideoCommon::CacheType::TextureCache)) {
std::scoped_lock lock{texture_cache.mutex};
texture_cache.DownloadMemory(addr, size);
}
- if ((bool(which & VideoCommon::CacheType::BufferCache))) {
+ if ((True(which & VideoCommon::CacheType::BufferCache))) {
std::scoped_lock lock{buffer_cache.mutex};
buffer_cache.DownloadMemory(addr, size);
}
- if ((bool(which & VideoCommon::CacheType::QueryCache))) {
+ if ((True(which & VideoCommon::CacheType::QueryCache))) {
query_cache.FlushRegion(addr, size);
}
}
bool RasterizerVulkan::MustFlushRegion(VAddr addr, u64 size, VideoCommon::CacheType which) {
- if ((bool(which & VideoCommon::CacheType::BufferCache))) {
+ if ((True(which & VideoCommon::CacheType::BufferCache))) {
std::scoped_lock lock{buffer_cache.mutex};
if (buffer_cache.IsRegionGpuModified(addr, size)) {
return true;
@@ -454,7 +454,7 @@ bool RasterizerVulkan::MustFlushRegion(VAddr addr, u64 size, VideoCommon::CacheT
if (!Settings::IsGPULevelHigh()) {
return false;
}
- if (bool(which & VideoCommon::CacheType::TextureCache)) {
+ if (True(which & VideoCommon::CacheType::TextureCache)) {
std::scoped_lock lock{texture_cache.mutex};
return texture_cache.IsRegionGpuModified(addr, size);
}
@@ -465,18 +465,18 @@ void RasterizerVulkan::InvalidateRegion(VAddr addr, u64 size, VideoCommon::Cache
if (addr == 0 || size == 0) {
return;
}
- if (bool(which & VideoCommon::CacheType::TextureCache)) {
+ if (True(which & VideoCommon::CacheType::TextureCache)) {
std::scoped_lock lock{texture_cache.mutex};
texture_cache.WriteMemory(addr, size);
}
- if ((bool(which & VideoCommon::CacheType::BufferCache))) {
+ if ((True(which & VideoCommon::CacheType::BufferCache))) {
std::scoped_lock lock{buffer_cache.mutex};
buffer_cache.WriteMemory(addr, size);
}
- if ((bool(which & VideoCommon::CacheType::QueryCache))) {
+ if ((True(which & VideoCommon::CacheType::QueryCache))) {
query_cache.InvalidateRegion(addr, size);
}
- if ((bool(which & VideoCommon::CacheType::ShaderCache))) {
+ if ((True(which & VideoCommon::CacheType::ShaderCache))) {
pipeline_cache.InvalidateRegion(addr, size);
}
}
@@ -1050,7 +1050,7 @@ void RasterizerVulkan::UpdateDepthBiasEnable(Tegra::Engines::Maxwell3D::Regs& re
constexpr size_t POINT = 0;
constexpr size_t LINE = 1;
constexpr size_t POLYGON = 2;
- constexpr std::array POLYGON_OFFSET_ENABLE_LUT = {
+ static constexpr std::array POLYGON_OFFSET_ENABLE_LUT = {
POINT, // Points
LINE, // Lines
LINE, // LineLoop
@@ -1159,13 +1159,12 @@ void RasterizerVulkan::UpdateStencilOp(Tegra::Engines::Maxwell3D::Regs& regs) {
}
void RasterizerVulkan::UpdateLogicOp(Tegra::Engines::Maxwell3D::Regs& regs) {
- if (!regs.logic_op.enable) {
- return;
- }
if (!state_tracker.TouchLogicOp()) {
return;
}
- auto op = static_cast<VkLogicOp>(static_cast<u32>(regs.logic_op.op) - 0x1500);
+ const auto op_value = static_cast<u32>(regs.logic_op.op);
+ auto op = op_value >= 0x1500 && op_value < 0x1510 ? static_cast<VkLogicOp>(op_value - 0x1500)
+ : VK_LOGIC_OP_NO_OP;
scheduler.Record([op](vk::CommandBuffer cmdbuf) { cmdbuf.SetLogicOpEXT(op); });
}
diff --git a/src/video_core/renderer_vulkan/vk_state_tracker.cpp b/src/video_core/renderer_vulkan/vk_state_tracker.cpp
index e5cf97472..d56558a83 100644
--- a/src/video_core/renderer_vulkan/vk_state_tracker.cpp
+++ b/src/video_core/renderer_vulkan/vk_state_tracker.cpp
@@ -251,4 +251,4 @@ void StateTracker::InvalidateState() {
StateTracker::StateTracker()
: flags{&default_flags}, default_flags{}, invalidation_flags{MakeInvalidationFlags()} {}
-} // namespace Vulkan \ No newline at end of file
+} // namespace Vulkan