class HLSLCompiler

The HLSLCompiler specialization of ICompiler interface. Handles everything necessary to compile and extract shader reflection data for HSLS and then exports the binary and reflection data for consumption by HLSL-specific backends.

File location: sdk/tools/ffx_shader_compiler/src/hlsl_compiler.h

Enumerations

Name

Description

Backend

Enumeration of possible HLSL backends to compile with.
DXC – Use included DXC compiler processes.
GDK_SCARLETT_X64 – Use GDK-provided shader compiler dll (requires the GDK be installed)
GDK_XBOXONE_X64 – Use GDK-provided shader compiler dll (requires the GDK be installed)
FXC – Use included FXC compiler processes.

Construction

Return type

Description

HLSLCompiler ( Backend backend, const std::string& dll, const std::string& shaderPath, const std::string& shaderName, const std::string& shaderFileName, const std::string& outputPath, bool disableLogs, bool debugCompile )
HLSL Compiler construction function.

Methods

Return type

Description

bool

Compile ( Permutation & permutation, const std::vector<std::string>& arguments, std::mutex& writeMutex )
Compiles a HLSL shader permutation.

bool

Extracts HLSL shader reflection data.

void

WriteBinaryHeaderReflectionData ( FILE* fp, const Permutation & permutation, std::mutex& writeMutex )
Writes HLSL reflection header data for shader permutations.

void

Writes HLSL permutation reflection header data structures for shader permutations.

void

WritePermutationHeaderReflectionData (FILE* fp, const Permutation & permutation)
Writes HLSL permutation reflection header data for shader permutations.

Detailed description

The HLSLCompiler specialization of ICompiler interface. Handles everything necessary to compile and extract shader reflection data for HSLS and then exports the binary and reflection data for consumption by HLSL-specific backends.

Construction

HLSLCompiler

Copied!

HLSLCompiler (
    Backend  backend,
    const std::string& dll,
    const std::string& shaderPath,
    const std::string& shaderName,
    const std::string& shaderFileName,
    const std::string& outputPath,
    bool disableLogs,
    bool debugCompile
)

HLSL Compiler construction function.

Parameters:

backend

The backend HLSL compile process to use

dll

DXC/FXC DLL override to use when compiling

shaderPath

Path to the shader to compile

shaderName

Shader entry point

shaderFileName

Filename of the shader file to compile

outputPath

Output path for shader export

disableLogs

Enables/Disables logging of errors and warnings

debugCompile

Compile shaders in debug and generate pdb information

Returns:

none


Methods

Compile

Copied!

virtual bool Compile (
    Permutation & permutation,
    const std::vector<std::string>& arguments,
    std::mutex& writeMutex
)

Compiles a HLSL shader permutation.

Parameters:

permutation

The permutation representation to compile

arguments

List of arguments to pass to the compiler

wrietMutex

Mutex to use for thread safety of compile process

Returns:

true if successful, false otherwise


ExtractReflectionData

Copied!

virtual bool ExtractReflectionData (Permutation & permutation)

Extracts HLSL shader reflection data.

Parameters:

permutation

The permutation representation to extract reflection for

Returns:

true if successful, false otherwise


WriteBinaryHeaderReflectionData

Copied!

virtual void WriteBinaryHeaderReflectionData (
    FILE* fp,
    const Permutation & permutation,
    std::mutex& writeMutex
)

Writes HLSL reflection header data for shader permutations.

Parameters:

fp

The file to write header information into

permutation

The permutation representation to write to head

wrietMutex

Mutex to use for thread safety of reflection data export

Returns:

none


WritePermutationHeaderReflectionStructMembers

Copied!

virtual void WritePermutationHeaderReflectionStructMembers (FILE* fp)

Writes HLSL permutation reflection header data structures for shader permutations.

Parameters:

fp

The file to write header data structures into

Returns:

none


WritePermutationHeaderReflectionData

Copied!

virtual void WritePermutationHeaderReflectionData (
    FILE* fp,
    const Permutation & permutation
)

Writes HLSL permutation reflection header data for shader permutations.

Parameters:

fp

The file to write header information into

permutation

The permutation representation to write to head

Returns:

none


Related pages

  • Visit the FidelityFX SDK product page for download links and more information.

Looking for more documentation on GPUOpen?

AMD GPUOpen software blogs

Our handy software release blogs will help you make good use of our tools, SDKs, and effects, as well as sharing the latest features with new releases.

GPUOpen Manuals

Don’t miss our manual documentation! And if slide decks are what you’re after, you’ll find 100+ of our finest presentations here.

AMD GPUOpen Performance Guides

The home of great performance and optimization advice for AMD RDNAâ„¢ 2 GPUs, AMD Ryzenâ„¢ CPUs, and so much more.

Getting started: AMD GPUOpen software

New or fairly new to AMD’s tools, libraries, and effects? This is the best place to get started on GPUOpen!

AMD GPUOpen Getting Started Development and Performance

Looking for tips on getting started with developing and/or optimizing your game, whether on AMD hardware or generally? We’ve got you covered!

AMD GPUOpen Technical blogs

Browse our technical blogs, and find valuable advice on developing with AMD hardware, ray tracing, Vulkan®, DirectX®, Unreal Engine, and lots more.

Find out more about our software!

AMD GPUOpen Effects - AMD FidelityFX technologies

Create wonder. No black boxes. Meet the AMD FidelityFX SDK!

AMD GPUOpen Samples

Browse all our useful samples. Perfect for when you’re needing to get started, want to integrate one of our libraries, and much more.

AMD GPUOpen developer SDKs

Discover what our SDK technologies can offer you. Query hardware or software, manage memory, create rendering applications or machine learning, and much more!

AMD GPUOpen Developer Tools

Analyze, Optimize, Profile, Benchmark. We provide you with the developer tools you need to make sure your game is the best it can be!