Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create VertexShader base on DirectX version #12

Closed
pubpy2015 opened this issue Nov 5, 2020 · 5 comments
Closed

Create VertexShader base on DirectX version #12

pubpy2015 opened this issue Nov 5, 2020 · 5 comments

Comments

@pubpy2015
Copy link

pubpy2015 commented Nov 5, 2020

Hi,

I am testing your project on some PCs, application can not start if DirextX version is 10.0.
So, I modified like that in Initialize() and it worked:

string vertexProfile = "vs_5_0";
string pixelProfile = "ps_5_0";
if (device.FeatureLevel == SharpDX.Direct3D.FeatureLevel.Level_9_1 ||
device.FeatureLevel == SharpDX.Direct3D.FeatureLevel.Level_9_2 ||
device.FeatureLevel == SharpDX.Direct3D.FeatureLevel.Level_9_3 ||
device.FeatureLevel == SharpDX.Direct3D.FeatureLevel.Level_10_0 ||
device.FeatureLevel == SharpDX.Direct3D.FeatureLevel.Level_10_1)
{
vertexProfile = "vs_4_0_level_9_1";
pixelProfile = "ps_4_0_level_9_1";
}

            var VertexShaderByteCode = ShaderBytecode.Compile(Properties.Resources.VertexShader, "main", vertexProfile, ShaderFlags.Debug);

var PixelShaderByteCode = ShaderBytecode.Compile(Properties.Resources.PixelShader, "main", pixelProfile, ShaderFlags.Debug);
var PixelShaderByteCodeYUV = ShaderBytecode.Compile(Properties.Resources.PixelShader_YUV, "main", pixelProfile, ShaderFlags.Debug);

@pubpy2015 pubpy2015 changed the title Create VertexShader base on DirectX veHi,rsion Create VertexShader base on DirectX version Nov 5, 2020
@SuRGeoNix
Copy link
Owner

Nice catch, thanks I will check this on the next commit. I need to double check that it does not affect the rest of the code and is also compatible with FFmpeg 's DirectX device! (Did you validate that it was using hardware acceleration with Success? Just press key 'h' to see if it was successful)

@pubpy2015
Copy link
Author

Hi,

Hardware acceleration (ON) failed

@SuRGeoNix
Copy link
Owner

Yep, not sure if that's is just the format of the video tho, or the change of DirectX features

@pubpy2015
Copy link
Author

This is directX feature. I am testing same video source on several PCs.

@pubpy2015
Copy link
Author

Original source code will create an exception:
Exception Info: SharpDX.SharpDXException
at SharpDX.Result.CheckError()
at SharpDX.Direct3D11.Device.CreateVertexShader(IntPtr, SharpDX.PointerSize, SharpDX.Direct3D11.ClassLinkage, SharpDX.Direct3D11.VertexShader)
at SharpDX.Direct3D11.VertexShader..ctor(SharpDX.Direct3D11.Device, Byte[], SharpDX.Direct3D11.ClassLinkage)
at SuRGeoNix.Flyleaf.MediaRenderer.Initialize()
at SuRGeoNix.Flyleaf.MediaRenderer.InitHandle(IntPtr)
at SuRGeoNix.Flyleaf.MediaRouter.InitHandle(IntPtr, Boolean)
at SuRGeoNix.Flyleaf.Controls.FlyleafPlayer.Initialize()
at SuRGeoNix.Flyleaf.Controls.FlyleafPlayer.OnParentChanged(System.Object, System.EventArgs)
at System.Windows.Forms.Control.OnParentChanged(System.EventArgs)
at System.Windows.Forms.ContainerControl.OnParentChanged(System.EventArgs)
at System.Windows.Forms.Control.AssignParent(System.Windows.Forms.Control)
at System.Windows.Forms.Control+ControlCollection.Add(System.Windows.Forms.Control)
at System.Windows.Forms.Form+ControlCollection.Add(System.Windows.Forms.Control)
at SuRGeoNix.FlyleafPlayer.FrmMain.InitializeComponent()
at SuRGeoNix.FlyleafPlayer.FrmMain..ctor()
at SuRGeoNix.FlyleafPlayer.Program.Main()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants