Switch from Nz prefix to namespace Nz
What a huge commit Former-commit-id: 38ac5eebf70adc1180f571f6006192d28fb99897
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
void printCap(std::ostream& o, const NzString& cap, bool b);
|
||||
void printCap(std::ostream& o, const String& cap, bool b);
|
||||
|
||||
int main()
|
||||
{
|
||||
@@ -28,68 +28,68 @@ int main()
|
||||
// Plutôt que d'initialiser le Renderer de Nazara, nous initialisons les deux classes utilisées ici
|
||||
// Elles sont compatibles avec NzInitialiser et seront donc libérées automatiquement
|
||||
// Cela permet d'avoir une initialisation plus rapide et un coût en mémoire moindre
|
||||
NzInitializer<NzHardwareInfo> hardwareInfo;
|
||||
Initializer<HardwareInfo> hardwareInfo;
|
||||
if (hardwareInfo)
|
||||
{
|
||||
// On commence par les informations sur le processeur, Nazara en récupère trois caractéristiques:
|
||||
// 1) La "brand string", qui est une chaîne de 48 caractères identifiant le processeur
|
||||
// 2) Le concepteur du processeur, accessible via une énumération (GetProcessorVendor) ou une chaîne de caractère (GetProcessorVendorName)
|
||||
// 3) Le nombre de processeurs logique, alias bien souvent le nombre de coeurs (logiques), cette valeur est renvoyée par l'OS (Le SMT multiplie donc la valeur réelle)
|
||||
oss << "Identification: " << NzHardwareInfo::GetProcessorBrandString() << std::endl;
|
||||
oss << "Concepteur: " << NzHardwareInfo::GetProcessorVendorName() << std::endl;
|
||||
oss << "Nombre de coeurs logiques: " << NzHardwareInfo::GetProcessorCount() << std::endl;
|
||||
oss << "Identification: " << HardwareInfo::GetProcessorBrandString() << std::endl;
|
||||
oss << "Concepteur: " << HardwareInfo::GetProcessorVendorName() << std::endl;
|
||||
oss << "Nombre de coeurs logiques: " << HardwareInfo::GetProcessorCount() << std::endl;
|
||||
oss << std::endl;
|
||||
|
||||
// Ensuite, Nazara récupère les capacités du processeur, dont des jeux d'extensions supplémentaires
|
||||
oss << "Rapport des capacites: " << std::endl;// Pas d'accent car écriture dans un fichier (et on ne va pas s'embêter avec ça)
|
||||
printCap(oss, "-64bits", NzHardwareInfo::HasCapability(nzProcessorCap_x64));
|
||||
printCap(oss, "-AVX", NzHardwareInfo::HasCapability(nzProcessorCap_AVX));
|
||||
printCap(oss, "-FMA3", NzHardwareInfo::HasCapability(nzProcessorCap_FMA3));
|
||||
printCap(oss, "-FMA4", NzHardwareInfo::HasCapability(nzProcessorCap_FMA4));
|
||||
printCap(oss, "-MMX", NzHardwareInfo::HasCapability(nzProcessorCap_MMX));
|
||||
printCap(oss, "-SSE", NzHardwareInfo::HasCapability(nzProcessorCap_SSE));
|
||||
printCap(oss, "-SSE2", NzHardwareInfo::HasCapability(nzProcessorCap_SSE2));
|
||||
printCap(oss, "-SSE3", NzHardwareInfo::HasCapability(nzProcessorCap_SSE3));
|
||||
printCap(oss, "-SSSE3", NzHardwareInfo::HasCapability(nzProcessorCap_SSSE3));
|
||||
printCap(oss, "-SSE4.1", NzHardwareInfo::HasCapability(nzProcessorCap_SSE41));
|
||||
printCap(oss, "-SSE4.2", NzHardwareInfo::HasCapability(nzProcessorCap_SSE42));
|
||||
printCap(oss, "-SSE4.a", NzHardwareInfo::HasCapability(nzProcessorCap_SSE4a));
|
||||
printCap(oss, "-64bits", HardwareInfo::HasCapability(ProcessorCap_x64));
|
||||
printCap(oss, "-AVX", HardwareInfo::HasCapability(ProcessorCap_AVX));
|
||||
printCap(oss, "-FMA3", HardwareInfo::HasCapability(ProcessorCap_FMA3));
|
||||
printCap(oss, "-FMA4", HardwareInfo::HasCapability(ProcessorCap_FMA4));
|
||||
printCap(oss, "-MMX", HardwareInfo::HasCapability(ProcessorCap_MMX));
|
||||
printCap(oss, "-SSE", HardwareInfo::HasCapability(ProcessorCap_SSE));
|
||||
printCap(oss, "-SSE2", HardwareInfo::HasCapability(ProcessorCap_SSE2));
|
||||
printCap(oss, "-SSE3", HardwareInfo::HasCapability(ProcessorCap_SSE3));
|
||||
printCap(oss, "-SSSE3", HardwareInfo::HasCapability(ProcessorCap_SSSE3));
|
||||
printCap(oss, "-SSE4.1", HardwareInfo::HasCapability(ProcessorCap_SSE41));
|
||||
printCap(oss, "-SSE4.2", HardwareInfo::HasCapability(ProcessorCap_SSE42));
|
||||
printCap(oss, "-SSE4.a", HardwareInfo::HasCapability(ProcessorCap_SSE4a));
|
||||
}
|
||||
else
|
||||
oss << "Impossible de retrouver les informations du processeur" << std::endl;
|
||||
|
||||
oss << std::endl << "--Carte graphique--" << std::endl;
|
||||
// La classe NzOpenGL nous donne accès à des informations sur la carte graphique
|
||||
// La classe OpenGL nous donne accès à des informations sur la carte graphique
|
||||
// Cependant celle-ci n'est accessible que si le projet est compilé avec NAZARA_RENDERER_OPENGL
|
||||
// et que les répertoires d'inclusions donnent accès aux includes d'OpenGL (Cette démo utilisent ceux de Nazara)
|
||||
NzInitializer<NzOpenGL> openGL;
|
||||
Initializer<OpenGL> openGL;
|
||||
if (openGL)
|
||||
{
|
||||
// Nous récupérons ensuite la version d'OpenGL sous forme d'entier (ex: OpenGL 3.3 donnera 330)
|
||||
unsigned int openglVersion = NzOpenGL::GetVersion();
|
||||
unsigned int openglVersion = OpenGL::GetVersion();
|
||||
|
||||
// NzOpenGL nous donne accès à trois informations principales:
|
||||
// OpenGL nous donne accès à trois informations principales:
|
||||
// 1) La chaîne d'identification du driver ("Renderer name")
|
||||
// 2) La chaîne d'identification du concepteur ("Vendor name")
|
||||
// 3) La version d'OpenGL
|
||||
oss << "Identification: " << NzOpenGL::GetRendererName() << std::endl;
|
||||
oss << "Concepteur: " << NzOpenGL::GetVendorName() << std::endl;
|
||||
oss << "Identification: " << OpenGL::GetRendererName() << std::endl;
|
||||
oss << "Concepteur: " << OpenGL::GetVendorName() << std::endl;
|
||||
oss << "Version d'OpenGL: " << openglVersion/100 << '.' << openglVersion%100 << std::endl;
|
||||
oss << std::endl;
|
||||
|
||||
// Ainsi qu'un report des capacités de la carte graphique (avec le driver actuel)
|
||||
oss << "Rapport des capacites: " << std::endl; // Pas d'accent car écriture dans un fichier (et on ne va pas s'embêter avec ça)
|
||||
printCap(oss, "-Calculs 64bits", NzOpenGL::IsSupported(nzOpenGLExtension_FP64));
|
||||
printCap(oss, "-Compression de textures (s3tc)", NzOpenGL::IsSupported(nzOpenGLExtension_TextureCompression_s3tc));
|
||||
printCap(oss, "-Filtrage anisotrope", NzOpenGL::IsSupported(nzOpenGLExtension_AnisotropicFilter));
|
||||
printCap(oss, "-Framebuffer Object", NzOpenGL::IsSupported(nzOpenGLExtension_FrameBufferObject));
|
||||
printCap(oss, "-Mode debug", NzOpenGL::IsSupported(nzOpenGLExtension_DebugOutput));
|
||||
printCap(oss, "-Pixelbuffer Object", NzOpenGL::IsSupported(nzOpenGLExtension_PixelBufferObject));
|
||||
printCap(oss, "-Samplers Object", NzOpenGL::IsSupported(nzOpenGLExtension_SamplerObjects));
|
||||
printCap(oss, "-Separate shader objects", NzOpenGL::IsSupported(nzOpenGLExtension_SeparateShaderObjects));
|
||||
printCap(oss, "-Texture array", NzOpenGL::IsSupported(nzOpenGLExtension_TextureArray));
|
||||
printCap(oss, "-Texture storage", NzOpenGL::IsSupported(nzOpenGLExtension_TextureStorage));
|
||||
printCap(oss, "-Vertex array objects", NzOpenGL::IsSupported(nzOpenGLExtension_VertexArrayObjects));
|
||||
printCap(oss, "-Calculs 64bits", OpenGL::IsSupported(OpenGLExtension_FP64));
|
||||
printCap(oss, "-Compression de textures (s3tc)", OpenGL::IsSupported(OpenGLExtension_TextureCompression_s3tc));
|
||||
printCap(oss, "-Filtrage anisotrope", OpenGL::IsSupported(OpenGLExtension_AnisotropicFilter));
|
||||
printCap(oss, "-Framebuffer Object", OpenGL::IsSupported(OpenGLExtension_FrameBufferObject));
|
||||
printCap(oss, "-Mode debug", OpenGL::IsSupported(OpenGLExtension_DebugOutput));
|
||||
printCap(oss, "-Pixelbuffer Object", OpenGL::IsSupported(OpenGLExtension_PixelBufferObject));
|
||||
printCap(oss, "-Samplers Object", OpenGL::IsSupported(OpenGLExtension_SamplerObjects));
|
||||
printCap(oss, "-Separate shader objects", OpenGL::IsSupported(OpenGLExtension_SeparateShaderObjects));
|
||||
printCap(oss, "-Texture array", OpenGL::IsSupported(OpenGLExtension_TextureArray));
|
||||
printCap(oss, "-Texture storage", OpenGL::IsSupported(OpenGLExtension_TextureStorage));
|
||||
printCap(oss, "-Vertex array objects", OpenGL::IsSupported(OpenGLExtension_VertexArrayObjects));
|
||||
}
|
||||
else
|
||||
oss << "Impossible de retrouver les informations de la carte graphique" << std::endl;
|
||||
@@ -99,10 +99,10 @@ int main()
|
||||
|
||||
std::cout << oss.str() << std::endl;
|
||||
|
||||
NzFile reportFile("RapportHardwareInfo.txt");
|
||||
if (reportFile.Open(nzOpenMode_Text | nzOpenMode_Truncate | nzOpenMode_WriteOnly))
|
||||
File reportFile("RapportHardwareInfo.txt");
|
||||
if (reportFile.Open(OpenMode_Text | OpenMode_Truncate | OpenMode_WriteOnly))
|
||||
{
|
||||
reportFile.Write(oss.str()); // Conversion implicite en NzString
|
||||
reportFile.Write(oss.str()); // Conversion implicite en String
|
||||
reportFile.Close();
|
||||
|
||||
char accentAigu = static_cast<char>(130); // C'est crade, mais ça marche chez 95% des Windowsiens
|
||||
@@ -116,7 +116,7 @@ int main()
|
||||
return 0;
|
||||
}
|
||||
|
||||
void printCap(std::ostream& o, const NzString& cap, bool b)
|
||||
void printCap(std::ostream& o, const String& cap, bool b)
|
||||
{
|
||||
if (b)
|
||||
o << cap << ": Oui" << std::endl;
|
||||
|
||||
Reference in New Issue
Block a user