Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[dxvk/d3d11] Static analysis corrections and nits #4748

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/d3d11/d3d11_cuda.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ namespace dxvk {

CubinShaderLaunchInfo() = default;

CubinShaderLaunchInfo(CubinShaderLaunchInfo&& other) {
shader = std::move(other.shader);
params = std::move(other.params);
paramSize = std::move(other.paramSize);
nvxLaunchInfo = std::move(other.nvxLaunchInfo);
cuLaunchConfig = other.cuLaunchConfig;
buffers = std::move(other.buffers);
images = std::move(other.images);
CubinShaderLaunchInfo(CubinShaderLaunchInfo&& other)
: shader ( std::move(other.shader) )
, params ( std::move(other.params) )
, paramSize ( std::move(other.paramSize) )
, nvxLaunchInfo ( std::move(other.nvxLaunchInfo) )
, cuLaunchConfig ( other.cuLaunchConfig )
, buffers ( std::move(other.buffers) )
, images ( std::move(other.images) ) {
other.cuLaunchConfig[1] = nullptr;
other.cuLaunchConfig[3] = nullptr;
other.nvxLaunchInfo.pExtras = nullptr;
Expand All @@ -68,9 +68,9 @@ namespace dxvk {

Com<CubinShaderWrapper> shader;
std::vector<uint8_t> params;
size_t paramSize;
size_t paramSize = 0;
VkCuLaunchInfoNVX nvxLaunchInfo = { VK_STRUCTURE_TYPE_CU_LAUNCH_INFO_NVX };
std::array<void*, 5> cuLaunchConfig;
std::array<void*, 5> cuLaunchConfig = { };

std::vector<std::pair<Rc<DxvkBuffer>, DxvkAccessFlags>> buffers;
std::vector<std::pair<Rc<DxvkImage>, DxvkAccessFlags>> images;
Expand Down
2 changes: 1 addition & 1 deletion src/d3d11/d3d11_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2012,7 +2012,7 @@ namespace dxvk {

HRESULT D3D11Device::CreateShaderModule(
D3D11CommonShader* pShaderModule,
DxvkShaderKey ShaderKey,
const DxvkShaderKey& ShaderKey,
const void* pShaderBytecode,
size_t BytecodeLength,
ID3D11ClassLinkage* pClassLinkage,
Expand Down
2 changes: 1 addition & 1 deletion src/d3d11/d3d11_device.h
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ namespace dxvk {

HRESULT CreateShaderModule(
D3D11CommonShader* pShaderModule,
DxvkShaderKey ShaderKey,
const DxvkShaderKey& ShaderKey,
const void* pShaderBytecode,
size_t BytecodeLength,
ID3D11ClassLinkage* pClassLinkage,
Expand Down
4 changes: 2 additions & 2 deletions src/d3d11/d3d11_fence.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ namespace dxvk {
UINT64 InitialValue,
D3D11_FENCE_FLAG Flags,
HANDLE hFence)
: D3D11DeviceChild<ID3D11Fence>(pDevice) {
: D3D11DeviceChild<ID3D11Fence> ( pDevice )
, m_flags ( Flags ) {
DxvkFenceCreateInfo fenceInfo;
fenceInfo.initialValue = InitialValue;
m_flags = Flags;

if (Flags & D3D11_FENCE_FLAG_SHARED) {
fenceInfo.sharedType = VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_FENCE_BIT;
Expand Down
3 changes: 2 additions & 1 deletion src/dxbc/dxbc_compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5184,7 +5184,8 @@ namespace dxvk {

if (modifiers.saturate) {
DxbcRegMask mask;
DxbcRegisterValue vec0, vec1;
DxbcRegisterValue vec0 = { };
DxbcRegisterValue vec1 = { };

if (value.type.ctype == DxbcScalarType::Float32) {
mask = DxbcRegMask::firstN(value.type.ccount);
Expand Down
2 changes: 1 addition & 1 deletion src/dxbc/dxbc_decoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ namespace dxvk {

private:

DxbcShaderInstruction m_instruction;
DxbcShaderInstruction m_instruction = { };

std::array<DxbcRegister, 8> m_dstOperands;
std::array<DxbcRegister, 8> m_srcOperands;
Expand Down
4 changes: 2 additions & 2 deletions src/dxvk/dxvk_access.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace dxvk {

DxvkObjectTracker::DxvkObjectTracker() {
m_head = std::make_unique<List>();
DxvkObjectTracker::DxvkObjectTracker()
: m_head ( std::make_unique<List>() ) {
m_next = m_head.get();
}

Expand Down
4 changes: 2 additions & 2 deletions src/dxvk/dxvk_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -1645,8 +1645,8 @@ namespace dxvk {
void uploadImageHw(
const Rc<DxvkImage>& image,
const Rc<DxvkBuffer>& source,
VkDeviceSize subresourceAlignment,
VkDeviceSize sourceOffset);
VkDeviceSize sourceOffset,
VkDeviceSize subresourceAlignment);

void performClear(
const Rc<DxvkImageView>& imageView,
Expand Down
2 changes: 1 addition & 1 deletion src/dxvk/dxvk_cs.h
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ namespace dxvk {
DxvkCsChunkFlags m_flags;

alignas(64)
char m_data[DxvkCsChunkSize];
char m_data[DxvkCsChunkSize] = { };

template<typename T>
void* alloc(size_t extra) {
Expand Down
5 changes: 2 additions & 3 deletions src/dxvk/dxvk_device_filter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ namespace dxvk {
DxvkDeviceFilter::DxvkDeviceFilter(
DxvkDeviceFilterFlags flags,
const DxvkOptions& options)
: m_flags(flags) {
m_matchDeviceName = env::getEnvVar("DXVK_FILTER_DEVICE_NAME");

: m_flags(flags)
, m_matchDeviceName ( env::getEnvVar("DXVK_FILTER_DEVICE_NAME") ) {
if (m_matchDeviceName.empty())
m_matchDeviceName = options.deviceFilter;

Expand Down
37 changes: 18 additions & 19 deletions src/dxvk/dxvk_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,23 @@

namespace dxvk {

DxvkOptions::DxvkOptions(const Config& config) {
enableDebugUtils = config.getOption<bool> ("dxvk.enableDebugUtils", false);
enableStateCache = config.getOption<bool> ("dxvk.enableStateCache", true);
enableMemoryDefrag = config.getOption<Tristate>("dxvk.enableMemoryDefrag", Tristate::Auto);
numCompilerThreads = config.getOption<int32_t> ("dxvk.numCompilerThreads", 0);
enableGraphicsPipelineLibrary = config.getOption<Tristate>("dxvk.enableGraphicsPipelineLibrary", Tristate::Auto);
trackPipelineLifetime = config.getOption<Tristate>("dxvk.trackPipelineLifetime", Tristate::Auto);
useRawSsbo = config.getOption<Tristate>("dxvk.useRawSsbo", Tristate::Auto);
hud = config.getOption<std::string>("dxvk.hud", "");
tearFree = config.getOption<Tristate>("dxvk.tearFree", Tristate::Auto);
latencySleep = config.getOption<Tristate>("dxvk.latencySleep", Tristate::Auto);
latencyTolerance = config.getOption<int32_t> ("dxvk.latencyTolerance", 1000);
disableNvLowLatency2 = config.getOption<Tristate>("dxvk.disableNvLowLatency2", Tristate::Auto);
hideIntegratedGraphics = config.getOption<bool> ("dxvk.hideIntegratedGraphics", false);
zeroMappedMemory = config.getOption<bool> ("dxvk.zeroMappedMemory", false);
allowFse = config.getOption<bool> ("dxvk.allowFse", false);
deviceFilter = config.getOption<std::string>("dxvk.deviceFilter", "");
tilerMode = config.getOption<Tristate>("dxvk.tilerMode", Tristate::Auto);
}
DxvkOptions::DxvkOptions(const Config& config)
: enableDebugUtils ( config.getOption<bool> ("dxvk.enableDebugUtils", false) )
, enableStateCache ( config.getOption<bool> ("dxvk.enableStateCache", true) )
, enableMemoryDefrag ( config.getOption<Tristate> ("dxvk.enableMemoryDefrag", Tristate::Auto) )
, numCompilerThreads ( config.getOption<int32_t> ("dxvk.numCompilerThreads", 0) )
, enableGraphicsPipelineLibrary ( config.getOption<Tristate> ("dxvk.enableGraphicsPipelineLibrary", Tristate::Auto) )
, trackPipelineLifetime ( config.getOption<Tristate> ("dxvk.trackPipelineLifetime", Tristate::Auto) )
, useRawSsbo ( config.getOption<Tristate> ("dxvk.useRawSsbo", Tristate::Auto) )
, hud ( config.getOption<std::string>("dxvk.hud", "") )
, tearFree ( config.getOption<Tristate> ("dxvk.tearFree", Tristate::Auto) )
, latencySleep ( config.getOption<Tristate> ("dxvk.latencySleep", Tristate::Auto) )
, latencyTolerance ( config.getOption<int32_t> ("dxvk.latencyTolerance", 1000) )
, disableNvLowLatency2 ( config.getOption<Tristate> ("dxvk.disableNvLowLatency2", Tristate::Auto) )
, hideIntegratedGraphics ( config.getOption<bool> ("dxvk.hideIntegratedGraphics", false) )
, zeroMappedMemory ( config.getOption<bool> ("dxvk.zeroMappedMemory", false) )
, allowFse ( config.getOption<bool> ("dxvk.allowFse", false) )
, tilerMode ( config.getOption<Tristate> ("dxvk.tilerMode", Tristate::Auto) )
, deviceFilter ( config.getOption<std::string>("dxvk.deviceFilter", "") ) { }

}
3 changes: 1 addition & 2 deletions src/dxvk/dxvk_shader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -796,9 +796,8 @@ namespace dxvk {

// Only consider variables that have a desired location
if (candidates.find(varId) != candidates.end()) {
VarInfo varInfo;
VarInfo varInfo = { };
varInfo.varId = varId;
varInfo.decorationOffset = 0;

auto decoration = decorations.find(varId);
if (decoration != decorations.end())
Expand Down
2 changes: 1 addition & 1 deletion src/dxvk/dxvk_state_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ namespace dxvk {

size_t m_size = 0;
size_t m_read = 0;
char m_data[MaxSize];
char m_data[MaxSize] = { };

template<typename T>
bool read(T& data) {
Expand Down
5 changes: 2 additions & 3 deletions src/vulkan/vulkan_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,8 @@ namespace dxvk::vk {
std::tie(m_library, m_getInstanceProcAddr) = loadVulkanLibrary();
}

LibraryLoader::LibraryLoader(PFN_vkGetInstanceProcAddr loaderProc) {
m_getInstanceProcAddr = loaderProc;
}
LibraryLoader::LibraryLoader(PFN_vkGetInstanceProcAddr loaderProc)
: m_getInstanceProcAddr ( loaderProc ) { }

LibraryLoader::~LibraryLoader() {
if (m_library)
Expand Down