Fixing vulkan playback

This commit is contained in:
Brad Davis 2018-10-28 20:15:55 -07:00 committed by Karol Suprynowicz
parent bf354119aa
commit 7f9c3deefd
5 changed files with 9 additions and 27 deletions

View file

@ -113,7 +113,7 @@ void Context::executeBatch(const char* name, std::function<void(Batch&)> lambda)
void Context::executeBatch(Batch& batch) const { void Context::executeBatch(Batch& batch) const {
PROFILE_RANGE(render_gpu, __FUNCTION__); PROFILE_RANGE(render_gpu, __FUNCTION__);
batch.flush(); batch.flush();
_backend->render(batch); //_backend->render(batch);
} }
void Context::recycle() const { void Context::recycle() const {
@ -133,22 +133,7 @@ void Context::executeFrame(const FramePointer& frame) const {
static ContextStats beginStats; static ContextStats beginStats;
getStats(beginStats); getStats(beginStats);
// FIXME? probably not necessary, but safe _backend->executeFrame(frame);
consumeFrameUpdates(frame);
_backend->setStereoState(frame->stereoState);
executeBatch("Context::executeFrame::begin", [&](Batch& batch){
batch.pushProfileRange("Frame");
_frameRangeTimer->begin(batch);
});
// Execute the frame rendering commands
for (auto& batch : frame->batches) {
_backend->render(*batch);
}
executeBatch("Context::executeFrame::end", [&](Batch& batch){
batch.popProfileRange();
_frameRangeTimer->end(batch);
});
static ContextStats endStats; static ContextStats endStats;
getStats(endStats); getStats(endStats);

View file

@ -149,6 +149,11 @@ namespace gpu {
class GLESBackend; class GLESBackend;
class GLESBuffer; class GLESBuffer;
} }
namespace vulkan {
class VKBackend;
class VKBuffer;
}
} }
#endif #endif

View file

@ -252,7 +252,7 @@ void Deserializer::readBuffers(const json& buffersNode) {
if (offset + size > mappedSize) { if (offset + size > mappedSize) {
throw std::runtime_error("read buffer error"); throw std::runtime_error("read buffer error");
} }
buffers.push_back(std::make_shared<Buffer>(size, mapped + offset)); buffers.push_back(std::make_shared<Buffer>(gpu::Buffer::AllFlags, size, mapped + offset));
bufferOffsets[buffers.back()] = offset; bufferOffsets[buffers.back()] = offset;
offset += size; offset += size;
} }

View file

@ -1,6 +1,6 @@
set(TARGET_NAME vk) set(TARGET_NAME vk)
setup_hifi_library(Gui) setup_hifi_library(Gui)
GroupSources(src) GroupSources(src)
link_hifi_libraries(shared gl) link_hifi_libraries(shared shaders gl)
target_vulkan() target_vulkan()

View file

@ -1,7 +1,6 @@
#pragma once #pragma once
#include "Context.h" #include "Context.h"
#include "Shaders.h"
namespace vks { namespace vks {
namespace pipelines { namespace pipelines {
@ -153,13 +152,6 @@ namespace vks {
shaderStages.clear(); shaderStages.clear();
} }
// Load a SPIR-V shader
vk::PipelineShaderStageCreateInfo& loadShader(const std::string& fileName, vk::ShaderStageFlagBits stage, const char* entryPoint = "main") {
vk::PipelineShaderStageCreateInfo shaderStage = vks::shaders::loadShader(device, fileName, stage, entryPoint);
shaderStages.push_back(shaderStage);
return shaderStages.back();
}
vk::Pipeline create(const vk::PipelineCache& cache) { vk::Pipeline create(const vk::PipelineCache& cache) {
update(); update();
return device.createGraphicsPipeline(cache, pipelineCreateInfo); return device.createGraphicsPipeline(cache, pipelineCreateInfo);