gfx: swapchain refactor (#3751)

* gfx: swapchain

* acquire/release/surface on swapchain

* fix swapchain texture creation

* acquire/present back on device

* formats are swapchain-specific

* swapchain: vk works

* enable device agent

* format fix

* update gfxdef

* fix enum decl

* pipeline adapt

* minor

* vk: compress attr locations directly in SPIR-V

* gles3 adjust

* InputAssembler owns an DrawInfo

* gles2 adapt

* texture keep track of its hash

* device cached states

* format

* glslang finalize

* buffer view adapt

* fg: subpass support

* minor

* 3.4 adapt

* profiler adapt

* buffer update frequency detection

* minor

* base commit

* swapchain works on metal

* spirv

* mtltexture issue

* remote test code

* depthtexture

* revert ifdef USE_METAL

* ios swapchain header

* fix some triple buffer issues

* resize accept surface transform

Co-authored-by: Zeqiang Li <Zeqiang-li@outlook.com>
This commit is contained in:
Yun Hsiao Wu
2021-08-31 19:40:32 +08:00
committed by GitHub
parent 02710af9d8
commit da2f03ff73
281 changed files with 9731 additions and 10953 deletions
@@ -31,14 +31,16 @@
#include "VKDescriptorSetLayout.h"
#include "VKDevice.h"
#include "VKPipelineLayout.h"
#include "VKSampler.h"
#include "VKShader.h"
#include "VKTexture.h"
#include "states/VKSampler.h"
namespace cc {
namespace gfx {
CCVKDescriptorSet::CCVKDescriptorSet() = default;
CCVKDescriptorSet::CCVKDescriptorSet() {
_typedID = generateObjectID<decltype(this)>();
}
CCVKDescriptorSet::~CCVKDescriptorSet() {
destroy();
@@ -103,7 +105,7 @@ void CCVKDescriptorSet::doInit(const DescriptorSetInfo & /*info*/) {
for (uint j = 0; j < binding.count; ++j, ++k) {
if (hasFlag(DESCRIPTOR_BUFFER_TYPE, binding.descriptorType)) {
instance.descriptorInfos[k].buffer.buffer = gpuDevice->defaultBuffer.vkBuffer;
instance.descriptorInfos[k].buffer.offset = gpuDevice->defaultBuffer.startOffset;
instance.descriptorInfos[k].buffer.offset = gpuDevice->defaultBuffer.getStartOffset(t);
instance.descriptorInfos[k].buffer.range = gpuDevice->defaultBuffer.size;
} else if (hasFlag(DESCRIPTOR_TEXTURE_TYPE, binding.descriptorType)) {
instance.descriptorInfos[k].image.sampler = gpuDevice->defaultSampler.vkSampler;