mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-31 05:40:04 +00:00 
			
		
		
		
	Update the entire application to use the new clang format style
This commit is contained in:
		
							parent
							
								
									ed36edf69c
								
							
						
					
					
						commit
						f61141e86a
					
				
					 148 changed files with 955 additions and 552 deletions
				
			
		|  | @ -311,8 +311,9 @@ static void WritePicaReg(u32 id, u32 value, u32 mask) { | |||
| 
 | ||||
|                 u8* texture_data = Memory::GetPhysicalPointer(texture.config.GetPhysicalAddress()); | ||||
|                 g_debug_context->recorder->MemoryAccessed( | ||||
|                     texture_data, Pica::TexturingRegs::NibblesPerPixel(texture.format) * | ||||
|                                       texture.config.width / 2 * texture.config.height, | ||||
|                     texture_data, | ||||
|                     Pica::TexturingRegs::NibblesPerPixel(texture.format) * texture.config.width / | ||||
|                         2 * texture.config.height, | ||||
|                     texture.config.GetPhysicalAddress()); | ||||
|             } | ||||
|         } | ||||
|  |  | |||
|  | @ -36,6 +36,6 @@ static_assert(sizeof(CommandHeader) == sizeof(u32), "CommandHeader has incorrect | |||
| 
 | ||||
| void ProcessCommandList(const u32* list, u32 size); | ||||
| 
 | ||||
| } // namespace
 | ||||
| } // namespace CommandProcessor
 | ||||
| 
 | ||||
| } // namespace
 | ||||
| } // namespace Pica
 | ||||
|  |  | |||
|  | @ -459,6 +459,6 @@ void DumpTevStageConfig(const std::array<TexturingRegs::TevStageConfig, 6>& stag | |||
|     LOG_TRACE(HW_GPU, "%s", stage_info.c_str()); | ||||
| } | ||||
| 
 | ||||
| } // namespace
 | ||||
| } // namespace DebugUtils
 | ||||
| 
 | ||||
| } // namespace
 | ||||
| } // namespace Pica
 | ||||
|  |  | |||
|  | @ -243,6 +243,6 @@ public: | |||
|     std::map<u32, u32> ranges; | ||||
| }; | ||||
| 
 | ||||
| } // namespace
 | ||||
| } // namespace DebugUtils
 | ||||
| 
 | ||||
| } // namespace
 | ||||
| } // namespace Pica
 | ||||
|  |  | |||
|  | @ -22,11 +22,11 @@ public: | |||
|         } | ||||
| 
 | ||||
|         /**
 | ||||
|         * Called when a GX command has been processed and is ready for being | ||||
|         * read via GraphicsDebugger::ReadGXCommandHistory. | ||||
|         * @param total_command_count Total number of commands in the GX history | ||||
|         * @note All methods in this class are called from the GSP thread | ||||
|         */ | ||||
|          * Called when a GX command has been processed and is ready for being | ||||
|          * read via GraphicsDebugger::ReadGXCommandHistory. | ||||
|          * @param total_command_count Total number of commands in the GX history | ||||
|          * @note All methods in this class are called from the GSP thread | ||||
|          */ | ||||
|         virtual void GXCommandProcessed(int total_command_count) { | ||||
|             const Service::GSP::Command& cmd = | ||||
|                 observed->ReadGXCommandHistory(total_command_count - 1); | ||||
|  |  | |||
|  | @ -51,4 +51,4 @@ void State::Reset() { | |||
|     Zero(immediate); | ||||
|     primitive_assembler.Reconfigure(PipelineRegs::TriangleTopology::List); | ||||
| } | ||||
| } | ||||
| } // namespace Pica
 | ||||
|  |  | |||
|  | @ -13,4 +13,4 @@ void Init(); | |||
| /// Shutdown Pica state
 | ||||
| void Shutdown(); | ||||
| 
 | ||||
| } // namespace
 | ||||
| } // namespace Pica
 | ||||
