中文亚洲精品无码_熟女乱子伦免费_人人超碰人人爱国产_亚洲熟妇女综合网

當(dāng)前位置: 首頁 > news >正文

平面設(shè)計(jì)短期培訓(xùn)班seo站長綜合查詢工具

平面設(shè)計(jì)短期培訓(xùn)班,seo站長綜合查詢工具,如何查看網(wǎng)站建設(shè)的時(shí)間,做刷單的網(wǎng)站1. 前言 Filament中使用了FrameGraph來管理渲染管線,需要準(zhǔn)備兩點(diǎn): 設(shè)備接口抽象:設(shè)備API抽象為Command資源抽象:使用虛擬資源,在實(shí)際用到時(shí)再創(chuàng)建,方便剔除無用資源 下面就圍繞Filament中設(shè)備API抽象為…

1. 前言

Filament中使用了FrameGraph來管理渲染管線,需要準(zhǔn)備兩點(diǎn):

  • 設(shè)備接口抽象:設(shè)備API抽象為Command
  • 資源抽象:使用虛擬資源,在實(shí)際用到時(shí)再創(chuàng)建,方便剔除無用資源

下面就圍繞Filament中設(shè)備API抽象為Command代碼部分做一個(gè)解讀:

2. 代碼分析

先貼一段創(chuàng)建頂點(diǎn)緩沖的接口調(diào)用堆棧:

[Inlined] filament::backend::CommandBase::CommandBase(void (*)(filament::backend::Driver &, filament::backend::CommandBase *, int *)) CommandStream.h:63
[Inlined] filament::backend::CommandType<void (filament::backend::Driver::*)(filament::backend::Handle<filament::backend::HwVertexBuffer>, unsigned char, unsigned char, unsigned int, std::__ndk1::array<filament::backend::Attribute, 16u>)>::Command<&filament::backend::Driver::createVertexBufferR(filament::backend::Handle<filament::backend::HwVertexBuffer>, unsigned char, unsigned char, unsigned int, std::__ndk1::array<filament::backend::Attribute, 16u>)>::Command<filament::backend::Handle<filament::backend::HwVertexBuffer>, unsigned char, unsigned char, unsigned int, std::__ndk1::array<filament::backend::Attribute, 16u>>(void (*)(filament::backend::Driver&, filament::backend::CommandBase*, int*), filament::backend::Handle<filament::backend::HwVertexBuffer>&&, unsigned char&&, unsigned char&&, unsigned int&&, std::__ndk1::array<filament::backend::Attribute, 16u>&&) CommandStream.h:154
[Inlined] filament::backend::CommandStream::createVertexBuffer(unsigned char, unsigned char, unsigned int, std::__ndk1::array<>) DriverAPI.inc:169
filament::FVertexBuffer::FVertexBuffer(filament::FEngine &, const filament::VertexBuffer::Builder &) VertexBuffer.cpp:185
[Inlined] utils::Arena::make<>(filament::FEngine &, const filament::VertexBuffer::Builder &) Allocator.h:647
[Inlined] filament::FEngine::create<>(filament::ResourceList<> &, const filament::FVertexBuffer::Builder &) Engine.cpp:680
filament::FEngine::createVertexBuffer(const filament::VertexBuffer::Builder &) Engine.cpp:690
filament::FEngine::init() Engine.cpp:277
filament::FEngine::create(filament::backend::Backend, filament::backend::Platform *, void *, const filament::Engine::Config *) Engine.cpp:110
[Inlined] FilamentTest::setupFilament() FilamentTest.cpp:98
FilamentTest::init() FilamentTest.cpp:68
boxing::xr::composer::StartBase::instance(ANativeWindow *, int, int) StartBase.h:263
[Inlined] native_OnDrawFrame::$_0::operator()() const JniImpl.cpp:100
[Inlined] std::__ndk1::__invoke<>(native_OnDrawFrame::$_0 &) type_traits:3874
[Inlined] std::__ndk1::__apply_functor<>(native_OnDrawFrame::$_0 &, std::__ndk1::tuple<> &, std::__ndk1::__tuple_indices<>, std::__ndk1::tuple<> &&) functional:2853
[Inlined] std::__ndk1::__bind::operator()<>() functional:2886
[Inlined] std::__ndk1::__invoke<>(std::__ndk1::__bind<> &) type_traits:3874
std::__ndk1::__packaged_task_func::operator()() future:1817
[Inlined] std::__ndk1::__packaged_task_function::operator()() const future:1994
std::__ndk1::packaged_task::operator()() future:2214
[Inlined] std::__ndk1::__function::__value_func::operator()() const functional:1884
[Inlined] std::__ndk1::function::operator()() const functional:2556
<lambda>::operator()() const ThreadPool.h:71
[Inlined] decltype(std::__ndk1::forward<boxing::core::ThreadPool::ThreadPool(unsigned int)::'lambda'()>(fp)()) std::__ndk1::__invoke<boxing::core::ThreadPool::ThreadPool(unsigned int)::'lambda'()>(boxing::core::ThreadPool::ThreadPool(unsigned int)::'lambda'()&&) type_traits:3874
[Inlined] std::__ndk1::__thread_execute<>(std::__ndk1::tuple<> &, std::__ndk1::__tuple_indices<>) thread:273
std::__ndk1::__thread_proxy<>(void *) thread:284
__pthread_start(void*) 0x00000000eab36828
__start_thread 0x00000000eaaed5ce

