Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
vulkan: Support desktop GLSL shaders, mat_spec shader inputs via UBOs
  • Loading branch information
rdb committed Jun 24, 2020
1 parent 08133d8 commit eaf3213
Show file tree
Hide file tree
Showing 10 changed files with 530 additions and 144 deletions.
2 changes: 1 addition & 1 deletion panda/src/shaderpipeline/shaderCompilerGlslang.cxx
Expand Up @@ -379,7 +379,7 @@ compile_now(ShaderModule::Stage stage, std::istream &in,
);
}
}
shader.setEnvClient(glslang::EShClient::EShClientVulkan, glslang::EShTargetVulkan_1_0);
shader.setEnvClient(glslang::EShClient::EShClientOpenGL, glslang::EShTargetOpenGL_450);
shader.setEnvTarget(glslang::EShTargetSpv, glslang::EShTargetSpv_1_0);

// This will squelch the warnings about missing bindings and locations, since
Expand Down
9 changes: 9 additions & 0 deletions panda/src/vulkandisplay/config_vulkandisplay.cxx
Expand Up @@ -48,6 +48,15 @@ ConfigVariableInt64 vulkan_memory_page_size
"several pages will be allocated at application start due to the "
"need for pages with varying memory types."));

ConfigVariableInt64 vulkan_global_uniform_buffer_size
("vulkan-global-uniform-buffer-size", 64 * 1024,
PRC_DESC("This value indicates how large the uniform buffer should be that is "
"allocated to contain all of the global uniforms values used by all "
"shaders in a give frame. To optimize this value, enable "
"\"notify-level-vulkandisplay debug\" and look for the highest value "
"in the message \"Used at most # bytes of global uniform buffer.\" "
"in the most complex scene, then add a generous safety margin."));

#define VK_ERROR_INVALID_SHADER_NV -1000012000

/**
Expand Down
1 change: 1 addition & 0 deletions panda/src/vulkandisplay/config_vulkandisplay.h
Expand Up @@ -23,6 +23,7 @@ NotifyCategoryDecl(vulkandisplay, EXPCL_VULKANDISPLAY, EXPTP_VULKANDISPLAY);

extern ConfigVariableInt vulkan_color_palette_size;
extern ConfigVariableInt64 vulkan_memory_page_size;
extern ConfigVariableInt64 vulkan_global_uniform_buffer_size;

extern EXPCL_VULKANDISPLAY void init_libvulkandisplay();
extern "C" EXPCL_VULKANDISPLAY int get_pipe_type_p3vulkandisplay();
Expand Down
38 changes: 0 additions & 38 deletions panda/src/vulkandisplay/vulkanGraphicsStateGuardian.I
Expand Up @@ -11,44 +11,6 @@
* @date 2016-02-16
*/

/**
* Copy constructor for DescriptorSetKey.
*/
INLINE VulkanGraphicsStateGuardian::DescriptorSetKey::
DescriptorSetKey(const DescriptorSetKey &copy) :
_tex_attrib(copy._tex_attrib),
_shader_attrib(copy._shader_attrib) {
}

/**
* Move constructor for DescriptorSetKey, defined for efficiency (so that we
* don't have to increase and decrease the reference count when moving this
* object).
*/
INLINE VulkanGraphicsStateGuardian::DescriptorSetKey::
DescriptorSetKey(DescriptorSetKey &&from) noexcept :
_tex_attrib(std::move(from._tex_attrib)),
_shader_attrib(std::move(from._shader_attrib)) {
}

/**
* Copy assignment operator for DescriptorSetKey.
*/
INLINE void VulkanGraphicsStateGuardian::DescriptorSetKey::
operator = (const DescriptorSetKey &copy) {
_tex_attrib = copy._tex_attrib;
_shader_attrib = copy._shader_attrib;
}

/**
* Move assignment operator for DescriptorSetKey.
*/
INLINE void VulkanGraphicsStateGuardian::DescriptorSetKey::
operator = (DescriptorSetKey &&from) noexcept {
_tex_attrib = std::move(from._tex_attrib);
_shader_attrib = std::move(from._shader_attrib);
}

/**
* Returns true if these two DescriptorSetKey objects are identical.
*/
Expand Down

0 comments on commit eaf3213

Please sign in to comment.