|  |  | |||
|  | @ -156,4 +156,4 @@ struct State { | |||
| 
 | ||||
| extern State g_state; ///< Current Pica state
 | ||||
| 
 | ||||
| } // namespace
 | ||||
| } // namespace Pica
 | ||||
|  |  | |||
|  | @ -74,4 +74,4 @@ void PrimitiveAssembler<VertexType>::Reconfigure(PipelineRegs::TriangleTopology | |||
| // explicitly instantiate use cases
 | ||||
| template struct PrimitiveAssembler<Shader::OutputVertex>; | ||||
| 
 | ||||
| } // namespace
 | ||||
| } // namespace Pica
 | ||||
|  |  | |||
|  | @ -54,4 +54,4 @@ private: | |||
|     bool winding = false; | ||||
| }; | ||||
| 
 | ||||
| } // namespace
 | ||||
| } // namespace Pica
 | ||||
|  |  | |||
|  | @ -13,7 +13,7 @@ namespace Pica { | |||
| namespace Shader { | ||||
| struct OutputVertex; | ||||
| } | ||||
| } | ||||
| } // namespace Pica
 | ||||
| 
 | ||||
| namespace VideoCore { | ||||
| 
 | ||||
|  | @ -67,4 +67,4 @@ public: | |||
|         return false; | ||||
|     } | ||||
| }; | ||||
| } | ||||
| } // namespace VideoCore
 | ||||
|  |  | |||
|  | @ -41,7 +41,7 @@ namespace Pica { | |||
| //       field offset. Otherwise, the compiler will fail to compile this code.
 | ||||
| #define PICA_REG_INDEX_WORKAROUND(field_name, backup_workaround_index)                             \ | ||||
|     ((typename std::enable_if<backup_workaround_index == PICA_REG_INDEX(field_name),               \ | ||||
|                               size_t>::type)PICA_REG_INDEX(field_name)) | ||||
|                               size_t>::type) PICA_REG_INDEX(field_name)) | ||||
| #endif // _MSC_VER
 | ||||
| 
 | ||||
