public ID3D11Texture2D CreateTexture2D(D3D11_TEXTURE2D_DESC desc, D3D11_SUBRESOURCE_DATA initialData) {
Pointer<Pointer<ID3D11Texture2D>> pp = allocatePointer(ID3D11Texture2D.class);
try {
int result = this.CreateTexture2D(pointerTo(desc), pointerTo(initialData), pp);
if(result != 0) {
throw new D3D11Exception("Could not create 2D texture", result);
}
return pp.get().getNativeObject(ID3D11Texture2D.class);
} finally {
pp.release();