mirror of https://github.com/AxioDL/boo.git
Merge branch 'master' of https://github.com/AxioDL/boo
This commit is contained in:
commit
d04c19a258
|
@ -17,7 +17,7 @@ add_subdirectory(xxhash)
|
|||
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
find_package(IPP)
|
||||
if (IPP_FOUND)
|
||||
add_definitions(-DINTEL_IPP=1)
|
||||
list(APPEND _BOO_SYS_DEFINES -DINTEL_IPP=1)
|
||||
include_directories(${IPP_INCLUDE_DIRS})
|
||||
list(APPEND _BOO_SYS_LIBS ${IPP_LIBRARIES})
|
||||
endif ()
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "boo/graphicsdev/GL.hpp"
|
||||
#include "boo/graphicsdev/glew.h"
|
||||
#include "boo/IApplication.hpp"
|
||||
#include "Common.hpp"
|
||||
#include <thread>
|
||||
#include <condition_variable>
|
||||
|
@ -1123,7 +1124,8 @@ struct GLCommandQueue : IGraphicsCommandQueue
|
|||
|
||||
static void RenderingWorker(GLCommandQueue* self)
|
||||
{
|
||||
logvisor::RegisterThreadName("Boo GL Rendering Thread");
|
||||
std::string thrName = APP->getFriendlyName() + " GL Rendering Thread";
|
||||
logvisor::RegisterThreadName(thrName.c_str());
|
||||
{
|
||||
std::unique_lock<std::mutex> lk(self->m_initmt);
|
||||
self->m_parent->makeCurrent();
|
||||
|
|
|
@ -26,10 +26,11 @@ class VulkanDataFactoryImpl;
|
|||
struct VulkanShareableShader : IShareableShader<VulkanDataFactoryImpl, VulkanShareableShader>
|
||||
{
|
||||
VkDevice m_dev;
|
||||
std::vector<unsigned int> m_shader;
|
||||
VkShaderModule m_shader;
|
||||
VulkanShareableShader(VulkanDataFactoryImpl& fac, uint64_t srcKey, uint64_t binKey,
|
||||
VkDevice dev, const std::vector<unsigned int>& s)
|
||||
VkDevice dev, VkShaderModule s)
|
||||
: IShareableShader(fac, srcKey, binKey), m_dev(dev), m_shader(s) {}
|
||||
~VulkanShareableShader() { vk::DestroyShaderModule(m_dev, m_shader, nullptr); }
|
||||
};
|
||||
|
||||
class VulkanDataFactoryImpl : public VulkanDataFactory, public GraphicsDataFactoryHead
|
||||
|
@ -328,9 +329,9 @@ void VulkanContext::initVulkan(const char* appName)
|
|||
|
||||
#ifndef NDEBUG
|
||||
m_layerNames.push_back("VK_LAYER_LUNARG_core_validation");
|
||||
m_layerNames.push_back("VK_LAYER_LUNARG_object_tracker");
|
||||
//m_layerNames.push_back("VK_LAYER_LUNARG_parameter_validation");
|
||||
//m_layerNames.push_back("VK_LAYER_GOOGLE_threading");
|
||||
//m_layerNames.push_back("VK_LAYER_LUNARG_object_tracker");
|
||||
m_layerNames.push_back("VK_LAYER_LUNARG_parameter_validation");
|
||||
m_layerNames.push_back("VK_LAYER_GOOGLE_threading");
|
||||
#endif
|
||||
|
||||
demo_check_layers(m_instanceLayerProperties, m_layerNames);
|
||||
|
@ -1910,23 +1911,11 @@ public:
|
|||
|
||||
VkPipelineShaderStageCreateInfo stages[2] = {};
|
||||
|
||||
VkShaderModuleCreateInfo smCreateInfo = {};
|
||||
smCreateInfo.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO;
|
||||
VkShaderModule vertModule, fragModule;
|
||||
const auto& vertShader = m_vert.get().m_shader;
|
||||
smCreateInfo.codeSize = vertShader.size() * sizeof(unsigned int);
|
||||
smCreateInfo.pCode = vertShader.data();
|
||||
ThrowIfFailed(vk::CreateShaderModule(m_ctx->m_dev, &smCreateInfo, nullptr, &vertModule));
|
||||
const auto& fragShader = m_frag.get().m_shader;
|
||||
smCreateInfo.codeSize = fragShader.size() * sizeof(unsigned int);
|
||||
smCreateInfo.pCode = fragShader.data();
|
||||
ThrowIfFailed(vk::CreateShaderModule(m_ctx->m_dev, &smCreateInfo, nullptr, &fragModule));
|
||||
|
||||
stages[0].sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
|
||||
stages[0].pNext = nullptr;
|
||||
stages[0].flags = 0;
|
||||
stages[0].stage = VK_SHADER_STAGE_VERTEX_BIT;
|
||||
stages[0].module = vertModule;
|
||||
stages[0].module = m_vert.get().m_shader;
|
||||
stages[0].pName = "main";
|
||||
stages[0].pSpecializationInfo = nullptr;
|
||||
|
||||
|
@ -1934,7 +1923,7 @@ public:
|
|||
stages[1].pNext = nullptr;
|
||||
stages[1].flags = 0;
|
||||
stages[1].stage = VK_SHADER_STAGE_FRAGMENT_BIT;
|
||||
stages[1].module = fragModule;
|
||||
stages[1].module = m_frag.get().m_shader;
|
||||
stages[1].pName = "main";
|
||||
stages[1].pSpecializationInfo = nullptr;
|
||||
|
||||
|
@ -2051,9 +2040,6 @@ public:
|
|||
ThrowIfFailed(vk::CreateGraphicsPipelines(m_ctx->m_dev, m_pipelineCache, 1, &pipelineCreateInfo,
|
||||
nullptr, &m_pipeline));
|
||||
|
||||
vk::DestroyShaderModule(m_ctx->m_dev, vertModule, nullptr);
|
||||
vk::DestroyShaderModule(m_ctx->m_dev, fragModule, nullptr);
|
||||
|
||||
m_vert.reset();
|
||||
m_frag.reset();
|
||||
}
|
||||
|
@ -2349,7 +2335,8 @@ struct VulkanShaderDataBinding : GraphicsDataNode<IShaderDataBinding>
|
|||
writes[totalWrites].dstSet = m_descSets[b];
|
||||
writes[totalWrites].descriptorCount = 1;
|
||||
writes[totalWrites].descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER;
|
||||
writes[totalWrites].pImageInfo = GetTextureGPUResource(m_texs[i].tex.get(), b, m_texs[i].idx, m_texs[i].depth);
|
||||
writes[totalWrites].pImageInfo = GetTextureGPUResource(m_texs[i].tex.get(), b,
|
||||
m_texs[i].idx, m_texs[i].depth);
|
||||
writes[totalWrites].dstArrayElement = 0;
|
||||
writes[totalWrites].dstBinding = binding;
|
||||
m_knownViewHandles[b][i] = writes[totalWrites].pImageInfo->imageView;
|
||||
|
@ -2382,7 +2369,8 @@ struct VulkanShaderDataBinding : GraphicsDataNode<IShaderDataBinding>
|
|||
{
|
||||
if (i<m_texs.size() && m_texs[i].tex)
|
||||
{
|
||||
const VkDescriptorImageInfo* resComp = GetTextureGPUResource(m_texs[i].tex.get(), b, m_texs[i].idx, m_texs[i].depth);
|
||||
const VkDescriptorImageInfo* resComp = GetTextureGPUResource(m_texs[i].tex.get(), b,
|
||||
m_texs[i].idx, m_texs[i].depth);
|
||||
if (resComp->imageView != m_knownViewHandles[b][i])
|
||||
{
|
||||
writes[totalWrites].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
|
||||
|
@ -2983,7 +2971,8 @@ void VulkanTextureD::update(int b)
|
|||
|
||||
/* map memory and copy staging data */
|
||||
uint8_t* mappedData;
|
||||
ThrowIfFailed(vk::MapMemory(m_q->m_ctx->m_dev, m_cpuMem, m_cpuOffsets[b], m_cpuSz, 0, reinterpret_cast<void**>(&mappedData)));
|
||||
ThrowIfFailed(vk::MapMemory(m_q->m_ctx->m_dev, m_cpuMem, m_cpuOffsets[b], m_cpuSz, 0,
|
||||
reinterpret_cast<void**>(&mappedData)));
|
||||
memmove(mappedData, m_stagingBuf.get(), m_cpuSz);
|
||||
vk::UnmapMemory(m_q->m_ctx->m_dev, m_cpuMem);
|
||||
|
||||
|
@ -3246,10 +3235,15 @@ boo::ObjToken<IShaderPipeline> VulkanDataFactory::Context::newShaderPipeline
|
|||
binHashes[0] = CompileVert(vertBlob, vertSource, srcHashes[0], factory);
|
||||
}
|
||||
|
||||
VkShaderModule vertModule;
|
||||
smCreateInfo.codeSize = useVertBlob->size() * sizeof(unsigned int);
|
||||
smCreateInfo.pCode = useVertBlob->data();
|
||||
ThrowIfFailed(vk::CreateShaderModule(factory.m_ctx->m_dev, &smCreateInfo, nullptr, &vertModule));
|
||||
|
||||
auto it =
|
||||
factory.m_sharedShaders.emplace(std::make_pair(binHashes[0],
|
||||
std::make_unique<VulkanShareableShader>(factory, srcHashes[0], binHashes[0],
|
||||
factory.m_ctx->m_dev, *useVertBlob))).first;
|
||||
factory.m_ctx->m_dev, vertModule))).first;
|
||||
vertShader = it->second->lock();
|
||||
}
|
||||
auto fragFind = binHashes[1] ? factory.m_sharedShaders.find(binHashes[1]) :
|
||||
|
@ -3272,10 +3266,15 @@ boo::ObjToken<IShaderPipeline> VulkanDataFactory::Context::newShaderPipeline
|
|||
binHashes[1] = CompileFrag(fragBlob, fragSource, srcHashes[1], factory);
|
||||
}
|
||||
|
||||
VkShaderModule fragModule;
|
||||
smCreateInfo.codeSize = useFragBlob->size() * sizeof(unsigned int);
|
||||
smCreateInfo.pCode = useFragBlob->data();
|
||||
ThrowIfFailed(vk::CreateShaderModule(factory.m_ctx->m_dev, &smCreateInfo, nullptr, &fragModule));
|
||||
|
||||
auto it =
|
||||
factory.m_sharedShaders.emplace(std::make_pair(binHashes[1],
|
||||
std::make_unique<VulkanShareableShader>(factory, srcHashes[1], binHashes[1],
|
||||
factory.m_ctx->m_dev, *useFragBlob))).first;
|
||||
factory.m_ctx->m_dev, fragModule))).first;
|
||||
fragShader = it->second->lock();
|
||||
}
|
||||
|
||||
|
@ -3293,8 +3292,9 @@ boo::ObjToken<IShaderPipeline> VulkanDataFactory::Context::newShaderPipeline
|
|||
ThrowIfFailed(vk::CreatePipelineCache(factory.m_ctx->m_dev, &cacheDataInfo, nullptr, &pipelineCache));
|
||||
}
|
||||
|
||||
VulkanShaderPipeline* retval = new VulkanShaderPipeline(m_data, factory.m_ctx, std::move(vertShader), std::move(fragShader),
|
||||
pipelineCache, vtxFmt, srcFac, dstFac, prim, depthTest, depthWrite, colorWrite,
|
||||
VulkanShaderPipeline* retval = new VulkanShaderPipeline(m_data, factory.m_ctx, std::move(vertShader),
|
||||
std::move(fragShader), pipelineCache, vtxFmt, srcFac,
|
||||
dstFac, prim, depthTest, depthWrite, colorWrite,
|
||||
alphaWrite, culling);
|
||||
|
||||
if (pipelineBlob && pipelineBlob->empty())
|
||||
|
@ -3304,7 +3304,8 @@ boo::ObjToken<IShaderPipeline> VulkanDataFactory::Context::newShaderPipeline
|
|||
if (cacheSz)
|
||||
{
|
||||
pipelineBlob->resize(cacheSz);
|
||||
ThrowIfFailed(vk::GetPipelineCacheData(factory.m_ctx->m_dev, pipelineCache, &cacheSz, pipelineBlob->data()));
|
||||
ThrowIfFailed(vk::GetPipelineCacheData(factory.m_ctx->m_dev, pipelineCache,
|
||||
&cacheSz, pipelineBlob->data()));
|
||||
pipelineBlob->resize(cacheSz);
|
||||
}
|
||||
}
|
||||
|
@ -3416,7 +3417,8 @@ void VulkanDataFactoryImpl::commitTransaction
|
|||
|
||||
if (data->m_DBufs)
|
||||
for (IGraphicsBufferD& buf : *data->m_DBufs)
|
||||
bufMemSize = static_cast<VulkanGraphicsBufferD<BaseGraphicsData>&>(buf).sizeForGPU(m_ctx, bufMemTypeBits, bufMemSize);
|
||||
bufMemSize = static_cast<VulkanGraphicsBufferD<BaseGraphicsData>&>(buf).
|
||||
sizeForGPU(m_ctx, bufMemTypeBits, bufMemSize);
|
||||
|
||||
if (data->m_STexs)
|
||||
for (ITextureS& tex : *data->m_STexs)
|
||||
|
@ -3611,6 +3613,9 @@ void VulkanCommandQueue::execute()
|
|||
resetCommandBuffer();
|
||||
m_dynamicNeedsReset = true;
|
||||
m_resolveDispSource = nullptr;
|
||||
|
||||
/* Clear dead data */
|
||||
m_drawResTokens[m_fillBuf].clear();
|
||||
return;
|
||||
}
|
||||
m_submitted = false;
|
||||
|
|
|
@ -56,7 +56,8 @@ int ApplicationRun(IApplication::EPlatformType platform,
|
|||
const std::vector<std::string>& args,
|
||||
bool singleInstance)
|
||||
{
|
||||
logvisor::RegisterThreadName("Boo Main Thread");
|
||||
std::string thrName = friendlyName + " Main Thread";
|
||||
logvisor::RegisterThreadName(thrName.c_str());
|
||||
if (APP)
|
||||
return 1;
|
||||
if (platform == IApplication::EPlatformType::Wayland)
|
||||
|
|
|
@ -433,7 +433,8 @@ public:
|
|||
std::unique_lock<std::mutex> innerLk(initmt);
|
||||
innerLk.unlock();
|
||||
initcv.notify_one();
|
||||
logvisor::RegisterThreadName("Boo Client Thread");
|
||||
std::string thrName = getFriendlyName() + " Client Thread";
|
||||
logvisor::RegisterThreadName(thrName.c_str());
|
||||
clientReturn = m_callback.appMain(this);
|
||||
pthread_kill(mainThread, SIGUSR2);
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue