Files
cocos4/native/cocos/renderer/pipeline/custom/NativeUtils.cpp
T
hyde zhou 8c612a3bbb [pipeline] add native pipeline ubo uploading (#14061)
* merge v3.7.0-pipeline

* pass done

* fix const reference return type

* add uniform block buiding

* fix const cast

* fix const

* fix mtl const

* integrating native program library

* native pipeline workflow updated

* adding ubo binding

* Solve the problem of the version attribute of pass (#87)

* ubo upload added

* adding camera ubo

* add constant name

* update uniform buffer

* adding execution resources

* per pass ubo added

* fix bugs

* ubo added

* fix render pass bug

* bind set added

* adding ubo uploading

* shader binding overwrite added

* shader binding overwrite added

* add missing header

* draw updated

* ubo updated

* fix main light ubo

* pass ubo added

* lint

* fix custom pipeline window resize issue. (#88)

* fix lint

* fix assert

* remove texture1d

* fix constantMacros

* lint

* fixed: native custom pipeline graphics pipeline state leak. (#89)

* lint

* skybox added

* skip subpass input binding rewrite (#90)

* per pass descriptor set modified

* adding blit

* fix material

* fix fg get usage (#91)

* fix barrier fetch

* fix ios bug

* fix barrier

* support cc builtin overwrite

* try fix shadowMap

* refactor resources

* update blit

* add render graph binding

* fix shader bugs

* fix blit

* fix bugs

* remove unnessary barriers

* fix init

* fix addCameraQuad

* fix raster view order

---------

Co-authored-by: GengineJS <476393671@qq.com>
Co-authored-by: Zach Lee <bluesky013@126.com>
Co-authored-by: Zeqiang Li <zeqiang-li@outlook.com>
2023-02-01 17:46:34 +08:00

36 lines
962 B
C++

#include "NativeUtils.h"
#include "cocos/renderer/gfx-base/GFXDevice.h"
namespace cc {
namespace render {
void setupQuadVertexBuffer(gfx::Device& device, const Vec4& viewport, float vbData[16]) {
auto minX = static_cast<float>(viewport.x);
auto maxX = static_cast<float>(viewport.x + viewport.z);
auto minY = static_cast<float>(viewport.y);
auto maxY = static_cast<float>(viewport.y + viewport.w);
if (device.getCapabilities().screenSpaceSignY > 0) {
std::swap(minY, maxY);
}
int n = 0;
vbData[n++] = -1.0F;
vbData[n++] = -1.0F;
vbData[n++] = minX; // uv
vbData[n++] = maxY;
vbData[n++] = 1.0F;
vbData[n++] = -1.0F;
vbData[n++] = maxX;
vbData[n++] = maxY;
vbData[n++] = -1.0F;
vbData[n++] = 1.0F;
vbData[n++] = minX;
vbData[n++] = minY;
vbData[n++] = 1.0F;
vbData[n++] = 1.0F;
vbData[n++] = maxX;
vbData[n++] = minY;
}
} // namespace render
} // namespace cc