Skip to content

Vulkan validation errors when using TTF_GetGPUTextDrawData #570

@giuinktse7

Description

@giuinktse7

Hi! I'm getting Vulkan validation errors (VUID-vkCmdCopyBufferToImage-imageOffset-07738) when using TTF_GetGPUTextDrawData. I'm not sure if this is related to SDL_tff or SDL (or both?).

The errors originate from here in SDL_TTF: SDL_gpu_textengine.c#L380

VUID-vkCmdCopyBufferToImage-imageOffset-07738(ERROR / SPEC): msgNum: -891194290 - Validation Error: [ VUID-vkCmdCopyBufferToImage-imageOffset-07738 ] Object 0: handle = 0x141f6ea8090, type = VK_OBJECT_TYPE_COMMAND_BUFFER; Object 1: handle = 0x301e6c0000000022, type = VK_OBJECT_TYPE_IMAGE; | MessageID = 0xcae1744e | vkCmdCopyBufferToImage(): pRegions[0].imageExtent (width = 12, height = 18, depth = 1) must match the image subresource extents (width = 1024, height = 1024, depth = 1) when the command buffer's queue family image transfer granularity is (w=0, h=0, d=0). The Vulkan spec states: The imageOffset and imageExtent members of each element of pRegions must respect the image transfer granularity requirements of commandBuffer's command pool's queue family, as described in VkQueueFamilyProperties (https://vulkan.lunarg.com/doc/view/1.3.283.0/windows/1.3-extensions/vkspec.html#VUID-vkCmdCopyBufferToImage-imageOffset-07738)
    Objects: 2
        [0] 0x141f6ea8090, type: 6, name: NULL
        [1] 0x301e6c0000000022, type: 10, name: NULL
VUID-vkCmdCopyBufferToImage-imageOffset-07738(ERROR / SPEC): msgNum: -891194290 - Validation Error: [ VUID-vkCmdCopyBufferToImage-imageOffset-07738 ] Object 0: handle = 0x141f6f258b0, type = VK_OBJECT_TYPE_COMMAND_BUFFER; Object 1: handle = 0x301e6c0000000022, type = VK_OBJECT_TYPE_IMAGE; | MessageID = 0xcae1744e | vkCmdCopyBufferToImage(): pRegions[0].imageOffset (x = 13, y = 0, z = 0) must be (x=0, y=0, z=0) when the command buffer's queue family image transfer granularity is (w=0, h=0, d=0). The Vulkan spec states: The imageOffset and imageExtent members of each element of pRegions must respect the image transfer granularity requirements of commandBuffer's command pool's queue family, as described in VkQueueFamilyProperties (https://vulkan.lunarg.com/doc/view/1.3.283.0/windows/1.3-extensions/vkspec.html#VUID-vkCmdCopyBufferToImage-imageOffset-07738)
    Objects: 2
        [0] 0x141f6f258b0, type: 6, name: NULL
        [1] 0x301e6c0000000022, type: 10, name: NULL
VUID-vkCmdCopyBufferToImage-imageOffset-07738(ERROR / SPEC): msgNum: -891194290 - Validation Error: [ VUID-vkCmdCopyBufferToImage-imageOffset-07738 ] Object 0: handle = 0x141f6f258b0, type = VK_OBJECT_TYPE_COMMAND_BUFFER; Object 1: handle = 0x301e6c0000000022, type = VK_OBJECT_TYPE_IMAGE; | MessageID = 0xcae1744e | vkCmdCopyBufferToImage(): pRegions[0].imageExtent (width = 11, height = 13, depth = 1) must match the image subresource extents (width = 1024, height = 1024, depth = 1) when the command buffer's queue family image transfer granularity is (w=0, h=0, d=0). The Vulkan spec states: The imageOffset and imageExtent members of each element of pRegions must respect the image transfer granularity requirements of commandBuffer's command pool's queue family, as described in VkQueueFamilyProperties (https://vulkan.lunarg.com/doc/view/1.3.283.0/windows/1.3-extensions/vkspec.html#VUID-vkCmdCopyBufferToImage-imageOffset-07738)
    Objects: 2
        [0] 0x141f6f258b0, type: 6, name: NULL
        [1] 0x301e6c0000000022, type: 10, name: NULL

Example code that gives me these errors (C++):

#define SDL_MAIN_USE_CALLBACKS 1

#include <SDL3/SDL.h>
#include <SDL3/SDL_gpu.h>
#include <SDL3/SDL_init.h>
#include <SDL3/SDL_main.h>
#include <SDL3_ttf/SDL_ttf.h>
#include <string>


SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
{
    SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTS);
    TTF_Init();

    SDL_GPUDevice *device = SDL_CreateGPUDevice(SDL_GPU_SHADERFORMAT_SPIRV, true, "vulkan");
    TTF_TextEngine *textEngine = TTF_CreateGPUTextEngine(device);

    const char *basePath = SDL_GetBasePath();
    std::string path = std::string(basePath) + "Roboto-Regular.ttf";
    TTF_Font *font = TTF_OpenFont(path.c_str(), 24.0F);

    std::string text = "ab";
    TTF_Text *ttf_text = TTF_CreateText(textEngine, font, text.data(), text.size());

    // This is the line that generates the validation errors
    TTF_GPUAtlasDrawSequence *sequence = TTF_GetGPUTextDrawData(ttf_text);

    return SDL_APP_FAILURE;
}

SDL_AppResult SDL_AppEvent(void *appstate, SDL_Event *event) {}
SDL_AppResult SDL_AppIterate(void *appstate) {}
void SDL_AppQuit(void *appstate, SDL_AppResult result) {}

Call-chain:
SDL_TTF:

SDL:

Version details:

  • Operating System: Windows 11
  • SDL_TTF version: 3.2.2
  • SDL version: 3.2.18

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions