More zero-initialization. Fix scope issue, MSVC's optimizer was aggressive enough that this was a problem. Fixes textures in release mode.

This commit is contained in:
Henrik Rydgard committed 2016-03-20 19:30:11 +01:00
1 parent 52e7f06908
commit 55ef97639a
5 files changed
+14 -9

No files matched your search

+3 -3
View File
@@ -394,6 +394,7 @@ VkDescriptorSet DrawEngineVulkan::GetDescriptorSet(VkImageView imageView, VkSamp
VkDescriptorSet desc;
VkDescriptorSetAllocateInfo descAlloc;
VkDescriptorImageInfo tex;
descAlloc.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO;
descAlloc.pNext = nullptr;
descAlloc.pSetLayouts = &descriptorSetLayout_;
@@ -408,7 +409,6 @@ VkDescriptorSet DrawEngineVulkan::GetDescriptorSet(VkImageView imageView, VkSamp
// Main texture
int n = 0;
if (imageView) {
VkDescriptorImageInfo tex;
// TODO: Also support LAYOUT_GENERAL to be able to texture from framebuffers without transitioning them?
tex.imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
tex.imageView = imageView;
@@ -480,8 +480,8 @@ void DrawEngineVulkan::DoFlush(VkCommandBuffer cmd) {
bool useHWTransform = CanUseHardwareTransform(prim);
VulkanVertexShader *vshader;
VulkanFragmentShader *fshader;
VulkanVertexShader *vshader = nullptr;
VulkanFragmentShader *fshader = nullptr;
// TODO: Keep these between calls if not dirty.
uint32_t baseUBOOffset = 0;
+3
View File
@@ -175,6 +175,9 @@ ShaderManagerVulkan::ShaderManagerVulkan(VulkanContext *vulkan)
: vulkan_(vulkan), lastVShader_(nullptr), lastFShader_(nullptr), globalDirty_(0xFFFFFFFF) {
codeBuffer_ = new char[16384];
uboAlignment_ = vulkan_->GetPhysicalDeviceProperties().limits.minUniformBufferOffsetAlignment;
memset(&ub_base, 0, sizeof(ub_base));
memset(&ub_lights, 0, sizeof(ub_lights));
memset(&ub_bones, 0, sizeof(ub_bones));
}
ShaderManagerVulkan::~ShaderManagerVulkan() {
+5 -2
View File
@@ -95,7 +95,7 @@ VkSampler SamplerCache::GetOrCreateSampler(const SamplerCacheKey &key) {
samp.compareEnable = false;
samp.compareOp = VK_COMPARE_OP_ALWAYS;
samp.flags = 0;
samp.magFilter = (key.magFilt & 1) ? VK_FILTER_LINEAR : VK_FILTER_NEAREST;
samp.magFilter = key.magFilt ? VK_FILTER_LINEAR : VK_FILTER_NEAREST;
samp.minFilter = key.minFilt ? VK_FILTER_LINEAR : VK_FILTER_NEAREST; // TODO: Aniso
samp.mipmapMode = VK_SAMPLER_MIPMAP_MODE_NEAREST; // key.4) ? ((key.magFilt & 2) ? VK_SAMPLER_MIPMAP_MODE_LINEAR : VK_SAMPLER_MIPMAP_MODE_NEAREST) : VK_SAMPLER_MIPMAP_MODE_BASE;
samp.maxAnisotropy = 1.0f;
@@ -111,7 +111,10 @@ VkSampler SamplerCache::GetOrCreateSampler(const SamplerCacheKey &key) {
return sampler;
}
TextureCacheVulkan::TextureCacheVulkan(VulkanContext *vulkan) : vulkan_(vulkan), samplerCache_(vulkan), cacheSizeEstimate_(0), secondCacheSizeEstimate_(0), clearCacheNextFrame_(false), lowMemoryMode_(false), clutBuf_(NULL), texelsScaledThisFrame_(0) {
TextureCacheVulkan::TextureCacheVulkan(VulkanContext *vulkan)
: vulkan_(vulkan), samplerCache_(vulkan), cacheSizeEstimate_(0), secondCacheSizeEstimate_(0),
clearCacheNextFrame_(false), lowMemoryMode_(false), clutBuf_(NULL), texelsScaledThisFrame_(0),
clutAlphaLinear_(false) {
timesInvalidatedAllThisFrame_ = 0;
lastBoundTexture = nullptr;
decimationCounter_ = TEXCACHE_DECIMATION_INTERVAL;
-1
View File
@@ -170,7 +170,6 @@ private:
u16 clutAlphaLinearColor_;
CachedTextureVulkan *lastBoundTexture;
float maxAnisotropyLevel;
int decimationCounter_;
int texelsScaledThisFrame_;
+3 -3
View File
@@ -345,6 +345,7 @@ public:
VulkanTexture(VulkanContext *vulkan)
: vulkan_(vulkan), image(nullptr), imageLayout(VK_IMAGE_LAYOUT_UNDEFINED), mem(nullptr), view(nullptr), tex_width(0), tex_height(0), format_(VK_FORMAT_UNDEFINED),
mappableImage(nullptr), mappableMemory(nullptr), needStaging(false) {
memset(&mem_reqs, 0, sizeof(mem_reqs));
}
~VulkanTexture() {
Destroy();
@@ -383,7 +384,6 @@ private:
class VulkanFramebuffer {
public:
void Create(VulkanContext *vulkan, int w, int h, VkFormat format);
// void TransitionToImage()
void BeginPass(VkCommandBuffer cmd);
void EndPass(VkCommandBuffer cmd);
@@ -407,7 +407,7 @@ public:
VulkanPushBuffer(VulkanContext *vulkan, size_t size) : offset_(0), size_(size), writePtr_(nullptr), deviceMemory_(nullptr) {
VkDevice device = vulkan->GetDevice();
VkBufferCreateInfo b;
VkBufferCreateInfo b = {};
b.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO;
b.pNext = nullptr;
b.size = size;
@@ -420,7 +420,7 @@ public:
assert(VK_SUCCESS == res);
// Okay, that's the buffer. Now let's allocate some memory for it.
VkMemoryAllocateInfo alloc;
VkMemoryAllocateInfo alloc = {};
alloc.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO;
alloc.pNext = nullptr;
vulkan->MemoryTypeFromProperties(0xFFFFFFFF, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT, &alloc.memoryTypeIndex);