Merge remote-tracking branch 'upstream/master'

Former-commit-id: 124b89e1c31a7b907f88d8c7a234473274d5a0f6
This commit is contained in:
Gawaboumga
2014-06-28 09:05:16 +02:00
14 changed files with 14 additions and 125 deletions

View File

@@ -44,13 +44,13 @@ void NzError::Error(nzErrorType type, const NzString& error, unsigned int line,
s_lastErrorFunction = function;
s_lastErrorLine = line;
if (type != nzErrorType_Warning && (s_flags & nzErrorFlag_ThrowException) != 0 && (s_flags & nzErrorFlag_ThrowExceptionDisabled) == 0)
throw std::runtime_error(error);
#if NAZARA_CORE_EXIT_ON_ASSERT_FAILURE
if (type == nzErrorType_AssertFailed)
std::exit(EXIT_FAILURE);
#endif
if (type != nzErrorType_Warning && (s_flags & nzErrorFlag_ThrowException) != 0 && (s_flags & nzErrorFlag_ThrowExceptionDisabled) == 0)
throw std::runtime_error(error);
}
nzUInt32 NzError::GetFlags()

View File

@@ -10,7 +10,7 @@
NzSemaphoreImpl::NzSemaphoreImpl(unsigned int count)
{
m_semaphore = CreateSemaphore(nullptr, count, std::numeric_limits<LONG>::max(), nullptr);
m_semaphore = CreateSemaphoreW(nullptr, count, std::numeric_limits<LONG>::max(), nullptr);
if (!m_semaphore)
NazaraError("Failed to create semaphore: " + NzError::GetLastSystemError());
}

View File

@@ -34,11 +34,11 @@ bool NzTaskSchedulerImpl::Initialize(unsigned int workerCount)
{
Worker& worker = s_workers[i];
InitializeCriticalSection(&worker.queueMutex);
worker.wakeEvent = CreateEventA(nullptr, false, false, nullptr);
worker.wakeEvent = CreateEventW(nullptr, false, false, nullptr);
worker.running = true;
worker.workCount = 0;
s_doneEvents[i] = CreateEventA(nullptr, true, false, nullptr);
s_doneEvents[i] = CreateEventW(nullptr, true, false, nullptr);
workerIDs[i] = i;
s_workerThreads[i] = reinterpret_cast<HANDLE>(_beginthreadex(nullptr, 0, &WorkerProc, &workerIDs[i], 0, nullptr));
@@ -149,7 +149,8 @@ NzFunctor* NzTaskSchedulerImpl::StealTask(unsigned int workerID)
if (worker.workCount > 0)
{
NzFunctor* task;
NzFunctor* task = nullptr;
if (TryEnterCriticalSection(&worker.queueMutex))
{
if (!worker.queue.empty())
@@ -158,8 +159,6 @@ NzFunctor* NzTaskSchedulerImpl::StealTask(unsigned int workerID)
worker.queue.pop();
worker.workCount = worker.queue.size();
}
else
task = nullptr;
LeaveCriticalSection(&worker.queueMutex);
}

View File

@@ -289,7 +289,7 @@ bool NzRenderWindow::OnWindowCreated()
std::unique_ptr<NzContext> context(new NzContext);
if (!context->Create(m_parameters))
{
NazaraError("Failed not create context");
NazaraError("Failed to create context");
return false;
}

View File

@@ -795,7 +795,7 @@ bool NzRenderer::Initialize()
{
try
{
NzErrorFlags errFlags(nzErrorFlag_ThrowException);
NzErrorFlags errFlags(nzErrorFlag_ThrowException, true);
s_instanceBuffer.Reset(nullptr, NAZARA_RENDERER_INSTANCE_BUFFER_SIZE, nzBufferStorage_Hardware, nzBufferUsage_Dynamic);
}
catch (const std::exception& e)

View File

@@ -11,6 +11,7 @@
#include <Nazara/Utility/Debug.hpp>
///TODO: Rajouter des warnings (Formats compressés avec les méthodes Copy/Update, tests taille dans Copy)
///TODO: Rendre les méthodes exception-safe
namespace
{
@@ -768,7 +769,7 @@ nzUInt8* NzImage::GetPixels(unsigned int x, unsigned int y, unsigned int z, nzUI
EnsureOwnership();
return GetPixelPtr(m_sharedImage->pixels[level], NzPixelFormat::GetBytesPerPixel(m_sharedImage->format), x, y, z, m_sharedImage->width, m_sharedImage->height);
return GetPixelPtr(m_sharedImage->pixels[level], NzPixelFormat::GetBytesPerPixel(m_sharedImage->format), x, y, z, width, height);
}
unsigned int NzImage::GetSize() const

View File

@@ -335,7 +335,7 @@ void NzWindowImpl::SetCursor(nzWindowCursor cursor)
if (cursor > nzWindowCursor_Max)
{
NazaraError("Window cursor out of enum");
return false;
return;
}
#endif