|
|
@@ -18,7 +18,6 @@ namespace anki
|
|
|
|
|
|
void ShaderCompilerOptions::setFromGrManager(const GrManager& gr)
|
|
|
{
|
|
|
- m_gpuVendor = gr.getGpuVendor();
|
|
|
#if ANKI_GR_BACKEND == ANKI_GR_BACKEND_VULKAN
|
|
|
m_outLanguage = ShaderLanguage::SPIRV;
|
|
|
#else
|
|
|
@@ -41,7 +40,7 @@ static const char* SHADER_HEADER = R"(#version 450 core
|
|
|
# define ANKI_TEX_BINDING(set_, binding_) binding = set_ * %u + binding_
|
|
|
# define ANKI_IMAGE_BINDING(set_, binding_) binding = set_ * %u + binding_
|
|
|
# define ANKI_SPEC_CONST(binding_, type_, name_) const type_ name_ = _anki_spec_const_ ## binding_
|
|
|
-# define ANKI_PUSH_CONSTANTS(struct_, name_) layout(location = 0) uniform struct_ name_
|
|
|
+# define ANKI_PUSH_CONSTANTS(struct_, name_) layout(location = 0, row_major) uniform struct_ name_
|
|
|
#else
|
|
|
# define gl_VertexID gl_VertexIndex
|
|
|
# define gl_InstanceID gl_InstanceIndex
|
|
|
@@ -50,7 +49,8 @@ static const char* SHADER_HEADER = R"(#version 450 core
|
|
|
# define ANKI_SS_BINDING(set_, binding_) set = set_, binding = %u + binding_
|
|
|
# define ANKI_IMAGE_BINDING(set_, binding_) set = set_, binding = %u + binding_
|
|
|
# define ANKI_SPEC_CONST(binding_, type_, name_) layout(constant_id = binding_) const type_ name_ = type_(0)
|
|
|
-# define ANKI_PUSH_CONSTANTS(struct_, name_) layout(push_constant) uniform pushConst_ {struct_ name_;}
|
|
|
+# define ANKI_PUSH_CONSTANTS(struct_, name_) layout(push_constant, row_major, std140) \
|
|
|
+ uniform pushConst_ {struct_ name_;}
|
|
|
#endif
|
|
|
|
|
|
#if %u
|
|
|
@@ -289,7 +289,7 @@ Error ShaderCompiler::compile(CString source, const ShaderCompilerOptions& optio
|
|
|
|
|
|
fullSrc.sprintf(SHADER_HEADER,
|
|
|
(options.m_outLanguage == ShaderLanguage::GLSL) ? "GL" : "VULKAN",
|
|
|
- &GPU_VENDOR_STR[options.m_gpuVendor][0],
|
|
|
+ &GPU_VENDOR_STR[options.m_gpuCapabilities.m_gpuVendor][0],
|
|
|
SHADER_NAME[options.m_shaderType],
|
|
|
// GL bindings
|
|
|
MAX_UNIFORM_BUFFER_BINDINGS,
|
|
|
@@ -302,7 +302,7 @@ Error ShaderCompiler::compile(CString source, const ShaderCompilerOptions& optio
|
|
|
MAX_TEXTURE_BINDINGS + MAX_UNIFORM_BUFFER_BINDINGS,
|
|
|
MAX_TEXTURE_BINDINGS + MAX_UNIFORM_BUFFER_BINDINGS + MAX_STORAGE_BUFFER_BINDINGS,
|
|
|
// Ballot
|
|
|
- !!(options.m_gpuCapabilities & GpuDeviceCapabilitiesBit::SHADER_BALLOT) ? 1u : 0u,
|
|
|
+ !!(options.m_gpuCapabilities.m_shaderSubgroups) ? 1u : 0u,
|
|
|
&source[0]);
|
|
|
|
|
|
ctx.m_src = fullSrc.toCString();
|