Revision: 2209
Author: mike.popoloski
Date: Sat Sep 15 21:15:48 2012
Log: Added Get/SetPrivateData to Resource class. Resolves issue 880.
http://code.google.com/p/slimdx/source/detail?r=2209
Modified:
/trunk/build/ReleaseNotes.txt
/trunk/source/direct3d9/Resource.cpp
/trunk/source/direct3d9/Resource.h
=======================================
--- /trunk/build/ReleaseNotes.txt Sat Sep 15 11:51:06 2012
+++ /trunk/build/ReleaseNotes.txt Sat Sep 15 21:15:48 2012
@@ -16,6 +16,7 @@
* Fixed a bug in KeyframedAnimationSet.RegisterAnimationKeys that caused
invalid values to be set.
* Fixed the DeviceEx.FromPointer method.
* Fixed text encoding issue in XFile parsing.
+ * Added Set/GetPrivateData to Resource class.
Direct3D 10
* Added missing StateBlockMask constructor.
=======================================
--- /trunk/source/direct3d9/Resource.cpp Sat Jan 28 10:03:11 2012
+++ /trunk/source/direct3d9/Resource.cpp Sat Sep 15 21:15:48 2012
@@ -24,6 +24,7 @@
#include <d3dx9.h>
#include "../ComObject.h"
+#include "../Utilities.h"
#include "Direct3D9Exception.h"
@@ -131,5 +132,24 @@
InternalPointer->SetPrivateData(WKPDID_D3DDebugObjectName, 0, 0, 0);
}
}
+
+ generic<typename T> where T : value class
+ Result Resource::SetPrivateData(Guid guid, T data)
+ {
+ HRESULT hr =
InternalPointer->SetPrivateData(Utilities::ConvertManagedGuid(guid), &data,
sizeof(T), 0);
+ return RECORD_D3D9(hr);
+ }
+
+ generic<typename T> where T : value class
+ T Resource::GetPrivateData(Guid guid)
+ {
+ T result;
+ DWORD size = sizeof(T);
+
+ HRESULT hr =
InternalPointer->GetPrivateData(Utilities::ConvertManagedGuid(guid),
&result, &size);
+ RECORD_D3D9(hr);
+
+ return result;
+ }
}
}
=======================================
--- /trunk/source/direct3d9/Resource.h Sat Jan 28 10:03:11 2012
+++ /trunk/source/direct3d9/Resource.h Sat Sep 15 21:15:48 2012
@@ -110,6 +110,12 @@
System::String^ get();
void set(System::String^ value);
}
+
+ generic<typename T> where T : value class
+ Result SetPrivateData(System::Guid guid, T data);
+
+ generic<typename T> where T : value class
+ T GetPrivateData(System::Guid guid);
};
}
}