Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

D3D11: _create2DTex() with mSurface. #3273

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

Arthurfernades
Copy link

Created a variable called mSurface that can be used to create a texture from an already existing surface. Inside the _create2DTex() function, there is an if statement to check whether this variable exists or not. If it exists, it will be manipulated to be used as an Ogre texture.

@@ -232,46 +232,106 @@ namespace Ogre
inline bool IsPowerOfTwo(unsigned int n) { return ((n&(n-1))==0); }
//---------------------------------------------------------------------
void D3D11Texture::_create2DTex()
{
if (NULL != mSurface)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of if else around everything I suggest you do:

if(mSurface)
{
   _createShared2DTex();
  return;
}

@@ -625,4 +687,6 @@ namespace Ogre
{
rebind(static_cast<D3D11HardwarePixelBuffer*>(mBuffer));
}
}
//---------------------------------------------------------------------
void D3D11RenderTexture::doFlush() { mDevice.Flush(); }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest you remove this for now. It should be part of RenderSystem as it not only affects this single texture.

Also see my comment on the forums. Maybe we do not need this at all.

hr = pUnk->QueryInterface(__uuidof(IDXGIResource), (void**)&pDXGIResource);
if (FAILED(hr))
{
throw std::runtime_error("Failed to query IDXGIResource interface from the provided object.");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use the OGRE_EXCEPT_EX macro instead of throwing directly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants