Jump to content
  • Advertisement

Karutoh

Member
  • Content Count

    10
  • Joined

  • Last visited

Community Reputation

110 Neutral

About Karutoh

  • Rank
    Member

Personal Information

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Karutoh

    Last Object Only Renders

    Currently I use a Dynamic Uniform Buffer, and use Dynamic Offsets. So each object for sure has it's own MVP data, etc... I'm a 100% certain it's not my entity array.   Edit: Actually, could it possibly be that I need to add a VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER in VkWriteDescriptorSet for each object?
  2. I have a problem in my engine, if I try to render multiple objects at once, only the last object to render shows up. What is the possible causes of this? As a side note I have not received any errors from the validation layer. I am stumped...
  3. VkDescriptorBufferInfo's member, range must be the max data size of a single object. For example if my data for a single object was for the MVP Matrices, and all together it was 48 bytes, you then would use GetAllignment for the range member, in respects of minUniformBufferOffsetAlignment. minUniformBufferOffsetAlignment for me was 256 bytes, so instead of using 48 I would use 256 bytes, if my matrices went over 256 bytes, then it would be "rounded" up to 512 bytes. This is also on the dynamic_uniform sample located in the Vulkan API-Samples folder. UInt_64 Buffer::GetAllignment(Renderer *ren, UInt_64 i) { VkPhysicalDeviceProperties prop; vkGetPhysicalDeviceProperties(ren->PhysicalDevice(), &prop); if (prop.limits.minUniformBufferOffsetAlignment) return (i + prop.limits.minUniformBufferOffsetAlignment - 1) & ~(prop.limits.minUniformBufferOffsetAlignment - 1); return i; }
  4. I'm having issues getting Dynamic Uniform Buffers to work with dynamic offsets. I can't seem to figure out why or how I'm getting this error. Can somebody help me understand what I'm doing wrong?   2866 | 23 | Descriptor set 0x22 encountered the following validation error at vkCmdDraw() time: Dynamic descriptor in binding #0 at global descriptor index 0 uses buffer 0000000000000030 with dynamic offset 256 combined with offset 0 and range 416 that oversteps the buffer size of 416.   void Shader::Begin(UInt index) { Renderer *ren = GetParent<Renderer>(); CmdBufferManager *drawBufferManager = ren->GetQueue(VK_QUEUE_GRAPHICS_BIT)->GetCmdBufferManager(U"DrawCommands"); VkCommandBufferInheritanceInfo inherInfo = { VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO, 0, ren->GetRenderPass(), 0, ren->CurrentFrameBuffer(), VK_FALSE, 0, 0 }; VkCommandBufferBeginInfo beginInfo = {}; beginInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO; beginInfo.flags = VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT; beginInfo.pInheritanceInfo = &inherInfo; drawBufferManager->Begin(index, beginInfo); ren->UpdateViewport(); vkCmdBindPipeline(*drawBufferManager->Get(index), VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline); UInt *offsets = 0; UInt_64 ind = 0; UInt size = 0; for (UInt_64 i = 0; i < descriptorWrites.size(); ++i) { if (descriptorWrites[i].descriptorType != VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC) continue; ++size; } offsets = new UInt[size]; for (UInt_64 i = 0; i < descriptorWrites.size(); ++i) { if (descriptorWrites[i].descriptorType != VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC) continue; offsets[ind++] = static_cast<UInt>(uniformBuffers[i].GetAllignment(uniformBuffers[i].GetDataSize() * bindCalls)); } vkCmdBindDescriptorSets(*drawBufferManager->Get(index), VK_PIPELINE_BIND_POINT_GRAPHICS, pipelineLayout, 0, 1, &descriptorSet, size, offsets); delete[] offsets; }  
  5. Karutoh

    Reusing Shaders

    I think I fixed the issue, I updated my engine with Primary and Secondary command buffers. I'm also using Dynamic Uniform Buffers, and Descriptor Set Offsets.   Edit: That did not solve my issue.
  6. Karutoh

    Reusing Shaders

    Here's my files where I have my RenderPass at. I appreciate your guys' help!   Renderer.h http://puu.sh/sFD0a/445d248ab7.h   Renderer.cpp http://puu.sh/sFD19/cc3086f95f.cpp
  7. Karutoh

    Reusing Shaders

    Yeah I don't enjoy it. I'd much rather have a diverse tutorial with a lot of examples, but Vulkan was just recently released to the public, so I don't expect much.
  8. Karutoh

    Reusing Shaders

    Honestly I'm not surprised most of the tutorials I've gone through only recorded commands to the Graphics Queue once. I had to experiment a lot to get to what it is now. Right now I'm at work, but once I get home I will post where I use and maintain my gameloop, including the renderpass.
  9. Karutoh

    Reusing Shaders

    Thank you for replying, to make things simpler I will post the Shader file so you can see exactly what it does, as it is difficult to explain.   http://puu.sh/sDHUI/745c019305.cpp   I also just recently discovered these errors. They occur when I render the second object. At the moment I do not use "vkQueueSubmit" after adding commands to the CommandBuffer after each object.   3854 | 6 | You must call vkBeginCommandBuffer() before this call to vkCmdBindPipeline() 3854 | 6 | You must call vkBeginCommandBuffer() before this call to vkCmdBindDescriptorSets() 3854 | 6 | You must call vkBeginCommandBuffer() before this call to vkCmdBindVertexBuffer() 3854 | 6 | You must call vkBeginCommandBuffer() before this call to vkCmdDraw() 3854 | 6 | You must call vkBeginCommandBuffer() before this call to vkCmdEndRenderPass() 3854 | 6 | You must call vkBeginCommandBuffer() before this call to vkEndCommandBuffer()
  10. So the problem is, when I try to render multiple objects that re-use the same shader, it only renders the last object. I assume that I need to sumbit the command buffers each time I render an object?   void Button::Render() { vk::Renderer *ren = GetParent()->GetParent<vk::Renderer>(); Level *level = GetParent<Level>(); float *data = new float[52]; memcpy(((float *)data + 0), level->GetCurrentCamera()->GetPosition().GetData(), sizeof(float) * 4); memcpy(((float *)data + 4), &transform.data[0][0], sizeof(float) * 16); memcpy(((float *)data + 20), &level->GetCurrentCamera()->GetTransform().data[0][0], sizeof(float) * 16); memcpy(((float *)data + 36), &level->GetProj().data[0][0], sizeof(float) * 16); shader->SetUniform(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 0, sizeof(float) * 52, data, 0); delete[] data; shader->SetUniform(VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, 0, 0, diamondBlock); shader->SetUniform(VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 2, 0, 0, diamondBlockSpec); data = new float[16]; data[0] = 0.1f; data[1] = 0.1f; data[2] = 0.1f; data[3] = 1.0f; data[4] = 0.8f; data[5] = 0.8f; data[6] = 0.8f; data[7] = 1.0f; data[8] = 1.0f; data[9] = 1.0f; data[10] = 1.0f; data[11] = 1.0f; data[12] = lightPos.GetX(); data[13] = lightPos.GetY(); data[14] = lightPos.GetZ(); data[15] = 1.0f; shader->SetUniform(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 3, sizeof(float) * 16, data, 0); delete[] data; UploadMaterial(shader, 4); ren->Begin(0); shader->Begin(); model->Begin(); ren->End(); ren->Submit(); }
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!