Minor vulkan updates to match the latest SDK/validator

This commit is contained in:
Henrik Rydgard 2016-05-14 16:29:40 +02:00
parent 0541fe36df
commit 51bcb02921
6 changed files with 20 additions and 17 deletions

View File

@ -71,6 +71,7 @@ static const char tex_vs[] = R"(#version 400
layout (location = 0) in vec3 a_position;
layout (location = 1) in vec2 a_texcoord0;
layout (location = 0) out vec2 v_texcoord0;
out gl_PerVertex { vec4 gl_Position; };
void main() {
v_texcoord0 = a_texcoord0;
gl_Position = vec4(a_position, 1.0);

View File

@ -858,12 +858,14 @@ void TextureCacheVulkan::ApplyTextureFramebuffer(VkCommandBuffer cmd, TexCacheEn
sampler = GetOrCreateSampler(samplerKey);
*/
SamplerCacheKey key;
UpdateSamplingParams(*entry, key);
key.mipEnable = false;
sampler = samplerCache_.GetOrCreateSampler(key);
if (entry->vkTex) {
SamplerCacheKey key;
UpdateSamplingParams(*entry, key);
key.mipEnable = false;
sampler = samplerCache_.GetOrCreateSampler(key);
lastBoundTexture = nullptr;
lastBoundTexture = nullptr;
}
}
bool TextureCacheVulkan::SetOffsetTexture(u32 offset) {

View File

@ -223,7 +223,7 @@ bool GenerateVulkanGLSLVertexShader(const ShaderID &id, char *buffer, bool *uses
WRITE(p, " return vec4(v.x, v.y, z * v.w, v.w);\n");
WRITE(p, "}\n\n");
}
WRITE(p, "out gl_PerVertex { vec4 gl_Position; };\n");
WRITE(p, "void main() {\n");
if (!useHWTransform) {

View File

@ -125,16 +125,12 @@ static VkBool32 VKAPI_CALL Vulkan_Dbg(VkDebugReportFlagsEXT msgFlags, VkDebugRep
}
message << "[" << pLayerPrefix << "] " << ObjTypeToString(objType) << " Code " << msgCode << " : " << pMsg << "\n";
// validator or glslang bug (validator #298)
if (msgCode == 15 && startsWith(pMsg, "Shader requires"))
return false;
// layout barrier. TODO: This one I should fix.
if (msgCode == 7 && startsWith(pMsg, "Cannot submit cmd buffer"))
return false;
// memory free'd while still holding a ref. validator bug? or worrying...
if (msgCode == 6 && startsWith(pMsg, "Attempting to free memory"))
// Another validator bug (vkBindImageMemory false positive)
if (msgCode == 15 && startsWith(pMsg, "In vkBindImageMemory, attempting"))
return false;
// another validator bug (validator #299)

View File

@ -84,7 +84,7 @@ static const char * const hlslVsCol =
"}\n";
static const char * const vulkan_vsCol =
"#version 140\n"
"#version 400\n"
"#extension GL_ARB_separate_shader_objects : enable\n"
"#extension GL_ARB_shading_language_420pack : enable\n"
"layout (std140, set = 0, binding = 0) uniform bufferVals {\n"
@ -93,6 +93,7 @@ static const char * const vulkan_vsCol =
"layout (location = 0) in vec4 pos;\n"
"layout (location = 1) in vec4 inColor;\n"
"layout (location = 0) out vec4 outColor;\n"
"out gl_PerVertex { vec4 gl_Position; };\n"
"void main() {\n"
" outColor = inColor;\n"
" gl_Position = myBufferVals.WorldViewProj * pos;\n"
@ -125,7 +126,7 @@ static const char * const hlslVsTexCol =
"}\n";
static const char * const vulkan_vsTexCol =
"#version 140\n"
"#version 400\n"
"#extension GL_ARB_separate_shader_objects : enable\n"
"#extension GL_ARB_shading_language_420pack : enable\n"
"layout (std140, set = 0, binding = 0) uniform bufferVals {\n"
@ -136,6 +137,7 @@ static const char * const vulkan_vsTexCol =
"layout (location = 2) in vec2 inTexCoord;\n"
"layout (location = 0) out vec4 outColor;\n"
"layout (location = 1) out vec2 outTexCoord;\n"
"out gl_PerVertex { vec4 gl_Position; };\n"
"void main() {\n"
" outColor = inColor;\n"
" outTexCoord = inTexCoord;\n"

View File

@ -194,7 +194,9 @@ public:
bool Compile(VulkanContext *vulkan, const char *source);
const std::string &GetSource() const { return source_; }
~Thin3DVKShader() {
vkDestroyShaderModule(device_, module_, nullptr);
if (module_) {
vkDestroyShaderModule(device_, module_, nullptr);
}
}
VkShaderModule Get() const { return module_; }
@ -548,7 +550,6 @@ public:
}
bool Create(T3DTextureType type, T3DImageFormat format, int width, int height, int depth, int mipLevels) override {
ILOG("texture created: %p", this);
format_ = format;
mipLevels_ = mipLevels;
width_ = width;
@ -567,7 +568,6 @@ public:
private:
void Destroy() {
ILOG("texture destroyed: %p", this);
if (vkTex_) {
vkTex_->Destroy();
delete vkTex_;
@ -1012,6 +1012,7 @@ Thin3DShader *Thin3DVKContext::CreateVertexShader(const char *glsl_source, const
if (shader->Compile(vulkan_, vulkan_source)) {
return shader;
} else {
ELOG("Failed to compile shader: %s", vulkan_source);
shader->Release();
return nullptr;
}
@ -1022,6 +1023,7 @@ Thin3DShader *Thin3DVKContext::CreateFragmentShader(const char *glsl_source, con
if (shader->Compile(vulkan_, vulkan_source)) {
return shader;
} else {
ELOG("Failed to compile shader: %s", vulkan_source);
shader->Release();
return nullptr;
}