diff options
| author | 2020-04-22 21:36:05 -0300 | |
|---|---|---|
| committer | 2020-04-22 21:36:05 -0300 | |
| commit | d9463f45622c74dff1a775e7d547cf44e627e65e (patch) | |
| tree | ca32dbf10eb8eb71567731a4e449200d5286ff85 /src | |
| parent | Merge pull request #3758 from H27CK/vk-cmd (diff) | |
| download | yuzu-d9463f45622c74dff1a775e7d547cf44e627e65e.tar.gz yuzu-d9463f45622c74dff1a775e7d547cf44e627e65e.tar.xz yuzu-d9463f45622c74dff1a775e7d547cf44e627e65e.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_pipeline_cache.cpp | 6 |
1 files 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 8fdc6400d..a792130fd 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) { | |||
| 330 | 330 | ||
| 331 | Specialization specialization; | 331 | Specialization specialization; |
| 332 | if (fixed_state.rasterizer.Topology() == Maxwell::PrimitiveTopology::Points) { | 332 | if (fixed_state.rasterizer.Topology() == Maxwell::PrimitiveTopology::Points) { |
| 333 | ASSERT(fixed_state.rasterizer.point_size != 0); | 333 | float point_size; |
| 334 | std::memcpy(&specialization.point_size, &fixed_state.rasterizer.point_size, sizeof(u32)); | 334 | std::memcpy(&point_size, &fixed_state.rasterizer.point_size, sizeof(float)); |
| 335 | specialization.point_size = point_size; | ||
| 336 | ASSERT(point_size != 0.0f); | ||
| 335 | } | 337 | } |
| 336 | for (std::size_t i = 0; i < Maxwell::NumVertexAttributes; ++i) { | 338 | for (std::size_t i = 0; i < Maxwell::NumVertexAttributes; ++i) { |
| 337 | specialization.attribute_types[i] = fixed_state.vertex_input.attributes[i].Type(); | 339 | specialization.attribute_types[i] = fixed_state.vertex_input.attributes[i].Type(); |