Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
5f8159e
Fixed missing write mask in DX9 HlslWriter
lanyizi May 18, 2021
d379a07
unified constant name handling in DX9 shader
lanyizi May 20, 2021
b5b3688
Fixed failed test cases in DX9's AsmMatchesFxc
lanyizi May 20, 2021
b5348d7
let FxlcOperand support both raw / descriptive name
lanyizi May 20, 2021
607bc00
Proper support of expression decompilation
lanyizi May 20, 2021
a2d0e1d
Support more instructions (ddx, ddy)
lanyizi May 20, 2021
d5fc02e
Support preshader decompilation; Refactored DX9 Fxlc
lanyizi May 20, 2021
9afca30
Various misc changes / fixes
lanyizi May 20, 2021
a768b50
Support referencing preshader-processed variables in main shader
lanyizi May 20, 2021
d0dcf2e
force invariant culture
lanyizi May 21, 2021
8d13694
Some kind of relative addressing support in FX9 decompilation
lanyizi May 21, 2021
9c43213
Support address register in FX9 decompilation
lanyizi May 21, 2021
a5f7037
Fix typo
lanyizi May 21, 2021
5ca2a35
Fix effect decompilation output
lanyizi May 22, 2021
f9d031a
Fixed tests and implemented more instructions in Dx9 Fxlc
lanyizi May 22, 2021
7b16ace
Refactored decompilation of constant declarations
lanyizi May 22, 2021
0a51204
Merge common constant declarations in DX9 Effect
lanyizi May 22, 2021
4c59abd
Merge effect shaders' input / output declaration when possible
lanyizi May 22, 2021
d441de8
Fixed the missing constructors in annotations
lanyizi May 22, 2021
3eb9e9f
Added a ToString method to SourceOperand
lanyizi May 22, 2021
85968ac
Added the missing compile statement in shader array initialization
lanyizi May 22, 2021
7301daa
Fixed incorrect typename when decompiling effect parameters
lanyizi May 22, 2021
16d0ef2
Fixed the wrong register number in ctab override
lanyizi May 22, 2021
170297f
Proper handling of write masks in DX9 shader decompilation
lanyizi May 22, 2021
0d605d8
Added the missing semicolon in DX9 shader constant declarations
lanyizi May 22, 2021
13259a8
Fixed pixal shader declaration semantic in DX9
lanyizi May 22, 2021
68bfb01
Handle rare cases where DX9 constant might start with a dollar sign
lanyizi May 22, 2021
4b738ff
Handle ambiguities between vs's addr and ps's texcoord in DX9
lanyizi May 22, 2021
336e514
fix conflicting names between input / output register names in DX9
lanyizi May 22, 2021
3e5b87a
Added the missing entry point name in DX9 tests
lanyizi May 22, 2021
79232e0
better handling of relative addressing in dx9
lanyizi May 22, 2021
88ca7fd
shader profile / version mapping
lanyizi May 22, 2021
dec7863
fixed rsq instruction in DX9's Fxlc
lanyizi May 22, 2021
592866b
Let expression return scalar
lanyizi May 22, 2021
94fa2d1
Fix DX9 tests' issues with shader profile / effects
lanyizi May 22, 2021
2932e74
Guess tex operation name by looking at sampler type
lanyizi May 23, 2021
25ed8eb
Better support of input declaration (with write masks) in DX9 shaders
lanyizi May 23, 2021
305f3b1
Automatically truncate uv swizzles in texture operations
lanyizi May 23, 2021
9c13fec
Fix bug in dx9 shader input structure checking
lanyizi May 23, 2021
8025c63
Let HLSL writer write disassambly in comments
lanyizi May 23, 2021
2f7313c
fix operand formatting in DX9
lanyizi May 23, 2021
da0bca3
Fix output declaration handling in dx9
lanyizi May 23, 2021
5c8d472
Correct handling of nrm instruction
lanyizi May 23, 2021
18d27cd
Prefer blobs instead of literal values in dx9 effect
lanyizi May 23, 2021
1578bb8
Handle multiple output registers in expression shaders
lanyizi May 23, 2021
d02e13f
fix compile target in dx9 effect
lanyizi May 23, 2021
d3feebd
fix temp variables in fxlc decompilation
lanyizi May 23, 2021
14390bd
make sure index register only uses one component
lanyizi May 23, 2021
f16ce07
Read correct number of dx9 constant default values
lanyizi May 23, 2021
48fd35c
handle null blobs gracefully
lanyizi May 23, 2021
c57fe5f
fix textureCUBE in Parameter.GetTypeName
lanyizi May 23, 2021
8e00485
Added a "constants' default values with padding" so fxl VM could work…
lanyizi May 23, 2021
e8cf5e3
Removed comments in dx9 structs again as they could be misleading
lanyizi May 23, 2021
0371506
Removed structure declaration unification as they could somtimes be m…
lanyizi May 24, 2021
798fc79
Handle empty pres comment token
lanyizi May 24, 2021
6a47382
Gracefully handle unsupported sm1 shaders
lanyizi May 24, 2021
6e56258
added a simple help message in DXDecompilerCmd
lanyizi May 24, 2021
0d39934
Implement lit instruction
lanyizi May 24, 2021
30edd6e
Added the missing destinatinon modifier in dx9 HlslWriter
lanyizi May 25, 2021
8e52052
Fixed wrong decompilation of lrp instruction in dx9 HlslWriter
lanyizi May 25, 2021
9a454b1
Prevent conflicting register assignments in effect
lanyizi May 25, 2021
f661774
Better handling of constant literals
lanyizi May 25, 2021
3ff8202
Experimental SM1 shaders support, made possible by jonwil's effort
lanyizi May 30, 2021
dfab560
minor style change
lanyizi May 30, 2021
7d30021
fix fxlc operand's scalar/vector handling
lanyizi Jul 22, 2021
77bcf12
More meaningful shader names
lanyizi Jul 22, 2021
f368384
fix texXXlod
lanyizi Jul 22, 2021
f3a6b4f
fix sincos
lanyizi Jul 22, 2021
77d0d36
upgrade to .NET 5
lanyizi Jul 23, 2021
c951198
Set up Github Actions
lanyizi Feb 17, 2022
5a4deec
Update README.md
lanyizi Feb 17, 2022
ebeea20
Allow manual triggering of Github Action
lanyizi May 24, 2022
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
39 changes: 39 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: build

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:

