#include "pxr/imaging/hgi/blitCmdsOps.h"
#include "pxr/imaging/hgi/buffer.h"
#include "pxr/imaging/hgi/capabilities.h"
+#include "pxr/imaging/hgi/tokens.h"
#include "pxr/base/arch/hash.h"
#include "pxr/base/tf/diagnostic.h"
HgiBufferHandle newBuf;
Hgi* hgi = _resourceRegistry->GetHgi();
+ bool const isVulkanEnabled = (hgi->GetAPIName() == HgiTokens->Vulkan);
// Skip buffers of zero size.
if (totalSize > 0) {
bufDesc.byteSize = totalSize;
// Vulkan Validation layer is raising an error here because
// a usage flag of Uniform is applied to a buffer bound as storage
- bufDesc.usage = HgiBufferUsageUniform | HgiBufferUsageStorage;
+ if (isVulkanEnabled) {
+ bufDesc.usage = HgiBufferUsageUniform | HgiBufferUsageStorage;
+ }
+ else {
+ bufDesc.usage = HgiBufferUsageUniform;
+ }
newBuf = hgi->CreateBuffer(bufDesc);
}
#include "pxr/imaging/hgi/blitCmds.h"
#include "pxr/imaging/hgi/blitCmdsOps.h"
#include "pxr/imaging/hgi/buffer.h"
+#include "pxr/imaging/hgi/tokens.h"
#include "pxr/imaging/hf/perfLog.h"
// Use blit work to record resource copy commands.
Hgi* hgi = _resourceRegistry->GetHgi();
+ bool const isVulkanEnabled = (hgi->GetAPIName() == HgiTokens->Vulkan);
HgiBlitCmds* blitCmds = _resourceRegistry->GetGlobalBlitCmds();
blitCmds->PushDebugGroup(__ARCH_PRETTY_FUNCTION__);
bufDesc.byteSize = bufferSize;
// Vulkan Validation layer is raising an error here because
// a usage flag of Uniform is applied to a buffer bound as storage
- bufDesc.usage = HgiBufferUsageUniform | HgiBufferUsageStorage;
+ if (isVulkanEnabled) {
+ bufDesc.usage = HgiBufferUsageUniform | HgiBufferUsageStorage;
+ }
+ else {
+ bufDesc.usage = HgiBufferUsageUniform | HgiBufferUsageVertex;
+ }
+
bufDesc.vertexStride = bytesPerElement;
bufDesc.debugName = bresIt->first.GetText();
newBuf = hgi->CreateBuffer(bufDesc);
PXR_NAMESPACE_OPEN_SCOPE
-TF_DEFINE_ENV_SETTING(HGIVULKAN_DEBUG, 0, "Enable debugging for HgiVulkan");
-TF_DEFINE_ENV_SETTING(HGIVULKAN_DEBUG_VERBOSE, 0,
+TF_DEFINE_ENV_SETTING(HGIVULKAN_DEBUG, 1, "Enable debugging for HgiVulkan");
+TF_DEFINE_ENV_SETTING(HGIVULKAN_DEBUG_VERBOSE, 1,
"Enable verbose debugging for HgiVulkan");
bool
case VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL:
srcAccessMask = VK_ACCESS_SHADER_READ_BIT;
break;
+ default:
+ srcAccessMask = VK_ACCESS_NONE;
+ break;
}
switch (newVkLayout) {
VK_ACCESS_SHADER_READ_BIT;
dstAccessMask = VK_ACCESS_SHADER_READ_BIT;
break;
+ default:
+ srcAccessMask = VK_ACCESS_NONE;
+ dstAccessMask = VK_ACCESS_NONE;
+ break;
}
TransitionImageBarrier(