mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 18:58:54 +01:00
internal/graphicsdriver/directx: check the DLL availability at NewGraphics
Updates #2613 Updates #2618
This commit is contained in:
parent
3e477d0bbb
commit
0cd832f096
@ -95,8 +95,12 @@ func init() {
|
||||
procD3DCompile = d3dcompiler.NewProc("D3DCompile")
|
||||
}
|
||||
|
||||
func isD3DCompilerDLLAvailable() bool {
|
||||
return procD3DCompile != nil
|
||||
}
|
||||
|
||||
func _D3DCompile(srcData []byte, sourceName string, pDefines []_D3D_SHADER_MACRO, pInclude unsafe.Pointer, entryPoint string, target string, flags1 uint32, flags2 uint32) (*_ID3DBlob, error) {
|
||||
if procD3DCompile == nil {
|
||||
if !isD3DCompilerDLLAvailable() {
|
||||
return nil, fmt.Errorf("directx: d3dcompiler_*.dll is missing in this environment")
|
||||
}
|
||||
|
||||
|
@ -73,6 +73,10 @@ func parseFeatureLevel(str string) (_D3D_FEATURE_LEVEL, bool) {
|
||||
// NewGraphics creates an implementation of graphicsdriver.Graphics for DirectX.
|
||||
// The returned graphics value is nil iff the error is not nil.
|
||||
func NewGraphics() (graphicsdriver.Graphics, error) {
|
||||
if !isD3DCompilerDLLAvailable() {
|
||||
return nil, fmt.Errorf("directx: d3dcompiler_*.dll is missing in this environment")
|
||||
}
|
||||
|
||||
var useWARP bool
|
||||
var useDebugLayer bool
|
||||
version := 11
|
||||
|
Loading…
Reference in New Issue
Block a user