1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-02 19:24:12 +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,
D3D_FEATURE_LEVEL featureLevel) {
VkPhysicalDeviceFeatures supported = adapter->features();
VkPhysicalDeviceFeatures enabled;
std::memset(&enabled, 0, sizeof(enabled));
VkPhysicalDeviceFeatures enabled = {};
if (featureLevel >= D3D_FEATURE_LEVEL_9_1) {
enabled.depthClamp = VK_TRUE;
@ -1510,11 +1509,8 @@ namespace dxvk {
image, subresources);
} else {
if (subresources.aspectMask == VK_IMAGE_ASPECT_COLOR_BIT) {
VkClearColorValue value;
std::memset(&value, 0, sizeof(value));
m_resourceInitContext->clearColorImage(
image, value, subresources);
image, VkClearColorValue(), subresources);
} else {
VkClearDepthStencilValue value;
value.depth = 1.0f;

View File

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