use TransitionUsageImpl
This commit is contained in:
parent
720a5d9366
commit
169809c458
|
@ -144,7 +144,7 @@ namespace backend {
|
|||
return;
|
||||
}
|
||||
TransitionUsageImpl(currentUsage, usage);
|
||||
currentUsage = usage;
|
||||
UpdateUsageInternal(usage);
|
||||
}
|
||||
|
||||
void TextureBase::FreezeUsage(nxt::TextureUsageBit usage) {
|
||||
|
@ -154,7 +154,7 @@ namespace backend {
|
|||
}
|
||||
allowedUsage = usage;
|
||||
TransitionUsageImpl(currentUsage, usage);
|
||||
currentUsage = usage;
|
||||
UpdateUsageInternal(usage);
|
||||
frozen = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -53,9 +53,9 @@ namespace backend {
|
|||
void TransitionUsage(nxt::TextureUsageBit usage);
|
||||
void FreezeUsage(nxt::TextureUsageBit usage);
|
||||
|
||||
private:
|
||||
virtual void TransitionUsageImpl(nxt::TextureUsageBit currentUsage, nxt::TextureUsageBit targetUsage) = 0;
|
||||
|
||||
private:
|
||||
DeviceBase* device;
|
||||
|
||||
nxt::TextureDimension dimension;
|
||||
|
|
|
@ -279,11 +279,9 @@ namespace d3d12 {
|
|||
|
||||
Texture* texture = ToBackend(currentFramebuffer->GetTextureView(attachmentSlot)->GetTexture());
|
||||
constexpr auto usage = nxt::TextureUsageBit::OutputAttachment;
|
||||
// It's already validated that this texture is either frozen to the correct usage, or not frozen.
|
||||
if (!texture->IsFrozen()) {
|
||||
D3D12_RESOURCE_BARRIER barrier;
|
||||
if (texture->GetResourceTransitionBarrier(texture->GetUsage(), usage, &barrier)) {
|
||||
commandList->ResourceBarrier(1, &barrier);
|
||||
}
|
||||
texture->TransitionUsageImpl(texture->GetUsage(), usage);
|
||||
texture->UpdateUsageInternal(usage);
|
||||
}
|
||||
|
||||
|
|
|
@ -36,13 +36,12 @@ namespace d3d12 {
|
|||
ID3D12Resource* GetD3D12Resource();
|
||||
bool GetResourceTransitionBarrier(nxt::TextureUsageBit currentUsage, nxt::TextureUsageBit targetUsage, D3D12_RESOURCE_BARRIER* barrier);
|
||||
|
||||
void TransitionUsageImpl(nxt::TextureUsageBit currentUsage, nxt::TextureUsageBit targetUsage) override;
|
||||
|
||||
private:
|
||||
Device* device;
|
||||
ComPtr<ID3D12Resource> resource = {};
|
||||
ID3D12Resource* resourcePtr = nullptr;
|
||||
|
||||
// NXT API
|
||||
void TransitionUsageImpl(nxt::TextureUsageBit currentUsage, nxt::TextureUsageBit targetUsage) override;
|
||||
};
|
||||
|
||||
class TextureView : public TextureViewBase {
|
||||
|
|
|
@ -32,9 +32,9 @@ namespace metal {
|
|||
|
||||
id<MTLTexture> GetMTLTexture();
|
||||
|
||||
private:
|
||||
void TransitionUsageImpl(nxt::TextureUsageBit currentUsage, nxt::TextureUsageBit targetUsage) override;
|
||||
|
||||
private:
|
||||
id<MTLTexture> mtlTexture = nil;
|
||||
};
|
||||
|
||||
|
|
|
@ -169,7 +169,6 @@ namespace null {
|
|||
Texture(TextureBuilder* builder);
|
||||
~Texture();
|
||||
|
||||
private:
|
||||
void TransitionUsageImpl(nxt::TextureUsageBit currentUsage, nxt::TextureUsageBit targetUsage) override;
|
||||
};
|
||||
|
||||
|
|
|
@ -40,9 +40,9 @@ namespace opengl {
|
|||
GLenum GetGLTarget() const;
|
||||
TextureFormatInfo GetGLFormat() const;
|
||||
|
||||
private:
|
||||
void TransitionUsageImpl(nxt::TextureUsageBit currentUsage, nxt::TextureUsageBit targetUsage) override;
|
||||
|
||||
private:
|
||||
GLuint handle;
|
||||
GLenum target;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue