mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-06 11:31:59 +08:00
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:
@@ -33,7 +33,9 @@
|
||||
namespace cc {
|
||||
namespace gfx {
|
||||
|
||||
CCVKInputAssembler::CCVKInputAssembler() = default;
|
||||
CCVKInputAssembler::CCVKInputAssembler() {
|
||||
_typedID = generateObjectID<decltype(this)>();
|
||||
}
|
||||
|
||||
CCVKInputAssembler::~CCVKInputAssembler() {
|
||||
destroy();
|
||||
@@ -48,23 +50,24 @@ void CCVKInputAssembler::doInit(const InputAssemblerInfo &info) {
|
||||
|
||||
for (size_t i = 0U; i < vbCount; ++i) {
|
||||
auto *vb = static_cast<CCVKBuffer *>(_vertexBuffers[i]);
|
||||
_gpuInputAssembler->gpuVertexBuffers[i] = vb->gpuBuffer();
|
||||
_gpuInputAssembler->gpuVertexBuffers[i] = vb->gpuBufferView();
|
||||
}
|
||||
|
||||
if (info.indexBuffer) {
|
||||
_gpuInputAssembler->gpuIndexBuffer = static_cast<CCVKBuffer *>(info.indexBuffer)->gpuBuffer();
|
||||
_gpuInputAssembler->gpuIndexBuffer = static_cast<CCVKBuffer *>(info.indexBuffer)->gpuBufferView();
|
||||
}
|
||||
|
||||
if (info.indirectBuffer) {
|
||||
_gpuInputAssembler->gpuIndirectBuffer = static_cast<CCVKBuffer *>(info.indirectBuffer)->gpuBuffer();
|
||||
_gpuInputAssembler->gpuIndirectBuffer = static_cast<CCVKBuffer *>(info.indirectBuffer)->gpuBufferView();
|
||||
}
|
||||
|
||||
_gpuInputAssembler->vertexBuffers.resize(vbCount);
|
||||
_gpuInputAssembler->vertexBufferOffsets.resize(vbCount);
|
||||
|
||||
CCVKGPUDevice *gpuDevice = CCVKDevice::getInstance()->gpuDevice();
|
||||
for (size_t i = 0U; i < vbCount; i++) {
|
||||
_gpuInputAssembler->vertexBuffers[i] = _gpuInputAssembler->gpuVertexBuffers[i]->vkBuffer;
|
||||
_gpuInputAssembler->vertexBufferOffsets[i] = _gpuInputAssembler->gpuVertexBuffers[i]->startOffset;
|
||||
_gpuInputAssembler->vertexBuffers[i] = _gpuInputAssembler->gpuVertexBuffers[i]->gpuBuffer->vkBuffer;
|
||||
_gpuInputAssembler->vertexBufferOffsets[i] = _gpuInputAssembler->gpuVertexBuffers[i]->getStartOffset(gpuDevice->curBackBufferIndex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user