Adding xb genspirv to do glsl->.h.
This commit is contained in:
@@ -18,6 +18,9 @@ project("xenia-ui-vulkan")
|
||||
project_root.."/third_party/vulkan/",
|
||||
})
|
||||
local_platform_files()
|
||||
files({
|
||||
"shaders/bin/*.h",
|
||||
})
|
||||
removefiles({"*_demo.cc"})
|
||||
|
||||
group("demos")
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
const uint8_t immediate_frag_spv[] = {
|
||||
// generated from `xb genspirv`
|
||||
// source: immediate.frag
|
||||
const uint8_t immediate_frag[] = {
|
||||
0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x08, 0x00,
|
||||
0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00,
|
||||
0x01, 0x00, 0x00, 0x00, 0x0B, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||
94
src/xenia/ui/vulkan/shaders/bin/immediate_frag.txt
Normal file
94
src/xenia/ui/vulkan/shaders/bin/immediate_frag.txt
Normal file
@@ -0,0 +1,94 @@
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 1
|
||||
; Bound: 53
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %4 "main" %9 %11 %30
|
||||
OpExecutionMode %4 OriginLowerLeft
|
||||
OpSource GLSL 450
|
||||
OpName %4 "main"
|
||||
OpName %9 "out_color"
|
||||
OpName %11 "vtx_color"
|
||||
OpName %16 "PushConstants"
|
||||
OpMemberName %16 0 "projection_matrix"
|
||||
OpMemberName %16 1 "restrict_texture_samples"
|
||||
OpName %18 "push_constants"
|
||||
OpName %30 "vtx_uv"
|
||||
OpName %42 "tex_color"
|
||||
OpName %46 "texture_sampler"
|
||||
OpDecorate %9 Location 0
|
||||
OpDecorate %11 Location 1
|
||||
OpMemberDecorate %16 0 ColMajor
|
||||
OpMemberDecorate %16 0 Offset 0
|
||||
OpMemberDecorate %16 0 MatrixStride 16
|
||||
OpMemberDecorate %16 1 Offset 64
|
||||
OpDecorate %16 Block
|
||||
OpDecorate %18 DescriptorSet 0
|
||||
OpDecorate %30 Location 0
|
||||
OpDecorate %46 DescriptorSet 0
|
||||
OpDecorate %46 Binding 0
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeFloat 32
|
||||
%7 = OpTypeVector %6 4
|
||||
%8 = OpTypePointer Output %7
|
||||
%9 = OpVariable %8 Output
|
||||
%10 = OpTypePointer Input %7
|
||||
%11 = OpVariable %10 Input
|
||||
%13 = OpTypeBool
|
||||
%14 = OpTypeMatrix %7 4
|
||||
%15 = OpTypeInt 32 1
|
||||
%16 = OpTypeStruct %14 %15
|
||||
%17 = OpTypePointer PushConstant %16
|
||||
%18 = OpVariable %17 PushConstant
|
||||
%19 = OpConstant %15 1
|
||||
%20 = OpTypePointer PushConstant %15
|
||||
%23 = OpConstant %15 0
|
||||
%28 = OpTypeVector %6 2
|
||||
%29 = OpTypePointer Input %28
|
||||
%30 = OpVariable %29 Input
|
||||
%31 = OpTypeInt 32 0
|
||||
%32 = OpConstant %31 0
|
||||
%33 = OpTypePointer Input %6
|
||||
%36 = OpConstant %6 1
|
||||
%41 = OpTypePointer Function %7
|
||||
%43 = OpTypeImage %6 2D 0 0 0 1 Unknown
|
||||
%44 = OpTypeSampledImage %43
|
||||
%45 = OpTypePointer UniformConstant %44
|
||||
%46 = OpVariable %45 UniformConstant
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%42 = OpVariable %41 Function
|
||||
%12 = OpLoad %7 %11
|
||||
OpStore %9 %12
|
||||
%21 = OpAccessChain %20 %18 %19
|
||||
%22 = OpLoad %15 %21
|
||||
%24 = OpIEqual %13 %22 %23
|
||||
%25 = OpLogicalNot %13 %24
|
||||
OpSelectionMerge %27 None
|
||||
OpBranchConditional %25 %26 %27
|
||||
%26 = OpLabel
|
||||
%34 = OpAccessChain %33 %30 %32
|
||||
%35 = OpLoad %6 %34
|
||||
%37 = OpFOrdLessThanEqual %13 %35 %36
|
||||
OpBranch %27
|
||||
%27 = OpLabel
|
||||
%38 = OpPhi %13 %24 %5 %37 %26
|
||||
OpSelectionMerge %40 None
|
||||
OpBranchConditional %38 %39 %40
|
||||
%39 = OpLabel
|
||||
%47 = OpLoad %44 %46
|
||||
%48 = OpLoad %28 %30
|
||||
%49 = OpImageSampleImplicitLod %7 %47 %48
|
||||
OpStore %42 %49
|
||||
%50 = OpLoad %7 %42
|
||||
%51 = OpLoad %7 %9
|
||||
%52 = OpFMul %7 %51 %50
|
||||
OpStore %9 %52
|
||||
OpBranch %40
|
||||
%40 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -1,4 +1,6 @@
|
||||
const uint8_t immediate_vert_spv[] = {
|
||||
// generated from `xb genspirv`
|
||||
// source: immediate.vert
|
||||
const uint8_t immediate_vert[] = {
|
||||
0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x08, 0x00,
|
||||
0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00,
|
||||
0x01, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x20, 0x00, 0x00, 0x00,
|
||||
96
src/xenia/ui/vulkan/shaders/bin/immediate_vert.txt
Normal file
96
src/xenia/ui/vulkan/shaders/bin/immediate_vert.txt
Normal file
@@ -0,0 +1,96 @@
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos Glslang Reference Front End; 1
|
||||
; Bound: 48
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpCapability ClipDistance
|
||||
OpCapability CullDistance
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %4 "main" %13 %25 %41 %42 %44 %46
|
||||
OpSource GLSL 450
|
||||
OpName %4 "main"
|
||||
OpName %11 "gl_PerVertex"
|
||||
OpMemberName %11 0 "gl_Position"
|
||||
OpMemberName %11 1 "gl_PointSize"
|
||||
OpMemberName %11 2 "gl_ClipDistance"
|
||||
OpMemberName %11 3 "gl_CullDistance"
|
||||
OpName %13 ""
|
||||
OpName %17 "PushConstants"
|
||||
OpMemberName %17 0 "projection_matrix"
|
||||
OpMemberName %17 1 "restrict_texture_samples"
|
||||
OpName %19 "push_constants"
|
||||
OpName %25 "in_pos"
|
||||
OpName %41 "vtx_uv"
|
||||
OpName %42 "in_uv"
|
||||
OpName %44 "vtx_color"
|
||||
OpName %46 "in_color"
|
||||
OpMemberDecorate %11 0 BuiltIn Position
|
||||
OpMemberDecorate %11 1 BuiltIn PointSize
|
||||
OpMemberDecorate %11 2 BuiltIn ClipDistance
|
||||
OpMemberDecorate %11 3 BuiltIn CullDistance
|
||||
OpDecorate %11 Block
|
||||
OpMemberDecorate %17 0 ColMajor
|
||||
OpMemberDecorate %17 0 Offset 0
|
||||
OpMemberDecorate %17 0 MatrixStride 16
|
||||
OpMemberDecorate %17 1 Offset 64
|
||||
OpDecorate %17 Block
|
||||
OpDecorate %19 DescriptorSet 0
|
||||
OpDecorate %25 Location 0
|
||||
OpDecorate %41 Location 0
|
||||
OpDecorate %42 Location 1
|
||||
OpDecorate %44 Location 1
|
||||
OpDecorate %46 Location 2
|
||||
%2 = OpTypeVoid
|
||||
%3 = OpTypeFunction %2
|
||||
%6 = OpTypeFloat 32
|
||||
%7 = OpTypeVector %6 4
|
||||
%8 = OpTypeInt 32 0
|
||||
%9 = OpConstant %8 1
|
||||
%10 = OpTypeArray %6 %9
|
||||
%11 = OpTypeStruct %7 %6 %10 %10
|
||||
%12 = OpTypePointer Output %11
|
||||
%13 = OpVariable %12 Output
|
||||
%14 = OpTypeInt 32 1
|
||||
%15 = OpConstant %14 0
|
||||
%16 = OpTypeMatrix %7 4
|
||||
%17 = OpTypeStruct %16 %14
|
||||
%18 = OpTypePointer PushConstant %17
|
||||
%19 = OpVariable %18 PushConstant
|
||||
%20 = OpTypePointer PushConstant %16
|
||||
%23 = OpTypeVector %6 2
|
||||
%24 = OpTypePointer Input %23
|
||||
%25 = OpVariable %24 Input
|
||||
%27 = OpConstant %6 0
|
||||
%28 = OpConstant %6 1
|
||||
%33 = OpTypePointer Output %7
|
||||
%35 = OpTypePointer Output %6
|
||||
%40 = OpTypePointer Output %23
|
||||
%41 = OpVariable %40 Output
|
||||
%42 = OpVariable %24 Input
|
||||
%44 = OpVariable %33 Output
|
||||
%45 = OpTypePointer Input %7
|
||||
%46 = OpVariable %45 Input
|
||||
%4 = OpFunction %2 None %3
|
||||
%5 = OpLabel
|
||||
%21 = OpAccessChain %20 %19 %15
|
||||
%22 = OpLoad %16 %21
|
||||
%26 = OpLoad %23 %25
|
||||
%29 = OpCompositeExtract %6 %26 0
|
||||
%30 = OpCompositeExtract %6 %26 1
|
||||
%31 = OpCompositeConstruct %7 %29 %30 %27 %28
|
||||
%32 = OpMatrixTimesVector %7 %22 %31
|
||||
%34 = OpAccessChain %33 %13 %15
|
||||
OpStore %34 %32
|
||||
%36 = OpAccessChain %35 %13 %15 %9
|
||||
%37 = OpLoad %6 %36
|
||||
%38 = OpFNegate %6 %37
|
||||
%39 = OpAccessChain %35 %13 %15 %9
|
||||
OpStore %39 %38
|
||||
%43 = OpLoad %23 %42
|
||||
OpStore %41 %43
|
||||
%47 = OpLoad %7 %46
|
||||
OpStore %44 %47
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -1,2 +0,0 @@
|
||||
glslangValidator -V immediate.vert -o immediate.vert.spv
|
||||
glslangValidator -V immediate.frag -o immediate.frag.spv
|
||||
@@ -1,3 +1,6 @@
|
||||
// NOTE: This file is compiled and embedded into the exe.
|
||||
// Use `xenia-build genspirv` and check in any changes under bin/.
|
||||
|
||||
#version 450 core
|
||||
precision highp float;
|
||||
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// NOTE: This file is compiled and embedded into the exe.
|
||||
// Use `xenia-build genspirv` and check in any changes under bin/.
|
||||
|
||||
#version 450 core
|
||||
precision highp float;
|
||||
|
||||
|
||||
@@ -20,8 +20,9 @@ namespace xe {
|
||||
namespace ui {
|
||||
namespace vulkan {
|
||||
|
||||
#include "xenia/ui/vulkan/shaders/immediate.frag.h"
|
||||
#include "xenia/ui/vulkan/shaders/immediate.vert.h"
|
||||
// Generated with `xenia-build genspirv`.
|
||||
#include "xenia/ui/vulkan/shaders/bin/immediate_frag.h"
|
||||
#include "xenia/ui/vulkan/shaders/bin/immediate_vert.h"
|
||||
|
||||
constexpr uint32_t kCircularBufferCapacity = 2 * 1024 * 1024;
|
||||
|
||||
@@ -380,9 +381,8 @@ VulkanImmediateDrawer::VulkanImmediateDrawer(VulkanContext* graphics_context)
|
||||
vertex_shader_info.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO;
|
||||
vertex_shader_info.pNext = nullptr;
|
||||
vertex_shader_info.flags = 0;
|
||||
vertex_shader_info.codeSize = sizeof(immediate_vert_spv);
|
||||
vertex_shader_info.pCode =
|
||||
reinterpret_cast<const uint32_t*>(immediate_vert_spv);
|
||||
vertex_shader_info.codeSize = sizeof(immediate_vert);
|
||||
vertex_shader_info.pCode = reinterpret_cast<const uint32_t*>(immediate_vert);
|
||||
VkShaderModule vertex_shader;
|
||||
err = vkCreateShaderModule(*device, &vertex_shader_info, nullptr,
|
||||
&vertex_shader);
|
||||
@@ -391,9 +391,9 @@ VulkanImmediateDrawer::VulkanImmediateDrawer(VulkanContext* graphics_context)
|
||||
fragment_shader_info.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO;
|
||||
fragment_shader_info.pNext = nullptr;
|
||||
fragment_shader_info.flags = 0;
|
||||
fragment_shader_info.codeSize = sizeof(immediate_frag_spv);
|
||||
fragment_shader_info.codeSize = sizeof(immediate_frag);
|
||||
fragment_shader_info.pCode =
|
||||
reinterpret_cast<const uint32_t*>(immediate_frag_spv);
|
||||
reinterpret_cast<const uint32_t*>(immediate_frag);
|
||||
VkShaderModule fragment_shader;
|
||||
err = vkCreateShaderModule(*device, &fragment_shader_info, nullptr,
|
||||
&fragment_shader);
|
||||
|
||||
Reference in New Issue
Block a user