渲染設(shè)備API定義:

filament\filament\backend\include\private\backend\DriverAPI.inc

DriverAPI.inc中使用大量的宏替換操作,將設(shè)備接口進(jìn)行封裝,或打包,這部分代碼可讀性極差,不過可從其調(diào)用邏輯來進(jìn)行拆解和理解:
先來分析其中一個(gè)接口: createVertexBuffer 創(chuàng)建一個(gè)頂點(diǎn)緩沖

DECL_DRIVER_API_R_N(backend::VertexBufferHandle, createVertexBuffer,uint8_t, bufferCount,uint8_t, attributeCount,uint32_t, vertexCount,backend::AttributeArray, attributes)

這里不是真的創(chuàng)建,而要看這個(gè)宏接口在哪里使用,我們主要看看這兩個(gè)地方:

  CommandStream.h  //命令流Driver.h   //設(shè)備接口

這兩個(gè)文件中都對(duì)DriverAPI.inc進(jìn)行了include,但是意義完全不一樣,先看DECL_DRIVER_API_R_N:

#define DECL_DRIVER_API_R_N(R, N, ...) \DECL_DRIVER_API_RETURN(R, N, PAIR_ARGS_N(ARG, ##__VA_ARGS__), PAIR_ARGS_N(PARAM, ##__VA_ARGS__))

關(guān)鍵在DECL_DRIVER_API_RETURN這個(gè)宏,在CommandStream.h和Driver.h頭文件中include文件DriverAPI.inc 之前分別定義了自己的DECL_DRIVER_API_RETURN宏,看看CommandStream.h中:

#define DECL_DRIVER_API(methodName, paramsDecl, params)                                         \inline void methodName(paramsDecl) {                                                        \DEBUG_COMMAND_BEGIN(methodName, false, params);                                         \using Cmd = COMMAND_TYPE(methodName);                                                   \void* const p = allocateCommand(CommandBase::align(sizeof(Cmd)));                       \new(p) Cmd(mDispatcher.methodName##_, APPLY(std::move, params));                        \DEBUG_COMMAND_END(methodName, false);                                                   \}#define DECL_DRIVER_API_SYNCHRONOUS(RetType, methodName, paramsDecl, params)                    \inline RetType methodName(paramsDecl) {                                                     \DEBUG_COMMAND_BEGIN(methodName, true, params);                                          \AutoExecute callOnExit([=](){                                                           \DEBUG_COMMAND_END(methodName, true);                                                \});                                                                                     \return apply(&Driver::methodName, mDriver, std::forward_as_tuple(params));              \}#define DECL_DRIVER_API_RETURN(RetType, methodName, paramsDecl, params)                         \inline RetType methodName(paramsDecl) {                                                     \DEBUG_COMMAND_BEGIN(methodName, false, params);                                         \RetType result = mDriver.methodName##S();                                               \using Cmd = COMMAND_TYPE(methodName##R);                                                \void* const p = allocateCommand(CommandBase::align(sizeof(Cmd)));                       \new(p) Cmd(mDispatcher.methodName##_, RetType(result), APPLY(std::move, params));       \DEBUG_COMMAND_END(methodName, false);                                                   \return result;                                                                          \}

上面三個(gè)宏的作用基本是一樣的,都將要調(diào)用的函數(shù)和參數(shù)封裝為了Command,不同之處在于DECL_DRIVER_API是command無返回值的,DECL_DRIVER_API_SYNCHRONOUS是封裝為command后同步執(zhí)行的,DECL_DRIVER_API_RETURN是需要返回值的
主要看看DECL_DRIVER_API_RETURN:

RetType result = mDriver.methodName##S();    

將方法名后面拼接了S,調(diào)用拿到返回類型
看看拼接S后的實(shí)現(xiàn):

Handle<HwVertexBuffer> OpenGLDriver::createVertexBufferS() noexcept {return initHandle<GLVertexBuffer>();
}

