瀏覽代碼

no message

Hongtae Kim 6 年之前
父節點
當前提交
aabd3b95fa
共有 3 個檔案被更改,包括 9 行新增3 行删除
  1. 7
    1
      Data/triangle.vert
  2. 二進制
      Data/triangle.vert.spv
  3. 2
    2
      TestApp1/TestApp1.cpp

+ 7
- 1
Data/triangle.vert 查看文件

@@ -6,6 +6,12 @@
6 6
 layout (location = 0) in vec3 inPos;
7 7
 layout (location = 1) in vec3 inColor;
8 8
 
9
+layout (binding = 0) uniform UBO 
10
+{
11
+	mat4 projectionMatrix;
12
+	mat4 modelMatrix;
13
+	mat4 viewMatrix;
14
+} ubo;
9 15
 
10 16
 layout (location = 0) out vec3 outColor;
11 17
 
@@ -18,5 +24,5 @@ out gl_PerVertex
18 24
 void main() 
19 25
 {
20 26
 	outColor = inColor;
21
-	gl_Position = vec4(inPos.xyz, 1.0);
27
+	gl_Position = ubo.projectionMatrix * ubo.viewMatrix * ubo.modelMatrix * vec4(inPos.xyz, 1.0);
22 28
 }

二進制
Data/triangle.vert.spv 查看文件


+ 2
- 2
TestApp1/TestApp1.cpp 查看文件

@@ -36,7 +36,7 @@ public:
36 36
 		for (int i = 0; i < vertShaderFunction->VertexAttributes().Count(); ++i)
37 37
 		{ 
38 38
 			const DKVertexAttribute& attr = vertShaderFunction->VertexAttributes().Value(i);
39
-			DKLog("  --> VertexAttribute[%d]: %ls (%u)", i, (const wchar_t*)attr.name, attr.location);
39
+			DKLog("  --> VertexAttribute[%d]: \"%ls\" (location:%u)", i, (const wchar_t*)attr.name, attr.location);
40 40
 		}
41 41
 
42 42
 		struct Vertex
@@ -96,7 +96,7 @@ public:
96 96
 				case DKShaderArgument::TypeSampler:	argType = "Sampler"; break;
97 97
 				case DKShaderArgument::TypeThreadgroupMemory:	argType = "ThreadMemory"; break;
98 98
 				}
99
-				DKLog("  --> %ls[%u] binding:%u:%u type:%s", (const wchar_t*)arg.name, uint32_t(arg.arrayLength), arg.set, arg.binding, argType);
99
+				DKLog("  --> \"%ls\"[%u] binding:%u:%u type:%s", (const wchar_t*)arg.name, uint32_t(arg.count), arg.set, arg.binding, argType);
100 100
 			};
101 101
 			DKLog("PipelineReflection.VertexArguments: %d", reflection.vertexArguments.Count());
102 102
 			for (auto& arg : reflection.vertexArguments)