| struct Regs { | ||||
|  |  | |||
|  | @ -39,13 +39,13 @@ struct LightingRegs { | |||
|     } | ||||
| 
 | ||||
|     /**
 | ||||
|     * Pica fragment lighting supports using different LUTs for each lighting component:  Reflectance | ||||
|     * R, G, and B channels, distribution function for specular components 0 and 1, fresnel factor, | ||||
|     * and spotlight attenuation.  Furthermore, which LUTs are used for each channel (or whether a | ||||
|     * channel is enabled at all) is specified by various pre-defined lighting configurations.  With | ||||
|     * configurations that require more LUTs, more cycles are required on HW to perform lighting | ||||
|     * computations. | ||||
|     */ | ||||
|      * Pica fragment lighting supports using different LUTs for each lighting component: Reflectance | ||||
|      * R, G, and B channels, distribution function for specular components 0 and 1, fresnel factor, | ||||
|      * and spotlight attenuation.  Furthermore, which LUTs are used for each channel (or whether a | ||||
|      * channel is enabled at all) is specified by various pre-defined lighting configurations.  With | ||||
|      * configurations that require more LUTs, more cycles are required on HW to perform lighting | ||||
|      * computations. | ||||
|      */ | ||||
|     enum class LightingConfig : u32 { | ||||
|         Config0 = 0, ///< Reflect Red, Distribution 0, Spotlight
 | ||||
|         Config1 = 1, ///< Reflect Red, Fresnel, Spotlight
 | ||||
|  |  | |||
|  | @ -1065,9 +1065,8 @@ bool RasterizerOpenGL::AccelerateTextureCopy(const GPU::Regs::DisplayTransferCon | |||
|     } | ||||
| 
 | ||||
|     if (output_gap != 0 && | ||||
|         (output_width != | ||||
|              src_surface->BytesInPixels(src_rect.GetWidth() / src_surface->res_scale) * | ||||
|                  (src_surface->is_tiled ? 8 : 1) || | ||||
|         (output_width != src_surface->BytesInPixels(src_rect.GetWidth() / src_surface->res_scale) * | ||||
|                              (src_surface->is_tiled ? 8 : 1) || | ||||
|          output_gap % src_surface->BytesInPixels(src_surface->is_tiled ? 64 : 1) != 0)) { | ||||
|         return false; | ||||
|     } | ||||
|  | @ -1075,9 +1074,8 @@ bool RasterizerOpenGL::AccelerateTextureCopy(const GPU::Regs::DisplayTransferCon | |||
|     SurfaceParams dst_params = *src_surface; | ||||
|     dst_params.addr = config.GetPhysicalOutputAddress(); | ||||
|     dst_params.width = src_rect.GetWidth() / src_surface->res_scale; | ||||
|     dst_params.stride = | ||||
|         dst_params.width + | ||||
|         src_surface->PixelsInBytes(src_surface->is_tiled ? output_gap / 8 : output_gap); | ||||
|     dst_params.stride = dst_params.width + src_surface->PixelsInBytes( | ||||
|                                                src_surface->is_tiled ? output_gap / 8 : output_gap); | ||||
|     dst_params.height = src_rect.GetHeight() / src_surface->res_scale; | ||||
|     dst_params.res_scale = src_surface->res_scale; | ||||
|     dst_params.UpdateParams(); | ||||
|  | @ -1396,7 +1394,8 @@ void RasterizerOpenGL::SyncBlendColor() { | |||
| void RasterizerOpenGL::SyncFogColor() { | ||||
|     const auto& regs = Pica::g_state.regs; | ||||
|     uniform_block_data.data.fog_color = { | ||||
|         regs.texturing.fog_color.r.Value() / 255.0f, regs.texturing.fog_color.g.Value() / 255.0f, | ||||
|         regs.texturing.fog_color.r.Value() / 255.0f, | ||||
|         regs.texturing.fog_color.g.Value() / 255.0f, | ||||
|         regs.texturing.fog_color.b.Value() / 255.0f, | ||||
|     }; | ||||
|     uniform_block_data.dirty = true; | ||||
|  | @ -1424,7 +1423,8 @@ void RasterizerOpenGL::SyncProcTexNoise() { | |||
|         Pica::float16::FromRaw(regs.proctex_noise_frequency.v).ToFloat32(), | ||||
|     }; | ||||
|     uniform_block_data.data.proctex_noise_a = { | ||||
|         regs.proctex_noise_u.amplitude / 4095.0f, regs.proctex_noise_v.amplitude / 4095.0f, | ||||
|         regs.proctex_noise_u.amplitude / 4095.0f, | ||||
|         regs.proctex_noise_v.amplitude / 4095.0f, | ||||
|     }; | ||||
|     uniform_block_data.data.proctex_noise_p = { | ||||
|         Pica::float16::FromRaw(regs.proctex_noise_u.phase).ToFloat32(), | ||||
|  |  | |||
|  | @ -662,7 +662,6 @@ static void WriteLighting(std::string& out, const PicaShaderConfig& config) { | |||
|             // LUT index is in the range of (-1.0, 1.0)
 | ||||
|             return "LookupLightingLUTSigned(" + sampler_string + ", " + index + ")"; | ||||
|         } | ||||
| 
 | ||||
|     }; | ||||
| 
 | ||||
|     // Write the code to emulate each enabled light
 | ||||
|  |  | |||
|  | @ -16,4 +16,4 @@ namespace GLShader { | |||
|  */ | ||||
| GLuint LoadProgram(const char* vertex_shader, const char* fragment_shader); | ||||
| 
 | ||||
| } // namespace
 | ||||
| } // namespace GLShader
 | ||||
|  |  | |||
|  | @ -221,15 +221,19 @@ inline GLenum StencilOp(Pica::FramebufferRegs::StencilAction action) { | |||
| 
 | ||||
| inline GLvec4 ColorRGBA8(const u32 color) { | ||||
|     return {{ | ||||
|         (color >> 0 & 0xFF) / 255.0f, (color >> 8 & 0xFF) / 255.0f, (color >> 16 & 0xFF) / 255.0f, | ||||
|         (color >> 0 & 0xFF) / 255.0f, | ||||
|         (color >> 8 & 0xFF) / 255.0f, | ||||
|         (color >> 16 & 0xFF) / 255.0f, | ||||
|         (color >> 24 & 0xFF) / 255.0f, | ||||
|     }}; | ||||
| } | ||||
| 
 | ||||
| inline std::array<GLfloat, 3> LightColor(const Pica::LightingRegs::LightColor& color) { | ||||
|     return {{ | ||||
|         color.r / 255.0f, color.g / 255.0f, color.b / 255.0f, | ||||
|         color.r / 255.0f, | ||||
|         color.g / 255.0f, | ||||
|         color.b / 255.0f, | ||||
|     }}; | ||||
| } | ||||
| 
 | ||||
| } // namespace
 | ||||
| } // namespace PicaToGL
 | ||||
|  |  | |||
|  | @ -66,8 +66,9 @@ OutputVertex OutputVertex::FromAttributeBuffer(const RasterizerRegs& regs, | |||
|         ret.color[i] = float24::FromFloat32(c < 1.0f ? c : 1.0f); | ||||
|     } | ||||
| 
 | ||||
|     LOG_TRACE(HW_GPU, "Output vertex: pos(%.2f, %.2f, %.2f, %.2f), quat(%.2f, %.2f, %.2f, %.2f), " | ||||
|                       "col(%.2f, %.2f, %.2f, %.2f), tc0(%.2f, %.2f), view(%.2f, %.2f, %.2f)", | ||||
|     LOG_TRACE(HW_GPU, | ||||
|               "Output vertex: pos(%.2f, %.2f, %.2f, %.2f), quat(%.2f, %.2f, %.2f, %.2f), " | ||||
|               "col(%.2f, %.2f, %.2f, %.2f), tc0(%.2f, %.2f), view(%.2f, %.2f, %.2f)", | ||||
|               ret.pos.x.ToFloat32(), ret.pos.y.ToFloat32(), ret.pos.z.ToFloat32(), | ||||
|               ret.pos.w.ToFloat32(), ret.quat.x.ToFloat32(), ret.quat.y.ToFloat32(), | ||||
|               ret.quat.z.ToFloat32(), ret.quat.w.ToFloat32(), ret.color.x.ToFloat32(), | ||||
|  |  | |||
|  | @ -17,9 +17,9 @@ | |||
| #include "video_core/regs_rasterizer.h" | ||||
| #include "video_core/regs_shader.h" | ||||
| 
 | ||||
| using nihstro::DestRegister; | ||||
| using nihstro::RegisterType; | ||||
| using nihstro::SourceRegister; | ||||
| using nihstro::DestRegister; | ||||
| 
 | ||||
| namespace Pica { | ||||
| 
 | ||||
|  |  | |||
|  | @ -19,8 +19,8 @@ | |||
| #include "video_core/shader/shader.h" | ||||
| #include "video_core/shader/shader_interpreter.h" | ||||
| 
 | ||||
| using nihstro::OpCode; | ||||
| using nihstro::Instruction; | ||||
| using nihstro::OpCode; | ||||
| using nihstro::RegisterType; | ||||
| using nihstro::SourceRegister; | ||||
| using nihstro::SwizzlePattern; | ||||
|  | @ -696,6 +696,6 @@ DebugData<true> InterpreterEngine::ProduceDebugInfo(const ShaderSetup& setup, | |||
|     return debug_data; | ||||
| } | ||||
| 
 | ||||
| } // namespace
 | ||||
| } // namespace Shader
 | ||||
| 
 | ||||
| } // namespace
 | ||||
| } // namespace Pica
 | ||||
|  |  | |||
|  | @ -27,6 +27,6 @@ public: | |||
|                                      const ShaderRegs& config) const; | ||||
| }; | ||||
| 
 | ||||
| } // namespace
 | ||||
