I need some help...

Need to know how to do something in Gorgon? Got some info on how to do something in Gorgon? Got something that relates to Gorgon but doesn't fit anywhere else? Well now it fits here. Submit!

Moderator: Gorgon Mods

Forum rules
Try to keep it Gorgon related please.

I need some help...

Postby Tape_Worm » Sat Mar 10, 2012 8:46 am

I need some help from people who have Nvidia video cards (ATI need not apply as I know the ATI driver is horrifically broken).

I have here a test program for Gorgon 2.x, and in this test program, an image -should- be written to the current directory (i.e. the directory that this application is running from). However, I'm running into a problem (which seems to be a driver issue for ATI) when saving a texture when using the 9.3 feature level for D3D.

Anyway, if you have an Nvidia chipset and could download and run this app, it'd help me immensely. Here's what I need you to do: Run it, and if you see this:
Error message: Unknown error (HRESULT = 0x887A0005)
Exception type: SharpDXException
Source: SharpDX
Target site: SharpDX.Result.CheckError

Stack trace:
at Tester_Graphics.Form1.OnLoad(EventArgs e) in Form1.cs:line 77
at GorgonLibrary.Graphics.GorgonTexture.Save(String fileName, ImageFileFormat format) in GorgonTexture.cs:line 144
at GorgonLibrary.Graphics.GorgonTexture2D.Save(Stream stream, ImageFileFormat format) in GorgonTexture2D.cs:line 654
at SharpDX.Direct3D11.Resource.ToStream[T](DeviceContext context, T texture, ImageFileFormat format, Stream stream) in :line 0
at SharpDX.Direct3D11.D3DX11.SaveTextureToMemory(DeviceContext contextRef, Resource srcTextureRef, ImageFileFormat destFormat, Blob& destBufOut, Int32 flags) in :line 0
at SharpDX.Result.CheckError() in :line 0
<<<END>>>

in the Details of the error dialog, then you're a winner and nvidia drivers are fucked as well.

Otherwise, it's just crappy ATI drivers.

And finally just post here if you saw an error or not. It's simple and I promise it's not a virus or some weird shit like that (you already downloaded one piece of software by me right?)

I just need to see if this is affecting Nvidia users as well.

Please note that you need Windows 7 or Windows Vista SP2 to run this!

Thanks kiddies.
You do not have the required permissions to view the files attached to this post.
haikus are easy
but sometimes they don't make sense
refrigerator.
User avatar
Tape_Worm
Site Admin
Site Admin
 
Posts: 362
Joined: Wed Feb 27, 2008 9:15 pm
Location: Canada

Re: I need some help...

Postby ravl » Sat Mar 10, 2012 9:22 am

Windows 7x64 with nVidia:

Code: Select all
Error message:  Unknown error (HRESULT = 0x887A0005)
Exception type:  SharpDXException
Source:  SharpDX
Target site:  SharpDX.Result.CheckError

Stack trace:
   at Tester_Graphics.Form1.OnLoad(EventArgs e)
   at GorgonLibrary.Graphics.GorgonTexture.Save(String fileName, ImageFileFormat format)
   at GorgonLibrary.Graphics.GorgonTexture2D.Save(Stream stream, ImageFileFormat format)
   at SharpDX.Direct3D11.Resource.ToStream[T](DeviceContext context, T texture, ImageFileFormat format, Stream stream)
   at SharpDX.Direct3D11.D3DX11.SaveTextureToMemory(DeviceContext contextRef, Resource srcTextureRef, ImageFileFormat destFormat, Blob& destBufOut, Int32 flags)
   at SharpDX.Result.CheckError()
<<<END>>>
User avatar
ravl
Lowly Humans
Lowly Humans
 
Posts: 75
Joined: Wed Dec 01, 2010 3:22 pm

Re: I need some help...

Postby Tape_Worm » Sat Mar 10, 2012 9:30 am

Thanks Rav.

Which version of Nvidia's drivers are you using?

This is starting to look more and more like a bug in the D3DX library. Great :?

Anyone know of a good image loading/saving library for .NET that handles DDS, BMP, JPG and PNG (and optionally TGA)?
haikus are easy
but sometimes they don't make sense
refrigerator.
User avatar
Tape_Worm
Site Admin
Site Admin
 
Posts: 362
Joined: Wed Feb 27, 2008 9:15 pm
Location: Canada

Re: I need some help...

Postby ravl » Sun Mar 11, 2012 10:41 am

the last ones from my GTS 250 card. I cannot tell you right now because I am on my laptop for the next 2 days. I only now I have update them a few days ago in order to lay Mass Effect :D so I assume is: 295.73 - WHQL

