d3dcompile

package
v0.18.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 27, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Rendered for windows/amd64

Overview

Package d3dcompile provides Pure Go bindings to d3dcompiler_47.dll.

D3DCompile compiles HLSL source code to DXBC bytecode using the D3DCompile function from d3dcompiler_47.dll. This DLL ships with Windows 10+ and requires no additional installation.

Zero CGO — uses syscall.NewLazyDLL for dynamic loading.

Index

Constants

View Source
const (
	TargetVS51 = "vs_5_1" // Vertex shader, Shader Model 5.1
	TargetPS51 = "ps_5_1" // Pixel (fragment) shader, Shader Model 5.1
	TargetCS51 = "cs_5_1" // Compute shader, Shader Model 5.1
)

Shader model target profiles for D3DCompile.

Variables

This section is empty.

Functions

This section is empty.

Types

type Lib

type Lib struct {
	// contains filtered or unexported fields
}

Lib provides access to d3dcompiler_47.dll functions.

func Load

func Load() (*Lib, error)

Load loads d3dcompiler_47.dll. Safe to call multiple times.

func (*Lib) Compile

func (l *Lib) Compile(source, entryPoint, target string) ([]byte, error)

Compile compiles HLSL source code to DXBC bytecode.

Parameters:

  • source: HLSL source code
  • entryPoint: entry point function name (e.g. "vs_main")
  • target: shader model target (e.g. TargetVS51, TargetPS51, TargetCS51)

Returns compiled DXBC bytecode or an error with the compiler error message.

func (*Lib) CompileWithFlags

func (l *Lib) CompileWithFlags(source, entryPoint, target string, flags1, flags2 uint32) ([]byte, error)

CompileWithFlags compiles HLSL source code with explicit compiler flags.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL