| 2334 | } |
| 2335 | |
| 2336 | bool createTextureImage(VulkanRenderDevice& vkDev, const char* filename, VkImage& textureImage, VkDeviceMemory& textureImageMemory, uint32_t* outTexWidth, uint32_t* outTexHeight) |
| 2337 | { |
| 2338 | int texWidth, texHeight, texChannels; |
| 2339 | stbi_uc* pixels = stbi_load(filename, &texWidth, &texHeight, &texChannels, STBI_rgb_alpha); |
| 2340 | |
| 2341 | if (!pixels) { |
| 2342 | printf("Failed to load [%s] texture\n", filename); fflush(stdout); |
| 2343 | return false; |
| 2344 | } |
| 2345 | |
| 2346 | bool result = createTextureImageFromData(vkDev, textureImage, textureImageMemory, |
| 2347 | pixels, texWidth, texHeight, VK_FORMAT_R8G8B8A8_UNORM); |
| 2348 | |
| 2349 | stbi_image_free(pixels); |
| 2350 | |
| 2351 | if (outTexWidth && outTexHeight) { |
| 2352 | *outTexWidth = (uint32_t)texWidth; |
| 2353 | *outTexHeight = (uint32_t)texHeight; |
| 2354 | } |
| 2355 | |
| 2356 | return result; |
| 2357 | } |
| 2358 | |
| 2359 | size_t allocateVertexBuffer(VulkanRenderDevice& vkDev, VkBuffer* storageBuffer, VkDeviceMemory* storageBufferMemory, size_t vertexDataSize, const void* vertexData, size_t indexDataSize, const void* indexData) |
| 2360 | { |
no test coverage detected