Jump to content
  • Advertisement

Search the Community

Showing results for tags 'Vulkan' in content posted in Graphics and GPU Programming.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Categories

  • Audio
    • Music and Sound FX
  • Business
    • Business and Law
    • Career Development
    • Production and Management
  • Game Design
    • Game Design and Theory
    • Writing for Games
    • UX for Games
  • Industry
    • Interviews
    • Event Coverage
  • Programming
    • Artificial Intelligence
    • General and Gameplay Programming
    • Graphics and GPU Programming
    • Engines and Middleware
    • Math and Physics
    • Networking and Multiplayer
  • Visual Arts
  • Archive

Categories

  • Audio
  • Visual Arts
  • Programming
  • Writing

Categories

  • Game Dev Loadout
  • Game Dev Unchained

Categories

  • Game Developers Conference
    • GDC 2017
    • GDC 2018
  • Power-Up Digital Games Conference
    • PDGC I: Words of Wisdom
    • PDGC II: The Devs Strike Back
    • PDGC III: Syntax Error

Forums

  • Audio
    • Music and Sound FX
  • Business
    • Games Career Development
    • Production and Management
    • Games Business and Law
  • Game Design
    • Game Design and Theory
    • Writing for Games
  • Programming
    • Artificial Intelligence
    • Engines and Middleware
    • General and Gameplay Programming
    • Graphics and GPU Programming
    • Math and Physics
    • Networking and Multiplayer
  • Visual Arts
    • 2D and 3D Art
    • Critique and Feedback
  • Community
    • GameDev Challenges
    • GDNet+ Member Forum
    • GDNet Lounge
    • GDNet Comments, Suggestions, and Ideas
    • Coding Horrors
    • Your Announcements
    • Hobby Project Classifieds
    • Indie Showcase
    • Article Writing
  • Affiliates
    • NeHe Productions
    • AngelCode
  • Topical
    • Virtual and Augmented Reality
    • News
  • Workshops
    • C# Workshop
    • CPP Workshop
    • Freehand Drawing Workshop
    • Hands-On Interactive Game Development
    • SICP Workshop
    • XNA 4.0 Workshop
  • Archive
    • Topical
    • Affiliates
    • Contests
    • Technical
  • GameDev Challenges's Topics
  • For Beginners's Forum

Calendars

  • Community Calendar
  • Games Industry Events
  • Game Jams
  • GameDev Challenges's Schedule

Blogs

There are no results to display.

There are no results to display.

Product Groups

  • Advertisements
  • GameDev Gear

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


About Me


Website


Role


Twitter


Github


Twitch


Steam

