Coder Social home page Coder Social logo

d3d4linux's Introduction

Description

The d3d4linux project allows to compile HLSL shaders on Linux using the Microsoft DirectX compiler DLL. It works by launching a Windows program in the background using Wine and diverting calls to that server on the fly.

Note: this is not for porting games to Linux. The goal of this project is to use Linux machines to build and package Windows games (because Linux build machines are cheaper and more reliable). You could see it as “shader cross-compilation”. In the end you still get HLSL bytecode which is of little use on Linux.

Only four functions are implemented for now. They are the ones required by the Unreal Engine shader compiler:

  • D3DCompile
  • D3DReflect
  • D3DStripShader
  • D3DDisassemble

d3d4linux is work in progress and not ready for production but is being successfully used at Dontnod Entertainment to package Windows versions of Unreal Engine 4 games.

Build

Prerequisites:

apt install g++-mingw-w64

Build d3d4linux:

make

Test

Prerequisites:

apt install wine64

Launch the test:

make check

Unreal Engine integration

Patch and build:

  • copy the d3d4linux project to Engine/Sources/ThirdParty/d3d4linux.
  • apply the patch found in extras/patch-ue4.11-support.diff to the Unreal source tree.
  • verify and optionally tweak the D3D4LINUX_ macros in Engine/Source/Developer/Windows/ShaderFormatD3D/Private/D3D11ShaderCompiler.cpp so that they match your desired setup (note that these can also be overridden at runtime using the similarly named environment variables)
  • make sure to rebuild UE4Editor and ShaderCompileWorker.

Run:

  • with AutomationTool: run BuildCookRun as usual with the -targetplatform=Win64 argument.
  • with UE4Editor: run with the -run=Cook -TargetPlatform=WindowsNoEditor arguments.

Debug:

  • set the D3D4LINUX_VERBOSE environment variable to 1 for some debugging information.

d3d4linux's People

Contributors

samhocevar avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.