Opened 6 years ago

Last modified 6 years ago

#5 accepted 작업

SPIRV 리플랙션 / triangle

Reported by: Hongtae Kim Owned by: Hongtae Kim
Priority: 사소 Milestone: pipelineReflection
Component: Graphics/Compute Pipeline Version: 2.0
Keywords: Cc:

Description

GLSL

vertex shader

#version 450

#extension GL_ARB_separate_shader_objects : enable
#extension GL_ARB_shading_language_420pack : enable

layout (location = 0) in vec3 inPos;
layout (location = 1) in vec3 inColor;

layout (binding = 0) uniform UBO 
{
    mat4 projectionMatrix;
    mat4 modelMatrix;
    mat4 viewMatrix;
} ubo;

layout (location = 0) out vec3 outColor;

out gl_PerVertex 
{
    vec4 gl_Position;   
};


void main() 
{
    outColor = inColor;
    gl_Position = ubo.projectionMatrix * ubo.viewMatrix * ubo.modelMatrix * vec4(inPos.xyz, 1.0);
}

fragment shader

#version 450

#extension GL_ARB_separate_shader_objects : enable
#extension GL_ARB_shading_language_420pack : enable

layout (location = 0) in vec3 inColor;

layout (location = 0) out vec4 outFragColor;

void main() 
{
  outFragColor = vec4(inColor, 1.0);
}

Change History (7)

comment:1 Changed 6 years ago by Hongtae Kim

Component: 일반Graphics/Compute Pipeline

comment:2 Changed 6 years ago by Hongtae Kim

Apple Metal

vertex shader

#include <metal_stdlib>
#include <simd/simd.h>

using namespace metal;

struct UBO
{
    float4x4 projectionMatrix;
    float4x4 modelMatrix;
    float4x4 viewMatrix;
};

struct main0_in
{
    float3 inColor [[attribute(1)]];
    float3 inPos [[attribute(0)]];
};

struct main0_out
{
    float3 outColor [[user(locn0)]];
    float4 gl_Position [[position]];
};

vertex main0_out main0(main0_in in [[stage_in]], constant UBO& ubo [[buffer(0)]])
{
    main0_out out = {};
    out.outColor = in.inColor;
    out.gl_Position = ((ubo.projectionMatrix * ubo.viewMatrix) * ubo.modelMatrix) * float4(in.inPos, 1.0);
    return out;
}

comment:3 Changed 6 years ago by Hongtae Kim

Reflection Info

MTLRenderPipelineReflection data

Printing description of pipelineReflection:
<MTLRenderPipelineReflectionInternal: 0x600000080370>
    Vertex Arguments: 
        argumentsCount = 2 
        Argument 0: <MTLBufferArgument: 0x600000085230>
            Name = vertexBuffer.0 
            Type = MTLArgumentTypeBuffer 
            Access = MTLArgumentAccessReadOnly 
            LocationIndex = 6 
            IsActive = 1 
            ArrayLength = 1 
            TypeInfo = 
                DataType = MTLDataTypePointer 
                ElementType = MTLDataTypeStruct  
                Access = MTLArgumentAccessReadOnly 
                Alignment = 4 
                DataSize = 24
            Alignment = 4 
            DataSize = 24 
            DataType = MTLDataTypeStruct 
        Argument 1: <MTLBufferArgument: 0x600000087760>
            Name = ubo 
            Type = MTLArgumentTypeBuffer 
            Access = MTLArgumentAccessReadOnly 
            LocationIndex = 0 
            IsActive = 1 
            ArrayLength = 1 
            TypeInfo = 
                DataType = MTLDataTypePointer 
                ElementType = MTLDataTypeStruct 
                ElementTypeDescription = <MTLStructTypeInternal: 0x60400044c120>
                    DataType = MTLDataTypeStruct 
                    0 <MTLStructMemberInternal: 0x604000096ad0>
                        Name = projectionMatrix 
                        Offset = 0 
                        DataType = MTLDataTypeFloat4x4 
                        ArgumentIndex = 0 
                        TypeInfo =  nil 
                    1 <MTLStructMemberInternal: 0x604000096bc0>
                        Name = modelMatrix 
                        Offset = 64 
                        DataType = MTLDataTypeFloat4x4 
                        ArgumentIndex = 0 
                        TypeInfo =  nil 
                    2 <MTLStructMemberInternal: 0x604000096c10>
                        Name = viewMatrix 
                        Offset = 128 
                        DataType = MTLDataTypeFloat4x4 
                        ArgumentIndex = 0 
                        TypeInfo =  nil 
                Access = MTLArgumentAccessReadOnly 
                Alignment = 256 
                DataSize = 192
            Alignment = 256 
            DataSize = 192 
            DataType = MTLDataTypeStruct 
    Fragment Arguments: 
        argumentsCount = 0

comment:4 Changed 6 years ago by Hongtae Kim

DKGL Reflection Output

[32240:34732 V] VertexFunction.VertexAttributes: 2
[32240:34732 V]   --> VertexAttribute[0]: "inColor" (location:1)
[32240:34732 V]   --> VertexAttribute[1]: "inPos" (location:0)
[32240:34732 V] PipelineReflection.VertexResources: 1
[32240:34732 I] ShaderResource: ubo (set=0, binding=0)
[32240:34732 I]  +Type:Buffer, Access:ReadOnly, Enabled:1 Alignment:0, Size:192
[32240:34732 I]  +TypeKey: ubo (struct)
[32240:34732 I]      + projectionMatrix (Float4x4, Offset: 0, Size: 64)
[32240:34732 I]      + modelMatrix (Float4x4, Offset: 64, Size: 64)
[32240:34732 I]      + viewMatrix (Float4x4, Offset: 128, Size: 64)
[32240:34732 V] PipelineReflection.FragmentResources: 0
Last edited 6 years ago by Hongtae Kim (previous) (diff)

comment:5 Changed 6 years ago by Hongtae Kim

Resolution: 수정됨
Status: assignedclosed

comment:6 Changed 6 years ago by Hongtae Kim

Priority: 치명적중요
Resolution: 완료
Status: closedreopened

comment:7 Changed 6 years ago by Hongtae Kim

Priority: 중요사소
Status: reopenedaccepted
Note: See TracTickets for help on using tickets.