mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-31 05:40:04 +00:00 
			
		
		
		
	VideoCore: Split rasterizer regs from Regs struct
This commit is contained in:
		
							parent
							
								
									97e06b0a0d
								
							
						
					
					
						commit
						000e78144c
					
				
					 14 changed files with 219 additions and 188 deletions
				
			
		|  | @ -20,7 +20,7 @@ namespace Pica { | |||
| 
 | ||||
| namespace Shader { | ||||
| 
 | ||||
| OutputVertex OutputVertex::FromAttributeBuffer(const Regs& regs, AttributeBuffer& input) { | ||||
| OutputVertex OutputVertex::FromAttributeBuffer(const RasterizerRegs& regs, AttributeBuffer& input) { | ||||
|     // Setup output data
 | ||||
|     union { | ||||
|         OutputVertex ret{}; | ||||
|  | @ -33,16 +33,16 @@ OutputVertex OutputVertex::FromAttributeBuffer(const Regs& regs, AttributeBuffer | |||
|     for (unsigned int i = 0; i < num_attributes; ++i) { | ||||
|         const auto& output_register_map = regs.vs_output_attributes[i]; | ||||
| 
 | ||||
|         Regs::VSOutputAttributes::Semantic semantics[4] = { | ||||
|         RasterizerRegs::VSOutputAttributes::Semantic semantics[4] = { | ||||
|             output_register_map.map_x, output_register_map.map_y, output_register_map.map_z, | ||||
|             output_register_map.map_w}; | ||||
| 
 | ||||
|         for (unsigned comp = 0; comp < 4; ++comp) { | ||||
|             Regs::VSOutputAttributes::Semantic semantic = semantics[comp]; | ||||
|             RasterizerRegs::VSOutputAttributes::Semantic semantic = semantics[comp]; | ||||
|             float24* out = &vertex_slots[semantic]; | ||||
|             if (semantic < vertex_slots.size()) { | ||||
|                 *out = input.attr[i][comp]; | ||||
|             } else if (semantic != Regs::VSOutputAttributes::INVALID) { | ||||
|             } else if (semantic != RasterizerRegs::VSOutputAttributes::INVALID) { | ||||
|                 LOG_ERROR(HW_GPU, "Invalid/unknown semantic id: %u", (unsigned int)semantic); | ||||
|             } | ||||
|         } | ||||
|  |  | |||
|  | @ -39,19 +39,19 @@ struct OutputVertex { | |||
|     INSERT_PADDING_WORDS(1); | ||||
|     Math::Vec2<float24> tc2; | ||||
| 
 | ||||
|     static OutputVertex FromAttributeBuffer(const Regs& regs, AttributeBuffer& output); | ||||
|     static OutputVertex FromAttributeBuffer(const RasterizerRegs& regs, AttributeBuffer& output); | ||||
| }; | ||||
| #define ASSERT_POS(var, pos)                                                                       \ | ||||
|     static_assert(offsetof(OutputVertex, var) == pos * sizeof(float24), "Semantic at wrong "       \ | ||||
|                                                                         "offset.") | ||||
| ASSERT_POS(pos, Regs::VSOutputAttributes::POSITION_X); | ||||
| ASSERT_POS(quat, Regs::VSOutputAttributes::QUATERNION_X); | ||||
| ASSERT_POS(color, Regs::VSOutputAttributes::COLOR_R); | ||||
| ASSERT_POS(tc0, Regs::VSOutputAttributes::TEXCOORD0_U); | ||||
| ASSERT_POS(tc1, Regs::VSOutputAttributes::TEXCOORD1_U); | ||||
| ASSERT_POS(tc0_w, Regs::VSOutputAttributes::TEXCOORD0_W); | ||||
| ASSERT_POS(view, Regs::VSOutputAttributes::VIEW_X); | ||||
| ASSERT_POS(tc2, Regs::VSOutputAttributes::TEXCOORD2_U); | ||||
| ASSERT_POS(pos, RasterizerRegs::VSOutputAttributes::POSITION_X); | ||||
| ASSERT_POS(quat, RasterizerRegs::VSOutputAttributes::QUATERNION_X); | ||||
| ASSERT_POS(color, RasterizerRegs::VSOutputAttributes::COLOR_R); | ||||
| ASSERT_POS(tc0, RasterizerRegs::VSOutputAttributes::TEXCOORD0_U); | ||||
| ASSERT_POS(tc1, RasterizerRegs::VSOutputAttributes::TEXCOORD1_U); | ||||
| ASSERT_POS(tc0_w, RasterizerRegs::VSOutputAttributes::TEXCOORD0_W); | ||||
| ASSERT_POS(view, RasterizerRegs::VSOutputAttributes::VIEW_X); | ||||
| ASSERT_POS(tc2, RasterizerRegs::VSOutputAttributes::TEXCOORD2_U); | ||||
| #undef ASSERT_POS | ||||
| static_assert(std::is_pod<OutputVertex>::value, "Structure is not POD"); | ||||
| static_assert(sizeof(OutputVertex) == 24 * sizeof(float), "OutputVertex has invalid size"); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue