1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-04 16:24:29 +01:00

[general] Make use of C++ zero initialization

This commit is contained in:
Philip Rebohle 2018-01-28 19:37:22 +01:00
parent b63346b052
commit c6f4cf7330
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
2 changed files with 9 additions and 15 deletions

View File

@ -1360,8 +1360,7 @@ namespace dxvk {
const Rc<DxvkAdapter>& adapter, const Rc<DxvkAdapter>& adapter,
D3D_FEATURE_LEVEL featureLevel) { D3D_FEATURE_LEVEL featureLevel) {
VkPhysicalDeviceFeatures supported = adapter->features(); VkPhysicalDeviceFeatures supported = adapter->features();
VkPhysicalDeviceFeatures enabled; VkPhysicalDeviceFeatures enabled = {};
std::memset(&enabled, 0, sizeof(enabled));
if (featureLevel >= D3D_FEATURE_LEVEL_9_1) { if (featureLevel >= D3D_FEATURE_LEVEL_9_1) {
enabled.depthClamp = VK_TRUE; enabled.depthClamp = VK_TRUE;
@ -1510,11 +1509,8 @@ namespace dxvk {
image, subresources); image, subresources);
} else { } else {
if (subresources.aspectMask == VK_IMAGE_ASPECT_COLOR_BIT) { if (subresources.aspectMask == VK_IMAGE_ASPECT_COLOR_BIT) {
VkClearColorValue value;
std::memset(&value, 0, sizeof(value));
m_resourceInitContext->clearColorImage( m_resourceInitContext->clearColorImage(
image, value, subresources); image, VkClearColorValue(), subresources);
} else { } else {
VkClearDepthStencilValue value; VkClearDepthStencilValue value;
value.depth = 1.0f; value.depth = 1.0f;

View File

@ -1020,9 +1020,6 @@ namespace dxvk {
DxvkContextFlag::GpDirtyPipelineState, DxvkContextFlag::GpDirtyPipelineState,
DxvkContextFlag::GpDirtyVertexBuffers); DxvkContextFlag::GpDirtyVertexBuffers);
m_state.gp.state.ilAttributeCount = attributeCount;
m_state.gp.state.ilBindingCount = bindingCount;
for (uint32_t i = 0; i < attributeCount; i++) { for (uint32_t i = 0; i < attributeCount; i++) {
m_state.gp.state.ilAttributes[i].location = attributes[i].location; m_state.gp.state.ilAttributes[i].location = attributes[i].location;
m_state.gp.state.ilAttributes[i].binding = attributes[i].binding; m_state.gp.state.ilAttributes[i].binding = attributes[i].binding;
@ -1030,18 +1027,19 @@ namespace dxvk {
m_state.gp.state.ilAttributes[i].offset = attributes[i].offset; m_state.gp.state.ilAttributes[i].offset = attributes[i].offset;
} }
std::memset( for (uint32_t i = attributeCount; i < m_state.gp.state.ilAttributeCount; i++)
m_state.gp.state.ilAttributes + attributeCount, 0, m_state.gp.state.ilAttributes[i] = VkVertexInputAttributeDescription();
sizeof(VkVertexInputAttributeDescription) * (MaxNumVertexAttributes - attributeCount));
for (uint32_t i = 0; i < bindingCount; i++) { for (uint32_t i = 0; i < bindingCount; i++) {
m_state.gp.state.ilBindings[i].binding = bindings[i].binding; m_state.gp.state.ilBindings[i].binding = bindings[i].binding;
m_state.gp.state.ilBindings[i].inputRate = bindings[i].inputRate; m_state.gp.state.ilBindings[i].inputRate = bindings[i].inputRate;
} }
std::memset( for (uint32_t i = bindingCount; i < m_state.gp.state.ilBindingCount; i++)
m_state.gp.state.ilBindings + bindingCount, 0, m_state.gp.state.ilBindings[i] = VkVertexInputBindingDescription();
sizeof(VkVertexInputBindingDescription) * (MaxNumVertexBindings - bindingCount));
m_state.gp.state.ilAttributeCount = attributeCount;
m_state.gp.state.ilBindingCount = bindingCount;
} }