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.
This commit is contained in:
parent
5ed13304e1
commit
d9463f4562
1 changed files with 4 additions and 2 deletions
|
@ -330,8 +330,10 @@ VKPipelineCache::DecompileShaders(const GraphicsPipelineCacheKey& key) {
|
||||||
|
|
||||||
Specialization specialization;
|
Specialization specialization;
|
||||||
if (fixed_state.rasterizer.Topology() == Maxwell::PrimitiveTopology::Points) {
|
if (fixed_state.rasterizer.Topology() == Maxwell::PrimitiveTopology::Points) {
|
||||||
ASSERT(fixed_state.rasterizer.point_size != 0);
|
float point_size;
|
||||||
std::memcpy(&specialization.point_size, &fixed_state.rasterizer.point_size, sizeof(u32));
|
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) {
|
for (std::size_t i = 0; i < Maxwell::NumVertexAttributes; ++i) {
|
||||||
specialization.attribute_types[i] = fixed_state.vertex_input.attributes[i].Type();
|
specialization.attribute_types[i] = fixed_state.vertex_input.attributes[i].Type();
|
||||||
|
|
Loading…
Reference in a new issue