GithubHelp home page GithubHelp logo

a2flo / dxil-spirv Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hanskristian-work/dxil-spirv

0.0 0.0 0.0 3.07 MB

DXIL conversion to SPIR-V for D3D12 translation libraries

License: GNU Lesser General Public License v2.1

CMake 0.76% C++ 82.20% Shell 0.15% Python 1.26% GLSL 13.66% C 1.74% Perl 0.01% Meson 0.22%

dxil-spirv's Introduction

dxil-spirv

This project aims to provide translation of DXIL (SM 6.x) shaders to SPIR-V which can be used in the vkd3d project, which implements D3D12 on top of Vulkan.

Building

Dependencies

Check out submodules first with git submodule update --init. No external dependencies apart from the submodules are required to build.

This project implements a "small" LLVM C++ API subset which acts as a drop-in replacement for the full LLVM. It is possible to build against the true LLVM C++ API if llvm is checked out in external/llvm and -DDXIL_SPIRV_NATIVE_LLVM=ON CMake option is used. See checkout_llvm.sh script.

Build

Standard CMake build.

mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make
make install

Linking against dxil-spirv

Only the C API is installed and is expected to be kept ABI/API stable when it releases.

pkg-config

pkg-config dxil-spirv-c-shared --cflags --libs

CMake module

Something like:

find_package(dxil_spirv_c_shared)
if (dxil_spirv_c_shared_FOUND)
	message("Found dxil-spirv! Enabling DXIL support.")
	target_link_libraries(vkd3d-shader PRIVATE dxil-spirv-c-shared)
	target_compile_definitions(vkd3d-shader PRIVATE HAVE_DXIL_SPV)
	target_sources(vkd3d-shader PRIVATE vkd3d/libs/vkd3d-shader/dxil.c)
else()
	message("Did not find dxil-spirv :( Disabling DXIL support.")
endif()

Testing

The primary method of testing dxil-spirv and avoiding regressions is through a reference shader suite.

Build DXC

First, build DXC. To keep output consistent, we must use a fixed version of DXC. Currently, this only works on Linux, the Windows build of DXC does not seem to support CMake properly.

./checkout_dxc.sh
./build_dxc.sh

The test suite accepts an arbitrary path to DXC, so if you have a standalone binary somewhere, that can work as well.

Run test suite

When adding new tests, place the HLSL test in shaders/ somewhere and run:

./test_shaders.py shaders --dxc external/dxc-build/bin/dxc --dxil-spirv cmake-build-debug/dxil-spirv

If there is any mismatch, the test script will complain. If there are legitimate changes to be made, add --update to the command. The updated files should now be committed alongside the dxil-spirv change.

License

dxil-spirv is currently licensed as LGPLv2, to match vkd3d.

/*
 * Copyright 2019-2021 Hans-Kristian Arntzen for Valve Corporation
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
 */

dxil-spirv's People

Contributors

aeikum avatar damcclos avatar hanskristian-work avatar joshua-ashton avatar wine-pardon 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.