Add areShadersReady poll function

This commit is contained in:
Jack Andersen 2019-06-20 20:01:27 -10:00
parent e0674ff957
commit 8a181b96ce
4 changed files with 11 additions and 0 deletions

View File

@ -278,6 +278,7 @@ struct IGraphicsDataFactory {
virtual void setDisplayGamma(float gamma) = 0; virtual void setDisplayGamma(float gamma) = 0;
virtual bool isTessellationSupported(uint32_t& maxPatchSizeOut) = 0; virtual bool isTessellationSupported(uint32_t& maxPatchSizeOut) = 0;
virtual void waitUntilShadersReady() = 0; virtual void waitUntilShadersReady() = 0;
virtual bool areShadersReady() = 0;
}; };
using GraphicsDataFactoryContext = IGraphicsDataFactory::Context; using GraphicsDataFactoryContext = IGraphicsDataFactory::Context;

View File

@ -248,6 +248,10 @@ public:
m_backcv.wait(lk, [this]() { return m_outstandingTasks == 0 || !m_running; }); m_backcv.wait(lk, [this]() { return m_outstandingTasks == 0 || !m_running; });
} }
bool isReady() {
return m_outstandingTasks == 0 || !m_running;
}
PipelineCompileQueue() { PipelineCompileQueue() {
unsigned int numThreads = std::thread::hardware_concurrency(); unsigned int numThreads = std::thread::hardware_concurrency();
if (numThreads > 1) if (numThreads > 1)

View File

@ -136,6 +136,8 @@ public:
} }
void waitUntilShadersReady() {} void waitUntilShadersReady() {}
bool areShadersReady() { return true; }
}; };
static const GLenum USE_TABLE[] = {GL_INVALID_ENUM, GL_ARRAY_BUFFER, GL_ELEMENT_ARRAY_BUFFER, GL_UNIFORM_BUFFER}; static const GLenum USE_TABLE[] = {GL_INVALID_ENUM, GL_ARRAY_BUFFER, GL_ELEMENT_ARRAY_BUFFER, GL_UNIFORM_BUFFER};

View File

@ -147,6 +147,10 @@ public:
void waitUntilShadersReady() { void waitUntilShadersReady() {
m_pipelineQueue.waitUntilReady(); m_pipelineQueue.waitUntilReady();
} }
bool areShadersReady() {
return m_pipelineQueue.isReady();
}
}; };
static inline void ThrowIfFailed(VkResult res) { static inline void ThrowIfFailed(VkResult res) {