Permalink
Browse files

thin3d: Cleanup some unused/uninitialized warnings.

  • Loading branch information...
unknownbrackets committed Jun 24, 2018
1 parent 4cfc6ee commit 5028486630989fdecc89ab453bafb1a92b5e0c81
@@ -102,7 +102,6 @@ const char *GetFn(const char *fn);
#define ELOG(...) XLOG_IMPL("E", __VA_ARGS__)
#define FLOG(...) do {XLOG_IMPL("F", __VA_ARGS__); Crash();} while (false)
// TODO: Win32 version using OutputDebugString
#else
#include <stdio.h>
@@ -240,7 +240,7 @@ void GLQueueRunner::RunInitSteps(const std::vector<GLRInitStep> &steps) {
}
case GLRInitStepType::CREATE_INPUT_LAYOUT:
{
GLRInputLayout *layout = step.create_input_layout.inputLayout;
// GLRInputLayout *layout = step.create_input_layout.inputLayout;
// Nothing to do unless we want to create vertexbuffer objects (GL 4.5)
break;
}
@@ -537,7 +537,6 @@ void GLQueueRunner::PerformRenderPass(const GLRStep &step) {
glBindVertexArray(globalVAO_);
}
GLRFramebuffer *fb = step.render.framebuffer;
GLRProgram *curProgram = nullptr;
int activeSlot = 0;
glActiveTexture(GL_TEXTURE0 + activeSlot);
@@ -547,15 +546,17 @@ void GLQueueRunner::PerformRenderPass(const GLRStep &step) {
int colorMask = -1;
int depthMask = -1;
int depthFunc = -1;
int logicOp = -1;
GLuint curArrayBuffer = (GLuint)-1;
GLuint curElemArrayBuffer = (GLuint)-1;
bool depthEnabled = false;
bool stencilEnabled = false;
bool blendEnabled = false;
bool cullEnabled = false;
bool ditherEnabled = false;
#ifndef USING_GLES2
int logicOp = -1;
bool logicEnabled = false;
#endif
GLuint blendEqColor = (GLuint)-1;
GLuint blendEqAlpha = (GLuint)-1;
@@ -14,9 +14,11 @@
#endif
static std::thread::id renderThreadId;
#if MAX_LOGLEVEL >= DEBUG_LEVEL
static bool OnRenderThread() {
return std::this_thread::get_id() == renderThreadId;
}
#endif
// Runs on the GPU thread.
void GLDeleter::Perform(GLRenderManager *renderManager) {
@@ -698,7 +700,7 @@ void GLPushBuffer::NextBuffer(size_t minSize) {
}
void GLPushBuffer::Defragment() {
_dbg_assert_(G3D, std::this_thread::get_id() != renderThreadId);
_dbg_assert_(G3D, !OnRenderThread());
if (buffers_.size() <= 1) {
// Let's take this chance to jetison localMemory we don't need.
@@ -64,7 +64,6 @@ void VulkanQueueRunner::ResizeReadbackBuffer(VkDeviceSize requiredSize) {
void VulkanQueueRunner::DestroyDeviceObjects() {
ILOG("VulkanQueueRunner::DestroyDeviceObjects");
VkDevice device = vulkan_->GetDevice();
vulkan_->Delete().QueueDeleteDeviceMemory(readbackMemory_);
vulkan_->Delete().QueueDeleteBuffer(readbackBuffer_);
readbackBufferSize_ = 0;
@@ -675,9 +674,8 @@ void VulkanQueueRunner::PerformRenderPass(const VKRStep &step, VkCommandBuffer c
barrier.subresourceRange.layerCount = 1;
barrier.subresourceRange.levelCount = 1;
barrier.image = iter.fb->color.image;
barrier.srcAccessMask = 0;
VkPipelineStageFlags srcStage;
VkPipelineStageFlags dstStage;
VkPipelineStageFlags srcStage{};
VkPipelineStageFlags dstStage{};
switch (barrier.oldLayout) {
case VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL:
barrier.srcAccessMask = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT | VK_ACCESS_COLOR_ATTACHMENT_READ_BIT;
@@ -729,7 +727,6 @@ void VulkanQueueRunner::PerformRenderPass(const VKRStep &step, VkCommandBuffer c
VKRFramebuffer *fb = step.render.framebuffer;
VkPipeline lastPipeline = VK_NULL_HANDLE;
VkDescriptorSet lastDescSet = VK_NULL_HANDLE;
auto &commands = step.commands;
@@ -248,7 +248,6 @@ class VulkanQueueRunner {
VkFramebuffer backbuffer_;
VkImage backbufferImage_;
VkFramebuffer curFramebuffer_ = VK_NULL_HANDLE;
VkRenderPass backbufferRenderPass_ = VK_NULL_HANDLE;
VkRenderPass framebufferRenderPass_ = VK_NULL_HANDLE;
@@ -91,7 +91,7 @@ void CreateImage(VulkanContext *vulkan, VkCommandBuffer cmd, VKRImage &img, int
break;
default:
Crash();
break;
return;
}
TransitionImageLayout2(cmd, img.image, 0, 1, aspects,
@@ -263,7 +263,6 @@ void VulkanRenderManager::DestroyBackbuffers() {
StopThread();
vulkan_->WaitUntilQueueIdle();
VkDevice device = vulkan_->GetDevice();
for (uint32_t i = 0; i < swapchainImageCount_; i++) {
vulkan_->Delete().QueueDeleteImageView(swapchainImages_[i].view);
}
@@ -289,7 +288,6 @@ VulkanRenderManager::~VulkanRenderManager() {
vkDestroySemaphore(device, acquireSemaphore_, nullptr);
vkDestroySemaphore(device, renderingCompleteSemaphore_, nullptr);
for (int i = 0; i < vulkan_->GetInflightFrames(); i++) {
VkCommandBuffer cmdBuf[2]{ frameData_[i].mainCmd, frameData_[i].initCmd };
vkFreeCommandBuffers(device, frameData_[i].cmdPoolInit, 1, &frameData_[i].initCmd);
vkFreeCommandBuffers(device, frameData_[i].cmdPoolMain, 1, &frameData_[i].mainCmd);
vkDestroyCommandPool(device, frameData_[i].cmdPoolInit, nullptr);
@@ -450,7 +448,7 @@ bool VulkanRenderManager::CopyFramebufferToMemorySync(VKRFramebuffer *src, int a
FlushSync();
Draw::DataFormat srcFormat;
Draw::DataFormat srcFormat = Draw::DataFormat::UNDEFINED;
if (aspectBits & VK_IMAGE_ASPECT_COLOR_BIT) {
if (src) {
switch (src->color.format) {
@@ -260,7 +260,6 @@ class OpenGLShaderModule : public ShaderModule {
ShaderLanguage language_;
GLRShader *shader_ = nullptr;
GLuint glstage_ = 0;
bool ok_ = false;
std::string source_; // So we can recompile in case of context loss.
};
@@ -1039,8 +1038,6 @@ OpenGLInputLayout::~OpenGLInputLayout() {
}
void OpenGLInputLayout::Compile(const InputLayoutDesc &desc) {
int semMask = 0;
// TODO: This is only accurate if there's only one stream. But whatever, for now we
// never use multiple streams anyway.
stride = (GLsizei)desc.bindings[0].stride;
@@ -707,7 +707,6 @@ bool VKTexture::Create(VkCommandBuffer cmd, VulkanPushBuffer *push, const Textur
vkTex_ = new VulkanTexture(vulkan_, alloc);
vkTex_->SetTag(desc.tag);
VkFormat vulkanFormat = DataFormatToVulkan(format_);
int stride = desc.width * (int)DataFormatSizeInBytes(format_);
int bpp = GetBpp(vulkanFormat);
int bytesPerPixel = bpp / 8;
int usageBits = VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_SAMPLED_BIT;

0 comments on commit 5028486

Please sign in to comment.