Coder Social home page Coder Social logo

owensgroup / unifiedshaderspecialization Goto Github PK

View Code? Open in Web Editor NEW
14.0 19.0 1.0 53 KB

Source code supporting the High Performance Graphics 2022 paper: Supporting Unified Shader Specialization by Co-opting C++ Features

License: Other

C++ 97.15% C 2.85%

unifiedshaderspecialization's Introduction

thusc

Translator for Heterogeneous Unified Shaders in C++

This repository contains source code supporting the High Performance Graphics 2022 paper:

Supporting Unified Shader Specialization by Co-opting C++ Features
Kerry A. Seitz, Jr., Theresa Foley, Serban D. Porumbescu, and John D. Owens
Proceedings of the ACM on Computer Graphics and Interactive Techniques (PACMCGIT)
Volume 5 Issue 3, July 2022
Article No. 25

DOI: https://doi.org/10.1145/3543866
Code: https://github.com/owensgroup/UnifiedShaderSpecialization

Getting Started

Note: This code is currently tested only on 64-bit Windows.

Required Software

  1. Microsoft Visual Studio 2019: https://visualstudio.microsoft.com/vs/older-downloads/

    Note: Also known as Microsoft Visual Studio 16.0

  2. LLVM and Clang version 11.0.0: https://llvm.org/

    Note: We recommend building LLVM 11 from source with the following CMake arguments:

    • -DLLVM_ENABLE_PROJECTS=clang
    • -DLLVM_TARGETS_TO_BUILD=X86
    • -DLLVM_USE_CRT_RELWITHDEBINFO=MDd
    • -DMSVC_DIA_SDK_DIR=C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/DIA SDK
    • (Modify path appropriately for your install of Visual Studio 2019)

Note 2: We recommend building the Release and RelWithDebInfo builds of LLVM and Clang, which are used with thusc's Release and Debug builds, respectively. However, you can change this by modifying $THSUC/source/thusc/LLVMSpecificProperties-Release.props and $THUSC/source/thusc/LLVMSpecificProperties-Debug.props to build against different LLVM build types.

Building

  1. Clone the thusc repository. We'll call the directory into which you cloned the repository: $THUSC

    # Make sure to clone with --recursive
    git clone --recursive https://github.com/owensgroup/UnifiedShaderSpecialization.git

    Note: If you didn't clone with the --recursive flag, then you need to manually clone the submodules:

    cd $THUSC
    git submodule update --init --recursive
  2. Modify $THUSC/source/thusc/ThuscCommon.h as follows:

    • Modify line 38 #define THUSC_H_PATH "G:\\workspace\\thusc\\include\\thusc.h" to point to your cloned copy of the $THUSC/include/thusc.h file.
  3. Modify $THUSC/source/thusc/LLVMSpecificProperties.props as follows:

    • (Optional) Modify line 5 <LLVMDir>$(SolutionDir)\..\llvm\</LLVMDir> to point to the location of the parent directory to your LLVM source and build directories.
    • Modify line 6 <LLVMSrcDir>$(LLVMDir)\llvm-project</LLVMSrcDir> to point to the location of your LLVM top-level source directory. This directory should contain subdirectories for llvm and clang.
    • Modify line 7 <LLVMBuildDir>$(LLVMDir)\build-11.0.0</LLVMBuildDir> to point to the location of your LLVM build directory.
  4. Build thusc by opening thusc.sln and building via Visual Studio 2019. The solution provides both Debug and Release builds.

  5. You should now be able to run the translator tool. Run with -h to see the command-line arguments.

Tips for use with Unreal Engine 4 (UE4)

In the paper, the C++ attribute [[ShaderClass]] is used to denote a ShaderClass. However, UE4 uses this identifier already. Instead, use [[ThuscShader]] to denote a ShaderClass.

If you are writing code that #includes UE4 header files, we recommend generating a Clang Compilation Database from UE4. The Unreal Build Tool can generate this database for you:

  1. Unreal Build Tool expects LLVM and Clang to be installed at C:\Program Files\LLVM (it searches for bin\clang-cl.exe at that location). If you did not install LLVM and Clang to this location, you can symbolically link C:\Program Files\LLVM to your build.

  2. You can then generate the compilation database by running this command:

    UnrealEngine\Engine\Build\BatchFiles\Build.bat -mode=GenerateClangDatabase -Target="UE4Editor Win64 Development" -WaitMutex
  3. This generated file is very large, and the translator tool takes a long time to parse it. We recommend making a copy and editing it to contain just the portions you need.

unifiedshaderspecialization's People

Contributors

kseitz avatar

Stargazers

Pavlo Penenko avatar Wu Jingyu avatar zephyr avatar Snowapril avatar Link avatar  avatar Zheng Shaokun avatar Jim avatar  avatar  avatar  avatar Heedong Lee avatar ahmed avatar Muhammad Awad avatar

Watchers

Serban Porumbescu avatar James Cloos avatar  avatar Afton Geil avatar Shubho Sengupta avatar  avatar Carl Yang avatar  avatar Leyuan Wang avatar ahmed avatar Vehbi Esref Bayraktar avatar Saman Ashkiani avatar Muhammad Awad avatar  avatar  avatar Toluwanimi O avatar Achal Agarwal avatar  avatar  avatar

Forkers

peterzs

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.