06-26-2018, 02:46 AM
(This post was last modified: 06-26-2018, 08:50 AM by steve.chasse@gmail.com.
Edit Reason: I found the culprit to the error
)
Hi Mr. Benedik, Thank you for you fast response.
There is a line of code that gives me an error in the Console. It says that there is an invalid parameter. The device is created at the start of the scene and the scene can display a cube perfectly but it outputs an invalid parameter when I try to create the ShaderResourceView.
I scoured the internet a bit for info on that but the info is really hard to find on SharpDX. I am using the 4.0.1.0 SharpDX dll's. I Wonder if that is the problem. I tried creating a Texture2D to see the results like this:
But to no avail. It says that there is still an invalid parameter... Anyway, if you have any insight on what might be going on?
Steve
EDIT 2018-06-26 - 02h43am - I have found the culprit. I am sending the MainDXViewportView.DXScene.DXDevice.Device to the DesktopDuplication to Acquire the Frame... It seems that using this Device again to create the ShaderResourceView isn't working. I will review this part and try to understand why I can't use the same MainDXViewportView.DXScene.DXDevice.Device. It's probably Something that is easy to understand for others but me, I have no clue. I am in uncharted waters right now. Sorry for not debugging properly and asking questions.
There is a line of code that gives me an error in the Console. It says that there is an invalid parameter. The device is created at the start of the scene and the scene can display a cube perfectly but it outputs an invalid parameter when I try to create the ShaderResourceView.
Code:
var resourceViewDescription = new ShaderResourceViewDescription
{
Format = Format.B8G8R8A8_UNorm,
Dimension = SharpDX.Direct3D.ShaderResourceViewDimension.Texture2D,
Texture2D = new ShaderResourceViewDescription.Texture2DResource
{
MipLevels = 1,
MostDetailedMip = 0
}
};
var shaderResourceView = new ShaderResourceView(_currentDXDevice, _desktopFrame.texture2D, resourceViewDescription); //<------ the error is in that line of code?I scoured the internet a bit for info on that but the info is really hard to find on SharpDX. I am using the 4.0.1.0 SharpDX dll's. I Wonder if that is the problem. I tried creating a Texture2D to see the results like this:
Code:
_Texture2DDescription = new Texture2DDescription
{
ArraySize = 1,
BindFlags = BindFlags.None,
CpuAccessFlags = CpuAccessFlags.Read,
Format = Format.B8G8R8A8_UNorm,
Height = _height,
MipLevels = 1,
OptionFlags = ResourceOptionFlags.None,
SampleDescription = { Count = 1, Quality = 0 },
Usage = ResourceUsage.Staging,
Width = _width
};
//and then I create the Texture2D here
var _desktopImageTexture00 = new Texture2D(_currentDXDevice, _Texture2DDescription);But to no avail. It says that there is still an invalid parameter... Anyway, if you have any insight on what might be going on?
Steve
EDIT 2018-06-26 - 02h43am - I have found the culprit. I am sending the MainDXViewportView.DXScene.DXDevice.Device to the DesktopDuplication to Acquire the Frame... It seems that using this Device again to create the ShaderResourceView isn't working. I will review this part and try to understand why I can't use the same MainDXViewportView.DXScene.DXDevice.Device. It's probably Something that is easy to understand for others but me, I have no clue. I am in uncharted waters right now. Sorry for not debugging properly and asking questions.

