18 #include "precompiled.h"
51 scriptInterface.
Eval(
"[]", ret);
58 scriptInterface.
Eval(
"({})", cache);
73 scriptInterface.
Eval(
"[]", ret);
74 for(
size_t i = 0; ; i++)
80 scriptInterface.
Eval(
"({})", tlb);
167 TIMER(L
"RunHardwareDetection");
171 scriptInterface.RegisterFunction<void, bool, &
SetDisableAudio>(
"SetDisableAudio");
172 scriptInterface.RegisterFunction<void, bool, &
SetDisableS3TC>(
"SetDisableS3TC");
173 scriptInterface.RegisterFunction<void, bool, &
SetDisableShadows>(
"SetDisableShadows");
175 scriptInterface.RegisterFunction<void, bool, &
SetDisableAllWater>(
"SetDisableAllWater");
177 scriptInterface.RegisterFunction<void, bool, &
SetDisableFBOWater>(
"SetDisableFBOWater");
178 scriptInterface.RegisterFunction<void, std::string, &
SetRenderPath>(
"SetRenderPath");
182 const wchar_t* scriptName = L
"hwdetect/hwdetect.js";
186 LOGERROR(L
"Failed to load hardware detection script");
198 scriptInterface.
Eval(
"({})", settings);
218 scriptInterface.
SetProperty(settings.
get(),
"build_datetime", std::string(__DATE__
" " __TIME__));
252 std::ifstream ifs(
"/etc/lsb-release");
255 std::string str((std::istreambuf_iterator<char>(ifs)), std::istreambuf_iterator<char>());
256 scriptInterface.
SetProperty(settings.
get(),
"linux_release", str);
288 u32 caps0, caps1, caps2, caps3;
290 scriptInterface.
SetProperty(settings.
get(),
"x86_caps[0]", caps0);
291 scriptInterface.
SetProperty(settings.
get(),
"x86_caps[1]", caps1);
292 scriptInterface.
SetProperty(settings.
get(),
"x86_caps[2]", caps2);
293 scriptInterface.
SetProperty(settings.
get(),
"x86_caps[3]", caps3);
297 scriptInterface.
SetProperty(settings.
get(),
"x86_tlbs", ConvertTLBs(scriptInterface));
312 const char* errstr =
"(error)";
314 #define INTEGER(id) do { \
316 glGetIntegerv(GL_##id, &i); \
317 if (ogl_SquelchError(GL_INVALID_ENUM)) \
318 scriptInterface.SetProperty(settings.get(), "GL_" #id, errstr); \
320 scriptInterface.SetProperty(settings.get(), "GL_" #id, i); \
323 #define INTEGER2(id) do { \
324 GLint i[2] = { -1, -1 }; \
325 glGetIntegerv(GL_##id, i); \
326 if (ogl_SquelchError(GL_INVALID_ENUM)) { \
327 scriptInterface.SetProperty(settings.get(), "GL_" #id "[0]", errstr); \
328 scriptInterface.SetProperty(settings.get(), "GL_" #id "[1]", errstr); \
330 scriptInterface.SetProperty(settings.get(), "GL_" #id "[0]", i[0]); \
331 scriptInterface.SetProperty(settings.get(), "GL_" #id "[1]", i[1]); \
335 #define FLOAT(id) do { \
336 GLfloat f = std::numeric_limits<GLfloat>::quiet_NaN(); \
337 glGetFloatv(GL_##id, &f); \
338 if (ogl_SquelchError(GL_INVALID_ENUM)) \
339 scriptInterface.SetProperty(settings.get(), "GL_" #id, errstr); \
341 scriptInterface.SetProperty(settings.get(), "GL_" #id, f); \
344 #define FLOAT2(id) do { \
345 GLfloat f[2] = { std::numeric_limits<GLfloat>::quiet_NaN(), std::numeric_limits<GLfloat>::quiet_NaN() }; \
346 glGetFloatv(GL_##id, f); \
347 if (ogl_SquelchError(GL_INVALID_ENUM)) { \
348 scriptInterface.SetProperty(settings.get(), "GL_" #id "[0]", errstr); \
349 scriptInterface.SetProperty(settings.get(), "GL_" #id "[1]", errstr); \
351 scriptInterface.SetProperty(settings.get(), "GL_" #id "[0]", f[0]); \
352 scriptInterface.SetProperty(settings.get(), "GL_" #id "[1]", f[1]); \
356 #define STRING(id) do { \
357 const char* c = (const char*)glGetString(GL_##id); \
359 if (ogl_SquelchError(GL_INVALID_ENUM)) c = errstr; \
360 scriptInterface.SetProperty(settings.get(), "GL_" #id, std::string(c)); \
363 #define QUERY(target, pname) do { \
365 pglGetQueryivARB(GL_##target, GL_##pname, &i); \
366 if (ogl_SquelchError(GL_INVALID_ENUM)) \
367 scriptInterface.SetProperty(settings.get(), "GL_" #target ".GL_" #pname, errstr); \
369 scriptInterface.SetProperty(settings.get(), "GL_" #target ".GL_" #pname, i); \
372 #define VERTEXPROGRAM(id) do { \
374 pglGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_##id, &i); \
375 if (ogl_SquelchError(GL_INVALID_ENUM)) \
376 scriptInterface.SetProperty(settings.get(), "GL_VERTEX_PROGRAM_ARB.GL_" #id, errstr); \
378 scriptInterface.SetProperty(settings.get(), "GL_VERTEX_PROGRAM_ARB.GL_" #id, i); \
381 #define FRAGMENTPROGRAM(id) do { \
383 pglGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_##id, &i); \
384 if (ogl_SquelchError(GL_INVALID_ENUM)) \
385 scriptInterface.SetProperty(settings.get(), "GL_FRAGMENT_PROGRAM_ARB.GL_" #id, errstr); \
387 scriptInterface.SetProperty(settings.get(), "GL_FRAGMENT_PROGRAM_ARB.GL_" #id, i); \
390 #define BOOL(id) INTEGER(id)
405 INTEGER(MAX_MODELVIEW_STACK_DEPTH);
406 INTEGER(MAX_PROJECTION_STACK_DEPTH);
407 INTEGER(MAX_TEXTURE_STACK_DEPTH);
414 INTEGER(MAX_CUBE_MAP_TEXTURE_SIZE);
423 INTEGER(MAX_ATTRIB_STACK_DEPTH);
424 INTEGER(MAX_CLIENT_ATTRIB_STACK_DEPTH);
431 FLOAT2(ALIASED_POINT_SIZE_RANGE);
433 FLOAT2(SMOOTH_POINT_SIZE_RANGE);
434 FLOAT(SMOOTH_POINT_SIZE_GRANULARITY);
436 FLOAT2(ALIASED_LINE_WIDTH_RANGE);
438 FLOAT2(SMOOTH_LINE_WIDTH_RANGE);
439 FLOAT(SMOOTH_LINE_WIDTH_GRANULARITY);
442 INTEGER(MAX_ELEMENTS_VERTICES);
470 FLOAT(MAX_TEXTURE_LOD_BIAS_EXT);
475 QUERY(SAMPLES_PASSED, QUERY_COUNTER_BITS);
480 STRING(SHADING_LANGUAGE_VERSION_ARB);
485 INTEGER(MAX_VERTEX_ATTRIBS_ARB);
486 INTEGER(MAX_VERTEX_UNIFORM_COMPONENTS_ARB);
487 INTEGER(MAX_VARYING_FLOATS_ARB);
488 INTEGER(MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB);
489 INTEGER(MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB);
494 INTEGER(MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB);
500 INTEGER(MAX_TEXTURE_IMAGE_UNITS_ARB);
501 INTEGER(MAX_TEXTURE_COORDS_ARB);
513 INTEGER(MIN_PROGRAM_TEXEL_OFFSET);
514 INTEGER(MAX_PROGRAM_TEXEL_OFFSET);
519 INTEGER(MAX_COLOR_ATTACHMENTS_EXT);
520 INTEGER(MAX_RENDERBUFFER_SIZE_EXT);
530 INTEGER(MAX_ARRAY_TEXTURE_LAYERS_EXT);
535 INTEGER(MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_EXT);
536 INTEGER(MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_EXT);
537 INTEGER(MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_EXT);
545 QUERY(TIME_ELAPSED, QUERY_COUNTER_BITS);
550 QUERY(TIMESTAMP, QUERY_COUNTER_BITS);
555 FLOAT(MAX_TEXTURE_MAX_ANISOTROPY_EXT);
560 INTEGER(MAX_RECTANGLE_TEXTURE_SIZE_ARB);
565 INTEGER(MAX_PROGRAM_MATRICES_ARB);
566 INTEGER(MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB);
631 INTEGER(MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_ARB);
632 INTEGER(MAX_GEOMETRY_OUTPUT_VERTICES_ARB);
633 INTEGER(MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_ARB);
634 INTEGER(MAX_GEOMETRY_UNIFORM_COMPONENTS_ARB);
635 INTEGER(MAX_GEOMETRY_VARYING_COMPONENTS_ARB);
636 INTEGER(MAX_VERTEX_VARYING_COMPONENTS_ARB);
639 #else // CONFIG2_GLES
643 STRING(SHADING_LANGUAGE_VERSION);
645 INTEGER(MAX_VERTEX_UNIFORM_VECTORS);
647 INTEGER(MAX_COMBINED_TEXTURE_IMAGE_UNITS);
648 INTEGER(MAX_VERTEX_TEXTURE_IMAGE_UNITS);
649 INTEGER(MAX_FRAGMENT_UNIFORM_VECTORS);
650 INTEGER(MAX_TEXTURE_IMAGE_UNITS);
651 INTEGER(MAX_RENDERBUFFER_SIZE);
653 #endif // CONFIG2_GLES
CStr DecodeUTF8() const
Returns contents of a UTF-8 encoded file as a string with optional BOM removed.
double os_cpu_ClockFrequency()
size_t os_cpu_QueryMemorySize()
CUserReporter g_UserReporter
void ogl_tex_override(OglTexOverrides what, OglTexAllow allow)
Override the default decision and force/disallow use of the given feature.
const char * cpu_IdentifierString()
#define UNUSED(param)
mark a function parameter as unused and avoid the corresponding compiler warning. ...
const x86_x64::Cache * Caches(size_t idxCache)
const PSRETURN PSRETURN_OK
Reads a file, then gives read-only access to the contents.
bool CallFunctionVoid(jsval val, const char *name)
Call the named property on the given object, with void return type and 0 arguments.
void SetDisableAudio(void *cbdata, bool disabled)
void SetDisableS3TC(void *cbdata, bool disabled)
const jsval & get() const
Returns the current value.
A trivial wrapper around a jsval.
LIB_API double numa_Factor()
bool LoadScript(const VfsPath &filename, const std::string &code)
Load and execute the given script in a new function scope.
size_t os_cpu_NumProcessors()
std::string StringifyJSON(jsval obj, bool indent=true)
Stringify to a JSON string, UTF-8 encoded.
size_t os_cpu_LargePageSize()
bool SetPropertyInt(jsval obj, int name, const T &value, bool constant=false, bool enumerate=true)
Set the integer-named property on the given object.
size_t os_cpu_MemorySize()
std::wstring DriverInfo()
static void ReportGLLimits(ScriptInterface &scriptInterface, CScriptValRooted settings)
void SubmitReport(const char *type, int version, const std::string &data)
Submit a report to be transmitted to the online server.
size_t sharedBy
how many logical processors share this cache?
#define VERTEXPROGRAM(id)
static const size_t maxLevels
size_t os_cpu_MemoryAvailable()
double ClockFrequency()
measure the CPU clock frequency via rdtsc and timer_Time.
static bool IsOverridden(const char *setting)
bool Eval(const char *code)
void GetCapBits(u32 *d0, u32 *d1, u32 *d2, u32 *d3)
int uname(struct utsname *un)
void SetDisableShadowPCF(void *cbdata, bool disabled)
wchar_t snd_drv_ver[SND_DRV_VER_LEN]
sound driver identification and version.
wchar_t snd_card[SND_CARD_LEN]
description of sound card.
#define TIMER(description)
Measures the time taken to execute code up until end of the current scope; displays it via debug_prin...
void RunHardwareDetection()
Runs hardware-detection script to adjust default config settings and/or emit warnings depending on th...
void SetDisableAllWater(void *cbdata, bool disabled)
#define QUERY(target, pname)
void SetDisableShadows(void *cbdata, bool disabled)
LIB_API size_t numa_NumNodes()
LIB_API bool numa_IsMemoryInterleaved()
bool ogl_HaveExtension(const char *ext)
check if an extension is supported by the OpenGL implementation.
double timer_Resolution()
void SetDisableFBOWater(void *cbdata, bool disabled)
PSRETURN Load(const PIVFS &vfs, const VfsPath &filename)
Returns either PSRETURN_OK or PSRETURN_CVFSFile_LoadFailed.
jsval get() const
Returns the current value (or JSVAL_VOID if uninitialised).
Abstraction around a SpiderMonkey JSContext.
void ogl_WarnIfError()
raise a warning (break into the debugger) if an OpenGL error is pending.
#define FRAGMENTPROGRAM(id)
size_t numEntries
if 0, the cache is disabled and all other values are zero
bool SetProperty(jsval obj, const char *name, const T &value, bool constant=false, bool enumerate=true)
Set the named property on the given object.
void SetRenderPath(void *cbdata, std::string renderpath)
size_t associativity
= fullyAssociative or the actual ways of associativity
size_t entrySize
NB: cache entries are lines, TLB entries are pages.
void SetDisableFancyWater(void *cbdata, bool disabled)