Minimize the Adreno shader compiler bug repro test

This commit is contained in:
Henrik Rydgård 2021-01-30 10:21:14 +01:00
parent c18142b41e
commit c251d69eab
2 changed files with 6 additions and 9 deletions

View file

@ -215,7 +215,7 @@ bool VKShaderModule::Compile(VulkanContext *vulkan, ShaderLanguage language, con
std::vector<uint32_t> spirv; std::vector<uint32_t> spirv;
std::string errorMessage; std::string errorMessage;
if (!GLSLtoSPV(vkstage_, source_.c_str(), GLSLVariant::VULKAN, spirv, &errorMessage)) { if (!GLSLtoSPV(vkstage_, source_.c_str(), GLSLVariant::VULKAN, spirv, &errorMessage)) {
INFO_LOG(G3D, "Shader compile to module failed: %s", errorMessage.c_str()); WARN_LOG(G3D, "Shader compile to module failed: %s", errorMessage.c_str());
return false; return false;
} }
@ -231,6 +231,7 @@ bool VKShaderModule::Compile(VulkanContext *vulkan, ShaderLanguage language, con
if (vulkan->CreateShaderModule(spirv, &module_)) { if (vulkan->CreateShaderModule(spirv, &module_)) {
ok_ = true; ok_ = true;
} else { } else {
WARN_LOG(G3D, "vkCreateShaderModule failed");
ok_ = false; ok_ = false;
} }
return ok_; return ok_;
@ -1281,7 +1282,7 @@ ShaderModule *VKContext::CreateShaderModule(ShaderStage stage, ShaderLanguage la
if (shader->Compile(vulkan_, language, data, size)) { if (shader->Compile(vulkan_, language, data, size)) {
return shader; return shader;
} else { } else {
ERROR_LOG(G3D, "Failed to compile shader: %s", (const char *)data); ERROR_LOG(G3D, "Failed to compile shader:\n%s", (const char *)data);
shader->Release(); shader->Release();
return nullptr; return nullptr;
} }

View file

@ -82,16 +82,12 @@ static const std::vector<Draw::ShaderSource> fsAdrenoLogicTest = {
R"(#version 450 R"(#version 450
#extension GL_ARB_separate_shader_objects : enable #extension GL_ARB_separate_shader_objects : enable
#extension GL_ARB_shading_language_420pack : enable #extension GL_ARB_shading_language_420pack : enable
precision lowp float; layout(location = 0) in vec4 oColor0;
layout(location = 0) flat in lowp vec4 oColor0;
layout(location = 1) in highp vec2 oTexCoord0; layout(location = 1) in highp vec2 oTexCoord0;
layout(location = 0) out vec4 fragColor0; layout(location = 0) out vec4 fragColor0;
layout(set = 0, binding = 1) uniform sampler2D Sampler0; layout(set = 0, binding = 1) uniform sampler2D Sampler0;
void main() { void main() {
vec4 t = texture(Sampler0, oTexCoord0).aaaa; vec4 v = texture(Sampler0, oTexCoord0).aaaa * oColor0;
vec4 p = oColor0;
vec4 v = p * t;
v.rgb = clamp(v.rgb * 2.0, 0.0, 1.0);
if (v.r < 0.2 && v.g < 0.2 && v.b < 0.2) discard; if (v.r < 0.2 && v.g < 0.2 && v.b < 0.2) discard;
fragColor0 = vec4(0.0, 1.0, 0.0, 1.0); fragColor0 = vec4(0.0, 1.0, 0.0, 1.0);
})" })"
@ -126,7 +122,7 @@ static const std::vector<Draw::ShaderSource> vsAdrenoLogicTest = {
"layout (location = 0) in vec4 pos;\n" "layout (location = 0) in vec4 pos;\n"
"layout (location = 1) in vec4 inColor;\n" "layout (location = 1) in vec4 inColor;\n"
"layout (location = 2) in vec2 inTexCoord;\n" "layout (location = 2) in vec2 inTexCoord;\n"
"layout (location = 0) out lowp vec4 outColor;\n" "layout (location = 0) out vec4 outColor;\n"
"layout (location = 1) out highp vec2 outTexCoord;\n" "layout (location = 1) out highp vec2 outTexCoord;\n"
"out gl_PerVertex { vec4 gl_Position; };\n" "out gl_PerVertex { vec4 gl_Position; };\n"
"void main() {\n" "void main() {\n"