mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-16 19:15:14 -04:00
add /client gpuinfo to C client
This commit is contained in:
parent
c2ab0f8141
commit
334abc47fd
@ -548,7 +548,7 @@ namespace ClassicalSharp.GraphicsAPI {
|
|||||||
GL.GetIntegerv(GetPName.DepthBits, &depthBits);
|
GL.GetIntegerv(GetPName.DepthBits, &depthBits);
|
||||||
|
|
||||||
ApiInfo = new string[] {
|
ApiInfo = new string[] {
|
||||||
"--Using OpenGL --",
|
"-- Using OpenGL --",
|
||||||
"Vendor: " + vendor,
|
"Vendor: " + vendor,
|
||||||
"Renderer: " + renderer,
|
"Renderer: " + renderer,
|
||||||
"GL version: " + version,
|
"GL version: " + version,
|
||||||
|
@ -606,12 +606,9 @@ void Gfx_BeginFrame(void) {
|
|||||||
|
|
||||||
void Gfx_EndFrame(void) {
|
void Gfx_EndFrame(void) {
|
||||||
IDirect3DDevice9_EndScene(device);
|
IDirect3DDevice9_EndScene(device);
|
||||||
ReturnCode code = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL);
|
ReturnCode result = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL);
|
||||||
if ((Int32)code >= 0) return;
|
if ((Int32)result >= 0) return;
|
||||||
|
if (result != D3DERR_DEVICELOST) ErrorHandler_FailWithCode(result, "D3D9_EndFrame");
|
||||||
if (code != D3DERR_DEVICELOST) {
|
|
||||||
ErrorHandler_FailWithCode(code, "D3D9_EndFrame");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* TODO: Make sure this actually works on all graphics cards.*/
|
/* TODO: Make sure this actually works on all graphics cards.*/
|
||||||
GfxCommon_LoseContext(" (Direct3D9 device lost)");
|
GfxCommon_LoseContext(" (Direct3D9 device lost)");
|
||||||
@ -619,6 +616,46 @@ void Gfx_EndFrame(void) {
|
|||||||
D3D9_RecreateDevice();
|
D3D9_RecreateDevice();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const UChar* D3D9_StrFlags(void) {
|
||||||
|
if (createFlags & D3DCREATE_HARDWARE_VERTEXPROCESSING) return "HardwareVertexProcessing";
|
||||||
|
if (createFlags & D3DCREATE_MIXED_VERTEXPROCESSING) return "MixedVertexProcessing";
|
||||||
|
if (createFlags & D3DCREATE_SOFTWARE_VERTEXPROCESSING) return "SoftwareVertexProcessing";
|
||||||
|
return "(none)";
|
||||||
|
}
|
||||||
|
|
||||||
|
const UChar* D3D9_StrFormat(D3DFORMAT format) {
|
||||||
|
switch (format) {
|
||||||
|
case D3DFMT_D32: return "D32";
|
||||||
|
case D3DFMT_D24X8: return "D24X8";
|
||||||
|
case D3DFMT_D24S8: return "D24S8";
|
||||||
|
case D3DFMT_D24X4S4: return "D24X4S4";
|
||||||
|
case D3DFMT_D16: return "D16";
|
||||||
|
case D3DFMT_D15S1: return "D15S1";
|
||||||
|
|
||||||
|
case D3DFMT_X8R8G8B8: return "X8R8G8B8";
|
||||||
|
case D3DFMT_R8G8B8: return "R8G8B8";
|
||||||
|
case D3DFMT_R5G6B5: return "R5G6B5";
|
||||||
|
case D3DFMT_X1R5G5B5: return "X1R5G5B5";
|
||||||
|
}
|
||||||
|
return "(unknown)";
|
||||||
|
}
|
||||||
|
|
||||||
|
void Gfx_MakeApiInfo(void) {
|
||||||
|
D3DADAPTER_IDENTIFIER9 adapter;
|
||||||
|
ReturnCode result = IDirect3D9_GetAdapterIdentifier(d3d, D3DADAPTER_DEFAULT, 0, &adapter);
|
||||||
|
ErrorHandler_CheckOrFail(result, "D3D9_GetAdapterDetails");
|
||||||
|
UInt32 texMemBytes = IDirect3DDevice9_GetAvailableTextureMem(device);
|
||||||
|
Real32 texMem = texMemBytes / (1024.0f * 1024.0f);
|
||||||
|
|
||||||
|
String_AppendConst(&Gfx_ApiInfo[0],"-- Using Direct3D9 --");
|
||||||
|
String_Format1(&Gfx_ApiInfo[1], "Adapter: %c", adapter.Description);
|
||||||
|
String_Format1(&Gfx_ApiInfo[2], "Mode: %c", D3D9_StrFlags());
|
||||||
|
String_Format1(&Gfx_ApiInfo[3], "Texture memory: %f2 MB", &texMem);
|
||||||
|
String_Format1(&Gfx_ApiInfo[4], "Max 2D texture dimensions: %i", &Gfx_MaxTextureDimensions);
|
||||||
|
String_Format1(&Gfx_ApiInfo[5], "Depth buffer format: %c", D3D9_StrFormat(d3d9_depthFormat));
|
||||||
|
String_Format1(&Gfx_ApiInfo[6], "Back buffer format: %c", D3D9_StrFormat(d3d9_viewFormat));
|
||||||
|
}
|
||||||
|
|
||||||
void Gfx_OnWindowResize(void) {
|
void Gfx_OnWindowResize(void) {
|
||||||
GfxCommon_LoseContext(" (resizing window)");
|
GfxCommon_LoseContext(" (resizing window)");
|
||||||
D3D9_RecreateDevice();
|
D3D9_RecreateDevice();
|
||||||
|
@ -765,8 +765,6 @@ void Audio_SetMusic(Int32 volume) { }
|
|||||||
void Audio_SetSounds(Int32 volume) { }
|
void Audio_SetSounds(Int32 volume) { }
|
||||||
void Audio_PlayDigSound(UInt8 type) { }
|
void Audio_PlayDigSound(UInt8 type) { }
|
||||||
void Audio_PlayStepSound(UInt8 type) { }
|
void Audio_PlayStepSound(UInt8 type) { }
|
||||||
|
|
||||||
void Gfx_MakeApiInfo(void) { }
|
|
||||||
void AdvLightingBuilder_SetActive(void) { }
|
void AdvLightingBuilder_SetActive(void) { }
|
||||||
|
|
||||||
/* TODO: Initalise Shell, see https://msdn.microsoft.com/en-us/library/windows/desktop/bb762153(v=vs.85).aspx
|
/* TODO: Initalise Shell, see https://msdn.microsoft.com/en-us/library/windows/desktop/bb762153(v=vs.85).aspx
|
||||||
|
@ -7,12 +7,12 @@
|
|||||||
#include "ExtMath.h"
|
#include "ExtMath.h"
|
||||||
#include "Texture.h"
|
#include "Texture.h"
|
||||||
|
|
||||||
UChar Gfx_ApiBuffer[8][String_BufferSize(STRING_SIZE)];
|
UChar Gfx_ApiBuffer[7][String_BufferSize(STRING_SIZE)];
|
||||||
String Gfx_ApiInfo[8] = {
|
String Gfx_ApiInfo[7] = {
|
||||||
{ Gfx_ApiBuffer[0], 0, STRING_SIZE }, { Gfx_ApiBuffer[1], 0, STRING_SIZE },
|
{ Gfx_ApiBuffer[0], 0, STRING_SIZE }, { Gfx_ApiBuffer[1], 0, STRING_SIZE },
|
||||||
{ Gfx_ApiBuffer[2], 0, STRING_SIZE }, { Gfx_ApiBuffer[3], 0, STRING_SIZE },
|
{ Gfx_ApiBuffer[2], 0, STRING_SIZE }, { Gfx_ApiBuffer[3], 0, STRING_SIZE },
|
||||||
{ Gfx_ApiBuffer[4], 0, STRING_SIZE }, { Gfx_ApiBuffer[5], 0, STRING_SIZE },
|
{ Gfx_ApiBuffer[4], 0, STRING_SIZE }, { Gfx_ApiBuffer[5], 0, STRING_SIZE },
|
||||||
{ Gfx_ApiBuffer[6], 0, STRING_SIZE }, { Gfx_ApiBuffer[7], 0, STRING_SIZE },
|
{ Gfx_ApiBuffer[6], 0, STRING_SIZE },
|
||||||
};
|
};
|
||||||
|
|
||||||
void GfxCommon_Init(void) {
|
void GfxCommon_Init(void) {
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
struct Texture;
|
struct Texture;
|
||||||
|
|
||||||
extern String Gfx_ApiInfo[8];
|
extern String Gfx_ApiInfo[7];
|
||||||
GfxResourceID GfxCommon_defaultIb;
|
GfxResourceID GfxCommon_defaultIb;
|
||||||
|
|
||||||
void GfxCommon_Init(void);
|
void GfxCommon_Init(void);
|
||||||
|
@ -539,6 +539,21 @@ void Gfx_TakeScreenshot(struct Stream* output, Int32 width, Int32 height) {
|
|||||||
Platform_MemFree(&bmp.Scan0);
|
Platform_MemFree(&bmp.Scan0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Gfx_MakeApiInfo(void) {
|
||||||
|
const UChar* vendor = glGetString(GL_VENDOR);
|
||||||
|
const UChar* renderer = glGetString(GL_RENDERER);
|
||||||
|
const UChar* version = glGetString(GL_VERSION);
|
||||||
|
Int32 depthBits = 0;
|
||||||
|
glGetIntegerv(GL_DEPTH_BITS, &depthBits);
|
||||||
|
|
||||||
|
String_AppendConst(&Gfx_ApiInfo[0],"-- Using OpenGL --");
|
||||||
|
String_Format1(&Gfx_ApiInfo[1], "Vendor: %c", vendor);
|
||||||
|
String_Format1(&Gfx_ApiInfo[2], "Renderer: %c", renderer);
|
||||||
|
String_Format1(&Gfx_ApiInfo[3], "GL version: %c", version);
|
||||||
|
String_Format1(&Gfx_ApiInfo[4], "Max 2D texture dimensions: %i", &Gfx_MaxTextureDimensions);
|
||||||
|
String_Format1(&Gfx_ApiInfo[5], "Depth buffer bits: %i", &depthBits);
|
||||||
|
}
|
||||||
|
|
||||||
bool Gfx_WarnIfNecessary(void) {
|
bool Gfx_WarnIfNecessary(void) {
|
||||||
#if CC_BUILD_GL11
|
#if CC_BUILD_GL11
|
||||||
Chat_AddRaw(tmp1, "&cYou are using the very outdated OpenGL backend.");
|
Chat_AddRaw(tmp1, "&cYou are using the very outdated OpenGL backend.");
|
||||||
|
@ -59,7 +59,7 @@ struct FontDesc { void* Handle; UInt16 Size, Style; };
|
|||||||
#define UInt32_MaxValue ((UInt32)4294967295UL)
|
#define UInt32_MaxValue ((UInt32)4294967295UL)
|
||||||
|
|
||||||
#define CC_BUILD_GL11 false
|
#define CC_BUILD_GL11 false
|
||||||
#define CC_BUILD_D3D9 false
|
#define CC_BUILD_D3D9 true
|
||||||
|
|
||||||
#define CC_BUILD_WIN true
|
#define CC_BUILD_WIN true
|
||||||
#define CC_BUILD_OSX false
|
#define CC_BUILD_OSX false
|
||||||
|
Loading…
x
Reference in New Issue
Block a user