Skip to content

Commit

Permalink
Modify for new VSG instance extensions support
Browse files Browse the repository at this point in the history
  • Loading branch information
timoore committed Nov 29, 2023
1 parent 7f9145c commit 9c60737
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
6 changes: 3 additions & 3 deletions examples/nodes/vsgannotation/Annotation.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,16 @@ namespace experimental
{
auto* commandBuffer = visitor.getCommandBuffer();
auto* instance = commandBuffer->getDevice()->getInstance();
if (instance->vkCmdBeginDebugUtilsLabelEXT && !annotation.empty())
if (instance->getExtensions()->vkCmdBeginDebugUtilsLabelEXT && !annotation.empty())
{
VkCommandBuffer cmdBuffer{*commandBuffer};
VkDebugUtilsLabelEXT markerInfo = {};
markerInfo.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT;
markerInfo.pLabelName = annotation.c_str();
std::copy(&debugColor.value[0], &debugColor.value[4], &markerInfo.color[0]);
instance->vkCmdBeginDebugUtilsLabelEXT(cmdBuffer, &markerInfo);
instance->getExtensions()->vkCmdBeginDebugUtilsLabelEXT(cmdBuffer, &markerInfo);
ParentClass::accept(visitor);
instance->vkCmdEndDebugUtilsLabelEXT(cmdBuffer);
instance->getExtensions()->vkCmdEndDebugUtilsLabelEXT(cmdBuffer);
}
else
{
Expand Down
9 changes: 7 additions & 2 deletions examples/nodes/vsgannotation/vsgannotation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ int main(int argc, char** argv)
arguments.read(options);

auto windowTraits = vsg::WindowTraits::create();
// Use the VK_EXT_debug_utils extension, the point of this demo
windowTraits->debugUtils = true;
windowTraits->windowTitle = "vsgviewer";
windowTraits->debugLayer = arguments.read({"--debug", "-d"});
windowTraits->apiDumpLayer = arguments.read({"--api", "-a"});
Expand Down Expand Up @@ -164,15 +166,18 @@ int main(int argc, char** argv)

if (int log_level = 0; arguments.read("--log-level", log_level)) vsg::Logger::instance()->level = vsg::Logger::Level(log_level);

// For a sanity check that everything still works if we don't enable the extension.
if (arguments.read("--no-annotate"))
{
windowTraits->debugUtils = false;
}
if (arguments.errors()) return arguments.writeErrorMessages(std::cerr);

if (argc <= 1)
{
std::cout << "Please specify a 3d model or image file on the command line." << std::endl;
return 1;
}
// Use the VK_EXT_debug_utils extension, the point of this demo
windowTraits->debugUtils = true;

std::vector<std::string> fileNames;
std::vector<vsg::ref_ptr<vsg::Node>> nodes;
Expand Down

0 comments on commit 9c60737

Please sign in to comment.