Giter Club home page Giter Club logo

go-d3d's Introduction

This code allows to use D3D11 IDXGIOutputDuplication in Go

Examples

Libaries used

  • golang.org/x/exp/shiny/driver/internal/swizzle for faster BGRA -> RGBA conversion (see shiny LICENSE)

app.manifest

To make use of IDXGIOutput5::DuplicateOutput1, an application has to provide support for PerMonitorV2 DPI-Awareness (Windows 10 1703+) This is usually done by providing an my-executable.exe.manifest file either next to the executable, or as an embedded resource.

In the examples there are calls to IsValidDpiAwarenessContext and SetThreadDpiAwarenessContext which circumvent the requirement.

go-d3d's People

Contributors

fabian-z avatar kirides avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

go-d3d's Issues

Failures and botched up video output on multiple monitor setup

I have 2 monitors in extended mode.

  1. 2560 x 1440 px
  2. 1920 x 1080 px

Context: I'm running the mjpegstream example

If I just use any one of these then its fine but the program just fails when I have both connected and I try to record from the primary (index 0) monitor! This is the failure output -

Registering stream 0
Registering stream 1
Enabled PerMonitorAwareV2 DPI awareness.
Enabled PerMonitorAwareV2 DPI awareness.
panic: runtime error: slice bounds out of range [8304640:8294400]

goroutine 8 [running, locked to thread]:
github.com/kirides/go-d3d/outputduplication.(*OutputDuplicator).GetImage(0xc000132000, 0xc00007e280, 0x10afca0?)
        C:/Users/.../go/pkg/mod/github.com/kirides/[email protected]/outputduplication/output_duplication.go:253 +0x25e
main.streamDisplayDXGI({0x10b1fe8, 0xc00007e240}, 0x0, 0x19, 0x0?)
        I:/code/...go:157 +0x579
created by main.main in goroutine 1
        I:/code/...go:63 +0x2d1
exit status 2

But on non-primary monitor I get output like this -

image

The error occurs here ->

copy(img.Pix[imgStart:], data[dataStart:dataEnd])

Make BGRA conversion optional

When encoding with e.g. ffmpeg, ffmpeg can handle the conversion, right? It'd be great if we could disable the conversion to RGBA.

Maybe it'd make sense to remove it from the library completely, because if someone wants to convert BGRA -> RGBA, it's just one line to add?

Just throwing around a couple ideas :)

Many thanks for building this lib!

Thank you

I just wanted to thank you for making this library, that is all :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.