Merge pull request #522 from sephiroth99/lf3

Linux compilation/link and compatibility fixes
This commit is contained in:
Ben Vanik 2016-01-20 19:41:40 -08:00
commit 6c6f7c6eca
11 changed files with 62 additions and 42 deletions

View File

@ -272,8 +272,6 @@ void Profiler::Present() {}
} // namespace xe } // namespace xe
#if XE_OPTION_PROFILING
uint32_t MicroProfileGpuInsertTimeStamp() { return 0; } uint32_t MicroProfileGpuInsertTimeStamp() { return 0; }
uint64_t MicroProfileGpuGetTimeStamp(uint32_t nKey) { return 0; } uint64_t MicroProfileGpuGetTimeStamp(uint32_t nKey) { return 0; }
@ -282,6 +280,7 @@ uint64_t MicroProfileTicksPerSecondGpu() { return 0; }
const char* MicroProfileGetThreadName() { return "TODO: get thread name!"; } const char* MicroProfileGetThreadName() { return "TODO: get thread name!"; }
#if XE_OPTION_PROFILING
#if XE_OPTION_PROFILING_UI #if XE_OPTION_PROFILING_UI
void MicroProfileDrawBox(int nX, int nY, int nX1, int nY1, uint32_t nColor, void MicroProfileDrawBox(int nX, int nY, int nX1, int nY1, uint32_t nColor,

View File

@ -12,6 +12,14 @@
namespace xe { namespace xe {
namespace threading { namespace threading {
uint32_t logical_processor_count() {
static uint32_t value = 0;
if (!value) {
value = std::thread::hardware_concurrency();
}
return value;
}
thread_local uint32_t current_thread_id_ = UINT_MAX; thread_local uint32_t current_thread_id_ = UINT_MAX;
uint32_t current_thread_id() { uint32_t current_thread_id() {

View File

@ -16,16 +16,6 @@
namespace xe { namespace xe {
namespace threading { namespace threading {
uint32_t logical_processor_count() {
static uint32_t value = 0;
if (!value) {
SYSTEM_INFO system_info;
GetSystemInfo(&system_info);
value = system_info.dwNumberOfProcessors;
}
return value;
}
void EnableAffinityConfiguration() { void EnableAffinityConfiguration() {
HANDLE process_handle = GetCurrentProcess(); HANDLE process_handle = GetCurrentProcess();
DWORD_PTR process_affinity_mask; DWORD_PTR process_affinity_mask;

View File

@ -11,6 +11,7 @@
#include <gflags/gflags.h> #include <gflags/gflags.h>
#include <climits>
#include <cstring> #include <cstring>
#include "xenia/base/assert.h" #include "xenia/base/assert.h"

View File

@ -251,6 +251,9 @@ void Value::Round(RoundMode round_mode) {
case ROUND_TO_NEAREST: case ROUND_TO_NEAREST:
constant.f32 = std::round(constant.f32); constant.f32 = std::round(constant.f32);
return; return;
default:
assert_unhandled_case(round_mode);
return;
} }
return; return;
case FLOAT64_TYPE: case FLOAT64_TYPE:
@ -261,11 +264,15 @@ void Value::Round(RoundMode round_mode) {
case ROUND_TO_NEAREST: case ROUND_TO_NEAREST:
constant.v128.f32[i] = std::round(constant.v128.f32[i]); constant.v128.f32[i] = std::round(constant.v128.f32[i]);
return; return;
default:
assert_unhandled_case(round_mode);
return;
} }
} }
return; return;
default: default:
assert_unhandled_case(type); assert_unhandled_case(type);
return;
} }
} }
@ -791,6 +798,9 @@ void Value::Extract(Value* vec, Value* index) {
case INT64_TYPE: case INT64_TYPE:
constant.u64 = vec->constant.v128.u64[index->constant.u64]; constant.u64 = vec->constant.v128.u64[index->constant.u64];
break; break;
default:
assert_unhandled_case(type);
break;
} }
} }
@ -1013,6 +1023,9 @@ void Value::VectorSub(Value* other, TypeName type, bool is_unsigned,
} }
} }
} }
default:
assert_unhandled_case(type);
break;
} }
} }

View File

@ -10,6 +10,7 @@
#include "xenia/cpu/testing/util.h" #include "xenia/cpu/testing/util.h"
#include <cfloat> #include <cfloat>
#include <climits>
using namespace xe; using namespace xe;
using namespace xe::cpu; using namespace xe::cpu;

View File

@ -10,6 +10,7 @@
#include "xenia/cpu/testing/util.h" #include "xenia/cpu/testing/util.h"
#include <cfloat> #include <cfloat>
#include <climits>
using namespace xe; using namespace xe;
using namespace xe::cpu; using namespace xe::cpu;

View File