| } // namespace Shader
 | ||||
| 
 | ||||
| } // namespace
 | ||||
| } // namespace Pica
 | ||||
|  |  | |||
|  | @ -139,13 +139,20 @@ static const Xmm NEGBIT = xmm15; | |||
| // Scratch registers, e.g., SRC1 and SCRATCH, have to be saved on the side if needed
 | ||||
| static const BitSet32 persistent_regs = BuildRegSet({ | ||||
|     // Pointers to register blocks
 | ||||
|     SETUP, STATE, | ||||
|     SETUP, | ||||
|     STATE, | ||||
|     // Cached registers
 | ||||
|     ADDROFFS_REG_0, ADDROFFS_REG_1, LOOPCOUNT_REG, COND0, COND1, | ||||
|     ADDROFFS_REG_0, | ||||
|     ADDROFFS_REG_1, | ||||
|     LOOPCOUNT_REG, | ||||
|     COND0, | ||||
|     COND1, | ||||
|     // Constants
 | ||||
|     ONE, NEGBIT, | ||||
|     ONE, | ||||
|     NEGBIT, | ||||
|     // Loop variables
 | ||||
|     LOOPCOUNT, LOOPINC, | ||||
|     LOOPCOUNT, | ||||
|     LOOPINC, | ||||
| }); | ||||
| 
 | ||||
