shader: Split profile and runtime info headers
This commit is contained in:
		| @@ -226,6 +226,7 @@ add_library(shader_recompiler STATIC | |||||||
|     object_pool.h |     object_pool.h | ||||||
|     profile.h |     profile.h | ||||||
|     program_header.h |     program_header.h | ||||||
|  |     runtime_info.h | ||||||
|     shader_info.h |     shader_info.h | ||||||
| ) | ) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -8,6 +8,7 @@ | |||||||
| #include "shader_recompiler/backend/glasm/emit_context.h" | #include "shader_recompiler/backend/glasm/emit_context.h" | ||||||
| #include "shader_recompiler/frontend/ir/program.h" | #include "shader_recompiler/frontend/ir/program.h" | ||||||
| #include "shader_recompiler/profile.h" | #include "shader_recompiler/profile.h" | ||||||
|  | #include "shader_recompiler/runtime_info.h" | ||||||
|  |  | ||||||
| namespace Shader::Backend::GLASM { | namespace Shader::Backend::GLASM { | ||||||
| namespace { | namespace { | ||||||
|   | |||||||
| @@ -13,6 +13,7 @@ | |||||||
| #include "shader_recompiler/frontend/ir/ir_emitter.h" | #include "shader_recompiler/frontend/ir/ir_emitter.h" | ||||||
| #include "shader_recompiler/frontend/ir/program.h" | #include "shader_recompiler/frontend/ir/program.h" | ||||||
| #include "shader_recompiler/profile.h" | #include "shader_recompiler/profile.h" | ||||||
|  | #include "shader_recompiler/runtime_info.h" | ||||||
|  |  | ||||||
| namespace Shader::Backend::GLASM { | namespace Shader::Backend::GLASM { | ||||||
| namespace { | namespace { | ||||||
|   | |||||||
| @@ -9,6 +9,7 @@ | |||||||
| #include "shader_recompiler/backend/bindings.h" | #include "shader_recompiler/backend/bindings.h" | ||||||
| #include "shader_recompiler/frontend/ir/program.h" | #include "shader_recompiler/frontend/ir/program.h" | ||||||
| #include "shader_recompiler/profile.h" | #include "shader_recompiler/profile.h" | ||||||
|  | #include "shader_recompiler/runtime_info.h" | ||||||
|  |  | ||||||
| namespace Shader::Backend::GLASM { | namespace Shader::Backend::GLASM { | ||||||
|  |  | ||||||
|   | |||||||
| @@ -8,7 +8,7 @@ | |||||||
| #include "shader_recompiler/backend/glasm/emit_glasm_instructions.h" | #include "shader_recompiler/backend/glasm/emit_glasm_instructions.h" | ||||||
| #include "shader_recompiler/frontend/ir/program.h" | #include "shader_recompiler/frontend/ir/program.h" | ||||||
| #include "shader_recompiler/frontend/ir/value.h" | #include "shader_recompiler/frontend/ir/value.h" | ||||||
| #include "shader_recompiler/profile.h" | #include "shader_recompiler/runtime_info.h" | ||||||
|  |  | ||||||
| namespace Shader::Backend::GLASM { | namespace Shader::Backend::GLASM { | ||||||
| namespace { | namespace { | ||||||
|   | |||||||
| @@ -6,6 +6,7 @@ | |||||||
| #include "shader_recompiler/backend/glsl/emit_context.h" | #include "shader_recompiler/backend/glsl/emit_context.h" | ||||||
| #include "shader_recompiler/frontend/ir/program.h" | #include "shader_recompiler/frontend/ir/program.h" | ||||||
| #include "shader_recompiler/profile.h" | #include "shader_recompiler/profile.h" | ||||||
|  | #include "shader_recompiler/runtime_info.h" | ||||||
|  |  | ||||||
| namespace Shader::Backend::GLSL { | namespace Shader::Backend::GLSL { | ||||||
| namespace { | namespace { | ||||||
|   | |||||||
| @@ -9,6 +9,7 @@ | |||||||
| #include "shader_recompiler/backend/bindings.h" | #include "shader_recompiler/backend/bindings.h" | ||||||
| #include "shader_recompiler/frontend/ir/program.h" | #include "shader_recompiler/frontend/ir/program.h" | ||||||
| #include "shader_recompiler/profile.h" | #include "shader_recompiler/profile.h" | ||||||
|  | #include "shader_recompiler/runtime_info.h" | ||||||
|  |  | ||||||
| namespace Shader::Backend::GLSL { | namespace Shader::Backend::GLSL { | ||||||
|  |  | ||||||
|   | |||||||
| @@ -18,9 +18,6 @@ class Value; | |||||||
| namespace Shader::Backend::GLSL { | namespace Shader::Backend::GLSL { | ||||||
| class EmitContext; | class EmitContext; | ||||||
|  |  | ||||||
| inline void EmitSetLoopSafetyVariable(EmitContext&) {} |  | ||||||
| inline void EmitGetLoopSafetyVariable(EmitContext&) {} |  | ||||||
|  |  | ||||||
| #define NotImplemented() throw NotImplementedException("GLSL instruction {}", __func__) | #define NotImplemented() throw NotImplementedException("GLSL instruction {}", __func__) | ||||||
|  |  | ||||||
| // Microinstruction emitters | // Microinstruction emitters | ||||||
|   | |||||||
| @@ -12,6 +12,7 @@ | |||||||
| #include "shader_recompiler/backend/bindings.h" | #include "shader_recompiler/backend/bindings.h" | ||||||
| #include "shader_recompiler/frontend/ir/program.h" | #include "shader_recompiler/frontend/ir/program.h" | ||||||
| #include "shader_recompiler/profile.h" | #include "shader_recompiler/profile.h" | ||||||
|  | #include "shader_recompiler/runtime_info.h" | ||||||
| #include "shader_recompiler/shader_info.h" | #include "shader_recompiler/shader_info.h" | ||||||
|  |  | ||||||
| namespace Shader::Backend::SPIRV { | namespace Shader::Backend::SPIRV { | ||||||
|   | |||||||
| @@ -4,59 +4,10 @@ | |||||||
|  |  | ||||||
| #pragma once | #pragma once | ||||||
|  |  | ||||||
| #include <array> |  | ||||||
| #include <optional> |  | ||||||
| #include <vector> |  | ||||||
|  |  | ||||||
| #include "common/common_types.h" | #include "common/common_types.h" | ||||||
|  |  | ||||||
| namespace Shader { | namespace Shader { | ||||||
|  |  | ||||||
| enum class AttributeType : u8 { |  | ||||||
|     Float, |  | ||||||
|     SignedInt, |  | ||||||
|     UnsignedInt, |  | ||||||
|     Disabled, |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| enum class InputTopology { |  | ||||||
|     Points, |  | ||||||
|     Lines, |  | ||||||
|     LinesAdjacency, |  | ||||||
|     Triangles, |  | ||||||
|     TrianglesAdjacency, |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| enum class CompareFunction { |  | ||||||
|     Never, |  | ||||||
|     Less, |  | ||||||
|     Equal, |  | ||||||
|     LessThanEqual, |  | ||||||
|     Greater, |  | ||||||
|     NotEqual, |  | ||||||
|     GreaterThanEqual, |  | ||||||
|     Always, |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| enum class TessPrimitive { |  | ||||||
|     Isolines, |  | ||||||
|     Triangles, |  | ||||||
|     Quads, |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| enum class TessSpacing { |  | ||||||
|     Equal, |  | ||||||
|     FractionalOdd, |  | ||||||
|     FractionalEven, |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| struct TransformFeedbackVarying { |  | ||||||
|     u32 buffer{}; |  | ||||||
|     u32 stride{}; |  | ||||||
|     u32 offset{}; |  | ||||||
|     u32 components{}; |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| struct Profile { | struct Profile { | ||||||
|     u32 supported_spirv{0x00010000}; |     u32 supported_spirv{0x00010000}; | ||||||
|  |  | ||||||
| @@ -114,27 +65,4 @@ struct Profile { | |||||||
|     bool ignore_nan_fp_comparisons{}; |     bool ignore_nan_fp_comparisons{}; | ||||||
| }; | }; | ||||||
|  |  | ||||||
| struct RuntimeInfo { |  | ||||||
|     std::array<AttributeType, 32> generic_input_types{}; |  | ||||||
|     bool convert_depth_mode{}; |  | ||||||
|     bool force_early_z{}; |  | ||||||
|  |  | ||||||
|     TessPrimitive tess_primitive{}; |  | ||||||
|     TessSpacing tess_spacing{}; |  | ||||||
|     bool tess_clockwise{}; |  | ||||||
|  |  | ||||||
|     InputTopology input_topology{}; |  | ||||||
|  |  | ||||||
|     std::optional<float> fixed_state_point_size; |  | ||||||
|     std::optional<CompareFunction> alpha_test_func; |  | ||||||
|     float alpha_test_reference{}; |  | ||||||
|  |  | ||||||
|     // Static y negate value |  | ||||||
|     bool y_negate{}; |  | ||||||
|     // Use storage buffers instead of global pointers on GLASM |  | ||||||
|     bool glasm_use_storage_buffers{}; |  | ||||||
|  |  | ||||||
|     std::vector<TransformFeedbackVarying> xfb_varyings; |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| } // namespace Shader | } // namespace Shader | ||||||
|   | |||||||
							
								
								
									
										83
									
								
								src/shader_recompiler/runtime_info.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										83
									
								
								src/shader_recompiler/runtime_info.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,83 @@ | |||||||
|  | // Copyright 2021 yuzu Emulator Project | ||||||
|  | // Licensed under GPLv2 or any later version | ||||||
|  | // Refer to the license.txt file included. | ||||||
|  |  | ||||||
|  | #pragma once | ||||||
|  |  | ||||||
|  | #include <array> | ||||||
|  | #include <optional> | ||||||
|  | #include <vector> | ||||||
|  |  | ||||||
|  | #include "common/common_types.h" | ||||||
|  |  | ||||||
|  | namespace Shader { | ||||||
|  |  | ||||||
|  | enum class AttributeType : u8 { | ||||||
|  |     Float, | ||||||
|  |     SignedInt, | ||||||
|  |     UnsignedInt, | ||||||
|  |     Disabled, | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | enum class InputTopology { | ||||||
|  |     Points, | ||||||
|  |     Lines, | ||||||
|  |     LinesAdjacency, | ||||||
|  |     Triangles, | ||||||
|  |     TrianglesAdjacency, | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | enum class CompareFunction { | ||||||
|  |     Never, | ||||||
|  |     Less, | ||||||
|  |     Equal, | ||||||
|  |     LessThanEqual, | ||||||
|  |     Greater, | ||||||
|  |     NotEqual, | ||||||
|  |     GreaterThanEqual, | ||||||
|  |     Always, | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | enum class TessPrimitive { | ||||||
|  |     Isolines, | ||||||
|  |     Triangles, | ||||||
|  |     Quads, | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | enum class TessSpacing { | ||||||
|  |     Equal, | ||||||
|  |     FractionalOdd, | ||||||
|  |     FractionalEven, | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | struct TransformFeedbackVarying { | ||||||
|  |     u32 buffer{}; | ||||||
|  |     u32 stride{}; | ||||||
|  |     u32 offset{}; | ||||||
|  |     u32 components{}; | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | struct RuntimeInfo { | ||||||
|  |     std::array<AttributeType, 32> generic_input_types{}; | ||||||
|  |     bool convert_depth_mode{}; | ||||||
|  |     bool force_early_z{}; | ||||||
|  |  | ||||||
|  |     TessPrimitive tess_primitive{}; | ||||||
|  |     TessSpacing tess_spacing{}; | ||||||
|  |     bool tess_clockwise{}; | ||||||
|  |  | ||||||
|  |     InputTopology input_topology{}; | ||||||
|  |  | ||||||
|  |     std::optional<float> fixed_state_point_size; | ||||||
|  |     std::optional<CompareFunction> alpha_test_func; | ||||||
|  |     float alpha_test_reference{}; | ||||||
|  |  | ||||||
|  |     // Static y negate value | ||||||
|  |     bool y_negate{}; | ||||||
|  |     // Use storage buffers instead of global pointers on GLASM | ||||||
|  |     bool glasm_use_storage_buffers{}; | ||||||
|  |  | ||||||
|  |     std::vector<TransformFeedbackVarying> xfb_varyings; | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | } // namespace Shader | ||||||
| @@ -16,6 +16,7 @@ | |||||||
| #include "shader_recompiler/frontend/ir/value.h" | #include "shader_recompiler/frontend/ir/value.h" | ||||||
| #include "shader_recompiler/host_translate_info.h" | #include "shader_recompiler/host_translate_info.h" | ||||||
| #include "shader_recompiler/object_pool.h" | #include "shader_recompiler/object_pool.h" | ||||||
|  | #include "shader_recompiler/profile.h" | ||||||
| #include "video_core/engines/shader_type.h" | #include "video_core/engines/shader_type.h" | ||||||
| #include "video_core/renderer_opengl/gl_compute_pipeline.h" | #include "video_core/renderer_opengl/gl_compute_pipeline.h" | ||||||
| #include "video_core/renderer_opengl/gl_graphics_pipeline.h" | #include "video_core/renderer_opengl/gl_graphics_pipeline.h" | ||||||
|   | |||||||
| @@ -8,7 +8,7 @@ | |||||||
| #include <vector> | #include <vector> | ||||||
|  |  | ||||||
| #include "common/common_types.h" | #include "common/common_types.h" | ||||||
| #include "shader_recompiler/profile.h" | #include "shader_recompiler/runtime_info.h" | ||||||
| #include "video_core/engines/maxwell_3d.h" | #include "video_core/engines/maxwell_3d.h" | ||||||
|  |  | ||||||
| namespace VideoCommon { | namespace VideoCommon { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user