Add depth-stencil textures and attachments (#77)

Related: #29
This commit is contained in:
Kai Ninomiya
2017-07-17 12:03:16 -04:00
committed by GitHub
parent 28684d93ed
commit fec8c58a97
24 changed files with 227 additions and 194 deletions

View File

@@ -23,11 +23,36 @@ namespace backend {
switch (format) {
case nxt::TextureFormat::R8G8B8A8Unorm:
return 4;
case nxt::TextureFormat::D32FloatS8Uint:
return 8;
default:
UNREACHABLE();
}
}
bool TextureFormatHasDepth(nxt::TextureFormat format) {
switch (format) {
case nxt::TextureFormat::R8G8B8A8Unorm:
return false;
case nxt::TextureFormat::D32FloatS8Uint:
return true;
default:
UNREACHABLE();
}
}
bool TextureFormatHasStencil(nxt::TextureFormat format) {
switch (format) {
case nxt::TextureFormat::R8G8B8A8Unorm:
return false;
case nxt::TextureFormat::D32FloatS8Uint:
return true;
default:
UNREACHABLE();
}
}
// TextureBase
TextureBase::TextureBase(TextureBuilder* builder)
@@ -95,15 +120,6 @@ namespace backend {
currentUsage = usage;
}
bool TextureBase::IsDepthFormat(nxt::TextureFormat format) {
switch (format) {
case nxt::TextureFormat::R8G8B8A8Unorm:
return false;
default:
UNREACHABLE();
}
}
void TextureBase::TransitionUsage(nxt::TextureUsageBit usage) {
if (!IsTransitionPossible(usage)) {
device->HandleError("Texture frozen or usage not allowed");