   [SlimDX] Software renderer
  Hi. I'm trying to get a software renderer working with SlimDX. I think I'm correct in saying that this still isn't officially supported, but I found a topic with someone having some success HEREUnfortunately the topic has been retired so I can't reply to it.I'm unable to get the same working, and I'm not sure why. The function appears to succeed (returns true) but the creation of the device with DeviceType.Software fails with 'D3DERR_NOTAVAILABLE: Not available (-2005530518)' and DebugView showing:[8780] D3D9 Helper: IDirect3D9::CreateDevice failed: D3DERR_NOTAVAILABLE Does anyone know what I might be doing wrong?   
  Clearly, something.Without code it's hard to say.   ;  Sorry! Here we go.This is the code from the linked topic, slightly modified   [DllImport("kernel32", SetLastError = true)]   static extern IntPtr LoadLibrary(string lpFileName);   [DllImport("kernel32", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]   static extern IntPtr GetProcAddress(IntPtr hModule, string procName);   [System.Runtime.InteropServices.Guid("81BDCBCA-64D4-426d-AE8D-AD0147F4275C"), System.Runtime.InteropServices.InterfaceType(System.Runtime.InteropServices.ComInterfaceType.InterfaceIsIUnknown)]   public interface ID3D9   {  int RegisterSoftwareDevice(IntPtr fnction);  // No reason to add the rest of the interface   }   private static bool RegisterSoftwareRenderer(Direct3D d3d)   {  bool result = false;  try  { IntPtr hRast = LoadLibrary(@"C:\Windows\System32\RGB9Rast.dll"); IntPtr D3D9GetSWInfo = GetProcAddress(hRast, "D3D9GetSWInfo"); IntPtr D3D9Ptr = d3d.ComPointer; ID3D9 D3D9 = (ID3D9)System.Runtime.InteropServices.Marshal.GetTypedObjectForIUnknown(D3D9Ptr, typeof(ID3D9)); int error = D3D9.RegisterSoftwareDevice(D3D9GetSWInfo); if (error == 0)result = true;  }  catch  { result = false;  }  return result;   }And my initialisation code:  Direct3D direct3D;  try  { direct3D = new Direct3DEx();  }  catch  { direct3D = new Direct3D();  }  // Register the software renderer  RegisterSoftwareRenderer(direct3D);  // Get the device capabilities and define the create flags and present parameters  DeviceType deviceType = DeviceType.Software;  Capabilities capabilities = direct3D.GetDeviceCaps(0, deviceType);  CreateFlags createFlags = GetCreateFlags(capabilities);  PresentParameters presentParams = GetPresentParameters(hWnd, width, height, capabilities);  // Create the device  Device device = (direct3D is Direct3DEx) ? new DeviceEx((Direct3DEx)direct3D, 0, deviceType, hWnd, createFlags, presentParams) : new Device(direct3D, 0, deviceType, hWnd, createFlags, presentParams);And, for completeness, the CreateFlags and PresentParams are derived with:   private static CreateFlags GetCreateFlags(Capabilities caps)   {  CreateFlags flags = CreateFlags.FpuPreserve | CreateFlags.Multithreaded;  flags |= ((caps.DeviceCaps & DeviceCaps.HWTransformAndLight) == 0) ? CreateFlags.SoftwareVertexProcessing : CreateFlags.HardwareVertexProcessing;  return flags;   }   private static PresentParameters GetPresentParameters(IntPtr hWnd, int width, int height, Capabilities caps)   {  PresentParameters pp = new PresentParameters()  { BackBufferCount = 2, BackBufferWidth = width, BackBufferHeight = height, DeviceWindowHandle = hWnd, Windowed = true  };  return pp;   };  (1) Does RegisterSoftwareRenderer return true? You don't check. The test that gates the return value of RegisterSoftwareRenderer is wrong, too -- 0 is not the only successful HRESULT value, and it's possible for D3D interfaces to return HRESULTs other than what the documentation suggests, sometimes.(2) Where did you obtain the software DLL, and are you sure it is functional (can you get this to work in native code, for example?(3) I assume everything works fine if you don't try and use a software device?   ;  1. Sorry, yes it does return true. I just hadn't put that check in my posted source code (I tested it with the VS debugger). The RegisterSoftwareRenderer method does return 0. 2. I got the download from here and also realised there was already the DLL in my System32 folder after seeing it referenced in another topic about it. Both successful in the RegisterSoftwareRenderer function, but still cause the device creation to fail. I've not tried it in an unmanaged setting, but I'll try that also.3. Yes. :(Hopefully you've got some more ideas for me? Many thanks for your replies so far.   ;  Hello,do you have solved your problem?I am the author of the thread you have linked.I'm not an expert but maybe I can help you.Probably you are using the wrong dll:you use RGB9Rast.dll instead of RGB9Rast_1.dll.;Quote:Original post by scostaHello,do you have solved your problem?I am the author of the thread you have linked.I'm not an expert but maybe I can help you.Probably you are using the wrong dll:you use RGB9Rast.dll instead of RGB9Rast_1.dll.Thanks for your suggestion. I've stopped attempting to get this working anyway, but I think I tried the RGB9Rast.dll and had the same problem. Nevermind, not an issue anymore.Thanks again.   ;  Just to clarify: RGB9Rast_1.dll is the right one.Bye   