mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
internal/graphicsdriver/directx: add optimization flag to D3DCompile
Updates #2034 Updates #2188
This commit is contained in:
parent
0035ba0bd1
commit
bf0f3d304b
@ -60,6 +60,12 @@ const (
|
||||
_D3D12XBOX_DEFAULT_SIZE_BYTES = 0xffffffff
|
||||
)
|
||||
|
||||
type _D3DCOMPILE uint32
|
||||
|
||||
const (
|
||||
_D3DCOMPILE_OPTIMIZATION_LEVEL3 _D3DCOMPILE = (1 << 15)
|
||||
)
|
||||
|
||||
type _D3D_FEATURE_LEVEL int32
|
||||
|
||||
const (
|
||||
|
@ -555,8 +555,10 @@ func (p *pipelineStates) ensureRootSignature(device *_ID3D12Device) (rootSignatu
|
||||
}
|
||||
|
||||
func newShader(source []byte, defs []_D3D_SHADER_MACRO) (vsh, psh *_ID3DBlob, ferr error) {
|
||||
var flag uint32 = uint32(_D3DCOMPILE_OPTIMIZATION_LEVEL3)
|
||||
|
||||
// Create a shader
|
||||
v, err := _D3DCompile(source, "shader", defs, nil, "VSMain", "vs_5_0", 0, 0)
|
||||
v, err := _D3DCompile(source, "shader", defs, nil, "VSMain", "vs_5_0", flag, 0)
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("directx: D3DCompile for VSMain failed, original source: %s, %w", string(source), err)
|
||||
}
|
||||
@ -566,7 +568,7 @@ func newShader(source []byte, defs []_D3D_SHADER_MACRO) (vsh, psh *_ID3DBlob, fe
|
||||
}
|
||||
}()
|
||||
|
||||
p, err := _D3DCompile(source, "shader", defs, nil, "PSMain", "ps_5_0", 0, 0)
|
||||
p, err := _D3DCompile(source, "shader", defs, nil, "PSMain", "ps_5_0", flag, 0)
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("directx: D3DCompile for PSMain failed, original source: %s, %w", string(source), err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user