diff --git a/app/headless/headless_gl.go b/app/headless/headless_gl.go index 3718969e..c00083ee 100644 --- a/app/headless/headless_gl.go +++ b/app/headless/headless_gl.go @@ -1,5 +1,7 @@ // SPDX-License-Identifier: Unlicense OR MIT +// +build !windows + package headless func newContext() (context, error) { diff --git a/app/headless/headless_windows.go b/app/headless/headless_windows.go new file mode 100644 index 00000000..843dac6f --- /dev/null +++ b/app/headless/headless_windows.go @@ -0,0 +1,40 @@ +// SPDX-License-Identifier: Unlicense OR MIT + +package headless + +import ( + "gioui.org/app/internal/d3d11" + "gioui.org/gpu/backend" +) + +type d3d11Context struct { + *d3d11.Device +} + +func newContext() (context, error) { + dev, err := d3d11.NewDevice() + if err != nil { + return nil, err + } + return &d3d11Context{Device: dev}, nil +} + +func (c *d3d11Context) Backend() (backend.Device, error) { + backend, err := d3d11.NewBackend(c.Device) + if err != nil { + return nil, err + } + return backend, nil +} + +func (c *d3d11Context) MakeCurrent() error { + return nil +} + +func (c *d3d11Context) ReleaseCurrent() { +} + +func (c *d3d11Context) Release() { + c.Device.Release() + c.Device = nil +} diff --git a/app/headless/shaders.go b/app/headless/shaders.go index cd61a8ac..726badb2 100644 --- a/app/headless/shaders.go +++ b/app/headless/shaders.go @@ -40,7 +40,7 @@ var ( } */ - HLSL: []byte(nil), + HLSL: []byte{0x44, 0x58, 0x42, 0x43, 0xaf, 0xcc, 0x41, 0x1f, 0xdd, 0x6b, 0x5a, 0x4d, 0x6, 0x75, 0x6f, 0xf3, 0xb2, 0xc9, 0xcb, 0xdc, 0x1, 0x0, 0x0, 0x0, 0xb4, 0x1, 0x0, 0x0, 0x5, 0x0, 0x0, 0x0, 0x34, 0x0, 0x0, 0x0, 0x8c, 0x0, 0x0, 0x0, 0xc0, 0x0, 0x0, 0x0, 0xf4, 0x0, 0x0, 0x0, 0x38, 0x1, 0x0, 0x0, 0x52, 0x44, 0x45, 0x46, 0x50, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0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, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x67, 0x0, 0x0, 0x4, 0xf2, 0x20, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x36, 0x0, 0x0, 0x5, 0xf2, 0x20, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x46, 0x1e, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3e, 0x0, 0x0, 0x1, 0x53, 0x54, 0x41, 0x54, 0x74, 0x0, 0x0, 0x0, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, } shader_simple_frag = backend.ShaderSources{ GLSL100ES: "precision mediump float;\nprecision highp int;\n\nvoid main()\n{\n gl_FragData[0] = vec4(0.25, 0.550000011920928955078125, 0.75, 1.0);\n}\n\n", @@ -69,7 +69,7 @@ var ( } */ - HLSL: []byte(nil), + HLSL: []byte{0x44, 0x58, 0x42, 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x;\n float y;\n if (gl_VertexID == 0)\n {\n x = 0.0;\n y = 0.5;\n }\n else\n {\n if (gl_VertexID == 1)\n {\n x = 0.5;\n y = -0.5;\n }\n else\n {\n x = -0.5;\n y = -0.5;\n }\n }\n gl_Position = vec4(x, y, 0.5, 1.0);\n}\n\n", @@ -124,6 +124,6 @@ var ( } */ - HLSL: []byte(nil), + HLSL: []byte{0x44, 0x58, 0x42, 0x43, 0x23, 0x35, 0xde, 0x2e, 0xd2, 0x4a, 0x81, 0xe1, 0x7f, 0xf2, 0xcd, 0x3b, 0xc5, 0x96, 0x4d, 0x6d, 0x1, 0x0, 0x0, 0x0, 0x54, 0x2, 0x0, 0x0, 0x5, 0x0, 0x0, 0x0, 0x34, 0x0, 0x0, 0x0, 0x8c, 0x0, 0x0, 0x0, 0xc0, 0x0, 0x0, 0x0, 0xf4, 0x0, 0x0, 0x0, 0xd8, 0x1, 0x0, 0x0, 0x52, 0x44, 0x45, 0x46, 0x50, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1c, 0x0, 0x0, 0x0, 0x0, 0x4, 0xfe, 0xff, 0x0, 0x1, 0x0, 0x0, 0x1c, 0x0, 0x0, 0x0, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x0, 0xab, 0xab, 0xab, 0x49, 0x53, 0x47, 0x4e, 0x2c, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x8, 0x0, 0x0, 0x0, 0x20, 0x0, 0x0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0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, } ) diff --git a/app/internal/d3d11/backend_windows.go b/app/internal/d3d11/backend_windows.go new file mode 100644 index 00000000..c58683ea --- /dev/null +++ b/app/internal/d3d11/backend_windows.go @@ -0,0 +1,812 @@ +// SPDX-License-Identifier: Unlicense OR MIT + +package d3d11 + +import ( + "errors" + "fmt" + "image" + "math" + "unsafe" + + "gioui.org/gpu/backend" + gunsafe "gioui.org/internal/unsafe" + "golang.org/x/sys/windows" +) + +const debug = false + +type Device struct { + dev *_ID3D11Device + ctx *_ID3D11DeviceContext + featLvl uint32 + depthStates map[depthState]*_ID3D11DepthStencilState + blendStates map[blendState]*_ID3D11BlendState +} + +type Backend struct { + clearColor [4]float32 + clearDepth float32 + viewport _D3D11_VIEWPORT + depthState depthState + blendState blendState + prog *Program + + dev *Device + caps backend.Caps + + // fbo is the currently bound fbo. + fbo *Framebuffer +} + +type blendState struct { + enable bool + sfactor backend.BlendFactor + dfactor backend.BlendFactor +} + +type depthState struct { + enable bool + mask bool + fn backend.DepthFunc +} + +type Texture struct { + backend *Backend + format uint32 + bindings backend.BufferBinding + tex *_ID3D11Texture2D + sampler *_ID3D11SamplerState + resView *_ID3D11ShaderResourceView + width int + height int +} + +type Program struct { + backend *Backend + + vert struct { + shader *_ID3D11VertexShader + uniforms *Buffer + } + frag struct { + shader *_ID3D11PixelShader + uniforms *Buffer + } +} + +type Framebuffer struct { + dev *Device + format uint32 + resource *_ID3D11Resource + renderTarget *_ID3D11RenderTargetView + depthView *_ID3D11DepthStencilView + foreign bool +} + +type Buffer struct { + backend *Backend + bind uint32 + buf *_ID3D11Buffer + immutable bool +} + +type InputLayout struct { + dev *Device + layout *_ID3D11InputLayout +} + +type SwapChain struct { + swchain *_IDXGISwapChain + fbo *Framebuffer +} + +func NewDevice() (*Device, error) { + var flags uint32 + if debug { + flags |= _D3D11_CREATE_DEVICE_DEBUG + } + d3ddev, d3dctx, featLvl, err := _D3D11CreateDevice( + _D3D_DRIVER_TYPE_HARDWARE, + flags, + ) + if err != nil { + return nil, fmt.Errorf("NewContext: %v", err) + } + dev := &Device{dev: d3ddev, ctx: d3dctx, featLvl: featLvl} + if featLvl < _D3D_FEATURE_LEVEL_9_1 { + _IUnknownRelease(unsafe.Pointer(d3ddev), d3ddev.vtbl.Release) + return nil, fmt.Errorf("d3d11: feature level too low: %d", featLvl) + } + dev.depthStates = make(map[depthState]*_ID3D11DepthStencilState) + dev.blendStates = make(map[blendState]*_ID3D11BlendState) + return dev, nil +} + +func (d *Device) CreateSwapChain(hwnd windows.Handle) (*SwapChain, error) { + dxgiDev, err := _IUnknownQueryInterface(unsafe.Pointer(d.dev), d.dev.vtbl.QueryInterface, &_IID_IDXGIDevice) + if err != nil { + return nil, fmt.Errorf("NewContext: %v", err) + } + adapter, err := (*_IDXGIDevice)(unsafe.Pointer(dxgiDev)).GetAdapter() + _IUnknownRelease(unsafe.Pointer(dxgiDev), dxgiDev.vtbl.Release) + if err != nil { + return nil, fmt.Errorf("NewContext: %v", err) + } + dxgiFactory, err := (*_IDXGIObject)(unsafe.Pointer(adapter)).GetParent(&_IID_IDXGIFactory) + _IUnknownRelease(unsafe.Pointer(adapter), adapter.vtbl.Release) + if err != nil { + return nil, fmt.Errorf("NewContext: %v", err) + } + d3dswchain, err := (*_IDXGIFactory)(unsafe.Pointer(dxgiFactory)).CreateSwapChain( + (*_IUnknown)(unsafe.Pointer(d.dev)), + &_DXGI_SWAP_CHAIN_DESC{ + BufferDesc: _DXGI_MODE_DESC{ + Format: _DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, + }, + SampleDesc: _DXGI_SAMPLE_DESC{ + Count: 1, + }, + BufferUsage: _DXGI_USAGE_RENDER_TARGET_OUTPUT, + BufferCount: 1, + OutputWindow: hwnd, + Windowed: 1, + SwapEffect: _DXGI_SWAP_EFFECT_DISCARD, + }, + ) + _IUnknownRelease(unsafe.Pointer(dxgiFactory), dxgiFactory.vtbl.Release) + if err != nil { + return nil, fmt.Errorf("NewContext: %v", err) + } + return &SwapChain{swchain: d3dswchain, fbo: &Framebuffer{}}, nil +} + +func (s *SwapChain) Framebuffer(d *Device) (*Framebuffer, error) { + if s.fbo.renderTarget != nil { + return s.fbo, nil + } + backBuffer, err := s.swchain.GetBuffer(0, &_IID_ID3D11Texture2D) + if err != nil { + return nil, err + } + texture := (*_ID3D11Resource)(unsafe.Pointer(backBuffer)) + renderTarget, err := d.dev.CreateRenderTargetView(texture) + _IUnknownRelease(unsafe.Pointer(backBuffer), backBuffer.vtbl.Release) + if err != nil { + return nil, err + } + s.fbo.renderTarget = renderTarget + s.fbo.dev = d + return s.fbo, nil +} + +func (d *Device) Release() { + _IUnknownRelease(unsafe.Pointer(d.ctx), d.ctx.vtbl.Release) + _IUnknownRelease(unsafe.Pointer(d.dev), d.dev.vtbl.Release) + d.ctx = nil + d.dev = nil + for _, state := range d.depthStates { + _IUnknownRelease(unsafe.Pointer(state), state.vtbl.Release) + } + d.depthStates = nil + for _, state := range d.blendStates { + _IUnknownRelease(unsafe.Pointer(state), state.vtbl.Release) + } + d.blendStates = nil +} + +func (s *SwapChain) Resize() error { + if s.fbo.renderTarget != nil { + s.fbo.Release() + } + return s.swchain.ResizeBuffers(0, 0, 0, _DXGI_FORMAT_UNKNOWN, 0) +} + +func (s *SwapChain) Release() { + _IUnknownRelease(unsafe.Pointer(s.swchain), s.swchain.vtbl.Release) +} + +func (s *SwapChain) Present() error { + return s.swchain.Present(0, 0) +} + +func NewBackend(d *Device) (*Backend, error) { + caps := backend.Caps{ + MaxTextureSize: 2048, // 9.1 maximum + } + switch { + case d.featLvl >= _D3D_FEATURE_LEVEL_11_0: + caps.MaxTextureSize = 16384 + case d.featLvl >= _D3D_FEATURE_LEVEL_9_3: + caps.MaxTextureSize = 4096 + } + b := &Backend{dev: d, caps: caps} + // Disable backface culling to match OpenGL. + state, err := b.dev.dev.CreateRasterizerState(&_D3D11_RASTERIZER_DESC{ + CullMode: _D3D11_CULL_NONE, + FillMode: _D3D11_FILL_SOLID, + DepthClipEnable: 1, + }) + if err != nil { + return nil, err + } + b.dev.ctx.RSSetState(state) + _IUnknownRelease(unsafe.Pointer(state), state.vtbl.Release) + return b, nil +} + +func (b *Backend) BeginFrame() { +} + +func (b *Backend) EndFrame() { +} + +func (b *Backend) Caps() backend.Caps { + return b.caps +} + +func (b *Backend) NewTimer() backend.Timer { + panic("timers not supported") +} + +func (b *Backend) IsTimeContinuous() bool { + panic("timers not supported") +} + +func (b *Backend) NewTexture(format backend.TextureFormat, width, height int, minFilter, magFilter backend.TextureFilter, bindings backend.BufferBinding) (backend.Texture, error) { + var d3dfmt uint32 + switch format { + case backend.TextureFormatFloat: + d3dfmt = _DXGI_FORMAT_R16_FLOAT + case backend.TextureFormatSRGB: + d3dfmt = _DXGI_FORMAT_R8G8B8A8_UNORM_SRGB + default: + return nil, fmt.Errorf("unsupported texture format %d", format) + } + tex, err := b.dev.dev.CreateTexture2D(&_D3D11_TEXTURE2D_DESC{ + Width: uint32(width), + Height: uint32(height), + MipLevels: 1, + ArraySize: 1, + Format: d3dfmt, + SampleDesc: _DXGI_SAMPLE_DESC{ + Count: 1, + Quality: 0, + }, + BindFlags: convBufferBinding(bindings), + }) + if err != nil { + return nil, err + } + var ( + sampler *_ID3D11SamplerState + resView *_ID3D11ShaderResourceView + ) + if bindings&backend.BufferBindingTexture != 0 { + var filter uint32 + switch { + case minFilter == backend.FilterNearest && magFilter == backend.FilterNearest: + filter = _D3D11_FILTER_MIN_MAG_MIP_POINT + case minFilter == backend.FilterLinear && magFilter == backend.FilterLinear: + filter = _D3D11_FILTER_MIN_MAG_LINEAR_MIP_POINT + default: + _IUnknownRelease(unsafe.Pointer(tex), tex.vtbl.Release) + return nil, fmt.Errorf("unsupported texture filter combination %d, %d", minFilter, magFilter) + } + var err error + sampler, err = b.dev.dev.CreateSamplerState(&_D3D11_SAMPLER_DESC{ + Filter: filter, + AddressU: _D3D11_TEXTURE_ADDRESS_CLAMP, + AddressV: _D3D11_TEXTURE_ADDRESS_CLAMP, + AddressW: _D3D11_TEXTURE_ADDRESS_CLAMP, + MaxAnisotropy: 1, + MinLOD: -math.MaxFloat32, + MaxLOD: math.MaxFloat32, + }) + if err != nil { + _IUnknownRelease(unsafe.Pointer(tex), tex.vtbl.Release) + return nil, err + } + resView, err = b.dev.dev.CreateShaderResourceViewTEX2D( + (*_ID3D11Resource)(unsafe.Pointer(tex)), + &_D3D11_SHADER_RESOURCE_VIEW_DESC_TEX2D{ + _D3D11_SHADER_RESOURCE_VIEW_DESC: _D3D11_SHADER_RESOURCE_VIEW_DESC{ + Format: d3dfmt, + ViewDimension: _D3D11_SRV_DIMENSION_TEXTURE2D, + }, + Texture2D: _D3D11_TEX2D_SRV{ + MostDetailedMip: 0, + MipLevels: ^uint32(0), + }, + }, + ) + if err != nil { + _IUnknownRelease(unsafe.Pointer(tex), tex.vtbl.Release) + _IUnknownRelease(unsafe.Pointer(sampler), sampler.vtbl.Release) + return nil, err + } + } + return &Texture{backend: b, format: d3dfmt, tex: tex, sampler: sampler, resView: resView, bindings: bindings, width: width, height: height}, nil +} + +func (b *Backend) CurrentFramebuffer() backend.Framebuffer { + renderTarget := b.dev.ctx.OMGetRenderTargets() + // Assume someone else is holding on to it. + _IUnknownRelease(unsafe.Pointer(renderTarget), renderTarget.vtbl.Release) + if renderTarget == b.fbo.renderTarget { + return b.fbo + } + return &Framebuffer{dev: b.dev, renderTarget: renderTarget, foreign: true} +} + +func (b *Backend) NewFramebuffer(tex backend.Texture, depthBits int) (backend.Framebuffer, error) { + d3dtex := tex.(*Texture) + if d3dtex.bindings&backend.BufferBindingFramebuffer == 0 { + return nil, errors.New("the texture was created without BufferBindingFramebuffer binding") + } + resource := (*_ID3D11Resource)(unsafe.Pointer(d3dtex.tex)) + renderTarget, err := b.dev.dev.CreateRenderTargetView(resource) + if err != nil { + return nil, err + } + fbo := &Framebuffer{dev: b.dev, format: d3dtex.format, resource: resource, renderTarget: renderTarget} + if depthBits > 0 { + depthTex, err := b.dev.dev.CreateTexture2D(&_D3D11_TEXTURE2D_DESC{ + Width: uint32(d3dtex.width), + Height: uint32(d3dtex.height), + MipLevels: 1, + ArraySize: 1, + Format: _DXGI_FORMAT_D24_UNORM_S8_UINT, + SampleDesc: _DXGI_SAMPLE_DESC{ + Count: 1, + Quality: 0, + }, + BindFlags: _D3D11_BIND_DEPTH_STENCIL, + }) + if err != nil { + _IUnknownRelease(unsafe.Pointer(renderTarget), renderTarget.vtbl.Release) + return nil, err + } + depthView, err := b.dev.dev.CreateDepthStencilViewTEX2D( + (*_ID3D11Resource)(unsafe.Pointer(depthTex)), + &_D3D11_DEPTH_STENCIL_VIEW_DESC_TEX2D{ + Format: _DXGI_FORMAT_D24_UNORM_S8_UINT, + ViewDimension: _D3D11_DSV_DIMENSION_TEXTURE2D, + }, + ) + _IUnknownRelease(unsafe.Pointer(depthTex), depthTex.vtbl.Release) + if err != nil { + _IUnknownRelease(unsafe.Pointer(renderTarget), renderTarget.vtbl.Release) + return nil, err + } + fbo.depthView = depthView + } + return fbo, nil +} + +func (b *Backend) NewInputLayout(vertexShader backend.ShaderSources, layout []backend.InputDesc) (backend.InputLayout, error) { + if len(vertexShader.Inputs) != len(layout) { + return nil, fmt.Errorf("NewInputLayout: got %d inputs, expected %d", len(layout), len(vertexShader.Inputs)) + } + descs := make([]_D3D11_INPUT_ELEMENT_DESC, len(layout)) + for i, l := range layout { + inp := vertexShader.Inputs[i] + cname, err := windows.BytePtrFromString(inp.Semantic) + if err != nil { + return nil, err + } + var format uint32 + switch l.Type { + case backend.DataTypeFloat: + switch l.Size { + case 1: + format = _DXGI_FORMAT_R32_FLOAT + case 2: + format = _DXGI_FORMAT_R32G32_FLOAT + case 3: + format = _DXGI_FORMAT_R32G32B32_FLOAT + case 4: + format = _DXGI_FORMAT_R32G32B32A32_FLOAT + default: + panic("unsupported float data size") + } + case backend.DataTypeShort: + switch l.Size { + case 1: + format = _DXGI_FORMAT_R16_SINT + case 2: + format = _DXGI_FORMAT_R16G16_SINT + default: + panic("unsupported float data size") + } + default: + panic("unsupported data type") + } + descs[i] = _D3D11_INPUT_ELEMENT_DESC{ + SemanticName: cname, + SemanticIndex: uint32(inp.SemanticIndex), + Format: format, + AlignedByteOffset: uint32(l.Offset), + } + } + l, err := b.dev.dev.CreateInputLayout(descs, vertexShader.HLSL) + if err != nil { + return nil, err + } + return &InputLayout{dev: b.dev, layout: l}, nil +} + +func (b *Backend) NewBuffer(typ backend.BufferBinding, size int) (backend.Buffer, error) { + if typ&backend.BufferBindingUniforms != 0 { + if typ != backend.BufferBindingUniforms { + return nil, errors.New("uniform buffers cannot have other bindings") + } + if size%16 != 0 { + return nil, fmt.Errorf("constant buffer size is %d, expected a multiple of 16", size) + } + } + bind := convBufferBinding(typ) + buf, err := b.dev.dev.CreateBuffer(&_D3D11_BUFFER_DESC{ + ByteWidth: uint32(size), + BindFlags: bind, + }, nil) + if err != nil { + return nil, err + } + return &Buffer{backend: b, buf: buf, bind: bind}, nil +} + +func (b *Backend) NewImmutableBuffer(typ backend.BufferBinding, data []byte) (backend.Buffer, error) { + if typ&backend.BufferBindingUniforms != 0 { + if typ != backend.BufferBindingUniforms { + return nil, errors.New("uniform buffers cannot have other bindings") + } + if len(data)%16 != 0 { + return nil, fmt.Errorf("constant buffer size is %d, expected a multiple of 16", len(data)) + } + } + bind := convBufferBinding(typ) + buf, err := b.dev.dev.CreateBuffer(&_D3D11_BUFFER_DESC{ + ByteWidth: uint32(len(data)), + Usage: _D3D11_USAGE_IMMUTABLE, + BindFlags: bind, + }, data) + if err != nil { + return nil, err + } + return &Buffer{backend: b, buf: buf, bind: bind, immutable: true}, nil +} + +func (b *Backend) NewProgram(vertexShader, fragmentShader backend.ShaderSources) (backend.Program, error) { + vs, err := b.dev.dev.CreateVertexShader(vertexShader.HLSL) + if err != nil { + return nil, err + } + ps, err := b.dev.dev.CreatePixelShader(fragmentShader.HLSL) + if err != nil { + return nil, err + } + p := &Program{backend: b} + p.vert.shader = vs + p.frag.shader = ps + return p, nil +} + +func (b *Backend) ClearColor(colr, colg, colb, cola float32) { + b.clearColor = [...]float32{colr, colg, colb, cola} +} + +func (b *Backend) Clear(buffers backend.BufferAttachments) { + if buffers&backend.BufferAttachmentColor != 0 { + b.dev.ctx.ClearRenderTargetView(b.fbo.renderTarget, &b.clearColor) + } + if buffers&backend.BufferAttachmentDepth != 0 { + b.dev.ctx.ClearDepthStencilView(b.fbo.depthView, _D3D11_CLEAR_DEPTH|_D3D11_CLEAR_STENCIL, b.clearDepth, 0) + } +} + +func (b *Backend) Viewport(x, y, width, height int) { + b.viewport = _D3D11_VIEWPORT{ + TopLeftX: float32(x), + TopLeftY: float32(y), + Width: float32(width), + Height: float32(height), + MinDepth: 0.0, + MaxDepth: 1.0, + } + b.dev.ctx.RSSetViewports(&b.viewport) +} + +func (b *Backend) DrawArrays(mode backend.DrawMode, off, count int) { + b.prepareDraw(mode) + b.dev.ctx.Draw(uint32(count), uint32(off)) +} + +func (b *Backend) DrawElements(mode backend.DrawMode, off, count int) { + b.prepareDraw(mode) + b.dev.ctx.DrawIndexed(uint32(count), uint32(off), 0) +} + +func (b *Backend) prepareDraw(mode backend.DrawMode) { + if p := b.prog; p != nil { + b.dev.ctx.VSSetShader(p.vert.shader) + b.dev.ctx.PSSetShader(p.frag.shader) + if buf := p.vert.uniforms; buf != nil { + b.dev.ctx.VSSetConstantBuffers(buf.buf) + } + if buf := p.frag.uniforms; buf != nil { + b.dev.ctx.PSSetConstantBuffers(buf.buf) + } + } + var topology uint32 + switch mode { + case backend.DrawModeTriangles: + topology = _D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST + case backend.DrawModeTriangleStrip: + topology = _D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP + default: + panic("unsupported draw mode") + } + b.dev.ctx.IASetPrimitiveTopology(topology) + + depthState, ok := b.dev.depthStates[b.depthState] + if !ok { + var desc _D3D11_DEPTH_STENCIL_DESC + if b.depthState.enable { + desc.DepthEnable = 1 + } + if !b.depthState.mask { + desc.DepthWriteMask = _D3D11_DEPTH_WRITE_MASK_ALL + } + switch b.depthState.fn { + case backend.DepthFuncGreater: + desc.DepthFunc = _D3D11_COMPARISON_GREATER + default: + panic("unsupported depth func") + } + var err error + depthState, err = b.dev.dev.CreateDepthStencilState(&desc) + if err != nil { + panic(err) + } + b.dev.depthStates[b.depthState] = depthState + } + b.dev.ctx.OMSetDepthStencilState(depthState, 0) + + blendState, ok := b.dev.blendStates[b.blendState] + if !ok { + var desc _D3D11_BLEND_DESC + t0 := &desc.RenderTarget[0] + t0.RenderTargetWriteMask = _D3D11_COLOR_WRITE_ENABLE_ALL + t0.BlendOp = _D3D11_BLEND_OP_ADD + t0.BlendOpAlpha = _D3D11_BLEND_OP_ADD + if b.blendState.enable { + t0.BlendEnable = 1 + } + scol, salpha := toBlendFactor(b.blendState.sfactor) + dcol, dalpha := toBlendFactor(b.blendState.dfactor) + t0.SrcBlend = scol + t0.SrcBlendAlpha = salpha + t0.DestBlend = dcol + t0.DestBlendAlpha = dalpha + var err error + blendState, err = b.dev.dev.CreateBlendState(&desc) + if err != nil { + panic(err) + } + b.dev.blendStates[b.blendState] = blendState + } + b.dev.ctx.OMSetBlendState(blendState, nil, 0xffffffff) +} + +func (b *Backend) DepthFunc(f backend.DepthFunc) { + b.depthState.fn = f +} + +func (b *Backend) ClearDepth(d float32) { + b.clearDepth = d +} + +func (b *Backend) SetBlend(enable bool) { + b.blendState.enable = enable +} + +func (b *Backend) SetDepthTest(enable bool) { + b.depthState.enable = enable +} + +func (b *Backend) DepthMask(mask bool) { + b.depthState.mask = mask +} + +func (b *Backend) BlendFunc(sfactor, dfactor backend.BlendFactor) { + b.blendState.sfactor = sfactor + b.blendState.dfactor = dfactor +} + +func (t *Texture) Upload(img *image.RGBA) { + b := img.Bounds() + w := b.Dx() + if img.Stride != w*4 { + panic("unsupported stride") + } + start := (b.Min.X + b.Min.Y*w) * 4 + end := (b.Max.X + (b.Max.Y-1)*w) * 4 + pixels := img.Pix[start:end] + res := (*_ID3D11Resource)(unsafe.Pointer(t.tex)) + t.backend.dev.ctx.UpdateSubresource(res, uint32(img.Stride), uint32(len(pixels)), pixels) +} + +func (t *Texture) Release() { + _IUnknownRelease(unsafe.Pointer(t.tex), t.tex.vtbl.Release) + t.tex = nil + if t.sampler != nil { + _IUnknownRelease(unsafe.Pointer(t.sampler), t.sampler.vtbl.Release) + t.sampler = nil + } + if t.resView != nil { + _IUnknownRelease(unsafe.Pointer(t.resView), t.resView.vtbl.Release) + t.resView = nil + } +} + +func (b *Backend) BindTexture(unit int, tex backend.Texture) { + t := tex.(*Texture) + b.dev.ctx.PSSetSamplers(uint32(unit), t.sampler) + b.dev.ctx.PSSetShaderResources(uint32(unit), t.resView) +} + +func (b *Backend) BindProgram(prog backend.Program) { + b.prog = prog.(*Program) +} + +func (p *Program) Release() { + _IUnknownRelease(unsafe.Pointer(p.vert.shader), p.vert.shader.vtbl.Release) + _IUnknownRelease(unsafe.Pointer(p.frag.shader), p.frag.shader.vtbl.Release) + p.vert.shader = nil + p.frag.shader = nil +} + +func (p *Program) SetVertexUniforms(buf backend.Buffer) { + p.vert.uniforms = buf.(*Buffer) +} + +func (p *Program) SetFragmentUniforms(buf backend.Buffer) { + p.frag.uniforms = buf.(*Buffer) +} + +func (b *Backend) BindVertexBuffer(buf backend.Buffer, stride, offset int) { + b.dev.ctx.IASetVertexBuffers(buf.(*Buffer).buf, uint32(stride), uint32(offset)) +} + +func (b *Backend) BindIndexBuffer(buf backend.Buffer) { + b.dev.ctx.IASetIndexBuffer(buf.(*Buffer).buf, _DXGI_FORMAT_R16_UINT, 0) +} + +func (b *Buffer) Upload(data []byte) { + b.backend.dev.ctx.UpdateSubresource((*_ID3D11Resource)(unsafe.Pointer(b.buf)), 0, 0, data) +} + +func (b *Buffer) Release() { + _IUnknownRelease(unsafe.Pointer(b.buf), b.buf.vtbl.Release) + b.buf = nil +} + +func (f *Framebuffer) ReadPixels(src image.Rectangle, pixels []byte) error { + if f.resource == nil { + return errors.New("framebuffer does not support ReadPixels") + } + w, h := src.Dx(), src.Dy() + tex, err := f.dev.dev.CreateTexture2D(&_D3D11_TEXTURE2D_DESC{ + Width: uint32(w), + Height: uint32(h), + MipLevels: 1, + ArraySize: 1, + Format: f.format, + SampleDesc: _DXGI_SAMPLE_DESC{ + Count: 1, + Quality: 0, + }, + Usage: _D3D11_USAGE_STAGING, + CPUAccessFlags: _D3D11_CPU_ACCESS_READ, + }) + if err != nil { + return fmt.Errorf("ReadPixels: %v", err) + } + defer _IUnknownRelease(unsafe.Pointer(tex), tex.vtbl.Release) + res := (*_ID3D11Resource)(unsafe.Pointer(tex)) + f.dev.ctx.CopySubresourceRegion( + res, + 0, // Destination subresource. + 0, 0, 0, // Destination coordinates (x, y, z). + f.resource, + 0, // Source subresource. + &_D3D11_BOX{ + left: uint32(src.Min.X), + top: uint32(src.Min.Y), + right: uint32(src.Max.X), + bottom: uint32(src.Max.Y), + front: 0, + back: 1, + }, + ) + resMap, err := f.dev.ctx.Map(res, 0, _D3D11_MAP_READ, 0) + if err != nil { + return fmt.Errorf("ReadPixels: %v", err) + } + defer f.dev.ctx.Unmap(res, 0) + pitch := w * 4 + if int(resMap.RowPitch) != pitch { + return fmt.Errorf("ReadPixels: got row pitch %d, expected %d", resMap.RowPitch, pitch) + } + n := pitch * h + data := gunsafe.SliceOf(resMap.pData)[:n:n] + copy(pixels, data) + return nil +} + +func (b *Backend) BindFramebuffer(fbo backend.Framebuffer) { + b.fbo = fbo.(*Framebuffer) + b.dev.ctx.OMSetRenderTargets(b.fbo.renderTarget, b.fbo.depthView) +} + +func (f *Framebuffer) Invalidate() { +} + +func (f *Framebuffer) Release() { + if f.foreign { + panic("cannot release Framebuffer from CurrentFramebuffer") + } + if f.renderTarget != nil { + _IUnknownRelease(unsafe.Pointer(f.renderTarget), f.renderTarget.vtbl.Release) + f.renderTarget = nil + } + if f.depthView != nil { + _IUnknownRelease(unsafe.Pointer(f.depthView), f.depthView.vtbl.Release) + f.depthView = nil + } +} + +func (b *Backend) BindInputLayout(layout backend.InputLayout) { + b.dev.ctx.IASetInputLayout(layout.(*InputLayout).layout) +} + +func (l *InputLayout) Release() { + _IUnknownRelease(unsafe.Pointer(l.layout), l.layout.vtbl.Release) + l.layout = nil +} + +func convBufferBinding(typ backend.BufferBinding) uint32 { + var bindings uint32 + if typ&backend.BufferBindingVertices != 0 { + bindings |= _D3D11_BIND_VERTEX_BUFFER + } + if typ&backend.BufferBindingIndices != 0 { + bindings |= _D3D11_BIND_INDEX_BUFFER + } + if typ&backend.BufferBindingUniforms != 0 { + bindings |= _D3D11_BIND_CONSTANT_BUFFER + } + if typ&backend.BufferBindingTexture != 0 { + bindings |= _D3D11_BIND_SHADER_RESOURCE + } + if typ&backend.BufferBindingFramebuffer != 0 { + bindings |= _D3D11_BIND_RENDER_TARGET + } + return bindings +} + +func toBlendFactor(f backend.BlendFactor) (uint32, uint32) { + switch f { + case backend.BlendFactorOne: + return _D3D11_BLEND_ONE, _D3D11_BLEND_ONE + case backend.BlendFactorOneMinusSrcAlpha: + return _D3D11_BLEND_INV_SRC_ALPHA, _D3D11_BLEND_INV_SRC_ALPHA + case backend.BlendFactorZero: + return _D3D11_BLEND_ZERO, _D3D11_BLEND_ZERO + case backend.BlendFactorDstColor: + return _D3D11_BLEND_DEST_COLOR, _D3D11_BLEND_DEST_ALPHA + default: + panic("unsupported blend source factor") + } +} diff --git a/app/internal/d3d11/d3d11_windows.go b/app/internal/d3d11/d3d11_windows.go new file mode 100644 index 00000000..75f03ce1 --- /dev/null +++ b/app/internal/d3d11/d3d11_windows.go @@ -0,0 +1,1386 @@ +// SPDX-License-Identifier: Unlicense OR MIT + +package d3d11 + +import ( + "fmt" + "math" + "unsafe" + + "syscall" + + gunsafe "gioui.org/internal/unsafe" + + "golang.org/x/sys/windows" +) + +type _DXGI_SWAP_CHAIN_DESC struct { + BufferDesc _DXGI_MODE_DESC + SampleDesc _DXGI_SAMPLE_DESC + BufferUsage uint32 + BufferCount uint32 + OutputWindow windows.Handle + Windowed uint32 + SwapEffect uint32 + Flags uint32 +} + +type _DXGI_SAMPLE_DESC struct { + Count uint32 + Quality uint32 +} + +type _DXGI_MODE_DESC struct { + Width uint32 + Height uint32 + RefreshRate _DXGI_RATIONAL + Format uint32 + ScanlineOrdering uint32 + Scaling uint32 +} + +type _DXGI_RATIONAL struct { + Numerator uint32 + Denominator uint32 +} + +type _D3D11_TEXTURE2D_DESC struct { + Width uint32 + Height uint32 + MipLevels uint32 + ArraySize uint32 + Format uint32 + SampleDesc _DXGI_SAMPLE_DESC + Usage uint32 + BindFlags uint32 + CPUAccessFlags uint32 + MiscFlags uint32 +} + +type _D3D11_SAMPLER_DESC struct { + Filter uint32 + AddressU uint32 + AddressV uint32 + AddressW uint32 + MipLODBias float32 + MaxAnisotropy uint32 + ComparisonFunc uint32 + BorderColor [4]float32 + MinLOD float32 + MaxLOD float32 +} + +type _D3D11_SHADER_RESOURCE_VIEW_DESC_TEX2D struct { + _D3D11_SHADER_RESOURCE_VIEW_DESC + Texture2D _D3D11_TEX2D_SRV +} + +type _D3D11_SHADER_RESOURCE_VIEW_DESC struct { + Format uint32 + ViewDimension uint32 +} + +type _D3D11_TEX2D_SRV struct { + MostDetailedMip uint32 + MipLevels uint32 +} + +type _D3D11_INPUT_ELEMENT_DESC struct { + SemanticName *byte + SemanticIndex uint32 + Format uint32 + InputSlot uint32 + AlignedByteOffset uint32 + InputSlotClass uint32 + InstanceDataStepRate uint32 +} + +type _IDXGISwapChain struct { + vtbl *struct { + _IUnknownVTbl + SetPrivateData uintptr + SetPrivateDataInterface uintptr + GetPrivateData uintptr + GetParent uintptr + GetDevice uintptr + Present uintptr + GetBuffer uintptr + SetFullscreenState uintptr + GetFullscreenState uintptr + GetDesc uintptr + ResizeBuffers uintptr + ResizeTarget uintptr + GetContainingOutput uintptr + GetFrameStatistics uintptr + GetLastPresentCount uintptr + } +} + +type _ID3D11Device struct { + vtbl *struct { + _IUnknownVTbl + CreateBuffer uintptr + CreateTexture1D uintptr + CreateTexture2D uintptr + CreateTexture3D uintptr + CreateShaderResourceView uintptr + CreateUnorderedAccessView uintptr + CreateRenderTargetView uintptr + CreateDepthStencilView uintptr + CreateInputLayout uintptr + CreateVertexShader uintptr + CreateGeometryShader uintptr + CreateGeometryShaderWithStreamOutput uintptr + CreatePixelShader uintptr + CreateHullShader uintptr + CreateDomainShader uintptr + CreateComputeShader uintptr + CreateClassLinkage uintptr + CreateBlendState uintptr + CreateDepthStencilState uintptr + CreateRasterizerState uintptr + CreateSamplerState uintptr + CreateQuery uintptr + CreatePredicate uintptr + CreateCounter uintptr + CreateDeferredContext uintptr + OpenSharedResource uintptr + CheckFormatSupport uintptr + CheckMultisampleQualityLevels uintptr + CheckCounterInfo uintptr + CheckCounter uintptr + CheckFeatureSupport uintptr + GetPrivateData uintptr + SetPrivateData uintptr + SetPrivateDataInterface uintptr + GetFeatureLevel uintptr + GetCreationFlags uintptr + GetDeviceRemovedReason uintptr + GetImmediateContext uintptr + SetExceptionMode uintptr + GetExceptionMode uintptr + } +} + +type _ID3D11DeviceContext struct { + vtbl *struct { + _IUnknownVTbl + GetDevice uintptr + GetPrivateData uintptr + SetPrivateData uintptr + SetPrivateDataInterface uintptr + VSSetConstantBuffers uintptr + PSSetShaderResources uintptr + PSSetShader uintptr + PSSetSamplers uintptr + VSSetShader uintptr + DrawIndexed uintptr + Draw uintptr + Map uintptr + Unmap uintptr + PSSetConstantBuffers uintptr + IASetInputLayout uintptr + IASetVertexBuffers uintptr + IASetIndexBuffer uintptr + DrawIndexedInstanced uintptr + DrawInstanced uintptr + GSSetConstantBuffers uintptr + GSSetShader uintptr + IASetPrimitiveTopology uintptr + VSSetShaderResources uintptr + VSSetSamplers uintptr + Begin uintptr + End uintptr + GetData uintptr + SetPredication uintptr + GSSetShaderResources uintptr + GSSetSamplers uintptr + OMSetRenderTargets uintptr + OMSetRenderTargetsAndUnorderedAccessViews uintptr + OMSetBlendState uintptr + OMSetDepthStencilState uintptr + SOSetTargets uintptr + DrawAuto uintptr + DrawIndexedInstancedIndirect uintptr + DrawInstancedIndirect uintptr + Dispatch uintptr + DispatchIndirect uintptr + RSSetState uintptr + RSSetViewports uintptr + RSSetScissorRects uintptr + CopySubresourceRegion uintptr + CopyResource uintptr + UpdateSubresource uintptr + CopyStructureCount uintptr + ClearRenderTargetView uintptr + ClearUnorderedAccessViewUint uintptr + ClearUnorderedAccessViewFloat uintptr + ClearDepthStencilView uintptr + GenerateMips uintptr + SetResourceMinLOD uintptr + GetResourceMinLOD uintptr + ResolveSubresource uintptr + ExecuteCommandList uintptr + HSSetShaderResources uintptr + HSSetShader uintptr + HSSetSamplers uintptr + HSSetConstantBuffers uintptr + DSSetShaderResources uintptr + DSSetShader uintptr + DSSetSamplers uintptr + DSSetConstantBuffers uintptr + CSSetShaderResources uintptr + CSSetUnorderedAccessViews uintptr + CSSetShader uintptr + CSSetSamplers uintptr + CSSetConstantBuffers uintptr + VSGetConstantBuffers uintptr + PSGetShaderResources uintptr + PSGetShader uintptr + PSGetSamplers uintptr + VSGetShader uintptr + PSGetConstantBuffers uintptr + IAGetInputLayout uintptr + IAGetVertexBuffers uintptr + IAGetIndexBuffer uintptr + GSGetConstantBuffers uintptr + GSGetShader uintptr + IAGetPrimitiveTopology uintptr + VSGetShaderResources uintptr + VSGetSamplers uintptr + GetPredication uintptr + GSGetShaderResources uintptr + GSGetSamplers uintptr + OMGetRenderTargets uintptr + OMGetRenderTargetsAndUnorderedAccessViews uintptr + OMGetBlendState uintptr + OMGetDepthStencilState uintptr + SOGetTargets uintptr + RSGetState uintptr + RSGetViewports uintptr + RSGetScissorRects uintptr + HSGetShaderResources uintptr + HSGetShader uintptr + HSGetSamplers uintptr + HSGetConstantBuffers uintptr + DSGetShaderResources uintptr + DSGetShader uintptr + DSGetSamplers uintptr + DSGetConstantBuffers uintptr + CSGetShaderResources uintptr + CSGetUnorderedAccessViews uintptr + CSGetShader uintptr + CSGetSamplers uintptr + CSGetConstantBuffers uintptr + ClearState uintptr + Flush uintptr + GetType uintptr + GetContextFlags uintptr + FinishCommandList uintptr + } +} + +type _ID3D11RenderTargetView struct { + vtbl *struct { + _IUnknownVTbl + } +} + +type _ID3D11Resource struct { + vtbl *struct { + _IUnknownVTbl + } +} + +type _ID3D11Texture2D struct { + vtbl *struct { + _IUnknownVTbl + } +} + +type _ID3D11Buffer struct { + vtbl *struct { + _IUnknownVTbl + } +} + +type _ID3D11SamplerState struct { + vtbl *struct { + _IUnknownVTbl + } +} + +type _ID3D11PixelShader struct { + vtbl *struct { + _IUnknownVTbl + } +} + +type _ID3D11ShaderResourceView struct { + vtbl *struct { + _IUnknownVTbl + } +} + +type _ID3D11DepthStencilView struct { + vtbl *struct { + _IUnknownVTbl + } +} + +type _ID3D11BlendState struct { + vtbl *struct { + _IUnknownVTbl + } +} + +type _ID3D11DepthStencilState struct { + vtbl *struct { + _IUnknownVTbl + } +} + +type _ID3D11VertexShader struct { + vtbl *struct { + _IUnknownVTbl + } +} + +type _ID3D11RasterizerState struct { + vtbl *struct { + _IUnknownVTbl + } +} + +type _ID3D11InputLayout struct { + vtbl *struct { + _IUnknownVTbl + GetBufferPointer uintptr + GetBufferSize uintptr + } +} + +type _ID3DBlob struct { + vtbl *struct { + _IUnknownVTbl + GetBufferPointer uintptr + GetBufferSize uintptr + } +} + +type _D3D11_DEPTH_STENCIL_DESC struct { + DepthEnable uint32 + DepthWriteMask uint32 + DepthFunc uint32 + StencilEnable uint32 + StencilReadMask uint8 + StencilWriteMask uint8 + FrontFace _D3D11_DEPTH_STENCILOP_DESC + BackFace _D3D11_DEPTH_STENCILOP_DESC +} + +type _D3D11_DEPTH_STENCILOP_DESC struct { + StencilFailOp uint32 + StencilDepthFailOp uint32 + StencilPassOp uint32 + StencilFunc uint32 +} + +type _D3D11_DEPTH_STENCIL_VIEW_DESC_TEX2D struct { + Format uint32 + ViewDimension uint32 + Flags uint32 + Texture2D _D3D11_TEX2D_DSV +} + +type _D3D11_TEX2D_DSV struct { + MipSlice uint32 +} + +type _D3D11_BLEND_DESC struct { + AlphaToCoverageEnable uint32 + IndependentBlendEnable uint32 + RenderTarget [8]_D3D11_RENDER_TARGET_BLEND_DESC +} + +type _D3D11_RENDER_TARGET_BLEND_DESC struct { + BlendEnable uint32 + SrcBlend uint32 + DestBlend uint32 + BlendOp uint32 + SrcBlendAlpha uint32 + DestBlendAlpha uint32 + BlendOpAlpha uint32 + RenderTargetWriteMask uint8 +} + +type _IDXGIObject struct { + vtbl *struct { + _IUnknownVTbl + SetPrivateData uintptr + SetPrivateDataInterface uintptr + GetPrivateData uintptr + GetParent uintptr + } +} + +type _IDXGIAdapter struct { + vtbl *struct { + _IUnknownVTbl + SetPrivateData uintptr + SetPrivateDataInterface uintptr + GetPrivateData uintptr + GetParent uintptr + EnumOutputs uintptr + GetDesc uintptr + CheckInterfaceSupport uintptr + GetDesc1 uintptr + } +} + +type _IDXGIFactory struct { + vtbl *struct { + _IUnknownVTbl + SetPrivateData uintptr + SetPrivateDataInterface uintptr + GetPrivateData uintptr + GetParent uintptr + EnumAdapters uintptr + MakeWindowAssociation uintptr + GetWindowAssociation uintptr + CreateSwapChain uintptr + CreateSoftwareAdapter uintptr + } +} + +type _IDXGIDevice struct { + vtbl *struct { + _IUnknownVTbl + SetPrivateData uintptr + SetPrivateDataInterface uintptr + GetPrivateData uintptr + GetParent uintptr + GetAdapter uintptr + CreateSurface uintptr + QueryResourceResidency uintptr + SetGPUThreadPriority uintptr + GetGPUThreadPriority uintptr + } +} + +type _IUnknown struct { + vtbl *struct { + _IUnknownVTbl + } +} + +type _IUnknownVTbl struct { + QueryInterface uintptr + AddRef uintptr + Release uintptr +} + +type _D3D11_BUFFER_DESC struct { + ByteWidth uint32 + Usage uint32 + BindFlags uint32 + CPUAccessFlags uint32 + MiscFlags uint32 + StructureByteStride uint32 +} + +type _GUID struct { + Data1 uint32 + Data2 uint16 + Data3 uint16 + Data4_0 uint8 + Data4_1 uint8 + Data4_2 uint8 + Data4_3 uint8 + Data4_4 uint8 + Data4_5 uint8 + Data4_6 uint8 + Data4_7 uint8 +} + +type _D3D11_VIEWPORT struct { + TopLeftX float32 + TopLeftY float32 + Width float32 + Height float32 + MinDepth float32 + MaxDepth float32 +} + +type _D3D11_SUBRESOURCE_DATA struct { + pSysMem *byte +} + +type _D3D11_BOX struct { + left uint32 + top uint32 + front uint32 + right uint32 + bottom uint32 + back uint32 +} + +type _D3D11_MAPPED_SUBRESOURCE struct { + pData uintptr + RowPitch uint32 + DepthPitch uint32 +} + +type ErrorCode struct { + Name string + Code int +} + +type _D3D11_RASTERIZER_DESC struct { + FillMode uint32 + CullMode uint32 + FrontCounterClockwise uint32 + DepthBias int32 + DepthBiasClamp float32 + SlopeScaledDepthBias float32 + DepthClipEnable uint32 + ScissorEnable uint32 + MultisampleEnable uint32 + AntialiasedLineEnable uint32 +} + +var ( + _IID_ID3D11Texture2D = _GUID{0x6f15aaf2, 0xd208, 0x4e89, 0x9a, 0xb4, 0x48, 0x95, 0x35, 0xd3, 0x4f, 0x9c} + _IID_IDXGIDevice = _GUID{0x54ec77fa, 0x1377, 0x44e6, 0x8c, 0x32, 0x88, 0xfd, 0x5f, 0x44, 0xc8, 0x4c} + _IID_IDXGIFactory = _GUID{0x7b7166ec, 0x21c7, 0x44ae, 0xb2, 0x1a, 0xc9, 0xae, 0x32, 0x1a, 0xe3, 0x69} +) + +var ( + d3d11 = windows.NewLazySystemDLL("d3d11.dll") + + __D3D11CreateDevice = d3d11.NewProc("D3D11CreateDevice") + __D3D11CreateDeviceAndSwapChain = d3d11.NewProc("D3D11CreateDeviceAndSwapChain") + + d3dcompiler_47 = windows.NewLazySystemDLL("d3dcompiler_47.dll") + + __D3DCompile = d3dcompiler_47.NewProc("D3DCompile") +) + +const ( + _D3D11_SDK_VERSION = 7 + _D3D_DRIVER_TYPE_HARDWARE = 1 + + _DXGI_FORMAT_UNKNOWN = 0 + _DXGI_FORMAT_R16_FLOAT = 54 + _DXGI_FORMAT_R32_FLOAT = 41 + _DXGI_FORMAT_R32G32_FLOAT = 16 + _DXGI_FORMAT_R32G32B32_FLOAT = 6 + _DXGI_FORMAT_R32G32B32A32_FLOAT = 2 + _DXGI_FORMAT_R8G8B8A8_UNORM_SRGB = 29 + _DXGI_FORMAT_R16_SINT = 59 + _DXGI_FORMAT_R16G16_SINT = 38 + + _DXGI_USAGE_RENDER_TARGET_OUTPUT = 1 << (1 + 4) + + _D3D11_CPU_ACCESS_READ = 0x20000 + + _D3D11_MAP_READ = 1 + + _DXGI_SWAP_EFFECT_DISCARD = 0 + + _DXGI_FORMAT_R16_UINT = 57 + + _D3D_FEATURE_LEVEL_9_1 = 0x9100 + _D3D_FEATURE_LEVEL_9_3 = 0x9300 + _D3D_FEATURE_LEVEL_11_0 = 0xb000 + + _D3D11_USAGE_IMMUTABLE = 1 + _D3D11_USAGE_STAGING = 3 + + _D3D11_BIND_VERTEX_BUFFER = 0x1 + _D3D11_BIND_INDEX_BUFFER = 0x2 + _D3D11_BIND_CONSTANT_BUFFER = 0x4 + _D3D11_BIND_SHADER_RESOURCE = 0x8 + _D3D11_BIND_RENDER_TARGET = 0x20 + _D3D11_BIND_DEPTH_STENCIL = 0x40 + + _D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST = 4 + _D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP = 5 + + _D3D11_FILTER_MIN_MAG_LINEAR_MIP_POINT = 0x14 + _D3D11_FILTER_MIN_MAG_MIP_POINT = 0 + + _D3D11_TEXTURE_ADDRESS_MIRROR = 2 + _D3D11_TEXTURE_ADDRESS_CLAMP = 3 + _D3D11_TEXTURE_ADDRESS_WRAP = 1 + + _D3D11_SRV_DIMENSION_TEXTURE2D = 4 + + _D3D11_CREATE_DEVICE_DEBUG = 0x2 + + _D3D11_FILL_SOLID = 3 + + _D3D11_CULL_NONE = 1 + + _D3D11_CLEAR_DEPTH = 0x1 + _D3D11_CLEAR_STENCIL = 0x2 + + _DXGI_FORMAT_D24_UNORM_S8_UINT = 45 + + _D3D11_DSV_DIMENSION_TEXTURE2D = 3 + + _D3D11_DEPTH_WRITE_MASK_ALL = 1 + + _D3D11_COMPARISON_GREATER = 5 + + _D3D11_BLEND_OP_ADD = 1 + _D3D11_BLEND_ONE = 2 + _D3D11_BLEND_INV_SRC_ALPHA = 6 + _D3D11_BLEND_ZERO = 1 + _D3D11_BLEND_DEST_COLOR = 9 + _D3D11_BLEND_DEST_ALPHA = 7 + + _D3D11_COLOR_WRITE_ENABLE_ALL = 1 | 2 | 4 | 8 + + DXGI_STATUS_OCCLUDED = 0x087A0001 + DXGI_ERROR_DEVICE_RESET = 0x887A0007 + DXGI_ERROR_DEVICE_REMOVED = 0x887A0005 + D3DDDIERR_DEVICEREMOVED = 1<<31 | 0x876<<16 | 2160 +) + +func _D3D11CreateDevice(driverType uint32, flags uint32) (*_ID3D11Device, *_ID3D11DeviceContext, uint32, error) { + var ( + dev *_ID3D11Device + ctx *_ID3D11DeviceContext + featLvl uint32 + ) + r, _, _ := __D3D11CreateDevice.Call( + 0, // pAdapter + uintptr(driverType), // driverType + 0, // Software + uintptr(flags), // Flags + 0, // pFeatureLevels + 0, // FeatureLevels + _D3D11_SDK_VERSION, // SDKVersion + uintptr(unsafe.Pointer(&dev)), // ppDevice + uintptr(unsafe.Pointer(&featLvl)), // pFeatureLevel + uintptr(unsafe.Pointer(&ctx)), // ppImmediateContext + ) + if r != 0 { + return nil, nil, 0, fmt.Errorf("D3D11CreateDevice: %#x", r) + } + return dev, ctx, featLvl, nil +} + +func _D3D11CreateDeviceAndSwapChain(driverType uint32, flags uint32, swapDesc *_DXGI_SWAP_CHAIN_DESC) (*_ID3D11Device, *_ID3D11DeviceContext, *_IDXGISwapChain, uint32, error) { + var ( + dev *_ID3D11Device + ctx *_ID3D11DeviceContext + swchain *_IDXGISwapChain + featLvl uint32 + ) + r, _, _ := __D3D11CreateDeviceAndSwapChain.Call( + 0, // pAdapter + uintptr(driverType), // driverType + 0, // Software + uintptr(flags), // Flags + 0, // pFeatureLevels + 0, // FeatureLevels + _D3D11_SDK_VERSION, // SDKVersion + uintptr(unsafe.Pointer(swapDesc)), // pSwapChainDesc + uintptr(unsafe.Pointer(&swchain)), // ppSwapChain + uintptr(unsafe.Pointer(&dev)), // ppDevice + uintptr(unsafe.Pointer(&featLvl)), // pFeatureLevel + uintptr(unsafe.Pointer(&ctx)), // ppImmediateContext + ) + if r != 0 { + return nil, nil, nil, 0, fmt.Errorf("D3D11CreateDeviceAndSwapChain: %#x", r) + } + return dev, ctx, swchain, featLvl, nil +} + +func _D3DCompile(src []byte, entryPoint, target string) ([]byte, error) { + var ( + code *_ID3DBlob + errors *_ID3DBlob + ) + entryPoint0 := []byte(entryPoint + "\x00") + target0 := []byte(target + "\x00") + r, _, _ := __D3DCompile.Call( + uintptr(unsafe.Pointer(&src[0])), + uintptr(len(src)), + 0, // pSourceName + 0, // pDefines + 0, // pInclude + uintptr(unsafe.Pointer(&entryPoint0[0])), + uintptr(unsafe.Pointer(&target0[0])), + 0, // Flags1 + 0, // Flags2 + uintptr(unsafe.Pointer(&code)), + uintptr(unsafe.Pointer(&errors)), + ) + var compileErr string + if errors != nil { + compileErr = string(errors.data()) + _IUnknownRelease(unsafe.Pointer(errors), errors.vtbl.Release) + } + if r != 0 { + return nil, fmt.Errorf("D3D11Compile: %#x: %s", r, compileErr) + } + bytecode := code.data() + cp := make([]byte, len(bytecode)) + copy(cp, bytecode) + _IUnknownRelease(unsafe.Pointer(code), code.vtbl.Release) + return cp, nil +} + +func (d *_ID3D11Device) CreateBuffer(desc *_D3D11_BUFFER_DESC, data []byte) (*_ID3D11Buffer, error) { + var dataDesc *_D3D11_SUBRESOURCE_DATA + if len(data) > 0 { + dataDesc = &_D3D11_SUBRESOURCE_DATA{ + pSysMem: &data[0], + } + } + var buf *_ID3D11Buffer + r, _, _ := syscall.Syscall6( + d.vtbl.CreateBuffer, + 4, + uintptr(unsafe.Pointer(d)), + uintptr(unsafe.Pointer(desc)), + uintptr(unsafe.Pointer(dataDesc)), + uintptr(unsafe.Pointer(&buf)), + 0, 0, + ) + if r != 0 { + return nil, fmt.Errorf("ID3D11DeviceCreateBuffer: %#x", r) + } + return buf, nil +} + +func (d *_ID3D11Device) CreateDepthStencilViewTEX2D(res *_ID3D11Resource, desc *_D3D11_DEPTH_STENCIL_VIEW_DESC_TEX2D) (*_ID3D11DepthStencilView, error) { + var view *_ID3D11DepthStencilView + r, _, _ := syscall.Syscall6( + d.vtbl.CreateDepthStencilView, + 4, + uintptr(unsafe.Pointer(d)), + uintptr(unsafe.Pointer(res)), + uintptr(unsafe.Pointer(desc)), + uintptr(unsafe.Pointer(&view)), + 0, 0, + ) + if r != 0 { + return nil, fmt.Errorf("ID3D11DeviceCreateDepthStencilView: %#x", r) + } + return view, nil +} + +func (d *_ID3D11Device) CreatePixelShader(bytecode []byte) (*_ID3D11PixelShader, error) { + var shader *_ID3D11PixelShader + r, _, _ := syscall.Syscall6( + d.vtbl.CreatePixelShader, + 5, + uintptr(unsafe.Pointer(d)), + uintptr(unsafe.Pointer(&bytecode[0])), + uintptr(len(bytecode)), + 0, // pClassLinkage + uintptr(unsafe.Pointer(&shader)), + 0, + ) + if r != 0 { + return nil, fmt.Errorf("ID3D11DeviceCreatePixelShader; %#x", r) + } + return shader, nil +} + +func (d *_ID3D11Device) CreateVertexShader(bytecode []byte) (*_ID3D11VertexShader, error) { + var shader *_ID3D11VertexShader + r, _, _ := syscall.Syscall6( + d.vtbl.CreateVertexShader, + 5, + uintptr(unsafe.Pointer(d)), + uintptr(unsafe.Pointer(&bytecode[0])), + uintptr(len(bytecode)), + 0, // pClassLinkage + uintptr(unsafe.Pointer(&shader)), + 0, + ) + if r != 0 { + return nil, fmt.Errorf("ID3D11DeviceCreateVertexShader; %#x", r) + } + return shader, nil +} + +func (d *_ID3D11Device) CreateShaderResourceViewTEX2D(res *_ID3D11Resource, desc *_D3D11_SHADER_RESOURCE_VIEW_DESC_TEX2D) (*_ID3D11ShaderResourceView, error) { + var resView *_ID3D11ShaderResourceView + r, _, _ := syscall.Syscall6( + d.vtbl.CreateShaderResourceView, + 4, + uintptr(unsafe.Pointer(d)), + uintptr(unsafe.Pointer(res)), + uintptr(unsafe.Pointer(desc)), + uintptr(unsafe.Pointer(&resView)), + 0, 0, + ) + if r != 0 { + return nil, fmt.Errorf("ID3D11DeviceCreateShaderResourceView: %#x", r) + } + return resView, nil +} + +func (d *_ID3D11Device) CreateRasterizerState(desc *_D3D11_RASTERIZER_DESC) (*_ID3D11RasterizerState, error) { + var state *_ID3D11RasterizerState + r, _, _ := syscall.Syscall( + d.vtbl.CreateRasterizerState, + 3, + uintptr(unsafe.Pointer(d)), + uintptr(unsafe.Pointer(desc)), + uintptr(unsafe.Pointer(&state)), + ) + if r != 0 { + return nil, fmt.Errorf("ID3D11DeviceCreateRasterizerState: %#x", r) + } + return state, nil +} + +func (d *_ID3D11Device) CreateInputLayout(descs []_D3D11_INPUT_ELEMENT_DESC, bytecode []byte) (*_ID3D11InputLayout, error) { + var pdesc *_D3D11_INPUT_ELEMENT_DESC + if len(descs) > 0 { + pdesc = &descs[0] + } + var layout *_ID3D11InputLayout + r, _, _ := syscall.Syscall6( + d.vtbl.CreateInputLayout, + 6, + uintptr(unsafe.Pointer(d)), + uintptr(unsafe.Pointer(pdesc)), + uintptr(len(descs)), + uintptr(unsafe.Pointer(&bytecode[0])), + uintptr(len(bytecode)), + uintptr(unsafe.Pointer(&layout)), + ) + if r != 0 { + return nil, fmt.Errorf("ID3D11DeviceCreateInputLayout: %#x", r) + } + return layout, nil +} + +func (d *_ID3D11Device) CreateSamplerState(desc *_D3D11_SAMPLER_DESC) (*_ID3D11SamplerState, error) { + var sampler *_ID3D11SamplerState + r, _, _ := syscall.Syscall( + d.vtbl.CreateSamplerState, + 3, + uintptr(unsafe.Pointer(d)), + uintptr(unsafe.Pointer(desc)), + uintptr(unsafe.Pointer(&sampler)), + ) + if r != 0 { + return nil, fmt.Errorf("ID3D11DeviceCreateSamplerState: %#x", r) + } + return sampler, nil +} + +func (d *_ID3D11Device) CreateTexture2D(desc *_D3D11_TEXTURE2D_DESC) (*_ID3D11Texture2D, error) { + var tex *_ID3D11Texture2D + r, _, _ := syscall.Syscall6( + d.vtbl.CreateTexture2D, + 4, + uintptr(unsafe.Pointer(d)), + uintptr(unsafe.Pointer(desc)), + 0, // pInitialData + uintptr(unsafe.Pointer(&tex)), + 0, 0, + ) + if r != 0 { + return nil, fmt.Errorf("ID3D11CreateTexture2D: %#x", r) + } + return tex, nil +} + +func (d *_ID3D11Device) CreateRenderTargetView(res *_ID3D11Resource) (*_ID3D11RenderTargetView, error) { + var target *_ID3D11RenderTargetView + r, _, _ := syscall.Syscall6( + d.vtbl.CreateRenderTargetView, + 4, + uintptr(unsafe.Pointer(d)), + uintptr(unsafe.Pointer(res)), + 0, // pDesc + uintptr(unsafe.Pointer(&target)), + 0, 0, + ) + if r != 0 { + return nil, fmt.Errorf("ID3D11DeviceCreateRenderTargetView: %#x", r) + } + return target, nil +} + +func (d *_ID3D11Device) CreateBlendState(desc *_D3D11_BLEND_DESC) (*_ID3D11BlendState, error) { + var state *_ID3D11BlendState + r, _, _ := syscall.Syscall( + d.vtbl.CreateBlendState, + 3, + uintptr(unsafe.Pointer(d)), + uintptr(unsafe.Pointer(desc)), + uintptr(unsafe.Pointer(&state)), + ) + if r != 0 { + return nil, fmt.Errorf("ID3D11DeviceCreateBlendState: %#x", r) + } + return state, nil +} + +func (d *_ID3D11Device) CreateDepthStencilState(desc *_D3D11_DEPTH_STENCIL_DESC) (*_ID3D11DepthStencilState, error) { + var state *_ID3D11DepthStencilState + r, _, _ := syscall.Syscall( + d.vtbl.CreateDepthStencilState, + 3, + uintptr(unsafe.Pointer(d)), + uintptr(unsafe.Pointer(desc)), + uintptr(unsafe.Pointer(&state)), + ) + if r != 0 { + return nil, fmt.Errorf("ID3D11DeviceCreateDepthStencilState: %#x", r) + } + return state, nil +} + +func (s *_IDXGISwapChain) ResizeBuffers(buffers, width, height, newFormat, flags uint32) error { + r, _, _ := syscall.Syscall6( + s.vtbl.ResizeBuffers, + 6, + uintptr(unsafe.Pointer(s)), + uintptr(buffers), + uintptr(width), + uintptr(height), + uintptr(newFormat), + uintptr(flags), + ) + if r != 0 { + return fmt.Errorf("IDXGISwapChainResizeBuffers: %#x", r) + } + return nil +} + +func (s *_IDXGISwapChain) Present(SyncInterval int, Flags uint32) error { + r, _, _ := syscall.Syscall( + s.vtbl.Present, + 3, + uintptr(unsafe.Pointer(s)), + uintptr(SyncInterval), + uintptr(Flags), + ) + if r != 0 { + return ErrorCode{Name: "IDXGISwapChainPresent", Code: int(r)} + } + return nil +} + +func (s *_IDXGISwapChain) GetBuffer(index int, riid *_GUID) (*_IUnknown, error) { + var buf *_IUnknown + r, _, _ := syscall.Syscall6( + s.vtbl.GetBuffer, + 4, + uintptr(unsafe.Pointer(s)), + uintptr(index), + uintptr(unsafe.Pointer(riid)), + uintptr(unsafe.Pointer(&buf)), + 0, + 0, + ) + if r != 0 { + return nil, fmt.Errorf("IDXGISwapChainGetBuffer: %#x", r) + } + return buf, nil +} + +func (c *_ID3D11DeviceContext) Unmap(resource *_ID3D11Resource, subResource uint32) { + syscall.Syscall( + c.vtbl.Unmap, + 3, + uintptr(unsafe.Pointer(c)), + uintptr(unsafe.Pointer(resource)), + uintptr(subResource), + ) +} + +func (c *_ID3D11DeviceContext) Map(resource *_ID3D11Resource, subResource, mapType, mapFlags uint32) (_D3D11_MAPPED_SUBRESOURCE, error) { + var resMap _D3D11_MAPPED_SUBRESOURCE + r, _, _ := syscall.Syscall6( + c.vtbl.Map, + 6, + uintptr(unsafe.Pointer(c)), + uintptr(unsafe.Pointer(resource)), + uintptr(subResource), + uintptr(mapType), + uintptr(mapFlags), + uintptr(unsafe.Pointer(&resMap)), + ) + if r != 0 { + return resMap, fmt.Errorf("ID3D11DeviceContextMap: %#x", r) + } + return resMap, nil +} + +func (c *_ID3D11DeviceContext) CopySubresourceRegion(dst *_ID3D11Resource, dstSubresource, dstX, dstY, dstZ uint32, src *_ID3D11Resource, srcSubresource uint32, srcBox *_D3D11_BOX) { + syscall.Syscall9( + c.vtbl.CopySubresourceRegion, + 9, + uintptr(unsafe.Pointer(c)), + uintptr(unsafe.Pointer(dst)), + uintptr(dstSubresource), + uintptr(dstX), + uintptr(dstY), + uintptr(dstZ), + uintptr(unsafe.Pointer(src)), + uintptr(srcSubresource), + uintptr(unsafe.Pointer(srcBox)), + ) +} + +func (c *_ID3D11DeviceContext) ClearDepthStencilView(target *_ID3D11DepthStencilView, flags uint32, depth float32, stencil uint8) { + syscall.Syscall6( + c.vtbl.ClearDepthStencilView, + 5, + uintptr(unsafe.Pointer(c)), + uintptr(unsafe.Pointer(target)), + uintptr(flags), + uintptr(math.Float32bits(depth)), + uintptr(stencil), + 0, + ) +} + +func (c *_ID3D11DeviceContext) ClearRenderTargetView(target *_ID3D11RenderTargetView, color *[4]float32) { + syscall.Syscall( + c.vtbl.ClearRenderTargetView, + 3, + uintptr(unsafe.Pointer(c)), + uintptr(unsafe.Pointer(target)), + uintptr(unsafe.Pointer(color)), + ) +} + +func (c *_ID3D11DeviceContext) RSSetViewports(viewport *_D3D11_VIEWPORT) { + syscall.Syscall( + c.vtbl.RSSetViewports, + 3, + uintptr(unsafe.Pointer(c)), + 1, // NumViewports + uintptr(unsafe.Pointer(viewport)), + ) +} + +func (c *_ID3D11DeviceContext) VSSetShader(s *_ID3D11VertexShader) { + syscall.Syscall6( + c.vtbl.VSSetShader, + 4, + uintptr(unsafe.Pointer(c)), + uintptr(unsafe.Pointer(s)), + 0, // ppClassInstances + 0, // NumClassInstances + 0, 0, + ) +} + +func (c *_ID3D11DeviceContext) VSSetConstantBuffers(b *_ID3D11Buffer) { + syscall.Syscall6( + c.vtbl.VSSetConstantBuffers, + 4, + uintptr(unsafe.Pointer(c)), + 0, // StartSlot + 1, // NumBuffers + uintptr(unsafe.Pointer(&b)), + 0, 0, + ) +} + +func (c *_ID3D11DeviceContext) PSSetConstantBuffers(b *_ID3D11Buffer) { + syscall.Syscall6( + c.vtbl.PSSetConstantBuffers, + 4, + uintptr(unsafe.Pointer(c)), + 0, // StartSlot + 1, // NumBuffers + uintptr(unsafe.Pointer(&b)), + 0, 0, + ) +} + +func (c *_ID3D11DeviceContext) PSSetShaderResources(startSlot uint32, s *_ID3D11ShaderResourceView) { + syscall.Syscall6( + c.vtbl.PSSetShaderResources, + 4, + uintptr(unsafe.Pointer(c)), + uintptr(startSlot), + 1, // NumViews + uintptr(unsafe.Pointer(&s)), + 0, 0, + ) +} + +func (c *_ID3D11DeviceContext) PSSetSamplers(startSlot uint32, s *_ID3D11SamplerState) { + syscall.Syscall6( + c.vtbl.PSSetSamplers, + 4, + uintptr(unsafe.Pointer(c)), + uintptr(startSlot), + 1, // NumSamplers + uintptr(unsafe.Pointer(&s)), + 0, 0, + ) +} + +func (c *_ID3D11DeviceContext) PSSetShader(s *_ID3D11PixelShader) { + syscall.Syscall6( + c.vtbl.PSSetShader, + 4, + uintptr(unsafe.Pointer(c)), + uintptr(unsafe.Pointer(s)), + 0, // ppClassInstances + 0, // NumClassInstances + 0, 0, + ) +} + +func (c *_ID3D11DeviceContext) UpdateSubresource(res *_ID3D11Resource, rowPitch, depthPitch uint32, data []byte) { + syscall.Syscall9( + c.vtbl.UpdateSubresource, + 7, + uintptr(unsafe.Pointer(c)), + uintptr(unsafe.Pointer(res)), + 0, // DstSubresource + 0, // pDstBox + uintptr(unsafe.Pointer(&data[0])), + uintptr(rowPitch), + uintptr(depthPitch), + 0, 0, + ) +} + +func (c *_ID3D11DeviceContext) RSSetState(state *_ID3D11RasterizerState) { + syscall.Syscall( + c.vtbl.RSSetState, + 2, + uintptr(unsafe.Pointer(c)), + uintptr(unsafe.Pointer(state)), + 0, + ) +} + +func (c *_ID3D11DeviceContext) IASetInputLayout(layout *_ID3D11InputLayout) { + syscall.Syscall( + c.vtbl.IASetInputLayout, + 2, + uintptr(unsafe.Pointer(c)), + uintptr(unsafe.Pointer(layout)), + 0, + ) +} + +func (c *_ID3D11DeviceContext) IASetIndexBuffer(buf *_ID3D11Buffer, format, offset uint32) { + syscall.Syscall6( + c.vtbl.IASetIndexBuffer, + 4, + uintptr(unsafe.Pointer(c)), + uintptr(unsafe.Pointer(buf)), + uintptr(format), + uintptr(offset), + 0, 0, + ) +} + +func (c *_ID3D11DeviceContext) IASetVertexBuffers(buf *_ID3D11Buffer, stride, offset uint32) { + syscall.Syscall6( + c.vtbl.IASetVertexBuffers, + 6, + uintptr(unsafe.Pointer(c)), + 0, // StartSlot + 1, // NumBuffers, + uintptr(unsafe.Pointer(&buf)), + uintptr(unsafe.Pointer(&stride)), + uintptr(unsafe.Pointer(&offset)), + ) +} + +func (c *_ID3D11DeviceContext) IASetPrimitiveTopology(mode uint32) { + syscall.Syscall( + c.vtbl.IASetPrimitiveTopology, + 2, + uintptr(unsafe.Pointer(c)), + uintptr(mode), + 0, + ) +} + +func (c *_ID3D11DeviceContext) OMGetRenderTargets() *_ID3D11RenderTargetView { + var target *_ID3D11RenderTargetView + syscall.Syscall6( + c.vtbl.OMGetRenderTargets, + 4, + uintptr(unsafe.Pointer(c)), + 1, // NumViews + uintptr(unsafe.Pointer(&target)), + 0, // pDepthStencilView + 0, 0, + ) + return target +} + +func (c *_ID3D11DeviceContext) OMSetRenderTargets(target *_ID3D11RenderTargetView, depthStencil *_ID3D11DepthStencilView) { + syscall.Syscall6( + c.vtbl.OMSetRenderTargets, + 4, + uintptr(unsafe.Pointer(c)), + 1, // NumViews + uintptr(unsafe.Pointer(&target)), + uintptr(unsafe.Pointer(depthStencil)), + 0, 0, + ) +} + +func (c *_ID3D11DeviceContext) Draw(count, start uint32) { + syscall.Syscall( + c.vtbl.Draw, + 3, + uintptr(unsafe.Pointer(c)), + uintptr(count), + uintptr(start), + ) +} + +func (c *_ID3D11DeviceContext) DrawIndexed(count, start uint32, base int32) { + syscall.Syscall6( + c.vtbl.DrawIndexed, + 4, + uintptr(unsafe.Pointer(c)), + uintptr(count), + uintptr(start), + uintptr(base), + 0, 0, + ) +} + +func (c *_ID3D11DeviceContext) OMSetBlendState(state *_ID3D11BlendState, factor *[4]float32, sampleMask uint32) { + syscall.Syscall6( + c.vtbl.OMSetBlendState, + 4, + uintptr(unsafe.Pointer(c)), + uintptr(unsafe.Pointer(state)), + uintptr(unsafe.Pointer(factor)), + uintptr(sampleMask), + 0, 0, + ) +} + +func (c *_ID3D11DeviceContext) OMSetDepthStencilState(state *_ID3D11DepthStencilState, stencilRef uint32) { + syscall.Syscall( + c.vtbl.OMSetDepthStencilState, + 3, + uintptr(unsafe.Pointer(c)), + uintptr(unsafe.Pointer(state)), + uintptr(stencilRef), + ) +} + +func (b *_ID3DBlob) GetBufferPointer() uintptr { + ptr, _, _ := syscall.Syscall( + b.vtbl.GetBufferPointer, + 1, + uintptr(unsafe.Pointer(b)), + 0, + 0, + ) + return ptr +} + +func (b *_ID3DBlob) GetBufferSize() uintptr { + sz, _, _ := syscall.Syscall( + b.vtbl.GetBufferSize, + 1, + uintptr(unsafe.Pointer(b)), + 0, + 0, + ) + return sz +} + +func (b *_ID3DBlob) data() []byte { + data := gunsafe.SliceOf(b.GetBufferPointer()) + n := int(b.GetBufferSize()) + return data[:n:n] +} + +func (d *_IDXGIObject) GetParent(guid *_GUID) (*_IDXGIObject, error) { + var parent *_IDXGIObject + r, _, _ := syscall.Syscall( + d.vtbl.GetParent, + 3, + uintptr(unsafe.Pointer(d)), + uintptr(unsafe.Pointer(guid)), + uintptr(unsafe.Pointer(&parent)), + ) + if r != 0 { + return nil, fmt.Errorf("IDXGIObjectGetParent: %#x", r) + } + return parent, nil +} + +func (d *_IDXGIFactory) CreateSwapChain(device *_IUnknown, desc *_DXGI_SWAP_CHAIN_DESC) (*_IDXGISwapChain, error) { + var swchain *_IDXGISwapChain + r, _, _ := syscall.Syscall6( + d.vtbl.CreateSwapChain, + 4, + uintptr(unsafe.Pointer(d)), + uintptr(unsafe.Pointer(device)), + uintptr(unsafe.Pointer(desc)), + uintptr(unsafe.Pointer(&swchain)), + 0, 0, + ) + if r != 0 { + return nil, fmt.Errorf("IDXGIFactory: %#x", r) + } + return swchain, nil +} + +func (d *_IDXGIDevice) GetAdapter() (*_IDXGIAdapter, error) { + var adapter *_IDXGIAdapter + r, _, _ := syscall.Syscall( + d.vtbl.GetAdapter, + 2, + uintptr(unsafe.Pointer(d)), + uintptr(unsafe.Pointer(&adapter)), + 0, + ) + if r != 0 { + return nil, fmt.Errorf("IDXGIDeviceGetAdapter: %#x", r) + } + return adapter, nil +} + +func _IUnknownQueryInterface(obj unsafe.Pointer, queryInterfaceMethod uintptr, guid *_GUID) (*_IUnknown, error) { + var ref *_IUnknown + r, _, _ := syscall.Syscall( + queryInterfaceMethod, + 3, + uintptr(obj), + uintptr(unsafe.Pointer(guid)), + uintptr(unsafe.Pointer(&ref)), + ) + if r != 0 { + return nil, fmt.Errorf("IUnknownQueryInterface: %#x", r) + } + return ref, nil +} + +func _IUnknownRelease(obj unsafe.Pointer, releaseMethod uintptr) { + syscall.Syscall( + releaseMethod, + 1, + uintptr(obj), + 0, + 0, + ) +} + +func (e ErrorCode) Error() string { + return fmt.Sprintf("%s: %#x", e.Name, e.Code) +} diff --git a/app/internal/window/d3d11_windows.go b/app/internal/window/d3d11_windows.go new file mode 100644 index 00000000..f1e06a6e --- /dev/null +++ b/app/internal/window/d3d11_windows.go @@ -0,0 +1,102 @@ +// SPDX-License-Identifier: Unlicense OR MIT + +package window + +import ( + "gioui.org/app/internal/d3d11" + "gioui.org/gpu/backend" +) + +type d3d11Context struct { + win *window + swchain *d3d11.SwapChain + fbo *d3d11.Framebuffer + backend backend.Device + *d3d11.Device + width, height int +} + +func init() { + backends = append(backends, gpuAPI{ + priority: 1, + initializer: func(w *window) (Context, error) { + hwnd, _, _ := w.HWND() + dev, err := d3d11.NewDevice() + if err != nil { + return nil, err + } + swchain, err := dev.CreateSwapChain(hwnd) + if err != nil { + dev.Release() + return nil, err + } + return &d3d11Context{win: w, Device: dev, swchain: swchain}, nil + }, + }) +} + +func (c *d3d11Context) Backend() (backend.Device, error) { + backend, err := d3d11.NewBackend(c.Device) + if err != nil { + return nil, err + } + c.backend = backend + c.backend.BindFramebuffer(c.fbo) + return backend, nil +} + +func (c *d3d11Context) Present() error { + if err := c.swchain.Present(); err != nil { + if err, ok := err.(d3d11.ErrorCode); ok { + switch err.Code { + case d3d11.DXGI_STATUS_OCCLUDED: + // Ignore + return nil + case d3d11.DXGI_ERROR_DEVICE_RESET, d3d11.DXGI_ERROR_DEVICE_REMOVED, d3d11.D3DDDIERR_DEVICEREMOVED: + return ErrDeviceLost + } + } + } + return nil +} + +func (c *d3d11Context) MakeCurrent() error { + _, width, height := c.win.HWND() + if c.fbo != nil && width == c.width && height == c.height { + c.backend.BindFramebuffer(c.fbo) + return nil + } + if c.fbo != nil { + c.fbo.Release() + c.fbo = nil + } + if err := c.swchain.Resize(); err != nil { + return err + } + c.width = width + c.height = height + fbo, err := c.swchain.Framebuffer(c.Device) + if err != nil { + return err + } + c.fbo = fbo + if c.backend != nil { + c.backend.BindFramebuffer(c.fbo) + } + return nil +} + +func (c *d3d11Context) Lock() {} + +func (c *d3d11Context) Unlock() {} + +func (c *d3d11Context) Release() { + if c.fbo != nil { + c.fbo.Release() + } + c.swchain.Release() + c.Device.Release() + c.fbo = nil + c.swchain = nil + c.Device = nil +} diff --git a/app/internal/window/egl_windows.go b/app/internal/window/egl_windows.go index bbfa9d5f..654d279d 100644 --- a/app/internal/window/egl_windows.go +++ b/app/internal/window/egl_windows.go @@ -6,28 +6,33 @@ import ( "gioui.org/app/internal/egl" ) -type context struct { +type glContext struct { win *window *egl.Context } -func (w *window) NewContext() (Context, error) { - disp := egl.NativeDisplayType(w.HDC()) - ctx, err := egl.NewContext(disp) - if err != nil { - return nil, err - } - return &context{win: w, Context: ctx}, nil +func init() { + backends = append(backends, gpuAPI{ + priority: 2, + initializer: func(w *window) (Context, error) { + disp := egl.NativeDisplayType(w.HDC()) + ctx, err := egl.NewContext(disp) + if err != nil { + return nil, err + } + return &glContext{win: w, Context: ctx}, nil + }, + }) } -func (c *context) Release() { +func (c *glContext) Release() { if c.Context != nil { c.Context.Release() c.Context = nil } } -func (c *context) MakeCurrent() error { +func (c *glContext) MakeCurrent() error { c.Context.ReleaseSurface() win, width, height := c.win.HWND() eglSurf := egl.NativeWindowType(win) @@ -41,6 +46,6 @@ func (c *context) MakeCurrent() error { return nil } -func (c *context) Lock() {} +func (c *glContext) Lock() {} -func (c *context) Unlock() {} +func (c *glContext) Unlock() {} diff --git a/app/internal/window/os_windows.go b/app/internal/window/os_windows.go index ff370441..ad517840 100644 --- a/app/internal/window/os_windows.go +++ b/app/internal/window/os_windows.go @@ -6,6 +6,7 @@ import ( "errors" "image" "runtime" + "sort" "sync" "time" "unicode" @@ -42,6 +43,15 @@ const _WM_REDRAW = windows.WM_USER + 0 var onceMu sync.Mutex var mainDone = make(chan struct{}) +// backends is the list of potential Context +// implementations. +var backends []gpuAPI + +type gpuAPI struct { + priority int + initializer func(w *window) (Context, error) +} + func Main() { <-mainDone } @@ -345,6 +355,26 @@ func (w *window) destroy() { } } +func (w *window) NewContext() (Context, error) { + sort.Slice(backends, func(i, j int) bool { + return backends[i].priority < backends[j].priority + }) + var cerr error + for _, b := range backends { + ctx, err := b.initializer(w) + if err == nil { + return ctx, nil + } + if cerr == nil { + cerr = err + } + } + if cerr != nil { + return nil, cerr + } + return nil, errors.New("NewContext: no available backends") +} + func (w *window) ShowTextInput(show bool) {} func (w *window) HDC() syscall.Handle { diff --git a/gpu/shaders.go b/gpu/shaders.go index 8f9f0fbf..908a81ba 100644 --- a/gpu/shaders.go +++ b/gpu/shaders.go @@ -51,7 +51,7 @@ var ( } */ - HLSL: []byte(nil), + HLSL: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, 0x41, 0x54, 0x74, 0x0, 0x0, 0x0, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, }, } shader_blit_vert = backend.ShaderSources{ @@ -108,9 +108,9 @@ var ( /* cbuffer Block : register(b0) { - float4 _24_transform : packoffset(c0); - float4 _24_uvTransform : packoffset(c1); - float _24_z : packoffset(c2); + float4 _41_transform : packoffset(c0); + float4 _41_uvTransform : packoffset(c1); + float _41_z : packoffset(c2); }; @@ -133,15 +133,15 @@ var ( float4 toClipSpace(float4 pos_1) { - return pos_1; + return float4(pos_1.xy, (pos_1.z + pos_1.w) * 0.5f, pos_1.w); } void vert_main() { - float2 p = (pos * _24_transform.xy) + _24_transform.zw; - float4 param = float4(p, _24_z, 1.0f); + float2 p = (pos * _41_transform.xy) + _41_transform.zw; + float4 param = float4(p, _41_z, 1.0f); gl_Position = toClipSpace(param); - vUV = (uv * _24_uvTransform.xy) + _24_uvTransform.z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, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, }, } shader_cover_vert = backend.ShaderSources{ @@ -276,10 +276,10 @@ var ( /* cbuffer Block : register(b0) { - float4 _66_transform : packoffset(c0); - float4 _66_uvCoverTransform : packoffset(c1); - float4 _66_uvTransform : packoffset(c2); - float _66_z : packoffset(c3); + float4 _82_transform : packoffset(c0); + float4 _82_uvCoverTransform : packoffset(c1); + float4 _82_uvTransform : packoffset(c2); + float _82_z : packoffset(c3); }; @@ -304,14 +304,14 @@ var ( float4 toClipSpace(float4 pos_1) { - return pos_1; + return float4(pos_1.xy, (pos_1.z + pos_1.w) * 0.5f, pos_1.w); } void fboTextureTransform(out float3 SPIRV_Cross_return_value[2]) { float3 t[2]; t[0] = float3(1.0f, 0.0f, 0.0f); - t[1] = float3(0.0f, 1.0f, 0.0f); + t[1] = float3(0.0f, -1.0f, 1.0f); SPIRV_Cross_return_value = t; } @@ -322,16 +322,16 @@ var ( void vert_main() { - float4 param = float4((pos * _66_transform.xy) + _66_transform.zw, _66_z, 1.0f); + float4 param = float4((pos * _82_transform.xy) + _82_transform.zw, _82_z, 1.0f); gl_Position = toClipSpace(param); - vUV = (uv * _66_uvTransform.xy) + _66_uvTransform.zw; - float3 _101[2]; - fboTextureTransform(_101); - float3 fboTrans[2] = _101; + vUV = (uv * _82_uvTransform.xy) + _82_uvTransform.zw; + float3 _117[2]; + fboTextureTransform(_117); + float3 fboTrans[2] = _117; float3 param_1[2] = fboTrans; float3 param_2 = float3(uv, 1.0f); float3 uv3 = transform3x2(param_1, param_2); - vCoverUV = ((uv3 * float3(_66_uvCoverTransform.xy, 1.0f)) + float3(_66_uvCoverTransform.zw, 0.0f)).xy; + vCoverUV = ((uv3 * float3(_82_uvCoverTransform.xy, 1.0f)) + float3(_82_uvCoverTransform.zw, 0.0f)).xy; } SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) @@ -347,7 +347,7 @@ var ( } */ - HLSL: []byte(nil), + HLSL: []byte{0x44, 0x58, 0x42, 0x43, 0x2, 0x2c, 0x11, 0xaa, 0xfa, 0xd0, 0x24, 0xab, 0xaa, 0xc4, 0x81, 0xfe, 0x6e, 0x70, 0xce, 0xac, 0x1, 0x0, 0x0, 0x0, 0x40, 0x4, 0x0, 0x0, 0x5, 0x0, 0x0, 0x0, 0x34, 0x0, 0x0, 0x0, 0x88, 0x1, 0x0, 0x0, 0xd8, 0x1, 0x0, 0x0, 0x48, 0x2, 0x0, 0x0, 0xc4, 0x3, 0x0, 0x0, 0x52, 0x44, 0x45, 0x46, 0x4c, 0x1, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x44, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1c, 0x0, 0x0, 0x0, 0x0, 0x4, 0xfe, 0xff, 0x0, 0x1, 0x0, 0x0, 0x18, 0x1, 0x0, 0x0, 0x3c, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x0, 0xab, 0xab, 0x3c, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x5c, 0x0, 0x0, 0x0, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xbc, 0x0, 0x0,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 0x3e, 0x0, 0x0, 0x1, 0x53, 0x54, 0x41, 0x54, 0x74, 0x0, 0x0, 0x0, 0x9, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x5, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, } shader_intersect_frag = backend.ShaderSources{ Textures: []backend.TextureBinding{{Name: "cover", Binding: 0}}, @@ -388,7 +388,7 @@ var ( } */ - HLSL: []byte(nil), + HLSL: []byte{0x44, 0x58, 0x42, 0x43, 0xf, 0x9, 0x75, 0xa6, 0x10, 0x91, 0x5e, 0x18, 0xcd, 0xeb, 0xa8, 0xce, 0x93, 0xa, 0x29, 0x5e, 0x1, 0x0, 0x0, 0x0, 0x70, 0x2, 0x0, 0x0, 0x5, 0x0, 0x0, 0x0, 0x34, 0x0, 0x0, 0x0, 0xe0, 0x0, 0x0, 0x0, 0x14, 0x1, 0x0, 0x0, 0x48, 0x1, 0x0, 0x0, 0xf4, 0x1, 0x0, 0x0, 0x52, 0x44, 0x45, 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 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x36, 0x0, 0x0, 0x8, 0xe2, 0x20, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3e, 0x0, 0x0, 0x1, 0x53, 0x54, 0x41, 0x54, 0x74, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, } shader_intersect_vert = backend.ShaderSources{ Inputs: []backend.InputLocation{{Name: "pos", Location: 0, Semantic: "POSITION", SemanticIndex: 0, Type: 0x0, Size: 2}, {Name: "uv", Location: 1, Semantic: "NORMAL", SemanticIndex: 0, Type: 0x0, Size: 2}}, @@ -445,7 +445,7 @@ var ( } */ - HLSL: []byte(nil), + HLSL: []byte{0x44, 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0, 0x1, 0x0, 0x0, 0x0, 0x2, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x80, 0x3f, 0x3e, 0x0, 0x0, 0x1, 0x53, 0x54, 0x41, 0x54, 0x74, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, } shader_stencil_frag = backend.ShaderSources{ GLSL100ES: "precision mediump float;\nprecision highp int;\n\nvarying vec2 vTo;\nvarying vec2 vFrom;\nvarying vec2 vCtrl;\n\nvoid main()\n{\n float dx = vTo.x - vFrom.x;\n bool increasing = vTo.x >= vFrom.x;\n bvec2 _35 = bvec2(increasing);\n vec2 left = vec2(_35.x ? vFrom.x : vTo.x, _35.y ? vFrom.y : vTo.y);\n bvec2 _41 = bvec2(increasing);\n vec2 right = vec2(_41.x ? vTo.x : vFrom.x, _41.y ? vTo.y : vFrom.y);\n vec2 extent = clamp(vec2(vFrom.x, vTo.x), vec2(-0.5), vec2(0.5));\n float midx = mix(extent.x, extent.y, 0.5);\n float x0 = midx - left.x;\n vec2 p1 = vCtrl - left;\n vec2 v = right - vCtrl;\n float t = x0 / (p1.x + sqrt((p1.x * p1.x) + ((v.x - p1.x) * x0)));\n float y = mix(mix(left.y, vCtrl.y, t), mix(vCtrl.y, right.y, t), t);\n vec2 d_half = mix(p1, v, vec2(t));\n float dy = d_half.y / d_half.x;\n float width = extent.y - extent.x;\n dy = abs(dy * width);\n vec4 sides = vec4((dy * 0.5) + y, (dy * (-0.5)) + y, (0.5 - y) / dy, ((-0.5) - y) / dy);\n sides = clamp(sides + vec4(0.5), vec4(0.0), vec4(1.0));\n float area = 0.5 * ((((sides.z - (sides.z * sides.y)) + 1.0) - sides.x) + (sides.x * sides.w));\n area *= width;\n if (width == 0.0)\n {\n area = 0.0;\n }\n gl_FragData[0].x = area;\n}\n\n", @@ -512,7 +512,7 @@ var ( } */ - HLSL: []byte(nil), + HLSL: []byte{0x44, 0x58, 0x42, 0x43, 0xc1, 0x4c, 0xe3, 0x57, 0xa2, 0x17, 0xfa, 0xa6, 0xec, 0xbb, 0xc6, 0x56, 0x50, 0x86, 0xd3, 0x40, 0x1, 0x0, 0x0, 0x0, 0x0, 0x7, 0x0, 0x0, 0x5, 0x0, 0x0, 0x0, 0x34, 0x0, 0x0, 0x0, 0x8c, 0x0, 0x0, 0x0, 0xf0, 0x0, 0x0, 0x0, 0x24, 0x1, 0x0, 0x0, 0x84, 0x6, 0x0, 0x0, 0x52, 0x44, 0x45, 0x46, 0x50, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1c, 0x0, 0x0, 0x0, 0x0, 0x4, 0xff, 0xff, 0x0, 0x1, 0x0, 0x0, 0x1c, 0x0, 0x0, 0x0, 0x4d, 0x69,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x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3, 0x0, 0x0, 0x0, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, } shader_stencil_vert = backend.ShaderSources{ Inputs: []backend.InputLocation{{Name: "corner", Location: 0, Semantic: "POSITION", SemanticIndex: 0, Type: 0x0, Size: 1}, {Name: "maxy", Location: 1, Semantic: "NORMAL", SemanticIndex: 0, Type: 0x0, Size: 1}, {Name: "from", Location: 2, Semantic: "TEXCOORD", SemanticIndex: 0, Type: 0x0, Size: 2}, {Name: "ctrl", Location: 3, Semantic: "TEXCOORD", SemanticIndex: 1, Type: 0x0, Size: 2}, {Name: "to", Location: 4, Semantic: "TEXCOORD", SemanticIndex: 2, Type: 0x0, Size: 2}}, @@ -609,6 +609,6 @@ var ( } */ - HLSL: []byte(nil), + HLSL: []byte{0x44, 0x58, 0x42, 0x43, 0xfa, 0x30, 0x91, 0x6f, 0x92, 0xd1, 0x46, 0xd3, 0x69, 0x25, 0x74, 0x3a, 0x6c, 0x11, 0xa3, 0xd0, 0x1, 0x0, 0x0, 0x0, 0xc, 0x6, 0x0, 0x0, 0x5, 0x0, 0x0, 0x0, 0x34, 0x0, 0x0, 0x0, 0x3c, 0x1, 0x0, 0x0, 0xe0, 0x1, 0x0, 0x0, 0x68, 0x2, 0x0, 0x0, 0x90, 0x5, 0x0, 0x0, 0x52, 0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 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2, 0x0, 0x0, 0x0, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, } ) diff --git a/gpu/shaders/common.inc b/gpu/shaders/common.inc index 5e477261..726ced5d 100644 --- a/gpu/shaders/common.inc +++ b/gpu/shaders/common.inc @@ -7,15 +7,25 @@ // to be [0, 0, 1]. vec3[2] fboTextureTransform() { vec3[2] t; +#ifdef HLSL + t[0] = vec3(1.0, 0.0, 0.0); + t[1] = vec3(0.0, -1.0, 1.0); +#else t[0] = vec3(1.0, 0.0, 0.0); t[1] = vec3(0.0, 1.0, 0.0); +#endif return t; } // toClipSpace converts an OpenGL gl_Position value to a // native GPU position. vec4 toClipSpace(vec4 pos) { +#ifdef HLSL + // Map depths to the Direct3D [0; 1] range. + return vec4(pos.xy, (pos.z + pos.w)*.5, pos.w); +#else return pos; +#endif } vec3 transform3x2(vec3[2] t, vec3 v) {