 c8c2beaeff
			
		
	
	c8c2beaeff
	
	
	
		
			
			* do not move constant variables
* applet_manager: avoid possible use after move
* use constant references where pointed out by msvc
* extra_hid: initialize response
* ValidateSaveState: passing slot separately is not necessary
* common: mark HashCombine as nodiscard
* cityhash: remove use of using namespace std
* Prefix all size_t with std::
done automatically by executing regex replace `([^:0-9a-zA-Z_])size_t([^0-9a-zA-Z_])` -> `$1std::size_t$2`
based on 7d8f115
* shared_memory.cpp: fix log error format
* fix compiling with pch off
		
	
		
			
				
	
	
		
			65 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			65 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| // Copyright 2023 Citra Emulator Project
 | |
| // Licensed under GPLv2 or any later version
 | |
| // Refer to the license.txt file included.
 | |
| 
 | |
| #include "common/assert.h"
 | |
| #include "common/bit_set.h"
 | |
| #include "video_core/pica/regs_shader.h"
 | |
| #include "video_core/pica/shader_unit.h"
 | |
| 
 | |
| namespace Pica {
 | |
| 
 | |
| ShaderUnit::ShaderUnit(GeometryEmitter* emitter) : emitter_ptr{emitter} {}
 | |
| 
 | |
| ShaderUnit::~ShaderUnit() = default;
 | |
| 
 | |
| void ShaderUnit::LoadInput(const ShaderRegs& config, const AttributeBuffer& buffer) {
 | |
|     const u32 max_attribute = config.max_input_attribute_index;
 | |
|     for (u32 attr = 0; attr <= max_attribute; ++attr) {
 | |
|         const u32 reg = config.GetRegisterForAttribute(attr);
 | |
|         input[reg] = buffer[attr];
 | |
|     }
 | |
| }
 | |
| 
 | |
| void ShaderUnit::WriteOutput(const ShaderRegs& config, AttributeBuffer& buffer) {
 | |
|     u32 output_index{};
 | |
|     for (u32 reg : Common::BitSet<u32>(config.output_mask)) {
 | |
|         buffer[output_index++] = output[reg];
 | |
|     }
 | |
| }
 | |
| 
 | |
| void GeometryEmitter::Emit(std::span<Common::Vec4<f24>, 16> output_regs) {
 | |
|     ASSERT(vertex_id < 3);
 | |
| 
 | |
|     u32 output_index{};
 | |
|     for (u32 reg : Common::BitSet<u32>(output_mask)) {
 | |
|         buffer[vertex_id][output_index++] = output_regs[reg];
 | |
|     }
 | |
| 
 | |
|     if (prim_emit) {
 | |
|         if (winding) {
 | |
|             handlers->winding_setter();
 | |
|         }
 | |
|         for (std::size_t i = 0; i < buffer.size(); ++i) {
 | |
|             handlers->vertex_handler(buffer[i]);
 | |
|         }
 | |
|     }
 | |
| }
 | |
| 
 | |
| GeometryShaderUnit::GeometryShaderUnit() : ShaderUnit{&emitter} {}
 | |
| 
 | |
| GeometryShaderUnit::~GeometryShaderUnit() = default;
 | |
| 
 | |
| void GeometryShaderUnit::SetVertexHandlers(VertexHandler vertex_handler,
 | |
|                                            WindingSetter winding_setter) {
 | |
|     emitter.handlers = new Handlers;
 | |
|     emitter.handlers->vertex_handler = vertex_handler;
 | |
|     emitter.handlers->winding_setter = winding_setter;
 | |
| }
 | |
| 
 | |
| void GeometryShaderUnit::ConfigOutput(const ShaderRegs& config) {
 | |
|     emitter.output_mask = config.output_mask;
 | |
| }
 | |
| 
 | |
| } // namespace Pica
 |