jobs:
build:

runs-on: windows-latest
defaults:
run:
working-directory: ./src
steps:
- uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x
- name: Restore previous dependencies
uses: actions/cache@v2
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
- name: Restore dependencies
run: dotnet restore DXDecompiler.sln
- name: Build
id: build
run: dotnet build --no-restore
- name: Publish
id: publish
run: dotnet publish DXDecompilerCmd --no-build
- name: Upload published files
uses: actions/upload-artifact@v2.3.1
with:
path: src/DXDecompilerCmd/bin/**/publish
33 changes: 33 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: test

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:

jobs:
test:
runs-on: windows-latest
defaults:
run:
working-directory: ./src
steps:
- uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x
- name: Restore previous dependencies
uses: actions/cache@v2
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
- name: Restore dependencies
run: dotnet restore DXDecompiler.sln
- name: Build
id: build
run: dotnet build --no-restore
- name: Test
run: dotnet test DXDecompiler.Tests --no-build --verbosity normal
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
DXDecompiler
==========

[![build](https://github.com/lanyizi/DXDecompiler/actions/workflows/build.yaml/badge.svg)](https://github.com/lanyizi/DXDecompiler/actions/workflows/build.yaml)
[![test](https://github.com/lanyizi/DXDecompiler/actions/workflows/test.yaml/badge.svg)](https://github.com/lanyizi/DXDecompiler/actions/workflows/test.yaml)

DXDecompiler is a Direct3D shader bytecode decompiler for .NET. It is in currently in very early development.

Latest CI build artifact can be downloaded [here](https://nightly.link/lanyizi/DXDecompiler/workflows/build.yaml/master/artifact.zip).
Requires [.NET 5 Runtime](https://dotnet.microsoft.com/en-us/download/dotnet/5.0/runtime).

Acknowledgements
----------------
DXDecompiler uses code and research from the following projects.
Expand Down
130 changes: 21 additions & 109 deletions src/DXDecompiler.Tests/DXDecompiler.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,87 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\NUnit3TestAdapter.3.17.0\build\net35\NUnit3TestAdapter.props" Condition="Exists('..\packages\NUnit3TestAdapter.3.17.0\build\net35\NUnit3TestAdapter.props')" />
<Import Project="..\packages\NUnit.3.12.0\build\NUnit.props" Condition="Exists('..\packages\NUnit.3.12.0\build\NUnit.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{3D19DAC1-E727-43BA-A264-A64408B4D598}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DXDecompiler.Tests</RootNamespace>
<AssemblyName>DXDecompiler.Tests</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
<TargetFramework>net5.0</TargetFramework>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<AssemblyTitle>SlimShader.Tests</AssemblyTitle>
<Product>SlimShader.Tests</Product>
<Copyright>Copyright © 2012</Copyright>
<OutputPath>bin\$(Configuration)\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<ItemGroup>
<Reference Include="nunit.framework, Version=3.12.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\packages\NUnit.3.12.0\lib\net40\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="SharpDX, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b4dcf0f35e5521f1, processorArchitecture=MSIL">
<HintPath>..\packages\SharpDX.4.2.0\lib\net40\SharpDX.dll</HintPath>
</Reference>
<Reference Include="SharpDX.D3DCompiler, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b4dcf0f35e5521f1, processorArchitecture=MSIL">
<HintPath>..\packages\SharpDX.D3DCompiler.4.2.0\lib\net40\SharpDX.D3DCompiler.dll</HintPath>
</Reference>
<Reference Include="SharpDX.Direct3D10, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b4dcf0f35e5521f1, processorArchitecture=MSIL">
<HintPath>..\packages\SharpDX.Direct3D10.4.2.0\lib\net40\SharpDX.Direct3D10.dll</HintPath>
</Reference>
<Reference Include="SharpDX.Direct3D11, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b4dcf0f35e5521f1, processorArchitecture=MSIL">
<HintPath>..\packages\SharpDX.Direct3D11.4.2.0\lib\net40\SharpDX.Direct3D11.dll</HintPath>
</Reference>
<Reference Include="SharpDX.Direct3D11.Effects, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b4dcf0f35e5521f1, processorArchitecture=MSIL">
<HintPath>..\packages\SharpDX.Direct3D11.Effects.4.2.0\lib\net40\SharpDX.Direct3D11.Effects.dll</HintPath>
</Reference>
<Reference Include="SharpDX.Direct3D9, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b4dcf0f35e5521f1, processorArchitecture=MSIL">
<HintPath>..\packages\SharpDX.Direct3D9.4.2.0\lib\net40\SharpDX.Direct3D9.dll</HintPath>
</Reference>
<Reference Include="SharpDX.DXGI, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b4dcf0f35e5521f1, processorArchitecture=MSIL">
<HintPath>..\packages\SharpDX.DXGI.4.2.0\lib\net40\SharpDX.DXGI.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
<PackageReference Include="SharpDX" Version="4.2.0" />
<PackageReference Include="SharpDX.D3DCompiler" Version="4.2.0" />
<PackageReference Include="SharpDX.Direct3D10" Version="4.2.0" />
<PackageReference Include="SharpDX.Direct3D11" Version="4.2.0" />
<PackageReference Include="SharpDX.Direct3D11.Effects" Version="4.2.0" />
<PackageReference Include="SharpDX.Direct3D9" Version="4.2.0" />
<PackageReference Include="SharpDX.DXGI" Version="4.2.0" />
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
</ItemGroup>
<ItemGroup>
<Compile Include="AssertTraceListener.cs" />
<Compile Include="ShaderCompiler.cs" />
<Compile Include="DX10Util\Extension.cs" />
<Compile Include="TestFixtures\TestDX9Effects.cs" />
<Compile Include="TestFixtures\CompileShadersFixture.cs" />
<Compile Include="TestFixtures\DX9Tests.cs" />
<Content Include="FXC\D3DCompiler_43.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
Expand Down Expand Up @@ -129,7 +78,6 @@
</Content>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<Content Include="ShadersDX9\Sdk\dx9sdk\LightingVS.fx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
Expand Down Expand Up @@ -280,24 +228,11 @@
<Content Include="Shaders\Internal\Effects\EffectNoTechnique.fx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Compile Include="Effects10.cs" />
<Compile Include="Effects11.cs" />
<Content Include="Shaders\Internal\Effects\EffectPacking.fx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Compile Include="TestFixtures\DoubleFormatterTests.cs" />
<Compile Include="TestFixtures\MiscTests.cs" />
<Compile Include="TestFixtures\TestEffectCreation.cs" />
<Compile Include="TestFixtures\TestLibraryShader.cs" />
<Compile Include="Util\DoubleUtil.cs" />
<Compile Include="Util\Util.cs" />
<Compile Include="TestFixtures\DecoderExtensionsTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="TestFixtures\DX10Tests.cs" />
<Compile Include="Util\TestUtils.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<Content Include="ShadersDX9\HlslCrossCompiler\ps2\tex2d.fx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
Expand Down Expand Up @@ -1105,14 +1040,8 @@
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\DebugParser\DebugParser.csproj">
<Project>{43b35c43-bd28-4731-81aa-772ee71c08b2}</Project>
<Name>DebugParser</Name>
</ProjectReference>
<ProjectReference Include="..\DXDecompiler\DXDecompiler.csproj">
<Project>{D75528F5-54F9-4E31-94F6-03C194F74CF2}</Project>
<Name>DXDecompiler</Name>
</ProjectReference>
<ProjectReference Include="..\DebugParser\DebugParser.csproj" />
<ProjectReference Include="..\DXDecompiler\DXDecompiler.csproj" />
</ItemGroup>
<ItemGroup>
<Content Include="Shaders\FxDis\readme.txt">
Expand Down Expand Up @@ -1272,21 +1201,4 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\NUnit.3.12.0\build\NUnit.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NUnit.3.12.0\build\NUnit.props'))" />
<Error Condition="!Exists('..\packages\NUnit3TestAdapter.3.17.0\build\net35\NUnit3TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NUnit3TestAdapter.3.17.0\build\net35\NUnit3TestAdapter.props'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
25 changes: 0 additions & 25 deletions src/DXDecompiler.Tests/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,35 +1,10 @@
using System.Reflection;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SlimShader.Tests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SlimShader.Tests")]
[assembly: AssemblyCopyright("Copyright © 2012")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("27e58db9-828f-4641-a0a5-50f283be5fda")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
28 changes: 18 additions & 10 deletions src/DXDecompiler.Tests/TestFixtures/DX9Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using DXDecompiler.DX9Shader;
using DXDecompiler.Tests.Util;
using NUnit.Framework;
using SharpDX.D3DCompiler;
using SharpDX.Direct3D9;
using System;
using System.Collections.Generic;
using System.IO;
Expand Down Expand Up @@ -46,7 +46,7 @@ private static IEnumerable<string> TestShaders
/// <summary>
/// Compare ASM output produced by fxc.exe and SlimShader.
/// </summary>
[TestCaseSource("TestShaders")]
[TestCaseSource(nameof(TestShaders))]
public void AsmMatchesFxc(string relPath)
{
string file = $"{ShaderDirectory}/{relPath}";
Expand Down Expand Up @@ -78,7 +78,7 @@ public void AsmMatchesFxc(string relPath)
/// <summary>
/// Compare ASM output produced by fxc.exe and SlimShader.
/// </summary>
[TestCaseSource("TestShaders")]
[TestCaseSource(nameof(TestShaders))]
public void Decompile(string relPath)
{
string file = $"{ShaderDirectory}/{relPath}";
Expand All @@ -93,7 +93,7 @@ public void Decompile(string relPath)
// Assert.
}

[TestCaseSource("TestShaders")]
[TestCaseSource(nameof(TestShaders))]
public void DumpStructure(string relPath)
{
string file = $"{ShaderDirectory}/{relPath}";
Expand Down Expand Up @@ -181,17 +181,25 @@ public void RecompileShaders(string relPath)
// Act.
var binaryFileBytes = File.ReadAllBytes(file + ".o");
var shaderModel = ShaderReader.ReadShader(binaryFileBytes);
var decompiledHLSL = HlslWriter.Decompile(shaderModel);
var decompiledHLSL = HlslWriter.Decompile(shaderModel, "main");
File.WriteAllText($"{OutputDir}/{relPath}.d.hlsl", decompiledHLSL);

using(var shaderBytecode = ShaderBytecode.FromStream(new MemoryStream(binaryFileBytes)))
{
var profile = shaderModel.Type == DX9Shader.ShaderType.Pixel ?
$"ps_{shaderModel.MajorVersion}_{shaderModel.MinorVersion}" :
$"vs_{shaderModel.MajorVersion}_{shaderModel.MinorVersion}";
var compiledShader = ShaderBytecode.Compile(decompiledHLSL, "main", profile);
var disassembly = shaderBytecode.Disassemble();
string profile;
switch(shaderModel.Type)
{
case ShaderType.Effect:
profile = "fx_2_0";
break;
default:
profile = shaderModel.Profile;
break;
}

var compiledShader = ShaderBytecode.Compile(decompiledHLSL, "main", profile, default);
var redisassembly = compiledShader.Bytecode.Disassemble();
var disassembly = shaderBytecode.Disassemble();
File.WriteAllText($"{OutputDir}/{relPath}.d1.asm", disassembly);
File.WriteAllText($"{OutputDir}/{relPath}.d2.asm", redisassembly);

Expand Down
12 changes: 0 additions & 12 deletions src/DXDecompiler.Tests/packages.config

This file was deleted.

Loading