티스토리 뷰

Game/작업일지

Vulkan 7번째 SPIR-V reflection

newpolaris 2018. 11. 26. 20:40

먼넘의 문법이;

http://www.duskborn.com/wp-content/uploads/2015/03/AnIntroductionToSPIR-V.pdf

https://www.khronos.org/registry/spir-v/specs/1.0/SPIRV.pdf

https://github.com/google-admin/vulkan-cpp-library/blob/master/spirv-reflection/include/reflection/internal/intermediate_types.h

3.32 Instructions

word count > opcode > result<id> > operands

실제 disasemble 에서 보이는건,

%5 = OpTypeFloat 32
%6 = OpTypeInt 32 0
%7 = OpTypeVector %5 4
%9 = OpConstant %5 0.4
%10 = OpConstant %5 0.8
%11 = OpConstant %6 1
%12 = OpConstantComposite %7 %9 %9 %10 %11

vec4(0.4, 0.4, 0.8, 1)

spirv_cross 사용한 reflection 설명

http://techblog.sega.jp/entry/2017/03/27/100000

https://github.com/khalladay/VkMaterialSystem/blob/master/ShaderPipeline/main.cpp

    spirv_cross::CompilerGLSL glsl(ir, wordCount);

    spirv_cross::ShaderResources resources = glsl.get_shader_resources();

    for (spirv_cross::Resource res : resources.push_constant_buffers)
    {
        createUniformBlockForResource(&data.pushConstants, res, glsl);
    }

https://github.com/KhronosGroup/SPIRV-Cross/wiki/Reflection-API-user-guide https://www.khronos.org/assets/uploads/developers/library/2018-vulkanised/04-SPIRVCross_Vulkanised2018.pdf https://www.khronos.org/assets/uploads/developers/library/2016-vulkan-devday-uk/4-Using-spir-v-with-spirv-cross.pdf

API가 좀 구리다

https://github.com/chaoticbob/SPIRV-Reflect

cross가 크다고 많이들 이야기하네;

http://kylehalladay.com/blog/tutorial/2017/11/27/Vulkan-Material-System.html

'Game > 작업일지' 카테고리의 다른 글

Vulkan 11 번째 - shader reflection  (0) 2018.12.05
Vulkan 10 번째: 새로 시작  (0) 2018.12.04
Vulkan 6 번째 메모리 타입 및 푸시디스크립터  (0) 2018.11.23
SetStablePowerState  (0) 2018.11.23
Vulkan 5번째 timer  (0) 2018.11.22
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크