VirtualBox

Changeset 107544 in vbox


Ignore:
Timestamp:
Jan 8, 2025 5:50:33 PM (10 days ago)
Author:
vboxsync
Message:

libs/dxvk-2.3.1: Make it build on Windows (optionally, for development purpose)

Location:
trunk/src/libs/dxvk-2.3.1
Files:
1 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/libs/dxvk-2.3.1/Makefile.kmk

    r106061 r107544  
    3939#
    4040VBOX_PATH_DXVK := $(PATH_SUB_CURRENT)
     41ifeq ($(KBUILD_TARGET),win)
     42 VBOX_DXVK_PLATFORM = DXVK_PLATFORM_WINDOWS
     43 VBOX_DXVK_CXXFLAGS_WIN = -GR # DXVK uses RTTI
     44 VBOX_DXVK_CXXFLAGS_WIN += -wd4101 # 'e': unreferenced local variable
     45 VBOX_DXVK_CXXFLAGS_WIN += -wd4146 # unary minus operator applied to unsigned type, result still unsigned
     46 VBOX_DXVK_CXXFLAGS_WIN += -wd4265 # 'dxvk::DxgiMonitorInfo': class has virtual functions, but its non-trivial destructor is not virtual; instances of this class may not be destructed correctly
     47 VBOX_DXVK_CXXFLAGS_WIN += -wd4355 # 'this': used in base member initializer list
     48 VBOX_DXVK_CXXFLAGS_WIN += -wd4456 # declaration of 'deviceId' hides previous local declaration
     49 VBOX_DXVK_CXXFLAGS_WIN += -wd4457 # declaration of 'extent' hides function parameter
     50 VBOX_DXVK_CXXFLAGS_WIN += -wd4458 # declaration of 'Srgb' hides class member
     51 VBOX_DXVK_CXXFLAGS_WIN += -wd4701 # potentially uninitialized local variable 'vec0' used
     52 VBOX_DXVK_CXXFLAGS_WIN += -wd4800 # Implicit conversion from 'VkBool32' to bool. Possible information loss
     53 VBOX_DXVK_CXXFLAGS_WIN += -wd4805 # '&=': unsafe mix of type 'bool' and type 'BOOL' in operation
     54 VBOX_DXVK_CXXFLAGS_WIN += -wd4946 # reinterpret_cast used between related classes: 'dxvk::D3D9DeviceEx' and 'IDirect3DDevice9Ex'
     55 VBOX_DXVK_CXXFLAGS_WIN += -wd5039 # pointer or reference to potentially throwing function passed to 'extern "C"' function under -EHc. Undefined behavior may occur if this function throws an exception.
     56 VBOX_DXVK_CXXFLAGS_WIN += -wd5041 # 'DefaultFrameLatency': out-of-line definition for constexpr static data member is not needed and is deprecated in C++17
     57 VBOX_DXVK_CXXFLAGS_WIN += -wd5204 # class has virtual functions, but its trivial destructor is not virtual
     58 VBOX_DXVK_CXXFLAGS_WIN += -wd5219 # implicit conversion from 'int' to 'float', possible loss of data
     59 VBOX_DXVK_CXXFLAGS_WIN += -wd5264 # 'MaxPendingSubmits': 'const' variable is not used
     60 VBOX_DXVK_CXXFLAGS_WIN += -wd5267 # definition of implicit copy constructor for 'dxvk::DxvkSparseBindSubmission' is deprecated because it has a user-provided destructor
     61else
     62 VBOX_DXVK_PLATFORM = DXVK_PLATFORM_LINUX
     63endif
    4164
    4265# The HLSL to Spir-V shader compiler
     
    80103        _WIN32_WINNT=0xa00
    81104VBox-DxVkNativeUtil_DEFS          += \
    82         DXVK_PLATFORM_LINUX \
     105        $(VBOX_DXVK_PLATFORM) \
    83106        DXVK_WSI_HEADLESS
    84107VBox-DxVkNativeUtil_CXXFLAGS.linux += \
     
    86109VBox-DxVkNativeUtil_CXXFLAGS.darwin += \
    87110        -std=c++17
     111VBox-DxVkNativeUtil_CXXFLAGS.win += \
     112        $(VBOX_DXVK_CXXFLAGS_WIN)
    88113VBox-DxVkNativeUtil_INCS           = \
    89114        $(VBOX_PATH_DXVK) \
     
    91116        $(VBOX_PATH_DXVK)/src/util/ \
    92117        $(VBOX_PATH_DXVK)/include/vulkan/include \
    93         $(VBOX_PATH_DXVK)/include/spirv/include \
     118        $(VBOX_PATH_DXVK)/include/spirv/include
     119ifneq ($(KBUILD_TARGET),win)
     120VBox-DxVkNativeUtil_INCS          += \
    94121        $(VBOX_PATH_DXVK)/include/native/ \
    95122        $(VBOX_PATH_DXVK)/include/native/windows \
    96123        $(VBOX_PATH_DXVK)/include/native/directx
     124endif
    97125VBox-DxVkNativeUtil_SOURCES        = \
    98126        src/util/util_env.cpp \
     
    168196        _WIN32_WINNT=0xa00
    169197VBox-DxVkNativeDxVk_DEFS           += \
    170         DXVK_PLATFORM_LINUX \
     198        $(VBOX_DXVK_PLATFORM) \
    171199        DXVK_WSI_HEADLESS
    172200VBox-DxVkNativeDxVk_CXXFLAGS.linux += \
     
    174202VBox-DxVkNativeDxVk_CXXFLAGS.darwin += \
    175203        -std=c++17
     204VBox-DxVkNativeDxVk_CXXFLAGS.win += \
     205        $(VBOX_DXVK_CXXFLAGS_WIN)
    176206VBox-DxVkNativeDxVk_INCS           = \
    177207        $(VBOX_PATH_DXVK) \
     
    179209        $(VBOX_PATH_DXVK)/src/util/ \
    180210        $(VBOX_PATH_DXVK)/include/vulkan/include \
    181         $(VBOX_PATH_DXVK)/include/spirv/include \
     211        $(VBOX_PATH_DXVK)/include/spirv/include
     212ifneq ($(KBUILD_TARGET),win)
     213VBox-DxVkNativeDxVk_INCS          += \
    182214        $(VBOX_PATH_DXVK)/include/native/ \
    183215        $(VBOX_PATH_DXVK)/include/native/windows \
    184216        $(VBOX_PATH_DXVK)/include/native/directx
     217endif
    185218VBox-DxVkNativeDxVk_SOURCES        = \
    186219        src/dxvk/dxvk_adapter.cpp \
     
    300333        _WIN32_WINNT=0xa00
    301334VBox-DxVkNativeD3D11_DEFS           += \
    302         DXVK_PLATFORM_LINUX \
     335        $(VBOX_DXVK_PLATFORM) \
    303336        DXVK_WSI_HEADLESS
    304337VBox-DxVkNativeD3D11_CXXFLAGS.linux += \
     
    306339VBox-DxVkNativeD3D11_CXXFLAGS.darwin += \
    307340        -std=c++17
     341VBox-DxVkNativeD3D11_CXXFLAGS.win += \
     342        $(VBOX_DXVK_CXXFLAGS_WIN)
    308343VBox-DxVkNativeD3D11_INCS            = \
    309344        $(VBOX_PATH_DXVK) \
     
    311346        $(VBOX_PATH_DXVK)/src/util/ \
    312347        $(VBOX_PATH_DXVK)/include/vulkan/include \
    313         $(VBOX_PATH_DXVK)/include/spirv/include \
     348        $(VBOX_PATH_DXVK)/include/spirv/include
     349ifneq ($(KBUILD_TARGET),win)
     350VBox-DxVkNativeD3D11_INCS           += \
    314351        $(VBOX_PATH_DXVK)/include/native/ \
    315352        $(VBOX_PATH_DXVK)/include/native/windows \
    316353        $(VBOX_PATH_DXVK)/include/native/directx
     354endif
    317355VBox-DxVkNativeD3D11_SOURCES        = \
    318356        src/dxgi/dxgi_format.cpp \
     
    387425        $(VBOX_PATH_DXVK) \
    388426        $(VBOX_PATH_DXVK)/include/ \
    389         $(VBOX_PATH_DXVK)/src/util/ \
     427        $(VBOX_PATH_DXVK)/src/util/
     428ifneq ($(KBUILD_TARGET),win)
     429VBoxDxVk_INCS    += \
    390430        $(VBOX_PATH_DXVK)/include/native/ \
    391431        $(VBOX_PATH_DXVK)/include/native/windows \
    392432        $(VBOX_PATH_DXVK)/include/native/directx
     433endif
    393434VBoxDxVk_CXXFLAGS.linux += \
    394435        -std=c++17
     436VBoxDxVk_CXXFLAGS.win += \
     437        $(VBOX_DXVK_CXXFLAGS_WIN)
    395438VBoxDxVk_SOURCES     = \
    396439        VBoxDxVkDeps.cpp
     440VBoxDxVk_SOURCES.win = \
     441        VBoxDxVk.def
    397442VBoxDxVk_LIBS     = \
    398443        $(PATH_STAGE_LIB)/VBox-DxVkNativeD3D11$(VBOX_SUFF_LIB) \
  • trunk/src/libs/dxvk-2.3.1/include/native/wsi/native_wsi.h

    r105107 r107544  
    88#include "wsi/native_glfw.h"
    99#elif DXVK_WSI_HEADLESS
     10#if defined(VBOX) && defined(_WIN32)
     11#include "native/wsi/native_headless.h"
     12#else
    1013#include "wsi/native_headless.h"
     14#endif
    1115#else
    1216#error Unknown wsi!
  • trunk/src/libs/dxvk-2.3.1/src/dxvk/dxvk_instance.cpp

    r105107 r107544  
    3636    m_extProviders.push_back(&DxvkPlatformExts::s_instance);
    3737#ifdef _WIN32
     38#ifndef VBOX
    3839    m_extProviders.push_back(&VrInstance::s_instance);
    3940    m_extProviders.push_back(&DxvkXrProvider::s_instance);
     41#endif
    4042#endif
    4143
  • trunk/src/libs/dxvk-2.3.1/src/util/com/com_include.h

    r105107 r107544  
    88
    99#define WIN32_LEAN_AND_MEAN
     10#if defined(VBOX) && defined(_WIN32)
     11#include <iprt/win/windows.h>
     12#else
    1013#include <windows.h>
     14#endif
    1115#include <unknwn.h>
    1216
  • trunk/src/libs/dxvk-2.3.1/src/util/util_env.cpp

    r105141 r107544  
    7676
    7777  std::string getExePath() {
    78 #ifdef VBOX
    79     std::array<char, PATH_MAX> exePath = {};
    80     if (!RTProcGetExecutablePath(exePath.data(), exePath.size()))
    81       return std::string("");
    82     return std::string(exePath.begin(), exePath.begin() + strlen(exePath.begin()));
    83 #else
    8478#if defined(_WIN32)
    8579    std::vector<WCHAR> exePath;
     
    9185    return str::fromws(exePath.data());
    9286#elif defined(__linux__)
     87#ifdef VBOX
     88    std::array<char, PATH_MAX> exePath = {};
     89    if (!RTProcGetExecutablePath(exePath.data(), exePath.size()))
     90      return std::string("");
     91    return std::string(exePath.begin(), exePath.begin() + strlen(exePath.begin()));
     92#else
    9393    std::array<char, PATH_MAX> exePath = {};
    9494
     
    9696
    9797    return std::string(exePath.begin(), exePath.begin() + count);
     98#endif /* VBOX */
    9899#endif
    99 #endif /* VBOX */
    100100  }
    101101 
  • trunk/src/libs/dxvk-2.3.1/src/util/util_gdi.h

    r105107 r107544  
    11#pragma once
    22
     3#if defined(VBOX) && defined(_WIN32)
     4#include <iprt/win/d3d9.h>
     5#else
    36#include <d3d9.h>
     7#endif
    48
    59namespace dxvk {
  • trunk/src/libs/dxvk-2.3.1/src/util/util_win32_compat.h

    r105110 r107544  
    11#pragma once
    22
    3 #if defined(__linux__) || defined(VBOX)
     3#if defined(__linux__) || (defined(VBOX) && !defined(_WIN32))
    44
    55#include <windows.h>
  • trunk/src/libs/dxvk-2.3.1/src/wsi/headless/wsi_monitor_headless.cpp

    r105107 r107544  
    33#include <windows.h>
    44
     5#if defined(VBOX) && defined(_WIN32)
     6#include "native/wsi/native_wsi.h"
     7#else
    58#include "wsi/native_wsi.h"
     9#endif
    610#include "wsi_platform_headless.h"
    711
  • trunk/src/libs/dxvk-2.3.1/src/wsi/headless/wsi_window_headless.cpp

    r105107 r107544  
    22
    33#include <windows.h>
     4#if defined(VBOX) && defined(_WIN32)
     5#include "native/wsi/native_wsi.h"
     6#else
    47#include "wsi/native_wsi.h"
     8#endif
    59#include "wsi_platform_headless.h"
    610
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette