From d9463f45622c74dff1a775e7d547cf44e627e65e Mon Sep 17 00:00:00 2001
From: ReinUsesLisp <reinuseslisp@airmail.cc>
Date: Wed, 22 Apr 2020 21:36:05 -0300
Subject: [PATCH] vk_pipeline_cache: Fix unintentional memcpy into optional

The intention behind this was to assign a float to from an uint32_t, but
it was unintentionally being copied directly into the std::optional.

Copy to a temporary and assign that temporary to std::optional. This can
be replaced with std::bit_cast<float> once we are in C++20.
---
 src/video_core/renderer_vulkan/vk_pipeline_cache.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp
index 8fdc6400dc..a792130fdf 100644
--- a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp
+++ b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp
@@ -330,8 +330,10 @@ VKPipelineCache::DecompileShaders(const GraphicsPipelineCacheKey& key) {
 
     Specialization specialization;
     if (fixed_state.rasterizer.Topology() == Maxwell::PrimitiveTopology::Points) {
-        ASSERT(fixed_state.rasterizer.point_size != 0);
-        std::memcpy(&specialization.point_size, &fixed_state.rasterizer.point_size, sizeof(u32));
+        float point_size;
+        std::memcpy(&point_size, &fixed_state.rasterizer.point_size, sizeof(float));
+        specialization.point_size = point_size;
+        ASSERT(point_size != 0.0f);
     }
     for (std::size_t i = 0; i < Maxwell::NumVertexAttributes; ++i) {
         specialization.attribute_types[i] = fixed_state.vertex_input.attributes[i].Type();