remove initialUsage from SwapChain::Configure

This commit is contained in:
Kai Ninomiya
2017-08-30 16:53:27 -07:00
committed by Kai Ninomiya
parent 8e587e8b42
commit 921fb5e1ce
21 changed files with 22 additions and 50 deletions

View File

@@ -34,24 +34,19 @@ namespace backend {
return device;
}
void SwapChainBase::Configure(nxt::TextureFormat format, nxt::TextureUsageBit allowedUsage, nxt::TextureUsageBit initialUsage, uint32_t width, uint32_t height) {
void SwapChainBase::Configure(nxt::TextureFormat format, nxt::TextureUsageBit allowedUsage, uint32_t width, uint32_t height) {
if (width == 0 || height == 0) {
device->HandleError("Swap chain cannot be configured to zero size");
return;
}
allowedUsage |= nxt::TextureUsageBit::Present;
if (!(HasZeroOrOneBits(initialUsage) && (initialUsage & allowedUsage))) {
device->HandleError("Swap chain configured with invalid texture usage");
return;
}
this->format = format;
this->allowedUsage = allowedUsage;
this->initialUsage = initialUsage;
this->width = width;
this->height = height;
implementation.Configure(implementation.userData,
static_cast<nxtTextureFormat>(format), static_cast<nxtTextureUsageBit>(allowedUsage), static_cast<nxtTextureUsageBit>(initialUsage), width, height);
static_cast<nxtTextureFormat>(format), static_cast<nxtTextureUsageBit>(allowedUsage), width, height);
}
TextureBase* SwapChainBase::GetNextTexture() {
@@ -67,7 +62,6 @@ namespace backend {
builder->SetFormat(format);
builder->SetMipLevels(1);
builder->SetAllowedUsage(allowedUsage);
builder->SetInitialUsage(initialUsage);
auto* texture = GetNextTextureImpl(builder);
lastNextTexture = texture;

View File

@@ -32,7 +32,7 @@ namespace backend {
DeviceBase* GetDevice();
// NXT API
void Configure(nxt::TextureFormat format, nxt::TextureUsageBit allowedUsage, nxt::TextureUsageBit initialUsage, uint32_t width, uint32_t height);
void Configure(nxt::TextureFormat format, nxt::TextureUsageBit allowedUsage, uint32_t width, uint32_t height);
TextureBase* GetNextTexture();
void Present(TextureBase* texture);
@@ -45,7 +45,6 @@ namespace backend {
nxtSwapChainImplementation implementation = {};
nxt::TextureFormat format = {};
nxt::TextureUsageBit allowedUsage;
nxt::TextureUsageBit initialUsage;
uint32_t width = 0;
uint32_t height = 0;
TextureBase* lastNextTexture = nullptr;