WE GOT TEXTURES BABY
This commit is contained in:
@@ -99,6 +99,23 @@ void GfxDevice::init(SDL_Window* window, const std::string& appName, bool vSync)
|
||||
swapchainFormat = VK_FORMAT_B8G8R8A8_SRGB;
|
||||
swapchain.createSwapchain(this, swapchainFormat, w, h, vSync);
|
||||
|
||||
VkPhysicalDeviceProperties props{};
|
||||
vkGetPhysicalDeviceProperties(physicalDevice, &props);
|
||||
|
||||
imageCache.bindlessSetManager.init(device, props.limits.maxSamplerAnisotropy);
|
||||
|
||||
{ // create white texture
|
||||
std::uint32_t pixel = 0xFFFFFFFF;
|
||||
whiteImageId = createImage(
|
||||
{
|
||||
.format = VK_FORMAT_R8G8B8A8_UNORM,
|
||||
.usage = VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT,
|
||||
.extent = VkExtent3D{1, 1, 1},
|
||||
},
|
||||
"white texture",
|
||||
&pixel);
|
||||
}
|
||||
|
||||
swapchain.initSync(device);
|
||||
|
||||
const auto poolCreateInfo = vkinit::commandPoolCreateInfo(VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT, graphicsQueueFamily);
|
||||
@@ -223,6 +240,30 @@ void GfxDevice::waitIdle() {
|
||||
VK_CHECK(vkDeviceWaitIdle(device));
|
||||
}
|
||||
|
||||
BindlessSetManager& GfxDevice::getBindlessSetManager() {
|
||||
return imageCache.bindlessSetManager;
|
||||
}
|
||||
|
||||
VkDescriptorSetLayout GfxDevice::getBindlessDescSetLayout() const {
|
||||
return imageCache.bindlessSetManager.getDescSetLayout();
|
||||
}
|
||||
|
||||
const VkDescriptorSet& GfxDevice::getBindlessDescSet() const {
|
||||
return imageCache.bindlessSetManager.getDescSet();
|
||||
}
|
||||
|
||||
void GfxDevice::bindBindlessDescSet(VkCommandBuffer cmd, VkPipelineLayout layout) const {
|
||||
vkCmdBindDescriptorSets(
|
||||
cmd,
|
||||
VK_PIPELINE_BIND_POINT_GRAPHICS,
|
||||
layout,
|
||||
0,
|
||||
1,
|
||||
&imageCache.bindlessSetManager.getDescSet(),
|
||||
0,
|
||||
nullptr);
|
||||
}
|
||||
|
||||
void GfxDevice::immediateSubmit(ImmediateExecuteFunction&& f) const {
|
||||
executor.immediateSubmit(std::move(f));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user