initHandle()這句在filament內(nèi)存池HandleArena上創(chuàng)建了一個(gè)GLVertexBuffer對(duì)象,然后根據(jù)內(nèi)存地址創(chuàng)建了對(duì)象的唯一handeID
再看下面這句:
using Cmd = COMMAND_TYPE(methodName##R);
方法名后面拼接了R,然后獲取了command的類型,沒有執(zhí)行方法,看看拼接R后的實(shí)現(xiàn):

void OpenGLDriver::createVertexBufferR(Handle<HwVertexBuffer> vbh,uint8_t bufferCount,uint8_t attributeCount,uint32_t elementCount,AttributeArray attributes) {DEBUG_MARKER()construct<GLVertexBuffer>(vbh, bufferCount, attributeCount, elementCount, attributes);
}

內(nèi)存池HandleArena上創(chuàng)建了一個(gè)GLVertexBuffer對(duì)象
再看下面一句

void* const p = allocateCommand(CommandBase::align(sizeof(Cmd)));   
new(p) Cmd(mDispatcher.methodName##_, RetType(result), APPLY(std::move, params));   

在CommandStream內(nèi)部的環(huán)形緩沖上申請(qǐng)了一塊Command對(duì)象的內(nèi)存p,然后在內(nèi)存p上new了對(duì)象Command
看看CommandBase* execute執(zhí)行函數(shù)的實(shí)現(xiàn):

inline CommandBase* execute(Driver& driver) {// returning the next command by output parameter allows the compiler to perform the// tail-call optimization in the function called by mExecute, however that comes at// a cost here (writing and reading the stack at each iteration), in the end it's// probably better to pay the cost at just one location.intptr_t next;mExecute(driver, this, &next);return reinterpret_cast<CommandBase*>(reinterpret_cast<intptr_t>(this) + next);
}

mExecute就是上面new(p) Cmd(mDispatcher.methodName##_, RetType(result), APPLY(std::move, params)); 后的函數(shù)和參數(shù)的封裝體,然后拿到了下一個(gè)圓形緩沖中下一個(gè)command的地址偏移量next,返回下一個(gè)command地址
CommandStream中執(zhí)行command,執(zhí)行完然后獲取下一個(gè)執(zhí)行。。。

mDriver.execute([this, buffer]() {Driver& UTILS_RESTRICT driver = mDriver;CommandBase* UTILS_RESTRICT base = static_cast<CommandBase*>(buffer);while (UTILS_LIKELY(base)) {base = base->execute(driver);}
});
http://www.risenshineclean.com/news/64822.html

相關(guān)文章:

  • wordpress將404跳轉(zhuǎn)主頁結(jié)構(gòu)優(yōu)化設(shè)計(jì)
  • 成都網(wǎng)站建設(shè)優(yōu)秀公司網(wǎng)絡(luò)推廣渠道和方法
  • 做網(wǎng)站項(xiàng)目的心得小紅書筆記關(guān)鍵詞排名優(yōu)化
  • 網(wǎng)站備案要多長時(shí)間廣告精準(zhǔn)推廣平臺(tái)
  • 企業(yè)網(wǎng)站管理系統(tǒng)安裝教程重慶森林講的什么內(nèi)容
  • 如何騰訊云二級(jí)域名做網(wǎng)站北京中文seo
  • 附近短期電腦培訓(xùn)班深圳關(guān)鍵詞優(yōu)化公司哪家好
  • thinkphp做網(wǎng)站好嗎免費(fèi)網(wǎng)站注冊(cè)免費(fèi)創(chuàng)建網(wǎng)站
  • 一般給公司做網(wǎng)站用什么軟件奶茶推廣軟文200字
  • 做曖網(wǎng)站seo排名優(yōu)化教學(xué)
  • 如何做網(wǎng)站靜態(tài)頁面佛山網(wǎng)站設(shè)計(jì)實(shí)力樂云seo
  • 做網(wǎng)站瀏覽器2022重大時(shí)政熱點(diǎn)事件簡短
  • 如何建設(shè)網(wǎng)站效果好近期10大新聞事件
  • 安徽教育機(jī)構(gòu)網(wǎng)站建設(shè)在線網(wǎng)頁編輯平臺(tái)
  • 網(wǎng)頁框架與布局網(wǎng)站如何做關(guān)鍵詞優(yōu)化
  • 網(wǎng)站建設(shè)及經(jīng)營應(yīng)解決好的問題seo網(wǎng)站診斷文檔案例
  • 昆明網(wǎng)站建設(shè)電話seo導(dǎo)航站
  • 做房地產(chǎn)咨詢網(wǎng)站怎么贏利百度地圖人工客服電話
  • .net網(wǎng)站開發(fā)程序員青島seo服務(wù)公司
  • 公司網(wǎng)站公眾號(hào)維護(hù)怎么做網(wǎng)站聯(lián)盟推廣
  • 上海做網(wǎng)站優(yōu)化價(jià)格重慶seo排名電話
  • 做網(wǎng)站上海做一個(gè)簡單的網(wǎng)站需要多少錢
  • 高端的環(huán)保行業(yè)網(wǎng)站開發(fā)歌爾股份砍單
  • 東莞做營銷型網(wǎng)站的百度推廣開戶費(fèi)用標(biāo)準(zhǔn)
  • 區(qū)域知識(shí)產(chǎn)權(quán)貿(mào)易中心seo助力網(wǎng)站轉(zhuǎn)化率提升
  • 網(wǎng)站如何做sem優(yōu)化seo搜索引擎優(yōu)化工程師招聘
  • 織夢(mèng)網(wǎng)站識(shí)別合肥seo管理
  • 020網(wǎng)站設(shè)計(jì)互聯(lián)網(wǎng)營銷培訓(xùn)班
  • 做網(wǎng)站的軟件著作權(quán)安卓手機(jī)優(yōu)化
  • 園林設(shè)計(jì)公司東莞網(wǎng)絡(luò)優(yōu)化哪家好