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

XAML textures sampling support #41

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

Conversation

marekkedzierski
Copy link
Collaborator

All,
This pull request is related to issue #25 - Texture formats needed for Direct2D/XAML.
The basic support for the (new) texture modes is provided:
DXGI_FORMAT_R8G8_UNORM,
DXGI_FORMAT_R8_UNORM
DXGI_FORMAT_A8_UNORM

Those modes are emulated with RGBA mode.
Textures can be used in both linear and tiled mode.
Driver is able to sample from those types of textures. Textures can't be used as render targets yet.

Now tiled mode can be also used with 8/16 bpp.

I hope those changes make sense. Thoughts/suggestions are welcome!

Thanks!

Marek
PS Worth to mention, that DXGI_FORMAT_A8_UNORM is mapped to HW format VC4_TEX_RGBX8888 but I think VC4_TEX_RGBA8888 should be used instead. I wasn't sure so I left it as it is.

@@ -424,11 +424,147 @@ class D3DDefaultTexture
std::shared_ptr<D3DDevice> m_pDevice;
};

char *DXGIFormatToString(DXGI_FORMAT format)
Copy link
Contributor

Choose a reason for hiding this comment

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

const char *

}
break;

default:
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this the desired behavior for all other formats, or catch-all for 'not-implemented' formats? If not implemented, please add assertions or throw exception.

@marekkedzierski
Copy link
Collaborator Author

All,
I did some fixes afer review. All comments are welcome.

Cheers,

Marek


case(DXGI_FORMAT_R8G8_UNORM) :
{
BYTE *colorConvertedBuffer = (BYTE*)malloc(texWidth * texHeight * sizeof(WORD) * 2);
Copy link
Contributor

Choose a reason for hiding this comment

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

Always use RAII types in a codebase with exceptions, since the scope may be exited at any time by an exception. A raw owning pointer or resource handle in a codebase where exceptions are allowed is always a bug, or can easily become one if someone inserts a codepath that can throw an exception in a subsequent change.

std::unique_ptr<BYTE[]> ConvertTextureFromRGBA(...)
{
    ...
    std::unique_ptr<BYTE[]> colorConvertedBuffer(new BYTE[texWidth * texHeight * sizeof(UINT16) * 2]);
   ...
   return colorConvertedBuffer;
}

call site:

std::unique_ptr<BYTE[]> buf = ConvertTextureFromRGBA(...); // explicitly specify the type 
auto buf = ConvertTextureFromRGBA(...);   // or let the compiler figure it out

@hansmbakker
Copy link

hansmbakker commented Aug 9, 2017

What is the status of this PR? Can we hope that an updated driver (with better HW acceleration) will be included in Windows IoT Core?

@enghch
Copy link

enghch commented Sep 6, 2017

Any status update on this?

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.

8 participants