| /// Raw constant for the source register selector that indicates no swizzling is performed
 | ||||
|  |  | |||
|  | @ -132,6 +132,6 @@ private: | |||
|     Xbyak::Label exp2_subroutine; | ||||
| }; | ||||
| 
 | ||||
| } // Shader
 | ||||
| } // namespace Shader
 | ||||
| 
 | ||||
| } // Pica
 | ||||
| } // namespace Pica
 | ||||
|  |  | |||
|  | @ -197,9 +197,9 @@ static void ProcessTriangleInternal(const Vertex& v0, const Vertex& v1, const Ve | |||
|         } else { | ||||
|             // check if vertex is on our left => right side
 | ||||
|             // TODO: Not sure how likely this is to overflow
 | ||||
|             return (int)vtx.x < (int)line1.x + | ||||
|                                     ((int)line2.x - (int)line1.x) * ((int)vtx.y - (int)line1.y) / | ||||
|                                         ((int)line2.y - (int)line1.y); | ||||
|             return (int)vtx.x < (int)line1.x + ((int)line2.x - (int)line1.x) * | ||||
|                                                    ((int)vtx.y - (int)line1.y) / | ||||
|                                                    ((int)line2.y - (int)line1.y); | ||||
|         } | ||||
|     }; | ||||
|     int bias0 = | ||||
|  | @ -423,12 +423,14 @@ static void ProcessTriangleInternal(const Vertex& v0, const Vertex& v1, const Ve | |||
|             Math::Vec4<u8> secondary_fragment_color = {0, 0, 0, 0}; | ||||
| 
 | ||||
|             if (!g_state.regs.lighting.disable) { | ||||
|                 Math::Quaternion<float> normquat = Math::Quaternion<float>{ | ||||
|                     {GetInterpolatedAttribute(v0.quat.x, v1.quat.x, v2.quat.x).ToFloat32(), | ||||
|                      GetInterpolatedAttribute(v0.quat.y, v1.quat.y, v2.quat.y).ToFloat32(), | ||||
|                      GetInterpolatedAttribute(v0.quat.z, v1.quat.z, v2.quat.z).ToFloat32()}, | ||||
|                     GetInterpolatedAttribute(v0.quat.w, v1.quat.w, v2.quat.w).ToFloat32(), | ||||
|                 }.Normalized(); | ||||
|                 Math::Quaternion<float> normquat = | ||||
|                     Math::Quaternion<float>{ | ||||
|                         {GetInterpolatedAttribute(v0.quat.x, v1.quat.x, v2.quat.x).ToFloat32(), | ||||
|                          GetInterpolatedAttribute(v0.quat.y, v1.quat.y, v2.quat.y).ToFloat32(), | ||||
|                          GetInterpolatedAttribute(v0.quat.z, v1.quat.z, v2.quat.z).ToFloat32()}, | ||||
|                         GetInterpolatedAttribute(v0.quat.w, v1.quat.w, v2.quat.w).ToFloat32(), | ||||
|                     } | ||||
|                         .Normalized(); | ||||
| 
 | ||||
|                 Math::Vec3<float> view{ | ||||
|                     GetInterpolatedAttribute(v0.view.x, v1.view.x, v2.view.x).ToFloat32(), | ||||
|  | @ -620,8 +622,9 @@ static void ProcessTriangleInternal(const Vertex& v0, const Vertex& v1, const Ve | |||
|                 u8 new_stencil = | ||||
|                     PerformStencilAction(action, old_stencil, stencil_test.reference_value); | ||||
|                 if (g_state.regs.framebuffer.framebuffer.allow_depth_stencil_write != 0) | ||||
|                     SetStencil(x >> 4, y >> 4, (new_stencil & stencil_test.write_mask) | | ||||
|                                                    (old_stencil & ~stencil_test.write_mask)); | ||||
|                     SetStencil(x >> 4, y >> 4, | ||||
|                                (new_stencil & stencil_test.write_mask) | | ||||
|                                    (old_stencil & ~stencil_test.write_mask)); | ||||
|             }; | ||||
| 
 | ||||
|             if (stencil_action_enable) { | ||||
|  |  | |||
|  | @ -16,7 +16,14 @@ namespace Texture { | |||
| namespace { | ||||
| 
 | ||||
| constexpr std::array<std::array<u8, 2>, 8> etc1_modifier_table = {{ | ||||
|     {2, 8}, {5, 17}, {9, 29}, {13, 42}, {18, 60}, {24, 80}, {33, 106}, {47, 183}, | ||||
|     {2, 8}, | ||||
|     {5, 17}, | ||||
|     {9, 29}, | ||||
|     {13, 42}, | ||||
|     {18, 60}, | ||||
|     {24, 80}, | ||||
|     {33, 106}, | ||||
|     {47, 183}, | ||||
| }}; | ||||
| 
 | ||||
| union ETC1Tile { | ||||
|  |  | |||
|  | @ -49,4 +49,4 @@ static inline u32 GetMortonOffset(u32 x, u32 y, u32 bytes_per_pixel) { | |||
|     return (i + offset) * bytes_per_pixel; | ||||
| } | ||||
| 
 | ||||
| } // namespace
 | ||||
| } // namespace VideoCore
 | ||||
|  |  | |||
|  | @ -136,8 +136,9 @@ void VertexLoader::LoadVertex(u32 base_address, int index, int vertex, | |||
|                     comp == 3 ? float24::FromFloat32(1.0f) : float24::FromFloat32(0.0f); | ||||
|             } | ||||
| 
 | ||||
|             LOG_TRACE(HW_GPU, "Loaded %d components of attribute %x for vertex %x (index %x) from " | ||||
|                               "0x%08x + 0x%08x + 0x%04x: %f %f %f %f", | ||||
|             LOG_TRACE(HW_GPU, | ||||
|                       "Loaded %d components of attribute %x for vertex %x (index %x) from " | ||||
|                       "0x%08x + 0x%08x + 0x%04x: %f %f %f %f", | ||||
|                       vertex_attribute_elements[i], i, vertex, index, base_address, | ||||
|                       vertex_attribute_sources[i], vertex_attribute_strides[i] * vertex, | ||||
|                       input.attr[i][0].ToFloat32(), input.attr[i][1].ToFloat32(), | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue