Add 1- and 2-component texture formats.

Implemented {uint8, unorm8} x {r, rg} texture formats.
Backend support added for Metal, D3D12 and OpenGL.
This commit is contained in:
Stephen White
2018-01-22 14:09:08 -05:00
committed by Corentin Wallez
parent 8d742d1375
commit cd4f8a2e2f
5 changed files with 40 additions and 18 deletions

View File

@@ -36,8 +36,16 @@ namespace backend { namespace opengl {
switch (format) {
case nxt::TextureFormat::R8G8B8A8Unorm:
return {GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE};
case nxt::TextureFormat::R8G8Unorm:
return {GL_RG8, GL_RG, GL_UNSIGNED_BYTE};
case nxt::TextureFormat::R8Unorm:
return {GL_R8, GL_RED, GL_UNSIGNED_BYTE};
case nxt::TextureFormat::R8G8B8A8Uint:
return {GL_RGBA8UI, GL_RGBA, GL_UNSIGNED_INT};
case nxt::TextureFormat::R8G8Uint:
return {GL_RG8UI, GL_RG, GL_UNSIGNED_INT};
case nxt::TextureFormat::R8Uint:
return {GL_R8UI, GL_RED, GL_UNSIGNED_INT};
case nxt::TextureFormat::B8G8R8A8Unorm:
// This doesn't have an enum for the internal format in OpenGL, so use RGBA8.
return {GL_RGBA8, GL_BGRA, GL_UNSIGNED_BYTE};