Found 118 results

  1. I'm creating a 2D game engine using Vulkan. I've been looking at how to draw different textures (each GameObject can contain its own texture and can be different from others). In OpenGL you call glBindTexture and in vulkan I have seen that there are people who say that you can create a descriptor for each texture and call vkCmdBindDescriptorSets for each. But I have read that doing this has a high cost. The way I'm doing it is to use only 1 descriptor for the Sampler2D and use a VkDescriptorImageInfo vector where I add each VkDescriptorImageInfo for each texture and assign the vector in pImageInfo. VkWriteDescriptorSet samplerDescriptorSet; samplerDescriptorSet.pNext = NULL; samplerDescriptorSet.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET; samplerDescriptorSet.dstSet = descriptorSets[i]; samplerDescriptorSet.dstBinding = 1; samplerDescriptorSet.dstArrayElement = 0; samplerDescriptorSet.descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER; samplerDescriptorSet.descriptorCount = static_cast<uint32_t>(samplerDescriptors.size()); samplerDescriptorSet.pImageInfo = samplerDescriptors.data(); //samplerDescriptors is the vector Using this, I can skip creating and binding a descriptor for each texture but now I need an array of Samplers in fragment shader. I can't use sampler2DArray because each texture have different sizes so I decided to use an array of Samplers2D (Sampler2D textures[n]). The problem with this is that I don't want to set a max number of textures to use. I found a way to do it dynamically using: #extension GL_EXT_nonuniform_qualifier : enable layout(binding = 1) uniform sampler2D texSampler[]; I never used this before and don't know if is efficient or not. Anyways there is still a problem with this. Now I need to set the number of descriptor count when I create the descriptor layout and again, I don't want to set a max number you can use: VkDescriptorSetLayoutBinding samplerLayoutBinding = {}; samplerLayoutBinding.binding = 1; samplerLayoutBinding.descriptorCount = 999999; <<<< HERE samplerLayoutBinding.descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER; samplerLayoutBinding.pImmutableSamplers = nullptr; samplerLayoutBinding.stageFlags = VK_SHADER_STAGE_FRAGMENT_BIT; Having said that. How can I solve this? Or which is the correct way to do this efficiently? If you need more information, just ask. Thanks in advance!
  2. I was looking at some of Sascha Willems' examples, specifically `multithreading.cpp`, and was surprised to see that he is creating a secondary command buffer per object. I'm curious to know if this is a fairly standard approach? Also, it made we wonder how expensive it is to bind the same pipeline (phong), once per secondary command buffer, but once these buffers have been executed (concatenated into a primary cbuffer) you effectively have a pipeline bind per object. Being that pipelines are immutable, is it fairly cheap after the first phong pipeline is bound and therefore any subsequent phong binds don't really impact things much? https://github.com/SaschaWillems/Vulkan/blob/master/examples/multithreading/multithreading.cpp Thanks
  3. I am wondering if it would be viable to transfer the SH coefficients calculation to a compute shader instead of doing it on CPU which for our engine requires a readback of the cube map texture. I am not entirely sure how to go about this since it will be hard to parallelize as each thread will be writing to all the coefficients. A lame implementation would be to have one thread running the entire shader but I think that's going into TDR territory. Currently, I am generating an irradiance map but I am planning on switching to storing it inside a spherical harmonics because of the smaller footprint. Does anyone have any ideas on how we can move this to the GPU or its just not a viable option?
  4. Hi, I have C++ Vulkan based project using Qt framework. QVulkanInstance and QVulkanWindow does lot of things for me like validation etc. but I can't figure out due Vulkan low level API how to troubleshoot Vulkan errors. I am trying to render terrain using tessellation shaders. I am learning from SaschaWillems tutorial for tessellation rendering. I think I am setting some value for rendering pass wrong in MapTile.cpp but unable to find which cause I dont know how to troubleshoot it. Whats the problem? App freezes on second end draw call Why? QVulkanWindow: Device lost Validation layers debug qt.vulkan: Vulkan init (vulkan-1.dll) qt.vulkan: Supported Vulkan instance layers: QVector(QVulkanLayer("VK_LAYER_NV_optimus" 1 1.1.84 "NVIDIA Optimus layer"), QVulkanLayer("VK_LAYER_RENDERDOC_Capture" 0 1.0.0 "Debugging capture layer for RenderDoc"), QVulkanLayer("VK_LAYER_VALVE_steam_overlay" 1 1.1.73 "Steam Overlay Layer"), QVulkanLayer("VK_LAYER_LUNARG_standard_validation" 1 1.0.82 "LunarG Standard Validation Layer")) qt.vulkan: Supported Vulkan instance extensions: QVector(QVulkanExtension("VK_KHR_device_group_creation" 1), QVulkanExtension("VK_KHR_external_fence_capabilities" 1), QVulkanExtension("VK_KHR_external_memory_capabilities" 1), QVulkanExtension("VK_KHR_external_semaphore_capabilities" 1), QVulkanExtension("VK_KHR_get_physical_device_properties2" 1), QVulkanExtension("VK_KHR_get_surface_capabilities2" 1), QVulkanExtension("VK_KHR_surface" 25), QVulkanExtension("VK_KHR_win32_surface" 6), QVulkanExtension("VK_EXT_debug_report" 9), QVulkanExtension("VK_EXT_swapchain_colorspace" 3), QVulkanExtension("VK_NV_external_memory_capabilities" 1), QVulkanExtension("VK_EXT_debug_utils" 1)) qt.vulkan: Enabling Vulkan instance layers: ("VK_LAYER_LUNARG_standard_validation") qt.vulkan: Enabling Vulkan instance extensions: ("VK_EXT_debug_report", "VK_KHR_surface", "VK_KHR_win32_surface") qt.vulkan: QVulkanWindow init qt.vulkan: 1 physical devices qt.vulkan: Physical device [0]: name 'GeForce GT 650M' version 416.64.0 qt.vulkan: Using physical device [0] qt.vulkan: queue family 0: flags=0xf count=16 supportsPresent=1 qt.vulkan: queue family 1: flags=0x4 count=1 supportsPresent=0 qt.vulkan: Using queue families: graphics = 0 present = 0 qt.vulkan: Supported device extensions: QVector(QVulkanExtension("VK_KHR_8bit_storage" 1), QVulkanExtension("VK_KHR_16bit_storage" 1), QVulkanExtension("VK_KHR_bind_memory2" 1), QVulkanExtension("VK_KHR_create_renderpass2" 1), QVulkanExtension("VK_KHR_dedicated_allocation" 3), QVulkanExtension("VK_KHR_descriptor_update_template" 1), QVulkanExtension("VK_KHR_device_group" 3), QVulkanExtension("VK_KHR_draw_indirect_count" 1), QVulkanExtension("VK_KHR_driver_properties" 1), QVulkanExtension("VK_KHR_external_fence" 1), QVulkanExtension("VK_KHR_external_fence_win32" 1), QVulkanExtension("VK_KHR_external_memory" 1), QVulkanExtension("VK_KHR_external_memory_win32" 1), QVulkanExtension("VK_KHR_external_semaphore" 1), QVulkanExtension("VK_KHR_external_semaphore_win32" 1), QVulkanExtension("VK_KHR_get_memory_requirements2" 1), QVulkanExtension("VK_KHR_image_format_list" 1), QVulkanExtension("VK_KHR_maintenance1" 2), QVulkanExtension("VK_KHR_maintenance2" 1), QVulkanExtension("VK_KHR_maintenance3" 1), QVulkanExtension("VK_KHR_multiview" 1), QVulkanExtension("VK_KHR_push_descriptor" 2), QVulkanExtension("VK_KHR_relaxed_block_layout" 1), QVulkanExtension("VK_KHR_sampler_mirror_clamp_to_edge" 1), QVulkanExtension("VK_KHR_sampler_ycbcr_conversion" 1), QVulkanExtension("VK_KHR_shader_draw_parameters" 1), QVulkanExtension("VK_KHR_storage_buffer_storage_class" 1), QVulkanExtension("VK_KHR_swapchain" 70), QVulkanExtension("VK_KHR_variable_pointers" 1), QVulkanExtension("VK_KHR_win32_keyed_mutex" 1), QVulkanExtension("VK_EXT_conditional_rendering" 1), QVulkanExtension("VK_EXT_depth_range_unrestricted" 1), QVulkanExtension("VK_EXT_descriptor_indexing" 2), QVulkanExtension("VK_EXT_discard_rectangles" 1), QVulkanExtension("VK_EXT_hdr_metadata" 1), QVulkanExtension("VK_EXT_inline_uniform_block" 1), QVulkanExtension("VK_EXT_shader_subgroup_ballot" 1), QVulkanExtension("VK_EXT_shader_subgroup_vote" 1), QVulkanExtension("VK_EXT_vertex_attribute_divisor" 3), QVulkanExtension("VK_NV_dedicated_allocation" 1), QVulkanExtension("VK_NV_device_diagnostic_checkpoints" 2), QVulkanExtension("VK_NV_external_memory" 1), QVulkanExtension("VK_NV_external_memory_win32" 1), QVulkanExtension("VK_NV_shader_subgroup_partitioned" 1), QVulkanExtension("VK_NV_win32_keyed_mutex" 1), QVulkanExtension("VK_NVX_device_generated_commands" 3), QVulkanExtension("VK_NVX_multiview_per_view_attributes" 1)) qt.vulkan: Enabling device extensions: QVector(VK_KHR_swapchain) qt.vulkan: memtype 0: flags=0x0 qt.vulkan: memtype 1: flags=0x0 qt.vulkan: memtype 2: flags=0x0 qt.vulkan: memtype 3: flags=0x0 qt.vulkan: memtype 4: flags=0x0 qt.vulkan: memtype 5: flags=0x0 qt.vulkan: memtype 6: flags=0x0 qt.vulkan: memtype 7: flags=0x1 qt.vulkan: memtype 8: flags=0x1 qt.vulkan: memtype 9: flags=0x6 qt.vulkan: memtype 10: flags=0xe qt.vulkan: Picked memtype 10 for host visible memory qt.vulkan: Picked memtype 7 for device local memory qt.vulkan: Color format: 44 Depth-stencil format: 129 qt.vulkan: Creating new swap chain of 2 buffers, size 600x370 qt.vulkan: Actual swap chain buffer count: 2 (supportsReadback=1) qt.vulkan: Allocating 1027072 bytes for transient image (memtype 8) qt.vulkan: Creating new swap chain of 2 buffers, size 600x368 qt.vulkan: Releasing swapchain qt.vulkan: Actual swap chain buffer count: 2 (supportsReadback=1) qt.vulkan: Allocating 1027072 bytes for transient image (memtype 8) QVulkanWindow: Device lost qt.vulkan: Releasing all resources due to device lost qt.vulkan: Releasing swapchain I am not so sure if this debug helps somehow :(( I dont want you to debug it for me. I just want to learn how I should debug it and find where problem is located. Could you give me guide please? Source code Source code rendering just few vertices (working) Difference between links are: Moved from Qt math libraries to glm Moved from QImage to gli for Texture class Added tessellation shaders Disabled window sampling Rendering terrain using heightmap and texturearray (Added normals and UV) Thanks
  5. Folks, I tried to google Vulcan and sdl2 but they did not help so well. I only found stand-alone or GLFW tutorials. Does anyone have good tutorial about Vulkan with SDL2? Thanks
  6. Home: https://www.khronos.org/vulkan/ SDK: http://lunarg.com/vulkan-sdk/ AMD drivers: http://gpuopen.com/gaming-product/vulkan/ (Note that Vulkan support is now part of AMD’s official drivers, so simply getting the latest drivers for your card should give you Vulkan support.) NVIDIA drivers: https://developer.nvidia.com/vulkan-driver (Note that Vulkan support is now part of NVIDIA’s official drivers, so simply getting the latest drivers for your card should give you Vulkan support.) Intel drivers: http://blogs.intel.com/evangelists/2016/02/16/intel-open-source-graphics-drivers-now-support-vulkan/ Quick reference: https://www.khronos.org/registry/vulkan/specs/1.0/refguide/Vulkan-1.0-web.pdf References: https://www.khronos.org/registry/vulkan/specs/1.0/apispec.html https://matthewwellings.com/blog/the-new-vulkan-coordinate-system/ GLSL-to-SPIR-V: https://github.com/KhronosGroup/glslang Sample code: https://github.com/LunarG/VulkanSamples https://github.com/SaschaWillems/Vulkan https://github.com/nvpro-samples https://github.com/nvpro-samples/gl_vk_chopper https://github.com/nvpro-samples/gl_vk_threaded_cadscene https://github.com/nvpro-samples/gl_vk_bk3dthreaded https://github.com/nvpro-samples/gl_vk_supersampled https://github.com/McNopper/Vulkan https://github.com/GPUOpen-LibrariesAndSDKs/HelloVulkan C++: https://github.com/nvpro-pipeline/vkcpp https://developer.nvidia.com/open-source-vulkan-c-api Getting started: https://vulkan-tutorial.com/ https://renderdoc.org/vulkan-in-30-minutes.html https://www.khronos.org/news/events/vulkan-webinar https://developer.nvidia.com/engaging-voyage-vulkan https://developer.nvidia.com/vulkan-shader-resource-binding https://developer.nvidia.com/vulkan-memory-management https://developer.nvidia.com/opengl-vulkan https://github.com/vinjn/awesome-vulkan Videos: https://www.youtube.com/playlist?list=PLYO7XTAX41FPg08uM_bgPE9HLgDAyzDaZ Utilities: https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator (AMD Memory allocator.) https://github.com/GPUOpen-LibrariesAndSDKs/Anvil (AMD Miniature Vulkan engine/framework.) L. Spiro
  7. Would anyone be able to point me to an object picking example with Vulkan using the render each object using a different color to a texture in a separate rendering pass and read those texture pixels to get the color value approach. I'm very new to Vulkan, and I'm starting to port my OpenGl apps over, and I use this technique a lot.
  8. Hello, I am university student. This year I am going to write bachelor thesis about Vulkan app using terrain to render real places based on e.g. google maps data. I played World of Warcraft for 10 years and I did some research about their terrain rendering. They render map as grid of tiles. Each tile had 4 available textures to paint (now 8 by expansion WoD) However I found issue about this implementation, that's gaps between tiles. Is there any technique which solves this problem? I read on stackoverflow that guys find only solution in using smooth tool and fixing it manually. Main question: is this terrain rendering technique obsolete? Is there any new technique that replaces this method to render large map as small tiles? Should I try to implement rendering terrain as grid of tiles or should I use some modern technique (can you tell me which is modern for you?). If I should implement terrain as one large map to prevent gaps between tiles how textures are applied for such large map? Thanks for any advice.
  9. Folks continue to tell me that Vulkan is a viable general-purpose replacement for OpenGL, and with the impending demise of OpenGL on Mac/iOS, I figured it's time to take the plunge... On the surface this looks like going back to the pain of old-school AMD/NVidia/Intel OpenGL driver hell. What I'm trying to get a grasp of is where the major portability pitfalls are up front, and what my hardware test matrix is going to be like... ~~ The validation layers seem useful. Do they work sufficiently well that a program which validates is guaranteed to at least run on another vendor's drivers (setting aside performance differences)? I assume I'm going to need to abstract across the various queue configurations? i.e. single queue on Intel, graphics+transfer on NVidia, graphics+compute+transfer on AMD? That seems fairly straightforward to wrap with a framegraph and bake the framegraph down to the available queues. Memory allocation seems like it's going to be a pain. Obviously theres some big memory scaling knobs like render target resolution, enabling/disabling post-process effects, asset resolution, etc. But at some point someone has to play tetris into the available memory on a particular GPU, and I don't really want to shove that off into manual configuration. Any pointers for techniques to deal with this in a sane manner? Any other major pitfalls I'm liable to run into when trying to write Vulkan code to run across multiple vendors/hardware targets? ~~ As for test matrix, I assume I'm going to need to test one each of recent AMD/NVidia/Intel, plus MoltenVK for Apple. Are the differences between subsequent architectures large enough that I need to test multiple different generations of cards from the same vendor? How bad is the driver situation in the android chipset space?
  10. Hi I'm searching for a good implementation of Vulkan in C#, Don't need to be the fastest as it's for an Editor, but i need the most complete and most active one. Saw a few ones but with no update in the past 5 months. Don't want to implement a "dead" library as my usage is for the next 3/4 years. Any idea ? thanks
  11. Hi everyone, I think my question boils down to "How do i feed shaders?" I was wondering what are the good strategies to store mesh transformation data [World matrices] to then be used in the shader for transforming vertices (performance being the priority ). And i'm talking about a game scenario where there are quite a lot of both moving entities, and static ones, that aren't repeated enough to be worth instanced drawing. So far i've only tried these naive methods : DX11 : - Store transforms of ALL entities in a constant buffer ( and give the entity an index to the buffer for later modification ) - Or store ONE transform in a constant buffer, and change it to the entity's transform before each drawcall. Vulkan : - Use Push Constants to send entity's transform to the shader before each drawcall, and maybe use a separate Device_local uniform buffer for static entities? Same question applies to lights. Any suggestions?
  12. Cannot get rid of z-fighting (severity varies between: no errors at all - ~40% fail). * up-to-date validation layer has nothing to say. * pipelines are nearly identical (differences: color attachments, descriptor sets for textures, depth write, depth compare op - LESS for prepass and EQUAL later). * did not notice anything funny when comparing the draw commands via NSight either - except, see end of this post. * "invariant gl_Position" for all participating vertex shaders makes no difference ('invariant' does not show up in decompile, but is present in SPIR-V). * gl_Position calculations are identical for all (also using identical source data: push constants + vertex attribs) However, when decompiling SPIR-V back to GLSL via NSight i noticed something rather strange: Depth prepass has "gl_Position.z = 2.0 * gl_Position.z - gl_Position.w;" added to it. What is this!? "gl_Position.y = -gl_Position.y;", which is always added to everything, i can understand - vulcans NDC is vertically flipped by default in comparison to OpenGL. That is fine. What is the muckery with z there for? And why is it only selectively added? Looking at my perspective projection code (the usual matrix multiplication, just simplified): vec4 projection(vec3 v) { return vec4(v.xy * par.proj.xy, v.z * par.proj.z + par.proj.w, -v.z); } All it ends up doing is doubling w-part of 'proj' in z (proj = vec4(1.0, 1.33.., -1.0, 0.2)). How does anything show at all given that i draw with compare op EQUAL. Decompile bug? I am out of ideas.
  13. I have a rather specific question. I'm trying to learn about linked multi GPU in Vulkan 1.1; the only real source I can find (other than the spec itself) is the following video: Anyway, each node in the linked configuration gets its own internal heap pointer. You can swizzle the node mask to your liking to make one node pull from another's memory. However, the only way to perform the "swizzling" is to rebind a new VkImage / VkBuffer instance to the same VkDeviceMemory handle (but with a different node configuration). This is effectively aliasing the memory between two instances with identical properties. I'm curious whether this configuration requires special barriers. How do image barriers work in this case? Does a layout transition on one alias automatically affect the other. I'm coming from DX12 land where placed resources require custom aliasing barriers, and each placed resource has its own independent state. It seems like Vulkan functions a bit differently. Thanks.
  14. Trying to figure out why input attachment reads as black with NSight VS plugin - and failing. This is what i can see at the invocation point of the shader: * attachment is filled with correct data (just a clear to bright red in previous renderpass) and used by the fragment shader: // SPIR-V decompiled to GLSL #version 450 layout(binding = 0) uniform sampler2D accum; // originally: layout(input_attachment_index=0, set=0, binding=0) uniform subpassInput accum; layout(location = 0) out vec4 fbFinal; void main(){ fbFinal = vec4(texelFetch(accum, ivec2(gl_FragCoord.xy), 0).xyz + vec3(0.0, 0.0, 1.0), 1.0); // originally: fbFinal = vec4(subpassLoad(accum).rgb + vec3(0.0, 0.0, 1.0), 1.0); } * the resulting image is bright blue - instead of the expected bright purple (red+blue) How can this happen? 'fbFinal' format is B8G8R8A8_UNORM and 'accum' format is R16G16B16A16_UNORM - ie. nothing weird.
  15. Hello everyone! For my engine, I want to be able to automatically generate pipeline layouts based on shader resources. That works perfectly well in D3D12 as shader resources are not required to specify descriptor tables, so I use reflection system and map different shader registers to tables as I need. In Vulkan, however, looks like descriptor sets must be specified in both SPIRV bytecode and when creating pipeline layout (why is that?). So it looks like I will have to mess around with the bytecode to tweak bindings and descriptor sets. I looked at SPIRV-cross but it seems like it can't emit SPIRV (funny enough). I also use glslang to compile GLSL to SPIRV and for some reason, binding decoration is only present for these resources that I explicitly defined. Does anybody know if there is a tool to change bindings in SPIRV bytecode?
  16. Hi, I am having problems with all of my compute shaders in Vulkan. They are not writing to resources, even though there are no problems in the debug layer, every descriptor seem correctly bound in the graphics debugger, and the shaders definitely take time to execute. I understand that this is probably a bug in my implementation which is a bit complex, trying to emulate a DX11 style rendering API, but maybe I'm missing something trivial in my logic here? Currently I am doing these: Set descriptors, such as VK_DESCRIPTOR_TYPE_STORAGE_BUFFER for a read-write structured buffer (which is non formatted buffer) Bind descriptor table / validate correctness by debug layer Dispatch on graphics/compute queue, the same one that is feeding graphics rendering commands. Insert memory barrier with both stagemasks as VK_PIPELINE_STAGE_ALL_COMMANDS_BIT and srcAccessMask VK_ACCESS_SHADER_WRITE_BIT to dstAccessMask VK_ACCESS_SHADER_READ_BIT Also insert buffer memory barrier just for the storage buffer I wanted to write Both my application behaves like the buffers are empty, and Nsight debugger also shows empty buffers (ssems like everything initialized to 0). Also, I tried the most trivial shader, writing value of 1 to the first element of uint buffer. Am I missing something trivial here? What could be an other way to debug this further?
  17. Hi, running Vulkan with the latest SDK, validation layers enabled I just got the following warning: That is really strange, because in DX11 we can have 15 constant buffers per shader stage. And my device (Nvidia GTX 1050 is DX11 compatible of course) Did anyone else run into the same issue? How is it usually handled? I would prefer not enforcing less amount of CBs for the Vulkan device and be as closely compliant to DX11 as possible. Any idea what could be the reason behind this limitation?
  18. Hi, I finally managed to get the DX11 emulating Vulkan device working but everything is flipped vertically now because Vulkan has a different clipping space. What are the best practices out there to keep these implementation consistent? I tried using a vertically flipped viewport, and while it works on Nvidia 1050, the Vulkan debug layer is throwing error messages that this is not supported in the spec so it might not work on others. There is also the possibility to flip the clip scpace position Y coordinate before writing out with vertex shader, but that requires changing and recompiling every shader. I could also bake it into the camera projection matrices, though I want to avoid that because then I need to track down for the whole engine where I upload matrices... Any chance of an easy extension or something? If not, I will probably go with changing the vertex shaders.
  19. I have a pretty good experience with multi gpu programming in D3D12. Now looking at Vulkan, although there are a few similarities, I cannot wrap my head around a few things due to the extremely sparse documentation (typical Khronos...) In D3D12 -> You create a resource on GPU0 that is visible to GPU1 by setting the VisibleNodeMask to (00000011 where last two bits set means its visible to GPU0 and GPU1) In Vulkan - I can see there is the VkBindImageMemoryDeviceGroupInfoKHR struct which you add to the pNext chain of VkBindImageMemoryInfoKHR and then call vkBindImageMemory2KHR. You also set the device indices which I assume is the same as the VisibleNodeMask except instead of a mask it is an array of indices. Till now it's fine. Let's look at a typical SFR scenario: Render left eye using GPU0 and right eye using GPU1 You have two textures. pTextureLeft is exclusive to GPU0 and pTextureRight is created on GPU1 but is visible to GPU0 so it can be sampled from GPU0 when we want to draw it to the swapchain. This is in the D3D12 world. How do I map this in Vulkan? Do I just set the device indices for pTextureRight as { 0, 1 } Now comes the command buffer submission part that is even more confusing. There is the struct VkDeviceGroupCommandBufferBeginInfoKHR. It accepts a device mask which I understand is similar to creating a command list with a certain NodeMask in D3D12. So for GPU1 -> Since I am only rendering to the pTextureRight, I need to set the device mask as 2? (00000010) For GPU0 -> Since I only render to pTextureLeft and finally sample pTextureLeft and pTextureRight to render to the swap chain, I need to set the device mask as 1? (00000001) The same applies to VkDeviceGroupSubmitInfoKHR? Now the fun part is it does not work . Both command buffers render to the textures correctly. I verified this by reading back the textures and storing as png. The left texture is sampled correctly in the final composite pass. But I get a black in the area where the right texture should appear. Is there something that I am missing in this? Here is a code snippet too void Init() { RenderTargetInfo info = {}; info.pDeviceIndices = { 0, 0 }; CreateRenderTarget(&info, &pTextureLeft); // Need to share this on both GPUs info.pDeviceIndices = { 0, 1 }; CreateRenderTarget(&info, &pTextureRight); } void DrawEye(CommandBuffer* pCmd, uint32_t eye) { // Do the draw // Begin with device mask depending on eye pCmd->Open((1 << eye)); // If eye is 0, we need to do some extra work to composite pTextureRight and pTextureLeft if (eye == 0) { DrawTexture(0, 0, width * 0.5, height, pTextureLeft); DrawTexture(width * 0.5, 0, width * 0.5, height, pTextureRight); } // Submit to the correct GPU pQueue->Submit(pCmd, (1 << eye)); } void Draw() { DrawEye(pRightCmd, 1); DrawEye(pLeftCmd, 0); }
  20. Hello guys, My math is failing and can't get my orthographic projection matrix to work in Vulkan 1.0 (my implementation works great in D3D11 and D3D12). Specifically, there's nothing being drawn on the screen when using an ortho matrix but my perspective projection matrix work fantastic! I use glm with defines GLM_FORCE_LEFT_HANDED and GLM_FORCE_DEPTH_ZERO_TO_ONE (to handle 0 to 1 depth). This is how i define my matrices: m_projection_matrix = glm::perspective(glm::radians(fov), aspect_ratio, 0.1f, 100.0f); m_ortho_matrix = glm::ortho(0.0f, (float)width, (float)height, 0.0f, 0.1f, 100.0f); // I also tried 0.0f and 1.0f for depth near and far, the same I set and work for D3D but in Vulkan it doesn't work either. Then I premultiply both matrices with a "fix matrix" to invert the Y axis: glm::mat4 matrix_fix = {1.0f, 0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}; m_projection_matrix = m_projection_matrix * matrix_fix; m_ortho_matrix = m_ortho_matrix * matrix_fix; This fix matrix works good in tandem with GLM_FORCE_DEPTH_ZERO_TO_ONE. Model/World matrix is the identity matrix: glm::mat4 m_world_matrix(1.0f); Then finally this is how i set my view matrix: // Yes, I use Euler angles (don't bring the gimbal lock topic here, lol). They work great with my cameras in D3D too! m_view_matrix = glm::yawPitchRoll(glm::radians(m_rotation.y), glm::radians(m_rotation.x), glm::radians(m_rotation.z)); m_view_matrix = glm::translate(m_view_matrix, -m_position); That's all guys, in my shaders I correctly multiply all 3 matrices with the position vector and as I said, the perspective matrix works really good but my ortho matrix displays no geometry. EDIT: My vertex data is also on the right track, I use the same geometry in D3D and it works great: 256.0f units means 256 points/dots/pixels wide. What could I possibly be doing wrong or missing? Big thanks guys any help would be greatly appreciated. Keep on coding, cheers.
  21. So I've been trying to implement a multi-threaded resource system w/ vulkan in my free time, where a thread can request a resource to be loaded, and it gets pushed into a queue. On another thread, the resource (as of right now, a mesh) gets loaded from a file, and I map the data to a staging buffer. The issue comes in where I record the command buffer to copy the data to a GPU buffer. I record a secondary command buffer w/ just the vkCmdCopyBuffer command, and push it to a queue to be executed from a primary command buffer on the main thread to a transfer-only queue. As far as I can tell, the staging works fine, and the mesh is drawn and looks perfectly fine, but my validation layers (VK_LAYER_LUNARG_standard_validation) spam tell me: "vkCmdBindIndexBuffer(): Cannot read invalid region of memory allocation 0x16 for bound Buffer object 0x15, please fill the memory before using," and the vertex buffer binding gives me an identical message. Both buffers were created with the proper bits, TRANSFER_SRC for the staging buffer, TRANSFER_DST for the gpu buffer (plus index and vertex buffer usage bits). I use Vulkan Memory Allocator from GPUOpen to handle buffer memory allocation, and I'm careful to make sure that the staging buffer is mapped properly and isn't deleted before the command finishes. The validation layers stop spamming telling me this error if I switch the copy commands to using primary buffers, even when recorded in the same way (i.e. just changing the level parameter), but everything I've seen recommends recording secondary command buffers simultaneously on worker threads, and submitting them on the main thread later. Any ideas on why my validation layers are freaking out, or did I just skip over something when reading the spec? Here's some relevant code:
  22. As the title says, I am explicitly creating a too small descriptor pool, which should NOT support the resources I am going to allocate from it. std::array<vk::DescriptorPoolSize, 3> type_count; // Initialize our pool with these values type_count[0].type = vk::DescriptorType::eCombinedImageSampler; type_count[0].descriptorCount = 0; type_count[1].type = vk::DescriptorType::eSampler; type_count[1].descriptorCount = 0; type_count[2].type = vk::DescriptorType::eUniformBuffer; type_count[2].descriptorCount = 0; vk::DescriptorPoolCreateInfo createInfo = vk::DescriptorPoolCreateInfo() .setPNext(nullptr) .setMaxSets(iMaxSets) .setPoolSizeCount(type_count.size()) .setPPoolSizes(type_count.data()); pool = aDevice.createDescriptorPool(createInfo); I have an allocation function which looks like this, I am allocating a uniform, image-combined sampler and a regular sampler. Though if my pool is empty this should not work? vk::DescriptorSetAllocateInfo alloc_info[1] = {}; alloc_info[0].pNext = NULL; alloc_info[0].setDescriptorPool(pool); alloc_info[0].setDescriptorSetCount(iNumToAllocate); alloc_info[0].setPSetLayouts(&iDescriptorLayouts); std::vector<vk::DescriptorSet> tDescriptors; tDescriptors.resize(iNumToAllocate); iDevice.allocateDescriptorSets(alloc_info, tDescriptors.data());
  23. I am looking at the SaschaWillems subpass example for getting some insight into subpass depdendencies but its hard to understand whats going on without any comments. Also there is not a lot of documentation on subpass dependencies overall. Looking at the code, I can see that user specifies the src subpass, dst subpass and src state, dst state. But there is no mention of which resource the dependency is on. Is a subpass dependency like a pipeline barrier. If yes, how does it issue the barrier? Is the pipeline barrier issued on all attachments in the subpass with the input src and dst access flags? Any explanation will really clear a lot of doubts on subpass dependencies. Thank you
  24. It is a bit unclear to me for what kind of tasks you would want to create a new command buffer/how to use them. is it ideal to have a command buffer per draw call? Per material call? Per render-pass? I know in Dx12 command lists can have complete rendering pipelines recorded, but I am a bit unsure how to see command buffers in Vulkan.
  25. I need to index into a texture array using indices which are not dynamically uniform. This works fine on NVIDIA chips but you can see the artifacts on AMD due to the wavefront problem. This means, a lot of pixel invocations get the wrong index value. I know you fix this by using NonUniformResourceIndex in hlsl. Is there an equivalent for Vulkan glsl? This is the shader code for reference. As you can see, index is an arbitrary value for each pixel and is not dynamically uniform. I fix this for hlsl by using NonUniformResourceIndex(index) layout(set = 0, binding = 0) uniform sampler textureSampler; layout(set = 0, binding = 1) uniform texture2D albedoMaps[256]; layout(location = 0) out vec4 oColor; void main() { uint index = calculate_arbitrary_texture_index(); vec2 texCoord = calculate_texcoord(); vec4 albedo = texture(sampler2D(albedoMaps[index], textureSampler), texCoord); oColor = albedo; } Thank you
  • 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!