Modified:
/trunk/source/direct3d11/Device11.cpp
/trunk/source/direct3d11/Device11.h
=======================================
--- /trunk/source/direct3d11/Device11.cpp Sat Jan 28 10:03:11 2012
+++ /trunk/source/direct3d11/Device11.cpp Sun Mar 4 15:53:19 2012
@@ -93,8 +93,9 @@
if( RECORD_D3D11( hr ).IsFailure )
throw gcnew Direct3D11Exception( Result::Last );
- context->Release();
Construct( device );
+
+ immediateContext = DeviceContext::FromPointer( context, this );
}
SlimDX::DXGI::Factory^ Device::Factory::get()
@@ -148,10 +149,14 @@
DeviceContext^ Device::ImmediateContext::get()
{
- ID3D11DeviceContext *context = NULL;
- InternalPointer->GetImmediateContext( &context );
-
- return DeviceContext::FromPointer( context, this );
+ if (immediateContext == nullptr)
+ {
+ ID3D11DeviceContext *context;
+ InternalPointer->GetImmediateContext(&context);
+ immediateContext = DeviceContext::FromPointer(context, this);
+ }
+
+ return immediateContext;
}
bool Device::IsReferenceDevice::get()
=======================================
--- /trunk/source/direct3d11/Device11.h Sat Jan 28 10:03:11 2012
+++ /trunk/source/direct3d11/Device11.h Sun Mar 4 15:53:19 2012
@@ -50,6 +50,7 @@
COMOBJECT(ID3D11Device, Device);
private:
+ DeviceContext^ immediateContext;
void Initialize( DXGI::Adapter^ adapter, DriverType driverType,
DeviceCreationFlags flags, const D3D_FEATURE_LEVEL *featureLevels, int
count );
public: