| 412 | } |
| 413 | |
| 414 | static void* create_func(GraphicContext* ctx, const uint64_t* params, const uint64_t* vaddr, const uint64_t* size, int vaddr_num, |
| 415 | VulkanMemory* mem) |
| 416 | { |
| 417 | KYTY_PROFILER_BLOCK("TextureObject::Create"); |
| 418 | |
| 419 | EXIT_IF(size == nullptr || vaddr == nullptr); |
| 420 | EXIT_IF(mem == nullptr); |
| 421 | EXIT_IF(ctx == nullptr); |
| 422 | EXIT_IF(params == nullptr); |
| 423 | |
| 424 | auto fmt = (params[TextureObject::PARAM_FORMAT] >> 16u) & 0xffffu; |
| 425 | auto dfmt = (params[TextureObject::PARAM_FORMAT] >> 8u) & 0xffu; |
| 426 | auto nfmt = (params[TextureObject::PARAM_FORMAT]) & 0xffu; |
| 427 | auto width = params[TextureObject::PARAM_WIDTH_HEIGHT] >> 32u; |
| 428 | auto height = params[TextureObject::PARAM_WIDTH_HEIGHT] & 0xffffffffu; |
| 429 | auto base_level = params[TextureObject::PARAM_LEVELS] >> 32u; |
| 430 | auto levels = params[TextureObject::PARAM_LEVELS] & 0xffffffffu; |
| 431 | auto swizzle = params[TextureObject::PARAM_SWIZZLE]; |
| 432 | |
| 433 | VkImageUsageFlags vk_usage = get_usage(); |
| 434 | |
| 435 | VkComponentMapping components {}; |
| 436 | |
| 437 | components.r = get_swizzle(GetDstSel(swizzle, 0)); |
| 438 | components.g = get_swizzle(GetDstSel(swizzle, 1)); |
| 439 | components.b = get_swizzle(GetDstSel(swizzle, 2)); |
| 440 | components.a = get_swizzle(GetDstSel(swizzle, 3)); |
| 441 | |
| 442 | auto pixel_format = get_texture_format(dfmt, nfmt, fmt); |
| 443 | |
| 444 | EXIT_NOT_IMPLEMENTED(pixel_format == VK_FORMAT_UNDEFINED); |
| 445 | EXIT_NOT_IMPLEMENTED(width == 0); |
| 446 | EXIT_NOT_IMPLEMENTED(height == 0); |
| 447 | |
| 448 | auto* vk_obj = new TextureVulkanImage; |
| 449 | |
| 450 | VkImageCreateInfo image_info {}; |
| 451 | image_info.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO; |
| 452 | image_info.pNext = nullptr; |
| 453 | image_info.flags = 0; |
| 454 | image_info.imageType = VK_IMAGE_TYPE_2D; |
| 455 | image_info.extent.width = width; |
| 456 | image_info.extent.height = height; |
| 457 | image_info.extent.depth = 1; |
| 458 | image_info.mipLevels = levels; |
| 459 | image_info.arrayLayers = 1; |
| 460 | image_info.format = pixel_format; |
| 461 | image_info.tiling = VK_IMAGE_TILING_OPTIMAL; |
| 462 | image_info.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED; |
| 463 | image_info.usage = vk_usage; |
| 464 | image_info.sharingMode = VK_SHARING_MODE_EXCLUSIVE; |
| 465 | image_info.samples = VK_SAMPLE_COUNT_1_BIT; |
| 466 | |
| 467 | if (!CheckSwizzle(ctx, &image_info, &components)) |
| 468 | { |
| 469 | EXIT("swizzle is not supported"); |
| 470 | } |
| 471 |
nothing calls this directly
no test coverage detected