@ -29,7 +29,7 @@ class GL4Shader : public Shader {
GLuint shader() const { return shader_; } GLuint shader() const { return shader_; }
GLuint vao() const { return vao_; } GLuint vao() const { return vao_; }
bool Prepare(); bool Prepare() override;
protected: protected:
bool PrepareVertexArrayObject(); bool PrepareVertexArrayObject();

View File

@ -25,8 +25,10 @@
#include "xenia/kernel/xevent.h" #include "xenia/kernel/xevent.h"
#include "xenia/kernel/xthread.h" #include "xenia/kernel/xthread.h"
// For FileTimeToSystemTime and SystemTimeToFileTime: #if XE_PLATFORM_WIN32
#include "xenia/base/platform_win.h" #include "xenia/base/platform_win.h"
#define timegm _mkgmtime
#endif
namespace xe { namespace xe {
namespace kernel { namespace kernel {
@ -439,44 +441,41 @@ struct X_TIME_FIELDS {
}; };
static_assert(sizeof(X_TIME_FIELDS) == 16, "Must be LARGEINTEGER"); static_assert(sizeof(X_TIME_FIELDS) == 16, "Must be LARGEINTEGER");
// https://support.microsoft.com/en-us/kb/167296
void RtlTimeToTimeFields(lpqword_t time_ptr, void RtlTimeToTimeFields(lpqword_t time_ptr,
pointer_t<X_TIME_FIELDS> time_fields_ptr) { pointer_t<X_TIME_FIELDS> time_fields_ptr) {
// TODO(benvanik): replace with our own version. int64_t time_ms = time_ptr.value() / 10000 - 11644473600000LL;
FILETIME ft; time_t timet = time_ms / 1000;
ft.dwHighDateTime = static_cast<uint32_t>(time_ptr.value() >> 32); struct tm* tm = gmtime(&timet);
ft.dwLowDateTime = static_cast<uint32_t>(time_ptr.value());
SYSTEMTIME st;
FileTimeToSystemTime(&ft, &st);
time_fields_ptr->year = st.wYear; time_fields_ptr->year = tm->tm_year + 1900;
time_fields_ptr->month = st.wMonth; time_fields_ptr->month = tm->tm_mon + 1;
time_fields_ptr->day = st.wDay; time_fields_ptr->day = tm->tm_mday;
time_fields_ptr->hour = st.wHour; time_fields_ptr->hour = tm->tm_hour;
time_fields_ptr->minute = st.wMinute; time_fields_ptr->minute = tm->tm_min;
time_fields_ptr->second = st.wSecond; time_fields_ptr->second = tm->tm_sec;
time_fields_ptr->milliseconds = st.wMilliseconds; time_fields_ptr->milliseconds = time_ms % 1000;
time_fields_ptr->weekday = st.wDayOfWeek; time_fields_ptr->weekday = tm->tm_wday;
} }
DECLARE_XBOXKRNL_EXPORT(RtlTimeToTimeFields, ExportTag::kImplemented); DECLARE_XBOXKRNL_EXPORT(RtlTimeToTimeFields, ExportTag::kImplemented);
dword_result_t RtlTimeFieldsToTime(pointer_t<X_TIME_FIELDS> time_fields_ptr, dword_result_t RtlTimeFieldsToTime(pointer_t<X_TIME_FIELDS> time_fields_ptr,
lpqword_t time_ptr) { lpqword_t time_ptr) {
// TODO(benvanik): replace with our own version. struct tm tm;
SYSTEMTIME st; tm.tm_year = time_fields_ptr->year - 1900;
st.wYear = time_fields_ptr->year; tm.tm_mon = time_fields_ptr->month - 1;
st.wMonth = time_fields_ptr->month; tm.tm_mday = time_fields_ptr->day;
st.wDay = time_fields_ptr->day; tm.tm_hour = time_fields_ptr->hour;
st.wHour = time_fields_ptr->hour; tm.tm_min = time_fields_ptr->minute;
st.wMinute = time_fields_ptr->minute; tm.tm_sec = time_fields_ptr->second;
st.wSecond = time_fields_ptr->second; tm.tm_isdst = 0;
st.wMilliseconds = time_fields_ptr->milliseconds; time_t timet = timegm(&tm);
st.wDayOfWeek = time_fields_ptr->weekday; if (timet == -1) {
FILETIME ft;
if (!SystemTimeToFileTime(&st, &ft)) {
// set last error = ERROR_INVALID_PARAMETER // set last error = ERROR_INVALID_PARAMETER
return 0; return 0;
} }
uint64_t time = (uint64_t(ft.dwHighDateTime) << 32) | ft.dwLowDateTime; uint64_t time =
((timet + 11644473600LL) * 1000 + time_fields_ptr->milliseconds) * 10000;
*time_ptr = time; *time_ptr = time;
return 1; return 1;
} }

View File

@ -36,6 +36,10 @@ DEFINE_bool(ignore_thread_affinities, true,
namespace xe { namespace xe {
namespace kernel { namespace kernel {
const uint32_t XAPC::kSize;
const uint32_t XAPC::kDummyKernelRoutine;
const uint32_t XAPC::kDummyRundownRoutine;
using xe::cpu::ppc::PPCOpcode; using xe::cpu::ppc::PPCOpcode;
uint32_t next_xthread_id_ = 0; uint32_t next_xthread_id_ = 0;

View File

@ -7,4 +7,8 @@ build_tools = "tools/build"
build_scripts = build_tools .. "/scripts" build_scripts = build_tools .. "/scripts"
build_tools_src = build_tools .. "/src" build_tools_src = build_tools .. "/src"
platform_suffix = "win" if os.is("windows") then
platform_suffix = "win"
else
platform_suffix = "posix"
end