R.
User avatar
ravl
Lowly Humans
Lowly Humans
 
Posts: 75
Joined: Wed Dec 01, 2010 3:22 pm

Re: I need some help...

Postby Tape_Worm » Sun Mar 11, 2012 10:55 pm

I am sick as a pig. I hate having a fucking cold.

So, I figured out the issue that prompted all of this and it took damn near forever. Apparently feature level 9.x devices can't copy GPU data to resources (e.g. textures) that have a shader binding flag set to CPU accessible resources. And apparently the D3DX functions to save the texture does exactly that. It copies the GPU texture to a CPU staging texture and writes that out (makes sense, reading from the video device is a no-no). Unfortunately my device object just says "fuck it" and promptly dies when this happens, which seems like a driver problem. Anyway, it's fixed now. Not that it matters, but it was painful and could have meant the end to Direct3D 9 video card support in Gorgon (which no one probably really cares about anyway).

Unfortunately the fix comes at a price. Part of that price is increased memory usage. It's painful enough to have to create temporary textures when converting to a format that's not able to accept anything by standard RGBA 32 bit formatting, but with the feature level 9.x there needs to be another temporary texture that doesn't have a shader binding flag. It's kind of gross. The other part is that the only way to get it without a shader binding is to create the texture as a render target (unordered access views would have been nice, but they're for Direct3D 11 devices only), so that limits the number of formats that can be used when saving.

Anyway, thought I'd throw that out there.
haikus are easy
but sometimes they don't make sense
refrigerator.
User avatar
Tape_Worm
Site Admin
Site Admin
 
Posts: 362
Joined: Wed Feb 27, 2008 9:15 pm
Location: Canada

Re: I need some help...

Postby ShadowDust702 » Wed Mar 14, 2012 2:32 pm

maybe you could detect DX9 devices, and only create the temprorary texture w/o a shader binding flag if the device is DX9
I am a Gorgonite :D
User avatar
ShadowDust702
Code Slave
Code Slave
 
Posts: 212
Joined: Tue Mar 10, 2009 6:13 pm
Location: Auckland, New Zealand

Re: I need some help...

Postby Tape_Worm » Wed Mar 14, 2012 8:28 pm

ShadowDust702 wrote:maybe you could detect DX9 devices, and only create the temprorary texture w/o a shader binding flag if the device is DX9

That's what I'm doing:

A 2D texture requires at least one binding flag to be used as a GPU resource (in this case RenderTarget). If I create it without a binding flag, then it requires that the texture be a staging resource and then I end up with the exact same problem as before. Right now it works like this:
CreateTexture -> if (featurelevel9.3) then new GorgonTexture2DSM2 else GorgonTexture2D (GorgonTexture2DSM2 is inherited from GorgonTexture2D and is internal so you don't actually see this interface, there's no need).

And GorgonTexture2DSM2 creates a shim texture whenever a call to Save or CopyResource is made. I could have made it default to render target binding no matter what for feature level 9.3, but then you can only create textures with render target compatible formats, never mind just saving and copying. I'd rather keep to a specific set of functionality.

The shim texture is created as a render target with default usage (i.e. on the GPU), and then we copy the current texture data to the shim and then the shim is used in the D3D copy/save methods. If the shim was created with no binding flag and with staging usage then the driver would shit its pants because a feature level 9.3 device can only copy 2D texture data within the GPU and they can't have the shader binding flag on if the destination is a CPU resource (dynamic usage resources aren't a problem because they're GPU accessible). Unfortunately, it looks (and I've confirmed this with PIX) like the D3DX routines copy the texture data to a staging resource (only way to read the texture data) and write out the file data from there.

There's still a ton of issues I'm running into when it comes to dealing with formats and textures even on a pure D3D11 device with the D3DX stuff. And unfortunately, it's not giving much info on exactly what I'm doing wrong (nothing in the debug output, just an HRESULT code, which isn't very helpful). So I'm still trying to weed it out. The only suggestion I got thus far was to "Use the DirectXTex library" (i.e. no help at all since it's pure C++ and I want AnyCPU available for Gorgon). Porting it to .NET looks to be a painful experience, so I won't be doing that. Although I did learn some crap from it though, so it wasn't an entire write off.
haikus are easy
but sometimes they don't make sense
refrigerator.
User avatar
Tape_Worm
Site Admin
Site Admin
 
Posts: 362
Joined: Wed Feb 27, 2008 9:15 pm
Location: Canada


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron