MCPcopy Create free account
hub / github.com/InoriRus/Kyty / create_func

Function create_func

source/emulator/src/Graphics/Objects/StorageTexture.cpp:215–330  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

213}
214
215static void* create_func(GraphicContext* ctx, const uint64_t* params, const uint64_t* vaddr, const uint64_t* size, int vaddr_num,
216 VulkanMemory* mem)
217{
218 KYTY_PROFILER_BLOCK("StorageTextureObject::Create");
219
220 EXIT_IF(size == nullptr || vaddr == nullptr);
221 EXIT_IF(mem == nullptr);
222 EXIT_IF(ctx == nullptr);
223 EXIT_IF(params == nullptr);
224
225 auto fmt = (params[StorageTextureObject::PARAM_FORMAT] >> 16u) & 0xffffu;
226 auto dfmt = (params[StorageTextureObject::PARAM_FORMAT] >> 8u) & 0xffu;
227 auto nfmt = (params[StorageTextureObject::PARAM_FORMAT]) & 0xffu;
228 auto width = params[StorageTextureObject::PARAM_WIDTH_HEIGHT] >> 32u;
229 auto height = params[StorageTextureObject::PARAM_WIDTH_HEIGHT] & 0xffffffffu;
230 auto base_level = params[StorageTextureObject::PARAM_LEVELS] >> 32u;
231 auto levels = params[StorageTextureObject::PARAM_LEVELS] & 0xffffffffu;
232 auto swizzle = params[StorageTextureObject::PARAM_SWIZZLE];
233
234 EXIT_NOT_IMPLEMENTED(base_level != 0);
235
236 VkImageUsageFlags vk_usage = get_usage();
237
238 VkComponentMapping components {};
239
240 components.r = get_swizzle(GetDstSel(swizzle, 0));
241 components.g = get_swizzle(GetDstSel(swizzle, 1));
242 components.b = get_swizzle(GetDstSel(swizzle, 2));
243 components.a = get_swizzle(GetDstSel(swizzle, 3));
244
245 auto pixel_format = get_texture_format(dfmt, nfmt, fmt);
246
247 EXIT_NOT_IMPLEMENTED(pixel_format == VK_FORMAT_UNDEFINED);
248 EXIT_NOT_IMPLEMENTED(width == 0);
249 EXIT_NOT_IMPLEMENTED(height == 0);
250
251 auto real_height = ((levels > 1) ? height + (height > 1 ? height / 2 : 1) : height);
252
253 auto* vk_obj = new StorageTextureVulkanImage;
254
255 VkImageCreateInfo image_info {};
256 image_info.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO;
257 image_info.pNext = nullptr;
258 image_info.flags = 0;
259 image_info.imageType = VK_IMAGE_TYPE_2D;
260 image_info.extent.width = width;
261 image_info.extent.height = real_height;
262 image_info.extent.depth = 1;
263 image_info.mipLevels = 1;
264 image_info.arrayLayers = 1;
265 image_info.format = pixel_format;
266 image_info.tiling = VK_IMAGE_TILING_OPTIMAL;
267 image_info.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
268 image_info.usage = vk_usage;
269 image_info.sharingMode = VK_SHARING_MODE_EXCLUSIVE;
270 image_info.samples = VK_SAMPLE_COUNT_1_BIT;
271
272 if (!CheckSwizzle(ctx, &image_info, &components))

Callers

nothing calls this directly

Calls 9

GetDstSelFunction · 0.85
VulkanAllocateFunction · 0.85
VulkanBindImageMemoryFunction · 0.85
get_usageFunction · 0.70
get_swizzleFunction · 0.70
get_texture_formatFunction · 0.70
CheckSwizzleFunction · 0.70
CheckFormatFunction · 0.70
update_funcFunction · 0.70

Tested by

no test coverage detected