Permalink
Browse files

Improve HRESULT handling.

  • Loading branch information...
jrfonseca committed Apr 16, 2012
1 parent 0f04d1a commit 9a3468aaaab098377a39b8f2ab4649be4b028971
Showing with 68 additions and 22 deletions.
  1. +1 −1 specs/d3d.py
  2. +0 −5 specs/d3d10.py
  3. +0 −5 specs/d3d11.py
  4. +1 −1 specs/d3d8.py
  5. +1 −1 specs/d3d9.py
  6. +2 −0 specs/dxgiformat.py
  7. +40 −0 specs/dxgitype.py
  8. +23 −9 specs/winapi.py
View
@@ -48,7 +48,7 @@
"D3DDP_DONOTLIGHT",
])
-HRESULT = Enum("HRESULT", [
+HRESULT = FakeEnum(HRESULT, [
"D3D_OK",
"D3DERR_BADMAJORVERSION",
"D3DERR_BADMINORVERSION",
View
@@ -33,11 +33,6 @@
"D3D10_ERROR_TOO_MANY_UNIQUE_STATE_OBJECTS",
"D3DERR_INVALIDCALL",
"D3DERR_WASSTILLDRAWING",
- "E_FAIL",
- "E_INVALIDARG",
- "E_OUTOFMEMORY",
- "S_FALSE",
- "S_OK",
])
D3D10_BLEND = Enum("D3D10_BLEND", [
View
@@ -36,11 +36,6 @@
"D3D11_ERROR_DEFERRED_CONTEXT_MAP_WITHOUT_INITIAL_DISCARD",
"D3DERR_INVALIDCALL",
"D3DERR_WASSTILLDRAWING",
- "E_FAIL",
- "E_INVALIDARG",
- "E_OUTOFMEMORY",
- "S_FALSE",
- "S_OK",
])
View
@@ -29,7 +29,7 @@
from d3d8types import *
from d3d8caps import *
-HRESULT = Enum("HRESULT", [
+HRESULT = FakeEnum(HRESULT, [
"D3D_OK",
"D3DERR_WRONGTEXTUREFORMAT",
"D3DERR_UNSUPPORTEDCOLOROPERATION",
View
@@ -78,7 +78,7 @@
"D3DPRESENT_VIDEO_RESTRICT_TO_MONITOR",
])
-HRESULT = Enum("HRESULT", [
+HRESULT = FakeEnum(HRESULT, [
"D3D_OK",
"D3DERR_WRONGTEXTUREFORMAT",
"D3DERR_UNSUPPORTEDCOLOROPERATION",
View
@@ -23,8 +23,10 @@
#
##########################################################################/
+
from winapi import *
+
DXGI_FORMAT = Enum("DXGI_FORMAT", [
"DXGI_FORMAT_UNKNOWN",
"DXGI_FORMAT_R32G32B32A32_TYPELESS",
View
@@ -23,8 +23,48 @@
#
##########################################################################/
+
from dxgiformat import *
+
+HRESULT = FakeEnum(HRESULT, [
+ "DXGI_STATUS_OCCLUDED",
+ "DXGI_STATUS_CLIPPED",
+ "DXGI_STATUS_NO_REDIRECTION",
+ "DXGI_STATUS_NO_DESKTOP_ACCESS",
+ "DXGI_STATUS_GRAPHICS_VIDPN_SOURCE_IN_USE",
+ "DXGI_STATUS_MODE_CHANGED",
+ "DXGI_STATUS_MODE_CHANGE_IN_PROGRESS",
+ "DXGI_ERROR_INVALID_CALL",
+ "DXGI_ERROR_NOT_FOUND",
+ "DXGI_ERROR_MORE_DATA",
+ "DXGI_ERROR_UNSUPPORTED",
+ "DXGI_ERROR_DEVICE_REMOVED",
+ "DXGI_ERROR_DEVICE_HUNG",
+ "DXGI_ERROR_DEVICE_RESET",
+ "DXGI_ERROR_WAS_STILL_DRAWING",
+ "DXGI_ERROR_FRAME_STATISTICS_DISJOINT",
+ "DXGI_ERROR_GRAPHICS_VIDPN_SOURCE_IN_USE",
+ "DXGI_ERROR_DRIVER_INTERNAL_ERROR",
+ "DXGI_ERROR_NONEXCLUSIVE",
+ "DXGI_ERROR_NOT_CURRENTLY_AVAILABLE",
+ "DXGI_ERROR_REMOTE_CLIENT_DISCONNECTED",
+ "DXGI_ERROR_REMOTE_OUTOFMEMORY",
+ "DXGI_CPU_ACCESS_NONE",
+ "DXGI_CPU_ACCESS_DYNAMIC",
+ "DXGI_CPU_ACCESS_READ_WRITE",
+ "DXGI_CPU_ACCESS_SCRATCH",
+ "DXGI_CPU_ACCESS_FIELD",
+ "DXGI_USAGE_SHADER_INPUT",
+ "DXGI_USAGE_RENDER_TARGET_OUTPUT",
+ "DXGI_USAGE_BACK_BUFFER",
+ "DXGI_USAGE_SHARED",
+ "DXGI_USAGE_READ_ONLY",
+ "DXGI_USAGE_DISCARD_ON_PRESENT",
+ "DXGI_USAGE_UNORDERED_ACCESS",
+])
+
+
DXGI_RGB = Struct("DXGI_RGB", [
(Float, "Red"),
(Float, "Green"),
View
@@ -25,8 +25,10 @@
"""Win32 API type description."""
+
from stdapi import *
+
SHORT = Alias("SHORT", Short)
USHORT = Alias("USHORT", UShort)
INT = Alias("INT", Int)
@@ -69,8 +71,6 @@
SIZE_T = Alias("SIZE_T", SizeT)
-HRESULT = Alias("HRESULT", Int)
-
VOID = Void
PVOID = Opaque("PVOID")
LPVOID = PVOID
@@ -149,8 +149,6 @@ def DECLARE_HANDLE(expr):
HMODULE = DECLARE_HANDLE("HMODULE")
-IUnknown = Interface("IUnknown")
-
FILETIME = Struct("FILETIME", [
(DWORD, "dwLowDateTime"),
(DWORD, "dwHighDateTime"),
@@ -175,14 +173,30 @@ def DECLARE_HANDLE(expr):
(WString, "lfFaceName"),
])
-HRESULT_com = FakeEnum(HRESULT, [
- "S_OK",
- "E_NOINTERFACE",
- "E_POINTER",
+
+# http://msdn.microsoft.com/en-us/library/ff485842.aspx
+# http://msdn.microsoft.com/en-us/library/windows/desktop/ms681381.aspx
+HRESULT = Enum("HRESULT", [
+ "S_OK", # 0x0
+ "S_FALSE", # 0x1
+ "E_PENDING", # 0x8000000A
+ "E_NOTIMPL", # 0x80004001
+ "E_NOINTERFACE", # 0x80004002
+ "E_POINTER", # 0x80004003
+ "E_ABORT", # 0x80004004
+ "E_FAIL", # 0x80004005
+ "E_UNEXPECTED", # 0x8000FFFF
+ "E_ACCESSDENIED", # 0x80070005
+ "E_HANDLE", # 0x80070006
+ "E_OUTOFMEMORY", # 0x8007000E
+ "E_INVALIDARG", # 0x80070057
])
+
+IUnknown = Interface("IUnknown")
+
IUnknown.methods = (
- Method(HRESULT_com, "QueryInterface", ((REFIID, "riid"), Out(Pointer(ObjPointer(Void)), "ppvObj"))),
+ Method(HRESULT, "QueryInterface", ((REFIID, "riid"), Out(Pointer(ObjPointer(Void)), "ppvObj"))),
Method(ULONG, "AddRef", ()),
Method(ULONG, "Release", ()),
)

0 comments on commit 9a3468a

Please sign in to comment.