WiP: Adding support for Direct2D effects (2 Viewers)

morpheus_xx

Retired Team Member
  • Team MediaPortal
  • March 24, 2007
    12,073
    7,459
    Home Country
    Germany Germany
    I implemented for s test a gradient blur shader in MP2, but removed it again bacsuse I saw there is already a blur effect....
    If you like I can readd it next week and post the updated skin engine for a test
    Few more information what I am actually trying to do:
    Direct2D is an interface to do hardware based modification on images/textures. There are many effects included that we need in skinning as well. See the MSDN page for a list and examples:
    http://msdn.microsoft.com/en-us/library/windows/desktop/hh706334(v=vs.85).aspx

    Now the idea is to use "Shared Resources" (texture) between Direct3D9Ex and Direct2D (10.1) to directly render from both worlds on the same shared texture (to avoid copies). Related posts are http://answer.techwikihow.com/1122068/apply-id2d1effect-above-direct3d-render-target.html and there are SharpDX examples for a combination on D3D11 and D3D101 (but not D3D9Ex :().

    If someone of our @Developers or @Plugin-and-Skin-Creators is able to help me in this task, please let me know!
     

    morpheus_xx

    Retired Team Member
  • Team MediaPortal
  • March 24, 2007
    12,073
    7,459
    Home Country
    Germany Germany
    • Thread starter
    • Moderator
    • #3
    A small update regarding my affords to combine D3D9ex with D2D: I finally got a setup where both worlds run with each other without errors and exceptions. "Only" problem remains, that always the other world doesn't produce any visible output yet:
    • If shared texture was created by D3D9ex no rendering of D2D is visible
    • And opposite way around
    I need to find out where the output is "lost" or if this is the named synchronizing issue between two worlds?
     

    morpheus_xx

    Retired Team Member
  • Team MediaPortal
  • March 24, 2007
    12,073
    7,459
    Home Country
    Germany Germany
    • Thread starter
    • Moderator
    • #4
    Yeah! It works :D
    It was indeed a synchronization issue between devices! I could manage it by using Event queries to make sure each device is finished with processing :)

    Here my test screen, the color triangle is rendered by Direct3D9Ex while the rounded rectangle is rendered by Direct2D (DX10 based!)
    D3D9Ex_D2D_Interop.png
    Next step will be to get the available D2D effects into MP2.

    "Ich liebe es, wenn ein Plan funktioniert" ;)
     

    morpheus_xx

    Retired Team Member
  • Team MediaPortal
  • March 24, 2007
    12,073
    7,459
    Home Country
    Germany Germany
    • Thread starter
    • Moderator
    • #5
    I moved out the D2D related posts from the original ApolloOne thread.

    Unfortunately I am facing new issues :(
    Once I updated the example code from Net2 to Net451, the synchronization didn't work anymore (neither within debugger or standalone). I updated SharpDX from 2.6.2 to 2.6.3 and now I'm able to run example again as standalone .exe, but not within debugger. Strange...

    But now the bigger issue: the Direct2D effects are based on DX11.1! I didn't see this yet until I tried to reference them in code :( The issue with this is, that DX11.1 is available for Windows 8 only. For Win 7 there is a "platform update" which brings the APIs backported from Win8.

    Now the issue is, that the SharpDX.Direct3D11.Effects assembly doesn't work inside a regular Winforms app. All examples are based on Windows 8 apps, which are based different project templates.

    For now I'm stuck in those issues...
     

    morpheus_xx

    Retired Team Member
  • Team MediaPortal
  • March 24, 2007
    12,073
    7,459
    Home Country
    Germany Germany
    • Thread starter
    • Moderator
    • #6
    I have added the interop example which contains my helper class for shared surface creation and device synchronization as example.
     

    Attachments

    • MiniTri.7z
      349.2 KB

    morpheus_xx

    Retired Team Member
  • Team MediaPortal
  • March 24, 2007
    12,073
    7,459
    Home Country
    Germany Germany
    • Thread starter
    • Moderator
    • #8
    In fact I use d3d10 in my code above. The issue is, that D2D effects are part of DX11.1
     

    FreakyJ

    Retired Team Member
  • Premium Supporter
  • July 25, 2010
    4,024
    1,420
    Home Country
    Germany Germany
    Ahh okay, now I understand :) thx
     

    morpheus_xx

    Retired Team Member
  • Team MediaPortal
  • March 24, 2007
    12,073
    7,459
    Home Country
    Germany Germany
    • Thread starter
    • Moderator
    • #10
    Seems sharpdx confuses me more and more...

    I want to use SharpDX.Direct2D1.Effects classes. But this namespace is not available inside SharpDX 2.6.3! Inside 2.6.2 I can see it inside objects view, but I'm not able to reference any class in this namespace?! :eek:

    sharpdx_d2d_effects.png
     

    Users who are viewing this thread

    Top Bottom