Humungous refactor

This commit is contained in:
Jack Andersen 2016-03-04 13:02:18 -10:00
parent 5c66d46cfe
commit 8ac929d140
19 changed files with 181 additions and 181 deletions

6
.gitmodules vendored
View File

@ -1,6 +1,6 @@
[submodule "glslang"] [submodule "glslang"]
path = glslang path = glslang
url = https://github.com/AxioDL/glslang.git url = https://github.com/AxioDL/glslang.git
[submodule "log-visor"] [submodule "logvisor"]
path = log-visor path = logvisor
url = https://github.com/AxioDL/log-visor.git url = https://github.com/AxioDL/logvisor.git

View File

@ -1,17 +1,17 @@
cmake_minimum_required(VERSION 3.0) cmake_minimum_required(VERSION 3.0)
project(libBoo) project(boo)
if (NOT MSVC) if (NOT MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
endif() endif()
if (NOT TARGET LogVisor) if (NOT TARGET logvisor)
add_subdirectory(LogVisor) add_subdirectory(logvisor)
endif() endif()
set(BOO_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include CACHE PATH "libBoo include path" FORCE) set(BOO_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include CACHE PATH "boo include path" FORCE)
include_directories(include ${LOG_VISOR_INCLUDE_DIR}) include_directories(include ${LOGVISOR_INCLUDE_DIR})
if(NOT GEKKO AND NOT CAFE) if(NOT GEKKO AND NOT CAFE)
list(APPEND PLAT_SRCS list(APPEND PLAT_SRCS
@ -120,7 +120,7 @@ else(NOT GEKKO)
lib64) lib64)
if(DBUS_INCLUDE_DIR-NOTFOUND) if(DBUS_INCLUDE_DIR-NOTFOUND)
message(FATAL_ERROR "Unix build of libBoo requires dbus") message(FATAL_ERROR "Unix build of boo requires dbus")
endif() endif()
include_directories(${DBUS_INCLUDE_DIR} ${DBUS_ARCH_INCLUDE_DIR}) include_directories(${DBUS_INCLUDE_DIR} ${DBUS_ARCH_INCLUDE_DIR})
@ -158,13 +158,13 @@ add_subdirectory(glslang/OGLCompilersDLL)
add_subdirectory(glslang/SPIRV) add_subdirectory(glslang/SPIRV)
list(APPEND _BOO_SYS_LIBS glslang OSDependent OGLCompiler SPIRV) list(APPEND _BOO_SYS_LIBS glslang OSDependent OGLCompiler SPIRV)
set(BOO_SYS_LIBS ${_BOO_SYS_LIBS} CACHE PATH "Boo System Libraries" FORCE) set(BOO_SYS_LIBS ${_BOO_SYS_LIBS} CACHE PATH "boo system libraries" FORCE)
set(BOO_SYS_DEFINES ${_BOO_SYS_DEFINES} CACHE PATH "Boo System Defines" FORCE) set(BOO_SYS_DEFINES ${_BOO_SYS_DEFINES} CACHE PATH "boo system defines" FORCE)
add_definitions(${_BOO_SYS_DEFINES}) add_definitions(${_BOO_SYS_DEFINES})
include_directories(include glslang) include_directories(include glslang)
add_library(Boo add_library(boo
lib/inputdev/CafeProPad.cpp include/boo/inputdev/CafeProPad.hpp lib/inputdev/CafeProPad.cpp include/boo/inputdev/CafeProPad.hpp
lib/inputdev/RevolutionPad.cpp include/boo/inputdev/RevolutionPad.hpp lib/inputdev/RevolutionPad.cpp include/boo/inputdev/RevolutionPad.hpp
lib/inputdev/DolphinSmashAdapter.cpp include/boo/inputdev/DolphinSmashAdapter.hpp lib/inputdev/DolphinSmashAdapter.cpp include/boo/inputdev/DolphinSmashAdapter.hpp

View File

@ -9,7 +9,7 @@ namespace boo
struct IAudioVoiceCallback struct IAudioVoiceCallback
{ {
/** Boo calls this on behalf of the audio platform to request more audio /** boo calls this on behalf of the audio platform to request more audio
* frames from the client */ * frames from the client */
virtual void needsNextBuffer(IAudioVoice* voice, size_t frames)=0; virtual void needsNextBuffer(IAudioVoice* voice, size_t frames)=0;
}; };

View File

@ -1,11 +1,11 @@
#include "boo/audiodev/IAudioVoiceAllocator.hpp" #include "boo/audiodev/IAudioVoiceAllocator.hpp"
#include <LogVisor/LogVisor.hpp> #include "logvisor/logvisor.hpp"
#include <alsa/asoundlib.h> #include <alsa/asoundlib.h>
namespace boo namespace boo
{ {
static LogVisor::LogModule Log("boo::ALSA"); static logvisor::Module Log("boo::ALSA");
struct ALSAAudioVoice : IAudioVoice struct ALSAAudioVoice : IAudioVoice
{ {
@ -29,7 +29,7 @@ struct ALSAAudioVoice : IAudioVoice
{ {
if (snd_pcm_open(&m_pcm, "default", SND_PCM_STREAM_PLAYBACK, SND_PCM_ASYNC) < 0) if (snd_pcm_open(&m_pcm, "default", SND_PCM_STREAM_PLAYBACK, SND_PCM_ASYNC) < 0)
{ {
Log.report(LogVisor::Error, "unable to allocate ALSA voice"); Log.report(logvisor::Error, "unable to allocate ALSA voice");
return; return;
} }
@ -47,7 +47,7 @@ struct ALSAAudioVoice : IAudioVoice
{ {
snd_pcm_close(m_pcm); snd_pcm_close(m_pcm);
m_pcm = nullptr; m_pcm = nullptr;
Log.report(LogVisor::Error, "unable to set ALSA voice params"); Log.report(logvisor::Error, "unable to set ALSA voice params");
return; return;
} }
@ -56,7 +56,7 @@ struct ALSAAudioVoice : IAudioVoice
{ {
snd_pcm_close(m_pcm); snd_pcm_close(m_pcm);
m_pcm = nullptr; m_pcm = nullptr;
Log.report(LogVisor::Error, "unable to query ALSA voice chmaps"); Log.report(logvisor::Error, "unable to query ALSA voice chmaps");
return; return;
} }
snd_pcm_chmap_t* foundChmap = nullptr; snd_pcm_chmap_t* foundChmap = nullptr;
@ -119,7 +119,7 @@ struct ALSAAudioVoice : IAudioVoice
snd_pcm_close(m_pcm); snd_pcm_close(m_pcm);
m_pcm = nullptr; m_pcm = nullptr;
snd_pcm_free_chmaps(chmaps); snd_pcm_free_chmaps(chmaps);
Log.report(LogVisor::Error, "unable to find matching ALSA voice chmap"); Log.report(logvisor::Error, "unable to find matching ALSA voice chmap");
return; return;
} }
m_map.m_channelCount = chCount; m_map.m_channelCount = chCount;

View File

@ -1,11 +1,11 @@
#include "boo/audiodev/IAudioVoiceAllocator.hpp" #include "boo/audiodev/IAudioVoiceAllocator.hpp"
#include <LogVisor/LogVisor.hpp> #include "logvisor/logvisor.hpp"
#include <AudioToolbox/AudioToolbox.h> #include <AudioToolbox/AudioToolbox.h>
namespace boo namespace boo
{ {
static LogVisor::LogModule Log("boo::AQS"); static logvisor::Module Log("boo::AQS");
static AudioChannel AQSChannelToBooChannel(AudioChannelLabel ch) static AudioChannel AQSChannelToBooChannel(AudioChannelLabel ch)
{ {
@ -80,7 +80,7 @@ struct AQSAudioVoice : IAudioVoice
} }
if (err) if (err)
{ {
Log.report(LogVisor::Error, "unable to create output audio queue"); Log.report(logvisor::Error, "unable to create output audio queue");
return; return;
} }
@ -88,7 +88,7 @@ struct AQSAudioVoice : IAudioVoice
UInt32 layoutSz = sizeof(layout); UInt32 layoutSz = sizeof(layout);
if (AudioQueueGetProperty(m_queue, kAudioQueueProperty_ChannelLayout, &layout, &layoutSz)) if (AudioQueueGetProperty(m_queue, kAudioQueueProperty_ChannelLayout, &layout, &layoutSz))
{ {
Log.report(LogVisor::Error, "unable to get channel layout from audio queue"); Log.report(logvisor::Error, "unable to get channel layout from audio queue");
return; return;
} }
@ -142,7 +142,7 @@ struct AQSAudioVoice : IAudioVoice
m_map.m_channels[4] = AudioChannel::FrontCenter; m_map.m_channels[4] = AudioChannel::FrontCenter;
break; break;
default: default:
Log.report(LogVisor::Error, "unknown channel layout %u; using stereo", layout.mChannelLayoutTag); Log.report(logvisor::Error, "unknown channel layout %u; using stereo", layout.mChannelLayoutTag);
m_map.m_channelCount = 2; m_map.m_channelCount = 2;
m_map.m_channels[0] = AudioChannel::FrontLeft; m_map.m_channels[0] = AudioChannel::FrontLeft;
m_map.m_channels[1] = AudioChannel::FrontRight; m_map.m_channels[1] = AudioChannel::FrontRight;
@ -155,7 +155,7 @@ struct AQSAudioVoice : IAudioVoice
for (int i=0 ; i<3 ; ++i) for (int i=0 ; i<3 ; ++i)
if (AudioQueueAllocateBuffer(m_queue, m_bufferFrames * chCount * 2, &m_buffers[i])) if (AudioQueueAllocateBuffer(m_queue, m_bufferFrames * chCount * 2, &m_buffers[i]))
{ {
Log.report(LogVisor::Error, "unable to create audio queue buffer"); Log.report(logvisor::Error, "unable to create audio queue buffer");
AudioQueueDispose(m_queue, false); AudioQueueDispose(m_queue, false);
m_queue = nullptr; m_queue = nullptr;
return; return;

View File

@ -1,12 +1,12 @@
#include "../win/Win32Common.hpp" #include "../win/Win32Common.hpp"
#include "boo/audiodev/IAudioVoiceAllocator.hpp" #include "boo/audiodev/IAudioVoiceAllocator.hpp"
#include <LogVisor/LogVisor.hpp> #include "logvisor/logvisor.hpp"
#include <xaudio2.h> #include <xaudio2.h>
namespace boo namespace boo
{ {
static LogVisor::LogModule Log("boo::XAudio2"); static logvisor::Module Log("boo::XAudio2");
struct XA2AudioVoice : IAudioVoice struct XA2AudioVoice : IAudioVoice
{ {
@ -52,7 +52,7 @@ struct XA2AudioVoice : IAudioVoice
if FAILED(xa2.CreateSourceVoice(&m_voiceQueue, &desc, 0, XAUDIO2_DEFAULT_FREQ_RATIO, &m_xaCb)) if FAILED(xa2.CreateSourceVoice(&m_voiceQueue, &desc, 0, XAUDIO2_DEFAULT_FREQ_RATIO, &m_xaCb))
{ {
Log.report(LogVisor::Error, "unable to create source voice"); Log.report(logvisor::Error, "unable to create source voice");
return; return;
} }
@ -101,7 +101,7 @@ struct XA2AudioVoice : IAudioVoice
m_map.m_channels[7] = AudioChannel::SideRight; m_map.m_channels[7] = AudioChannel::SideRight;
break; break;
default: default:
Log.report(LogVisor::Error, "unknown channel layout %u; using stereo", voxDetails.InputChannels); Log.report(logvisor::Error, "unknown channel layout %u; using stereo", voxDetails.InputChannels);
m_map.m_channelCount = 2; m_map.m_channelCount = 2;
m_map.m_channels[0] = AudioChannel::FrontLeft; m_map.m_channels[0] = AudioChannel::FrontLeft;
m_map.m_channels[1] = AudioChannel::FrontRight; m_map.m_channels[1] = AudioChannel::FrontRight;
@ -153,18 +153,18 @@ struct XA2AudioVoiceAllocator : IAudioVoiceAllocator
{ {
if (FAILED(XAudio2Create(&m_xa2))) if (FAILED(XAudio2Create(&m_xa2)))
{ {
Log.report(LogVisor::Error, "Unable to initialize XAudio2"); Log.report(logvisor::Error, "Unable to initialize XAudio2");
return; return;
} }
if (FAILED(m_xa2->CreateMasteringVoice(&m_masterVoice))) if (FAILED(m_xa2->CreateMasteringVoice(&m_masterVoice)))
{ {
Log.report(LogVisor::Error, "Unable to initialize XAudio2 mastering voice"); Log.report(logvisor::Error, "Unable to initialize XAudio2 mastering voice");
return; return;
} }
DWORD channelMask; DWORD channelMask;
if (FAILED(m_masterVoice->GetChannelMask(&channelMask))) if (FAILED(m_masterVoice->GetChannelMask(&channelMask)))
{ {
Log.report(LogVisor::Error, "Unable to get mastering voice's channel mask"); Log.report(logvisor::Error, "Unable to get mastering voice's channel mask");
return; return;
} }
if ((channelMask & (SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT)) == (SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT)) if ((channelMask & (SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT)) == (SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT))

View File

@ -1,5 +1,5 @@
#include "../win/Win32Common.hpp" #include "../win/Win32Common.hpp"
#include <LogVisor/LogVisor.hpp> #include "logvisor/logvisor.hpp"
#include "boo/graphicsdev/D3D.hpp" #include "boo/graphicsdev/D3D.hpp"
#include "boo/IGraphicsContext.hpp" #include "boo/IGraphicsContext.hpp"
#include <vector> #include <vector>
@ -19,7 +19,7 @@ extern pD3DCompile D3DCompilePROC;
namespace boo namespace boo
{ {
static LogVisor::LogModule Log("boo::D3D11"); static logvisor::Module Log("boo::D3D11");
static inline void ThrowIfFailed(HRESULT hr) static inline void ThrowIfFailed(HRESULT hr)
{ {
@ -28,7 +28,7 @@ static inline void ThrowIfFailed(HRESULT hr)
// Set a breakpoint on this line to catch Win32 API errors. // Set a breakpoint on this line to catch Win32 API errors.
_com_error err(hr); _com_error err(hr);
LPCTSTR errMsg = err.ErrorMessage(); LPCTSTR errMsg = err.ErrorMessage();
Log.report(LogVisor::FatalError, errMsg); Log.report(logvisor::Fatal, errMsg);
} }
} }
@ -48,7 +48,7 @@ struct D3D11Data : IGraphicsData
bool decref() bool decref()
{ {
if (!m_deleteCountdown) if (!m_deleteCountdown)
Log.report(LogVisor::FatalError, "Can't decrement 0-data"); Log.report(logvisor::Fatal, "Can't decrement 0-data");
--m_deleteCountdown; --m_deleteCountdown;
if (!m_deleteCountdown) if (!m_deleteCountdown)
{ {
@ -144,7 +144,7 @@ class D3D11TextureS : public ITextureS
pxPitchDenom = 2; pxPitchDenom = 2;
break; break;
default: default:
Log.report(LogVisor::FatalError, "unsupported tex format"); Log.report(logvisor::Fatal, "unsupported tex format");
} }
CD3D11_TEXTURE2D_DESC desc(pfmt, width, height, 1, mips, CD3D11_TEXTURE2D_DESC desc(pfmt, width, height, 1, mips,
@ -257,7 +257,7 @@ class D3D11TextureD : public ITextureD
pxPitch = 1; pxPitch = 1;
break; break;
default: default:
Log.report(LogVisor::FatalError, "unsupported tex format"); Log.report(logvisor::Fatal, "unsupported tex format");
} }
m_cpuSz = width * height * pxPitch; m_cpuSz = width * height * pxPitch;
@ -567,7 +567,7 @@ struct D3D11ShaderDataBinding : IShaderDataBinding
{ {
#ifndef NDEBUG #ifndef NDEBUG
if (!m_committed) if (!m_committed)
Log.report(LogVisor::FatalError, Log.report(logvisor::Fatal,
"attempted to use uncommitted D3D11ShaderDataBinding"); "attempted to use uncommitted D3D11ShaderDataBinding");
#endif #endif
@ -1152,7 +1152,7 @@ public:
if (FAILED(D3DCompilePROC(vertSource, strlen(vertSource), "HECL Vert Source", nullptr, nullptr, "main", if (FAILED(D3DCompilePROC(vertSource, strlen(vertSource), "HECL Vert Source", nullptr, nullptr, "main",
"vs_5_0", BOO_D3DCOMPILE_FLAG, 0, &vertBlobOut, &errBlob))) "vs_5_0", BOO_D3DCOMPILE_FLAG, 0, &vertBlobOut, &errBlob)))
{ {
Log.report(LogVisor::FatalError, "error compiling vert shader: %s", errBlob->GetBufferPointer()); Log.report(logvisor::Fatal, "error compiling vert shader: %s", errBlob->GetBufferPointer());
return nullptr; return nullptr;
} }
} }
@ -1162,7 +1162,7 @@ public:
if (FAILED(D3DCompilePROC(fragSource, strlen(fragSource), "HECL Pixel Source", nullptr, nullptr, "main", if (FAILED(D3DCompilePROC(fragSource, strlen(fragSource), "HECL Pixel Source", nullptr, nullptr, "main",
"ps_5_0", BOO_D3DCOMPILE_FLAG, 0, &fragBlobOut, &errBlob))) "ps_5_0", BOO_D3DCOMPILE_FLAG, 0, &fragBlobOut, &errBlob)))
{ {
Log.report(LogVisor::FatalError, "error compiling pixel shader: %s", errBlob->GetBufferPointer()); Log.report(logvisor::Fatal, "error compiling pixel shader: %s", errBlob->GetBufferPointer());
return nullptr; return nullptr;
} }
} }

View File

@ -1,6 +1,6 @@
#include "../win/Win32Common.hpp" #include "../win/Win32Common.hpp"
#if _WIN32_WINNT_WIN10 #if _WIN32_WINNT_WIN10
#include <LogVisor/LogVisor.hpp> #include "logvisor/logvisor.hpp"
#include "boo/graphicsdev/D3D.hpp" #include "boo/graphicsdev/D3D.hpp"
#include "boo/IGraphicsContext.hpp" #include "boo/IGraphicsContext.hpp"
#include <vector> #include <vector>
@ -21,7 +21,7 @@ extern pD3DCompile D3DCompilePROC;
namespace boo namespace boo
{ {
static LogVisor::LogModule Log("boo::D3D12"); static logvisor::Module Log("boo::D3D12");
static inline void ThrowIfFailed(HRESULT hr) static inline void ThrowIfFailed(HRESULT hr)
{ {
@ -30,7 +30,7 @@ static inline void ThrowIfFailed(HRESULT hr)
// Set a breakpoint on this line to catch Win32 API errors. // Set a breakpoint on this line to catch Win32 API errors.
_com_error err(hr); _com_error err(hr);
LPCTSTR errMsg = err.ErrorMessage(); LPCTSTR errMsg = err.ErrorMessage();
Log.report(LogVisor::FatalError, errMsg); Log.report(logvisor::Fatal, errMsg);
} }
} }
@ -83,7 +83,7 @@ class D3D12GraphicsBufferS : public IGraphicsBufferS
D3D12_SUBRESOURCE_DATA upData = {data, LONG_PTR(m_sz), LONG_PTR(m_sz)}; D3D12_SUBRESOURCE_DATA upData = {data, LONG_PTR(m_sz), LONG_PTR(m_sz)};
if (!PrepSubresources<1>(ctx->m_dev.Get(), &m_gpuDesc, m_buf.Get(), 0, 0, 1, &upData)) if (!PrepSubresources<1>(ctx->m_dev.Get(), &m_gpuDesc, m_buf.Get(), 0, 0, 1, &upData))
Log.report(LogVisor::FatalError, "error preparing resource for upload"); Log.report(logvisor::Fatal, "error preparing resource for upload");
} }
public: public:
size_t m_stride; size_t m_stride;
@ -186,7 +186,7 @@ class D3D12TextureS : public ITextureS
pxPitchDenom = 2; pxPitchDenom = 2;
break; break;
default: default:
Log.report(LogVisor::FatalError, "unsupported tex format"); Log.report(logvisor::Fatal, "unsupported tex format");
} }
@ -210,7 +210,7 @@ class D3D12TextureS : public ITextureS
} }
if (!PrepSubresources<16>(ctx->m_dev.Get(), &m_gpuDesc, m_tex.Get(), 0, 0, m_gpuDesc.MipLevels, upData)) if (!PrepSubresources<16>(ctx->m_dev.Get(), &m_gpuDesc, m_tex.Get(), 0, 0, m_gpuDesc.MipLevels, upData))
Log.report(LogVisor::FatalError, "error preparing resource for upload"); Log.report(logvisor::Fatal, "error preparing resource for upload");
} }
public: public:
ComPtr<ID3D12Resource> m_tex; ComPtr<ID3D12Resource> m_tex;
@ -258,7 +258,7 @@ class D3D12TextureSA : public ITextureSA
pixelFmt = DXGI_FORMAT_R8_UNORM; pixelFmt = DXGI_FORMAT_R8_UNORM;
break; break;
default: default:
Log.report(LogVisor::FatalError, "unsupported tex format"); Log.report(logvisor::Fatal, "unsupported tex format");
} }
m_gpuDesc = CD3DX12_RESOURCE_DESC::Tex2D(pixelFmt, width, height, layers, 1); m_gpuDesc = CD3DX12_RESOURCE_DESC::Tex2D(pixelFmt, width, height, layers, 1);
@ -281,7 +281,7 @@ class D3D12TextureSA : public ITextureSA
dataIt += upData[i].SlicePitch; dataIt += upData[i].SlicePitch;
} }
if (!PrepSubresources(ctx->m_dev.Get(), &m_gpuDesc, m_tex.Get(), 0, 0, layers, upData.get())) if (!PrepSubresources(ctx->m_dev.Get(), &m_gpuDesc, m_tex.Get(), 0, 0, layers, upData.get()))
Log.report(LogVisor::FatalError, "error preparing resource for upload"); Log.report(logvisor::Fatal, "error preparing resource for upload");
} }
else else
{ {
@ -294,7 +294,7 @@ class D3D12TextureSA : public ITextureSA
dataIt += upData[i].SlicePitch; dataIt += upData[i].SlicePitch;
} }
if (!PrepSubresources<16>(ctx->m_dev.Get(), &m_gpuDesc, m_tex.Get(), 0, 0, layers, upData)) if (!PrepSubresources<16>(ctx->m_dev.Get(), &m_gpuDesc, m_tex.Get(), 0, 0, layers, upData))
Log.report(LogVisor::FatalError, "error preparing resource for upload"); Log.report(logvisor::Fatal, "error preparing resource for upload");
} }
} }
public: public:
@ -353,7 +353,7 @@ class D3D12TextureD : public ITextureD
pixelFmt = DXGI_FORMAT_R8_UNORM; pixelFmt = DXGI_FORMAT_R8_UNORM;
break; break;
default: default:
Log.report(LogVisor::FatalError, "unsupported tex format"); Log.report(logvisor::Fatal, "unsupported tex format");
} }
m_gpuDesc = CD3DX12_RESOURCE_DESC::Tex2D(pixelFmt, width, height); m_gpuDesc = CD3DX12_RESOURCE_DESC::Tex2D(pixelFmt, width, height);
@ -958,7 +958,7 @@ struct D3D12ShaderDataBinding : IShaderDataBinding
{ {
#ifndef NDEBUG #ifndef NDEBUG
if (!m_committed) if (!m_committed)
Log.report(LogVisor::FatalError, Log.report(logvisor::Fatal,
"attempted to use uncommitted D3D12ShaderDataBinding"); "attempted to use uncommitted D3D12ShaderDataBinding");
#endif #endif
@ -1357,7 +1357,7 @@ void D3D12GraphicsBufferD::update(int b)
m_q->m_dynamicCmdList->ResourceBarrier(1, &CD3DX12_RESOURCE_BARRIER::Transition(gpuRes, m_q->m_dynamicCmdList->ResourceBarrier(1, &CD3DX12_RESOURCE_BARRIER::Transition(gpuRes,
m_state, D3D12_RESOURCE_STATE_COPY_DEST)); m_state, D3D12_RESOURCE_STATE_COPY_DEST));
if (!UpdateSubresources<1>(m_q->m_dynamicCmdList.Get(), gpuRes, res, 0, 0, 1, &d)) if (!UpdateSubresources<1>(m_q->m_dynamicCmdList.Get(), gpuRes, res, 0, 0, 1, &d))
Log.report(LogVisor::FatalError, "unable to update dynamic buffer data"); Log.report(logvisor::Fatal, "unable to update dynamic buffer data");
m_q->m_dynamicCmdList->ResourceBarrier(1, &CD3DX12_RESOURCE_BARRIER::Transition(gpuRes, m_q->m_dynamicCmdList->ResourceBarrier(1, &CD3DX12_RESOURCE_BARRIER::Transition(gpuRes,
D3D12_RESOURCE_STATE_COPY_DEST, m_state)); D3D12_RESOURCE_STATE_COPY_DEST, m_state));
m_validSlots |= slot; m_validSlots |= slot;
@ -1393,7 +1393,7 @@ void D3D12TextureD::update(int b)
m_q->m_dynamicCmdList->ResourceBarrier(1, &CD3DX12_RESOURCE_BARRIER::Transition(gpuRes, m_q->m_dynamicCmdList->ResourceBarrier(1, &CD3DX12_RESOURCE_BARRIER::Transition(gpuRes,
D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE, D3D12_RESOURCE_STATE_COPY_DEST)); D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE, D3D12_RESOURCE_STATE_COPY_DEST));
if (!UpdateSubresources<1>(m_q->m_dynamicCmdList.Get(), gpuRes, res, 0, 0, 1, &d)) if (!UpdateSubresources<1>(m_q->m_dynamicCmdList.Get(), gpuRes, res, 0, 0, 1, &d))
Log.report(LogVisor::FatalError, "unable to update dynamic texture data"); Log.report(logvisor::Fatal, "unable to update dynamic texture data");
m_q->m_dynamicCmdList->ResourceBarrier(1, &CD3DX12_RESOURCE_BARRIER::Transition(gpuRes, m_q->m_dynamicCmdList->ResourceBarrier(1, &CD3DX12_RESOURCE_BARRIER::Transition(gpuRes,
D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE)); D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE));
m_validSlots |= slot; m_validSlots |= slot;
@ -1600,7 +1600,7 @@ public:
if (FAILED(D3DCompilePROC(vertSource, strlen(vertSource), "HECL Vert Source", nullptr, nullptr, "main", if (FAILED(D3DCompilePROC(vertSource, strlen(vertSource), "HECL Vert Source", nullptr, nullptr, "main",
"vs_5_0", BOO_D3DCOMPILE_FLAG, 0, &vertBlobOut, &errBlob))) "vs_5_0", BOO_D3DCOMPILE_FLAG, 0, &vertBlobOut, &errBlob)))
{ {
Log.report(LogVisor::FatalError, "error compiling vert shader: %s", errBlob->GetBufferPointer()); Log.report(logvisor::Fatal, "error compiling vert shader: %s", errBlob->GetBufferPointer());
return nullptr; return nullptr;
} }
} }
@ -1610,7 +1610,7 @@ public:
if (FAILED(D3DCompilePROC(fragSource, strlen(fragSource), "HECL Pixel Source", nullptr, nullptr, "main", if (FAILED(D3DCompilePROC(fragSource, strlen(fragSource), "HECL Pixel Source", nullptr, nullptr, "main",
"ps_5_0", BOO_D3DCOMPILE_FLAG, 0, &fragBlobOut, &errBlob))) "ps_5_0", BOO_D3DCOMPILE_FLAG, 0, &fragBlobOut, &errBlob)))
{ {
Log.report(LogVisor::FatalError, "error compiling pixel shader: %s", errBlob->GetBufferPointer()); Log.report(logvisor::Fatal, "error compiling pixel shader: %s", errBlob->GetBufferPointer());
return nullptr; return nullptr;
} }
} }

View File

@ -7,14 +7,14 @@
#include <condition_variable> #include <condition_variable>
#include <array> #include <array>
#include <LogVisor/LogVisor.hpp> #include "logvisor/logvisor.hpp"
#undef min #undef min
#undef max #undef max
namespace boo namespace boo
{ {
static LogVisor::LogModule Log("boo::GL"); static logvisor::Module Log("boo::GL");
ThreadLocalPtr<struct GLData> GLDataFactory::m_deferredData; ThreadLocalPtr<struct GLData> GLDataFactory::m_deferredData;
struct GLData : IGraphicsData struct GLData : IGraphicsData
@ -143,7 +143,7 @@ class GLTextureS : public ITextureS
compressed = true; compressed = true;
break; break;
default: default:
Log.report(LogVisor::FatalError, "unsupported tex format"); Log.report(logvisor::Fatal, "unsupported tex format");
} }
if (compressed) if (compressed)
@ -453,7 +453,7 @@ IShaderPipeline* GLDataFactory::newShaderPipeline
GLShaderPipeline shader; GLShaderPipeline shader;
if (!shader.initObjects()) if (!shader.initObjects())
{ {
Log.report(LogVisor::Error, "unable to create shader objects\n"); Log.report(logvisor::Error, "unable to create shader objects\n");
return nullptr; return nullptr;
} }
shader.m_sfactor = BLEND_FACTOR_TABLE[int(srcFac)]; shader.m_sfactor = BLEND_FACTOR_TABLE[int(srcFac)];
@ -472,7 +472,7 @@ IShaderPipeline* GLDataFactory::newShaderPipeline
glGetShaderiv(shader.m_vert, GL_INFO_LOG_LENGTH, &logLen); glGetShaderiv(shader.m_vert, GL_INFO_LOG_LENGTH, &logLen);
char* log = (char*)malloc(logLen); char* log = (char*)malloc(logLen);
glGetShaderInfoLog(shader.m_vert, logLen, nullptr, log); glGetShaderInfoLog(shader.m_vert, logLen, nullptr, log);
Log.report(LogVisor::Error, "unable to compile vert source\n%s\n%s\n", log, vertSource); Log.report(logvisor::Error, "unable to compile vert source\n%s\n%s\n", log, vertSource);
free(log); free(log);
return nullptr; return nullptr;
} }
@ -486,7 +486,7 @@ IShaderPipeline* GLDataFactory::newShaderPipeline
glGetShaderiv(shader.m_frag, GL_INFO_LOG_LENGTH, &logLen); glGetShaderiv(shader.m_frag, GL_INFO_LOG_LENGTH, &logLen);
char* log = (char*)malloc(logLen); char* log = (char*)malloc(logLen);
glGetShaderInfoLog(shader.m_frag, logLen, nullptr, log); glGetShaderInfoLog(shader.m_frag, logLen, nullptr, log);
Log.report(LogVisor::Error, "unable to compile frag source\n%s\n%s\n", log, fragSource); Log.report(logvisor::Error, "unable to compile frag source\n%s\n%s\n", log, fragSource);
free(log); free(log);
return nullptr; return nullptr;
} }
@ -499,7 +499,7 @@ IShaderPipeline* GLDataFactory::newShaderPipeline
glGetProgramiv(shader.m_prog, GL_INFO_LOG_LENGTH, &logLen); glGetProgramiv(shader.m_prog, GL_INFO_LOG_LENGTH, &logLen);
char* log = (char*)malloc(logLen); char* log = (char*)malloc(logLen);
glGetProgramInfoLog(shader.m_prog, logLen, nullptr, log); glGetProgramInfoLog(shader.m_prog, logLen, nullptr, log);
Log.report(LogVisor::Error, "unable to link shader program\n%s\n", log); Log.report(logvisor::Error, "unable to link shader program\n%s\n", log);
free(log); free(log);
return nullptr; return nullptr;
} }
@ -513,7 +513,7 @@ IShaderPipeline* GLDataFactory::newShaderPipeline
{ {
GLint uniLoc = glGetUniformBlockIndex(shader.m_prog, uniformBlockNames[i]); GLint uniLoc = glGetUniformBlockIndex(shader.m_prog, uniformBlockNames[i]);
if (uniLoc < 0) if (uniLoc < 0)
Log.report(LogVisor::Error, "unable to find uniform block '%s'", uniformBlockNames[i]); Log.report(logvisor::Error, "unable to find uniform block '%s'", uniformBlockNames[i]);
shader.m_uniLocs.push_back(uniLoc); shader.m_uniLocs.push_back(uniLoc);
} }
} }
@ -522,7 +522,7 @@ IShaderPipeline* GLDataFactory::newShaderPipeline
{ {
GLint texLoc = glGetUniformLocation(shader.m_prog, texArrayName); GLint texLoc = glGetUniformLocation(shader.m_prog, texArrayName);
if (texLoc < 0) if (texLoc < 0)
Log.report(LogVisor::Error, "unable to find sampler variable '%s'", texArrayName); Log.report(logvisor::Error, "unable to find sampler variable '%s'", texArrayName);
else else
{ {
if (texCount > m_texUnis.size()) if (texCount > m_texUnis.size())
@ -585,7 +585,7 @@ struct GLShaderDataBinding : IShaderDataBinding
{ {
#ifndef NDEBUG #ifndef NDEBUG
if (!m_committed) if (!m_committed)
Log.report(LogVisor::FatalError, Log.report(logvisor::Fatal,
"attempted to use uncommitted GLShaderDataBinding"); "attempted to use uncommitted GLShaderDataBinding");
#endif #endif
@ -874,9 +874,9 @@ struct GLCommandQueue : IGraphicsCommandQueue
std::unique_lock<std::mutex> lk(self->m_initmt); std::unique_lock<std::mutex> lk(self->m_initmt);
self->m_parent->makeCurrent(); self->m_parent->makeCurrent();
if (glewInit() != GLEW_OK) if (glewInit() != GLEW_OK)
Log.report(LogVisor::FatalError, "unable to init glew"); Log.report(logvisor::Fatal, "unable to init glew");
const GLubyte* version = glGetString(GL_VERSION); const GLubyte* version = glGetString(GL_VERSION);
Log.report(LogVisor::Info, "OpenGL Version: %s", version); Log.report(logvisor::Info, "OpenGL Version: %s", version);
self->m_parent->postInit(); self->m_parent->postInit();
} }
self->m_initcv.notify_one(); self->m_initcv.notify_one();
@ -1290,7 +1290,7 @@ GLTextureD::GLTextureD(size_t width, size_t height, TextureFormat fmt)
pxPitch = 1; pxPitch = 1;
break; break;
default: default:
Log.report(LogVisor::FatalError, "unsupported tex format"); Log.report(logvisor::Fatal, "unsupported tex format");
} }
m_cpuSz = width * height * pxPitch; m_cpuSz = width * height * pxPitch;
m_cpuBuf.reset(new uint8_t[m_cpuSz]); m_cpuBuf.reset(new uint8_t[m_cpuSz]);

View File

@ -1,16 +1,16 @@
#include "boo/graphicsdev/glxew.h" #include "boo/graphicsdev/glxew.h"
#include <LogVisor/LogVisor.hpp> #include "logvisor/logvisor.hpp"
namespace boo namespace boo
{ {
static LogVisor::LogModule Log("boo::GLX"); static logvisor::Module Log("boo::GLX");
void GLXExtensionCheck() void GLXExtensionCheck()
{ {
if (!GLXEW_SGI_video_sync) if (!GLXEW_SGI_video_sync)
Log.report(LogVisor::FatalError, "GLX_SGI_video_sync not available"); Log.report(logvisor::Fatal, "GLX_SGI_video_sync not available");
if (!GLXEW_EXT_swap_control && !GLXEW_MESA_swap_control && !GLXEW_SGI_swap_control) if (!GLXEW_EXT_swap_control && !GLXEW_MESA_swap_control && !GLXEW_SGI_swap_control)
Log.report(LogVisor::FatalError, "swap_control not available"); Log.report(logvisor::Fatal, "swap_control not available");
} }
void GLXEnableVSync(Display* disp, GLXWindow drawable) void GLXEnableVSync(Display* disp, GLXWindow drawable)

View File

@ -12,7 +12,7 @@
#include <SPIRV/disassemble.h> #include <SPIRV/disassemble.h>
#include "boo/graphicsdev/GLSLMacros.hpp" #include "boo/graphicsdev/GLSLMacros.hpp"
#include <LogVisor/LogVisor.hpp> #include "logvisor/logvisor.hpp"
#undef min #undef min
#undef max #undef max
@ -214,19 +214,19 @@ static void init_resources(TBuiltInResource &Resources) {
namespace boo namespace boo
{ {
static LogVisor::LogModule Log("boo::Vulkan"); static logvisor::Module Log("boo::Vulkan");
VulkanContext g_VulkanContext; VulkanContext g_VulkanContext;
static inline void ThrowIfFailed(VkResult res) static inline void ThrowIfFailed(VkResult res)
{ {
if (res != VK_SUCCESS) if (res != VK_SUCCESS)
Log.report(LogVisor::FatalError, "%d\n", res); Log.report(logvisor::Fatal, "%d\n", res);
} }
static inline void ThrowIfFalse(bool res) static inline void ThrowIfFalse(bool res)
{ {
if (!res) if (!res)
Log.report(LogVisor::FatalError, "operation failed\n", res); Log.report(logvisor::Fatal, "operation failed\n", res);
} }
static VKAPI_ATTR VkBool32 VKAPI_CALL static VKAPI_ATTR VkBool32 VKAPI_CALL
@ -235,15 +235,15 @@ dbgFunc(VkDebugReportFlagsEXT msgFlags, VkDebugReportObjectTypeEXT objType,
const char *pLayerPrefix, const char *pMsg, void *pUserData) const char *pLayerPrefix, const char *pMsg, void *pUserData)
{ {
if (msgFlags & VK_DEBUG_REPORT_ERROR_BIT_EXT) { if (msgFlags & VK_DEBUG_REPORT_ERROR_BIT_EXT) {
Log.report(LogVisor::FatalError, "[%s] Code %d : %s", pLayerPrefix, msgCode, pMsg); Log.report(logvisor::Fatal, "[%s] Code %d : %s", pLayerPrefix, msgCode, pMsg);
} else if (msgFlags & VK_DEBUG_REPORT_WARNING_BIT_EXT) { } else if (msgFlags & VK_DEBUG_REPORT_WARNING_BIT_EXT) {
Log.report(LogVisor::Warning, "[%s] Code %d : %s", pLayerPrefix, msgCode, pMsg); Log.report(logvisor::Warning, "[%s] Code %d : %s", pLayerPrefix, msgCode, pMsg);
} else if (msgFlags & VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT) { } else if (msgFlags & VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT) {
Log.report(LogVisor::Warning, "[%s] Code %d : %s", pLayerPrefix, msgCode, pMsg); Log.report(logvisor::Warning, "[%s] Code %d : %s", pLayerPrefix, msgCode, pMsg);
} else if (msgFlags & VK_DEBUG_REPORT_INFORMATION_BIT_EXT) { } else if (msgFlags & VK_DEBUG_REPORT_INFORMATION_BIT_EXT) {
Log.report(LogVisor::Info, "[%s] Code %d : %s", pLayerPrefix, msgCode, pMsg); Log.report(logvisor::Info, "[%s] Code %d : %s", pLayerPrefix, msgCode, pMsg);
} else if (msgFlags & VK_DEBUG_REPORT_DEBUG_BIT_EXT) { } else if (msgFlags & VK_DEBUG_REPORT_DEBUG_BIT_EXT) {
Log.report(LogVisor::Info, "[%s] Code %d : %s", pLayerPrefix, msgCode, pMsg); Log.report(logvisor::Info, "[%s] Code %d : %s", pLayerPrefix, msgCode, pMsg);
} }
/* /*
@ -373,7 +373,7 @@ static void demo_check_layers(const std::vector<VulkanContext::LayerProperties>&
} }
} }
if (!found) { if (!found) {
Log.report(LogVisor::FatalError, "Cannot find layer: %s", layerNames[i]); Log.report(logvisor::Fatal, "Cannot find layer: %s", layerNames[i]);
} }
} }
} }
@ -381,7 +381,7 @@ static void demo_check_layers(const std::vector<VulkanContext::LayerProperties>&
void VulkanContext::initVulkan(const char* appName) void VulkanContext::initVulkan(const char* appName)
{ {
if (!glslang::InitializeProcess()) if (!glslang::InitializeProcess())
Log.report(LogVisor::FatalError, "unable to initialize glslang"); Log.report(logvisor::Fatal, "unable to initialize glslang");
uint32_t instanceLayerCount; uint32_t instanceLayerCount;
VkLayerProperties* vkProps = nullptr; VkLayerProperties* vkProps = nullptr;
@ -482,7 +482,7 @@ void VulkanContext::initVulkan(const char* appName)
PFN_vkCreateDebugReportCallbackEXT createDebugReportCallback = PFN_vkCreateDebugReportCallbackEXT createDebugReportCallback =
(PFN_vkCreateDebugReportCallbackEXT)vkGetInstanceProcAddr(m_instance, "vkCreateDebugReportCallbackEXT"); (PFN_vkCreateDebugReportCallbackEXT)vkGetInstanceProcAddr(m_instance, "vkCreateDebugReportCallbackEXT");
if (!createDebugReportCallback) if (!createDebugReportCallback)
Log.report(LogVisor::FatalError, "GetInstanceProcAddr: Unable to find vkCreateDebugReportCallbackEXT function."); Log.report(logvisor::Fatal, "GetInstanceProcAddr: Unable to find vkCreateDebugReportCallbackEXT function.");
VkDebugReportCallbackCreateInfoEXT debugCreateInfo = {}; VkDebugReportCallbackCreateInfoEXT debugCreateInfo = {};
debugCreateInfo.sType = VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT; debugCreateInfo.sType = VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT;
@ -516,7 +516,7 @@ void VulkanContext::initVulkan(const char* appName)
void VulkanContext::initDevice() void VulkanContext::initDevice()
{ {
if (m_graphicsQueueFamilyIndex == UINT32_MAX) if (m_graphicsQueueFamilyIndex == UINT32_MAX)
Log.report(LogVisor::FatalError, Log.report(logvisor::Fatal,
"VulkanContext::m_graphicsQueueFamilyIndex hasn't been initialized"); "VulkanContext::m_graphicsQueueFamilyIndex hasn't been initialized");
/* create the device */ /* create the device */
@ -909,7 +909,7 @@ class VulkanTextureS : public ITextureS
pxPitchDenom = 2; pxPitchDenom = 2;
break; break;
default: default:
Log.report(LogVisor::FatalError, "unsupported tex format"); Log.report(logvisor::Fatal, "unsupported tex format");
} }
m_vkFmt = pfmt; m_vkFmt = pfmt;
@ -1145,7 +1145,7 @@ class VulkanTextureSA : public ITextureSA
pfmt = VK_FORMAT_R8_UNORM; pfmt = VK_FORMAT_R8_UNORM;
break; break;
default: default:
Log.report(LogVisor::FatalError, "unsupported tex format"); Log.report(logvisor::Fatal, "unsupported tex format");
} }
m_vkFmt = pfmt; m_vkFmt = pfmt;
@ -1371,7 +1371,7 @@ class VulkanTextureD : public ITextureD
m_cpuSz = m_srcRowPitch * height; m_cpuSz = m_srcRowPitch * height;
break; break;
default: default:
Log.report(LogVisor::FatalError, "unsupported tex format"); Log.report(logvisor::Fatal, "unsupported tex format");
} }
m_cpuBuf.reset(new uint8_t[m_cpuSz]); m_cpuBuf.reset(new uint8_t[m_cpuSz]);
@ -2190,7 +2190,7 @@ struct VulkanShaderDataBinding : IShaderDataBinding
{ {
#ifndef NDEBUG #ifndef NDEBUG
if (!m_committed) if (!m_committed)
Log.report(LogVisor::FatalError, Log.report(logvisor::Fatal,
"attempted to use uncommitted VulkanShaderDataBinding"); "attempted to use uncommitted VulkanShaderDataBinding");
#endif #endif
@ -2878,7 +2878,7 @@ IShaderPipeline* VulkanDataFactory::newShaderPipeline
vs.setStrings(&vertSource, 1); vs.setStrings(&vertSource, 1);
if (!vs.parse(&DefaultBuiltInResource, 110, false, messages)) if (!vs.parse(&DefaultBuiltInResource, 110, false, messages))
{ {
Log.report(LogVisor::FatalError, "unable to compile vertex shader\n%s", vs.getInfoLog()); Log.report(logvisor::Fatal, "unable to compile vertex shader\n%s", vs.getInfoLog());
return nullptr; return nullptr;
} }
@ -2886,7 +2886,7 @@ IShaderPipeline* VulkanDataFactory::newShaderPipeline
fs.setStrings(&fragSource, 1); fs.setStrings(&fragSource, 1);
if (!fs.parse(&DefaultBuiltInResource, 110, false, messages)) if (!fs.parse(&DefaultBuiltInResource, 110, false, messages))
{ {
Log.report(LogVisor::FatalError, "unable to compile fragment shader\n%s", fs.getInfoLog()); Log.report(logvisor::Fatal, "unable to compile fragment shader\n%s", fs.getInfoLog());
return nullptr; return nullptr;
} }
@ -2895,7 +2895,7 @@ IShaderPipeline* VulkanDataFactory::newShaderPipeline
prog.addShader(&fs); prog.addShader(&fs);
if (!prog.link(messages)) if (!prog.link(messages))
{ {
Log.report(LogVisor::FatalError, "unable to link shader program\n%s", prog.getInfoLog()); Log.report(logvisor::Fatal, "unable to link shader program\n%s", prog.getInfoLog());
return nullptr; return nullptr;
} }
glslang::GlslangToSpv(*prog.getIntermediate(EShLangVertex), vertBlobOut); glslang::GlslangToSpv(*prog.getIntermediate(EShLangVertex), vertBlobOut);

View File

@ -16,7 +16,7 @@
#include "boo/IApplication.hpp" #include "boo/IApplication.hpp"
#include "boo/inputdev/DeviceFinder.hpp" #include "boo/inputdev/DeviceFinder.hpp"
#include "boo/graphicsdev/D3D.hpp" #include "boo/graphicsdev/D3D.hpp"
#include <LogVisor/LogVisor.hpp> #include "logvisor/logvisor.hpp"
DWORD g_mainThreadId = 0; DWORD g_mainThreadId = 0;
@ -57,7 +57,7 @@ static bool FindBestD3DCompile()
namespace boo namespace boo
{ {
static LogVisor::LogModule Log("boo::ApplicationWin32"); static logvisor::Module Log("boo::ApplicationWin32");
Win32Cursors WIN32_CURSORS; Win32Cursors WIN32_CURSORS;
IWindow* _WindowWin32New(const SystemString& title, Boo3DAppContext& d3dCtx, uint32_t sampleCount); IWindow* _WindowWin32New(const SystemString& title, Boo3DAppContext& d3dCtx, uint32_t sampleCount);
@ -96,12 +96,12 @@ public:
{ {
HMODULE dxgilib = LoadLibraryW(L"dxgi.dll"); HMODULE dxgilib = LoadLibraryW(L"dxgi.dll");
if (!dxgilib) if (!dxgilib)
Log.report(LogVisor::FatalError, "unable to load dxgi.dll"); Log.report(logvisor::Fatal, "unable to load dxgi.dll");
typedef HRESULT(WINAPI*CreateDXGIFactory1PROC)(REFIID riid, _COM_Outptr_ void **ppFactory); typedef HRESULT(WINAPI*CreateDXGIFactory1PROC)(REFIID riid, _COM_Outptr_ void **ppFactory);
CreateDXGIFactory1PROC MyCreateDXGIFactory1 = (CreateDXGIFactory1PROC)GetProcAddress(dxgilib, "CreateDXGIFactory1"); CreateDXGIFactory1PROC MyCreateDXGIFactory1 = (CreateDXGIFactory1PROC)GetProcAddress(dxgilib, "CreateDXGIFactory1");
if (!MyCreateDXGIFactory1) if (!MyCreateDXGIFactory1)
Log.report(LogVisor::FatalError, "unable to find CreateDXGIFactory1 in DXGI.dll\n"); Log.report(logvisor::Fatal, "unable to find CreateDXGIFactory1 in DXGI.dll\n");
bool no12 = false; bool no12 = false;
bool noD3d = false; bool noD3d = false;
@ -129,7 +129,7 @@ public:
} }
#endif #endif
if (!FindBestD3DCompile()) if (!FindBestD3DCompile())
Log.report(LogVisor::FatalError, "unable to find D3DCompile_[43-47].dll"); Log.report(logvisor::Fatal, "unable to find D3DCompile_[43-47].dll");
D3D12SerializeRootSignaturePROC = D3D12SerializeRootSignaturePROC =
(PFN_D3D12_SERIALIZE_ROOT_SIGNATURE)GetProcAddress(d3d12lib, "D3D12SerializeRootSignature"); (PFN_D3D12_SERIALIZE_ROOT_SIGNATURE)GetProcAddress(d3d12lib, "D3D12SerializeRootSignature");
@ -137,22 +137,22 @@ public:
/* Create device */ /* Create device */
PFN_D3D12_CREATE_DEVICE MyD3D12CreateDevice = (PFN_D3D12_CREATE_DEVICE)GetProcAddress(d3d12lib, "D3D12CreateDevice"); PFN_D3D12_CREATE_DEVICE MyD3D12CreateDevice = (PFN_D3D12_CREATE_DEVICE)GetProcAddress(d3d12lib, "D3D12CreateDevice");
if (!MyD3D12CreateDevice) if (!MyD3D12CreateDevice)
Log.report(LogVisor::FatalError, "unable to find D3D12CreateDevice in D3D12.dll"); Log.report(logvisor::Fatal, "unable to find D3D12CreateDevice in D3D12.dll");
/* Create device */ /* Create device */
HRESULT hr = MyD3D12CreateDevice(nullptr, D3D_FEATURE_LEVEL_11_0, __uuidof(ID3D12Device), &m_3dCtx.m_ctx12.m_dev); HRESULT hr = MyD3D12CreateDevice(nullptr, D3D_FEATURE_LEVEL_11_0, __uuidof(ID3D12Device), &m_3dCtx.m_ctx12.m_dev);
if (FAILED(hr)) if (FAILED(hr))
Log.report(LogVisor::FatalError, "unable to create D3D12 device"); Log.report(logvisor::Fatal, "unable to create D3D12 device");
/* Obtain DXGI Factory */ /* Obtain DXGI Factory */
hr = MyCreateDXGIFactory1(__uuidof(IDXGIFactory2), &m_3dCtx.m_ctx12.m_dxFactory); hr = MyCreateDXGIFactory1(__uuidof(IDXGIFactory2), &m_3dCtx.m_ctx12.m_dxFactory);
if (FAILED(hr)) if (FAILED(hr))
Log.report(LogVisor::FatalError, "unable to create DXGI factory"); Log.report(logvisor::Fatal, "unable to create DXGI factory");
/* Establish loader objects */ /* Establish loader objects */
if (FAILED(m_3dCtx.m_ctx12.m_dev->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT, if (FAILED(m_3dCtx.m_ctx12.m_dev->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT,
__uuidof(ID3D12CommandAllocator), &m_3dCtx.m_ctx12.m_loadqalloc))) __uuidof(ID3D12CommandAllocator), &m_3dCtx.m_ctx12.m_loadqalloc)))
Log.report(LogVisor::FatalError, "unable to create loader allocator"); Log.report(logvisor::Fatal, "unable to create loader allocator");
D3D12_COMMAND_QUEUE_DESC desc = D3D12_COMMAND_QUEUE_DESC desc =
{ {
@ -161,18 +161,18 @@ public:
D3D12_COMMAND_QUEUE_FLAG_NONE D3D12_COMMAND_QUEUE_FLAG_NONE
}; };
if (FAILED(m_3dCtx.m_ctx12.m_dev->CreateCommandQueue(&desc, __uuidof(ID3D12CommandQueue), &m_3dCtx.m_ctx12.m_loadq))) if (FAILED(m_3dCtx.m_ctx12.m_dev->CreateCommandQueue(&desc, __uuidof(ID3D12CommandQueue), &m_3dCtx.m_ctx12.m_loadq)))
Log.report(LogVisor::FatalError, "unable to create loader queue"); Log.report(logvisor::Fatal, "unable to create loader queue");
if (FAILED(m_3dCtx.m_ctx12.m_dev->CreateFence(0, D3D12_FENCE_FLAG_NONE, __uuidof(ID3D12Fence), &m_3dCtx.m_ctx12.m_loadfence))) if (FAILED(m_3dCtx.m_ctx12.m_dev->CreateFence(0, D3D12_FENCE_FLAG_NONE, __uuidof(ID3D12Fence), &m_3dCtx.m_ctx12.m_loadfence)))
Log.report(LogVisor::FatalError, "unable to create loader fence"); Log.report(logvisor::Fatal, "unable to create loader fence");
m_3dCtx.m_ctx12.m_loadfencehandle = CreateEvent(nullptr, FALSE, FALSE, nullptr); m_3dCtx.m_ctx12.m_loadfencehandle = CreateEvent(nullptr, FALSE, FALSE, nullptr);
if (FAILED(m_3dCtx.m_ctx12.m_dev->CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_DIRECT, m_3dCtx.m_ctx12.m_loadqalloc.Get(), if (FAILED(m_3dCtx.m_ctx12.m_dev->CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_DIRECT, m_3dCtx.m_ctx12.m_loadqalloc.Get(),
nullptr, __uuidof(ID3D12GraphicsCommandList), &m_3dCtx.m_ctx12.m_loadlist))) nullptr, __uuidof(ID3D12GraphicsCommandList), &m_3dCtx.m_ctx12.m_loadlist)))
Log.report(LogVisor::FatalError, "unable to create loader list"); Log.report(logvisor::Fatal, "unable to create loader list");
Log.report(LogVisor::Info, "initialized D3D12 renderer"); Log.report(logvisor::Info, "initialized D3D12 renderer");
return; return;
} }
#endif #endif
@ -180,12 +180,12 @@ public:
if (d3d11lib && !noD3d) if (d3d11lib && !noD3d)
{ {
if (!FindBestD3DCompile()) if (!FindBestD3DCompile())
Log.report(LogVisor::FatalError, "unable to find D3DCompile_[43-47].dll"); Log.report(logvisor::Fatal, "unable to find D3DCompile_[43-47].dll");
/* Create device proc */ /* Create device proc */
PFN_D3D11_CREATE_DEVICE MyD3D11CreateDevice = (PFN_D3D11_CREATE_DEVICE)GetProcAddress(d3d11lib, "D3D11CreateDevice"); PFN_D3D11_CREATE_DEVICE MyD3D11CreateDevice = (PFN_D3D11_CREATE_DEVICE)GetProcAddress(d3d11lib, "D3D11CreateDevice");
if (!MyD3D11CreateDevice) if (!MyD3D11CreateDevice)
Log.report(LogVisor::FatalError, "unable to find D3D11CreateDevice in D3D11.dll"); Log.report(logvisor::Fatal, "unable to find D3D11CreateDevice in D3D11.dll");
/* Create device */ /* Create device */
D3D_FEATURE_LEVEL level = D3D_FEATURE_LEVEL_11_0; D3D_FEATURE_LEVEL level = D3D_FEATURE_LEVEL_11_0;
@ -193,7 +193,7 @@ public:
ComPtr<ID3D11DeviceContext> tempCtx; ComPtr<ID3D11DeviceContext> tempCtx;
if (FAILED(MyD3D11CreateDevice(nullptr, D3D_DRIVER_TYPE_HARDWARE, nullptr, D3D11_CREATE_DEVICE_FLAGS, &level, if (FAILED(MyD3D11CreateDevice(nullptr, D3D_DRIVER_TYPE_HARDWARE, nullptr, D3D11_CREATE_DEVICE_FLAGS, &level,
1, D3D11_SDK_VERSION, &tempDev, nullptr, &tempCtx))) 1, D3D11_SDK_VERSION, &tempDev, nullptr, &tempCtx)))
Log.report(LogVisor::FatalError, "unable to create D3D11 device"); Log.report(logvisor::Fatal, "unable to create D3D11 device");
tempDev.As<ID3D11Device1>(&m_3dCtx.m_ctx11.m_dev); tempDev.As<ID3D11Device1>(&m_3dCtx.m_ctx11.m_dev);
tempCtx.As<ID3D11DeviceContext1>(&m_3dCtx.m_ctx11.m_devCtx); tempCtx.As<ID3D11DeviceContext1>(&m_3dCtx.m_ctx11.m_devCtx);
@ -211,7 +211,7 @@ public:
sampDesc.AddressW = D3D11_TEXTURE_ADDRESS_WRAP; sampDesc.AddressW = D3D11_TEXTURE_ADDRESS_WRAP;
m_3dCtx.m_ctx11.m_dev->CreateSamplerState(&sampDesc, &m_3dCtx.m_ctx11.m_ss); m_3dCtx.m_ctx11.m_dev->CreateSamplerState(&sampDesc, &m_3dCtx.m_ctx11.m_ss);
Log.report(LogVisor::Info, "initialized D3D11 renderer"); Log.report(logvisor::Info, "initialized D3D11 renderer");
return; return;
} }
@ -220,13 +220,13 @@ public:
/* Obtain DXGI Factory */ /* Obtain DXGI Factory */
HRESULT hr = MyCreateDXGIFactory1(__uuidof(IDXGIFactory1), &m_3dCtx.m_ctxOgl.m_dxFactory); HRESULT hr = MyCreateDXGIFactory1(__uuidof(IDXGIFactory1), &m_3dCtx.m_ctxOgl.m_dxFactory);
if (FAILED(hr)) if (FAILED(hr))
Log.report(LogVisor::FatalError, "unable to create DXGI factory"); Log.report(logvisor::Fatal, "unable to create DXGI factory");
Log.report(LogVisor::Info, "initialized OpenGL renderer"); Log.report(logvisor::Info, "initialized OpenGL renderer");
return; return;
} }
Log.report(LogVisor::FatalError, "system doesn't support OGL, D3D11 or D3D12"); Log.report(logvisor::Fatal, "system doesn't support OGL, D3D11 or D3D12");
} }
EPlatformType getPlatformType() const EPlatformType getPlatformType() const
@ -365,7 +365,7 @@ public:
{ {
std::unique_lock<std::mutex> lk(m_nwmt); std::unique_lock<std::mutex> lk(m_nwmt);
if (!PostThreadMessage(g_mainThreadId, WM_USER, WPARAM(&title), 0)) if (!PostThreadMessage(g_mainThreadId, WM_USER, WPARAM(&title), 0))
Log.report(LogVisor::FatalError, "PostThreadMessage error"); Log.report(logvisor::Fatal, "PostThreadMessage error");
m_nwcv.wait(lk); m_nwcv.wait(lk);
return m_mwret; return m_mwret;
} }

View File

@ -2,7 +2,7 @@
#include <Windowsx.h> #include <Windowsx.h>
#include "boo/IWindow.hpp" #include "boo/IWindow.hpp"
#include "boo/IGraphicsContext.hpp" #include "boo/IGraphicsContext.hpp"
#include <LogVisor/LogVisor.hpp> #include "logvisor/logvisor.hpp"
#include "boo/graphicsdev/D3D.hpp" #include "boo/graphicsdev/D3D.hpp"
#include "boo/graphicsdev/GL.hpp" #include "boo/graphicsdev/GL.hpp"
@ -21,7 +21,7 @@ static const int ContextAttribs[] =
namespace boo namespace boo
{ {
static LogVisor::LogModule Log("boo::WindowWin32"); static logvisor::Module Log("boo::WindowWin32");
#if _WIN32_WINNT_WIN10 #if _WIN32_WINNT_WIN10
IGraphicsCommandQueue* _NewD3D12CommandQueue(D3D12Context* ctx, D3D12Context::Window* windowCtx, IGraphicsContext* parent, IGraphicsCommandQueue* _NewD3D12CommandQueue(D3D12Context* ctx, D3D12Context::Window* windowCtx, IGraphicsContext* parent,
ID3D12CommandQueue** cmdQueueOut); ID3D12CommandQueue** cmdQueueOut);
@ -82,7 +82,7 @@ public:
HRESULT hr = b3dCtx.m_ctx12.m_dxFactory->CreateSwapChainForHwnd(cmdQueue, HRESULT hr = b3dCtx.m_ctx12.m_dxFactory->CreateSwapChainForHwnd(cmdQueue,
hwnd, &scDesc, nullptr, nullptr, &m_swapChain); hwnd, &scDesc, nullptr, nullptr, &m_swapChain);
if (FAILED(hr)) if (FAILED(hr))
Log.report(LogVisor::FatalError, "unable to create swap chain"); Log.report(logvisor::Fatal, "unable to create swap chain");
b3dCtx.m_ctx12.m_dxFactory->MakeWindowAssociation(hwnd, DXGI_MWA_NO_ALT_ENTER); b3dCtx.m_ctx12.m_dxFactory->MakeWindowAssociation(hwnd, DXGI_MWA_NO_ALT_ENTER);
m_swapChain.As<IDXGISwapChain3>(&w.m_swapChain); m_swapChain.As<IDXGISwapChain3>(&w.m_swapChain);
@ -94,14 +94,14 @@ public:
w.height = resDesc.Height; w.height = resDesc.Height;
if (FAILED(m_swapChain->GetContainingOutput(&m_output))) if (FAILED(m_swapChain->GetContainingOutput(&m_output)))
Log.report(LogVisor::FatalError, "unable to get DXGI output"); Log.report(logvisor::Fatal, "unable to get DXGI output");
} }
else else
#endif #endif
{ {
if (FAILED(b3dCtx.m_ctx11.m_dxFactory->CreateSwapChainForHwnd(b3dCtx.m_ctx11.m_dev.Get(), if (FAILED(b3dCtx.m_ctx11.m_dxFactory->CreateSwapChainForHwnd(b3dCtx.m_ctx11.m_dev.Get(),
hwnd, &scDesc, nullptr, nullptr, &m_swapChain))) hwnd, &scDesc, nullptr, nullptr, &m_swapChain)))
Log.report(LogVisor::FatalError, "unable to create swap chain"); Log.report(logvisor::Fatal, "unable to create swap chain");
b3dCtx.m_ctx11.m_dxFactory->MakeWindowAssociation(hwnd, DXGI_MWA_NO_ALT_ENTER); b3dCtx.m_ctx11.m_dxFactory->MakeWindowAssociation(hwnd, DXGI_MWA_NO_ALT_ENTER);
auto insIt = b3dCtx.m_ctx11.m_windows.emplace(std::make_pair(parentWindow, D3D11Context::Window())); auto insIt = b3dCtx.m_ctx11.m_windows.emplace(std::make_pair(parentWindow, D3D11Context::Window()));
@ -118,7 +118,7 @@ public:
m_commandQueue = _NewD3D11CommandQueue(&b3dCtx.m_ctx11, &insIt.first->second, this); m_commandQueue = _NewD3D11CommandQueue(&b3dCtx.m_ctx11, &insIt.first->second, this);
if (FAILED(m_swapChain->GetContainingOutput(&m_output))) if (FAILED(m_swapChain->GetContainingOutput(&m_output)))
Log.report(LogVisor::FatalError, "unable to get DXGI output"); Log.report(logvisor::Fatal, "unable to get DXGI output");
} }
} }
@ -221,14 +221,14 @@ public:
} }
if (!m_output) if (!m_output)
Log.report(LogVisor::FatalError, "unable to find window's IDXGIOutput"); Log.report(logvisor::Fatal, "unable to find window's IDXGIOutput");
auto insIt = b3dCtx.m_ctxOgl.m_windows.emplace(std::make_pair(parentWindow, OGLContext::Window())); auto insIt = b3dCtx.m_ctxOgl.m_windows.emplace(std::make_pair(parentWindow, OGLContext::Window()));
OGLContext::Window& w = insIt.first->second; OGLContext::Window& w = insIt.first->second;
w.m_hwnd = hwnd; w.m_hwnd = hwnd;
w.m_deviceContext = GetDC(hwnd); w.m_deviceContext = GetDC(hwnd);
if (!w.m_deviceContext) if (!w.m_deviceContext)
Log.report(LogVisor::FatalError, "unable to create window's device context"); Log.report(logvisor::Fatal, "unable to create window's device context");
if (!m_3dCtx.m_ctxOgl.m_lastContext) if (!m_3dCtx.m_ctxOgl.m_lastContext)
{ {
@ -258,10 +258,10 @@ public:
w.m_mainContext = wglCreateContext(w.m_deviceContext); w.m_mainContext = wglCreateContext(w.m_deviceContext);
if (!w.m_mainContext) if (!w.m_mainContext)
Log.report(LogVisor::FatalError, "unable to create window's main context"); Log.report(logvisor::Fatal, "unable to create window's main context");
if (m_3dCtx.m_ctxOgl.m_lastContext) if (m_3dCtx.m_ctxOgl.m_lastContext)
if (!wglShareLists(w.m_mainContext, m_3dCtx.m_ctxOgl.m_lastContext)) if (!wglShareLists(w.m_mainContext, m_3dCtx.m_ctxOgl.m_lastContext))
Log.report(LogVisor::FatalError, "unable to share contexts"); Log.report(logvisor::Fatal, "unable to share contexts");
m_3dCtx.m_ctxOgl.m_lastContext = w.m_mainContext; m_3dCtx.m_ctxOgl.m_lastContext = w.m_mainContext;
m_dataFactory = new GLDataFactory(this, sampleCount); m_dataFactory = new GLDataFactory(this, sampleCount);
@ -301,7 +301,7 @@ public:
{ {
OGLContext::Window& w = m_3dCtx.m_ctxOgl.m_windows[m_parentWindow]; OGLContext::Window& w = m_3dCtx.m_ctxOgl.m_windows[m_parentWindow];
if (!wglMakeCurrent(w.m_deviceContext, w.m_mainContext)) if (!wglMakeCurrent(w.m_deviceContext, w.m_mainContext))
Log.report(LogVisor::FatalError, "unable to make WGL context current"); Log.report(logvisor::Fatal, "unable to make WGL context current");
} }
void postInit() void postInit()
@ -312,12 +312,12 @@ public:
wglGetProcAddress("wglCreateContextAttribsARB"); wglGetProcAddress("wglCreateContextAttribsARB");
w.m_renderContext = wglCreateContextAttribsARB(w.m_deviceContext, w.m_mainContext, ContextAttribs); w.m_renderContext = wglCreateContextAttribsARB(w.m_deviceContext, w.m_mainContext, ContextAttribs);
if (!w.m_renderContext) if (!w.m_renderContext)
Log.report(LogVisor::FatalError, "unable to make new WGL context"); Log.report(logvisor::Fatal, "unable to make new WGL context");
if (!wglMakeCurrent(w.m_deviceContext, w.m_renderContext)) if (!wglMakeCurrent(w.m_deviceContext, w.m_renderContext))
Log.report(LogVisor::FatalError, "unable to make WGL context current"); Log.report(logvisor::Fatal, "unable to make WGL context current");
if (!WGLEW_EXT_swap_control) if (!WGLEW_EXT_swap_control)
Log.report(LogVisor::FatalError, "WGL_EXT_swap_control not available"); Log.report(logvisor::Fatal, "WGL_EXT_swap_control not available");
wglSwapIntervalEXT(1); wglSwapIntervalEXT(1);
} }
@ -346,10 +346,10 @@ public:
{ {
m_mainCtx = wglCreateContextAttribsARB(w.m_deviceContext, w.m_mainContext, ContextAttribs); m_mainCtx = wglCreateContextAttribsARB(w.m_deviceContext, w.m_mainContext, ContextAttribs);
if (!m_mainCtx) if (!m_mainCtx)
Log.report(LogVisor::FatalError, "unable to make main WGL context"); Log.report(logvisor::Fatal, "unable to make main WGL context");
} }
if (!wglMakeCurrent(w.m_deviceContext, m_mainCtx)) if (!wglMakeCurrent(w.m_deviceContext, m_mainCtx))
Log.report(LogVisor::FatalError, "unable to make main WGL context current"); Log.report(logvisor::Fatal, "unable to make main WGL context current");
return m_dataFactory; return m_dataFactory;
} }
@ -362,10 +362,10 @@ public:
{ {
m_loadCtx = wglCreateContextAttribsARB(w.m_deviceContext, w.m_mainContext, ContextAttribs); m_loadCtx = wglCreateContextAttribsARB(w.m_deviceContext, w.m_mainContext, ContextAttribs);
if (!m_loadCtx) if (!m_loadCtx)
Log.report(LogVisor::FatalError, "unable to make load WGL context"); Log.report(logvisor::Fatal, "unable to make load WGL context");
} }
if (!wglMakeCurrent(w.m_deviceContext, m_loadCtx)) if (!wglMakeCurrent(w.m_deviceContext, m_loadCtx))
Log.report(LogVisor::FatalError, "unable to make load WGL context current"); Log.report(logvisor::Fatal, "unable to make load WGL context current");
return m_dataFactory; return m_dataFactory;
} }
}; };
@ -581,7 +581,7 @@ static HGLOBAL MakeUnicodeCRLF(const char* data, size_t sz)
int32_t ch; int32_t ch;
int chSz = utf8proc_iterate(reinterpret_cast<const uint8_t*>(data+i), -1, &ch); int chSz = utf8proc_iterate(reinterpret_cast<const uint8_t*>(data+i), -1, &ch);
if (chSz < 0) if (chSz < 0)
Log.report(LogVisor::FatalError, "invalid UTF-8 char"); Log.report(logvisor::Fatal, "invalid UTF-8 char");
if (ch <= 0xffff) if (ch <= 0xffff)
{ {
if (ch == '\n' && lastCh != '\r') if (ch == '\n' && lastCh != '\r')
@ -855,7 +855,7 @@ public:
if (GetCurrentThreadId() != g_mainThreadId) if (GetCurrentThreadId() != g_mainThreadId)
{ {
if (!PostThreadMessage(g_mainThreadId, WM_USER+3, WPARAM(m_imc), LPARAM(open))) if (!PostThreadMessage(g_mainThreadId, WM_USER+3, WPARAM(m_imc), LPARAM(open)))
Log.report(LogVisor::FatalError, "PostThreadMessage error"); Log.report(logvisor::Fatal, "PostThreadMessage error");
return; return;
} }
ImmSetOpenStatus(m_imc, open); ImmSetOpenStatus(m_imc, open);
@ -872,7 +872,7 @@ public:
if (GetCurrentThreadId() != g_mainThreadId) if (GetCurrentThreadId() != g_mainThreadId)
{ {
if (!PostThreadMessage(g_mainThreadId, WM_USER+4, WPARAM(m_imc), LPARAM(&m_cForm))) if (!PostThreadMessage(g_mainThreadId, WM_USER+4, WPARAM(m_imc), LPARAM(&m_cForm)))
Log.report(LogVisor::FatalError, "PostThreadMessage error"); Log.report(logvisor::Fatal, "PostThreadMessage error");
return; return;
} }
ImmSetCompositionWindow(m_imc, &m_cForm); ImmSetCompositionWindow(m_imc, &m_cForm);

View File

@ -14,7 +14,7 @@
#include <dbus/dbus.h> #include <dbus/dbus.h>
DBusConnection* RegisterDBus(const char* appName, bool& isFirst); DBusConnection* RegisterDBus(const char* appName, bool& isFirst);
#include <LogVisor/LogVisor.hpp> #include "logvisor/logvisor.hpp"
#include <signal.h> #include <signal.h>
#include <sys/param.h> #include <sys/param.h>
@ -31,7 +31,7 @@ DBusConnection* RegisterDBus(const char* appName, bool& isFirst);
namespace boo namespace boo
{ {
static LogVisor::LogModule Log("boo::ApplicationXlib"); static logvisor::Module Log("boo::ApplicationXlib");
XlibCursors X_CURSORS; XlibCursors X_CURSORS;
int XINPUT_OPCODE = 0; int XINPUT_OPCODE = 0;
@ -245,13 +245,13 @@ public:
if (!XInitThreads()) if (!XInitThreads())
{ {
Log.report(LogVisor::FatalError, "X doesn't support multithreading"); Log.report(logvisor::Fatal, "X doesn't support multithreading");
return; return;
} }
if (setlocale(LC_ALL, "") == nullptr) if (setlocale(LC_ALL, "") == nullptr)
{ {
Log.report(LogVisor::FatalError, "Can't setlocale"); Log.report(logvisor::Fatal, "Can't setlocale");
return; return;
} }
@ -259,7 +259,7 @@ public:
m_xDisp = XOpenDisplay(0); m_xDisp = XOpenDisplay(0);
if (!m_xDisp) if (!m_xDisp)
{ {
Log.report(LogVisor::FatalError, "Can't open X display"); Log.report(logvisor::Fatal, "Can't open X display");
return; return;
} }
@ -268,19 +268,19 @@ public:
m_xcbConn = XGetXCBConnection(m_xDisp); m_xcbConn = XGetXCBConnection(m_xDisp);
if (!m_xcbConn) if (!m_xcbConn)
{ {
Log.report(LogVisor::FatalError, "Can't cast Display to XCB connection for Vulkan"); Log.report(logvisor::Fatal, "Can't cast Display to XCB connection for Vulkan");
return; return;
} }
#endif #endif
/* Configure locale */ /* Configure locale */
if (!XSupportsLocale()) { if (!XSupportsLocale()) {
Log.report(LogVisor::FatalError, "X does not support locale %s.", Log.report(logvisor::Fatal, "X does not support locale %s.",
setlocale(LC_ALL, nullptr)); setlocale(LC_ALL, nullptr));
return; return;
} }
if (XSetLocaleModifiers("") == nullptr) if (XSetLocaleModifiers("") == nullptr)
Log.report(LogVisor::Warning, "Cannot set locale modifiers."); Log.report(logvisor::Warning, "Cannot set locale modifiers.");
if ((m_xIM = XOpenIM(m_xDisp, nullptr, nullptr, nullptr))) if ((m_xIM = XOpenIM(m_xDisp, nullptr, nullptr, nullptr)))
{ {
@ -313,7 +313,7 @@ public:
/* if we couldn't support any of them, print an error and exit */ /* if we couldn't support any of them, print an error and exit */
if (m_bestStyle == 0) if (m_bestStyle == 0)
{ {
Log.report(LogVisor::FatalError, "interaction style not supported."); Log.report(logvisor::Fatal, "interaction style not supported.");
return; return;
} }
XFree(im_supported_styles); XFree(im_supported_styles);

View File

@ -27,7 +27,7 @@
#include <X11/XKBlib.h> #include <X11/XKBlib.h>
#include <X11/extensions/XInput2.h> #include <X11/extensions/XInput2.h>
#include <X11/Xatom.h> #include <X11/Xatom.h>
#include <LogVisor/LogVisor.hpp> #include "logvisor/logvisor.hpp"
#include "XlibCommon.hpp" #include "XlibCommon.hpp"
@ -111,7 +111,7 @@ const size_t MAINICON_NETWM_SZ __attribute__ ((weak)) = 0;
namespace boo namespace boo
{ {
static LogVisor::LogModule Log("boo::WindowXlib"); static logvisor::Module Log("boo::WindowXlib");
IGraphicsCommandQueue* _NewGLCommandQueue(IGraphicsContext* parent); IGraphicsCommandQueue* _NewGLCommandQueue(IGraphicsContext* parent);
#if BOO_HAS_VULKAN #if BOO_HAS_VULKAN
IGraphicsCommandQueue* _NewVulkanCommandQueue(VulkanContext* ctx, IGraphicsCommandQueue* _NewVulkanCommandQueue(VulkanContext* ctx,
@ -332,7 +332,7 @@ public:
fbConfigs = glXGetFBConfigs(display, defaultScreen, &numFBConfigs); fbConfigs = glXGetFBConfigs(display, defaultScreen, &numFBConfigs);
if (!fbConfigs || numFBConfigs == 0) if (!fbConfigs || numFBConfigs == 0)
{ {
Log.report(LogVisor::FatalError, "glXGetFBConfigs failed"); Log.report(logvisor::Fatal, "glXGetFBConfigs failed");
return; return;
} }
@ -378,7 +378,7 @@ public:
if (!m_fbconfig) if (!m_fbconfig)
{ {
Log.report(LogVisor::FatalError, "unable to find suitable pixel format"); Log.report(logvisor::Fatal, "unable to find suitable pixel format");
return; return;
} }
@ -440,14 +440,14 @@ public:
glXCreateContextAttribsARB = (glXCreateContextAttribsARBProc) glXCreateContextAttribsARB = (glXCreateContextAttribsARBProc)
glXGetProcAddressARB((const GLubyte*)"glXCreateContextAttribsARB"); glXGetProcAddressARB((const GLubyte*)"glXCreateContextAttribsARB");
if (!glXCreateContextAttribsARB) if (!glXCreateContextAttribsARB)
Log.report(LogVisor::FatalError, "unable to resolve glXCreateContextAttribsARB"); Log.report(logvisor::Fatal, "unable to resolve glXCreateContextAttribsARB");
} }
if (!glXWaitVideoSyncSGI) if (!glXWaitVideoSyncSGI)
{ {
glXWaitVideoSyncSGI = (glXWaitVideoSyncSGIProc) glXWaitVideoSyncSGI = (glXWaitVideoSyncSGIProc)
glXGetProcAddressARB((const GLubyte*)"glXWaitVideoSyncSGI"); glXGetProcAddressARB((const GLubyte*)"glXWaitVideoSyncSGI");
if (!glXWaitVideoSyncSGI) if (!glXWaitVideoSyncSGI)
Log.report(LogVisor::FatalError, "unable to resolve glXWaitVideoSyncSGI"); Log.report(logvisor::Fatal, "unable to resolve glXWaitVideoSyncSGI");
} }
s_glxError = false; s_glxError = false;
@ -460,10 +460,10 @@ public:
} }
XSetErrorHandler(oldHandler); XSetErrorHandler(oldHandler);
if (!m_glxCtx) if (!m_glxCtx)
Log.report(LogVisor::FatalError, "unable to make new GLX context"); Log.report(logvisor::Fatal, "unable to make new GLX context");
m_glxWindow = glXCreateWindow(m_xDisp, m_fbconfig, m_parentWindow->getPlatformHandle(), nullptr); m_glxWindow = glXCreateWindow(m_xDisp, m_fbconfig, m_parentWindow->getPlatformHandle(), nullptr);
if (!m_glxWindow) if (!m_glxWindow)
Log.report(LogVisor::FatalError, "unable to make new GLX window"); Log.report(logvisor::Fatal, "unable to make new GLX window");
_XlibUpdateLastGlxCtx(m_glxCtx); _XlibUpdateLastGlxCtx(m_glxCtx);
/* Spawn vsync thread */ /* Spawn vsync thread */
@ -480,7 +480,7 @@ public:
vsyncDisp = XOpenDisplay(0); vsyncDisp = XOpenDisplay(0);
if (!vsyncDisp) if (!vsyncDisp)
Log.report(LogVisor::FatalError, "unable to open new vsync display"); Log.report(logvisor::Fatal, "unable to open new vsync display");
XLockDisplay(vsyncDisp); XLockDisplay(vsyncDisp);
static int attributeList[] = { GLX_RGBA, GLX_DOUBLEBUFFER, GLX_RED_SIZE, 1, GLX_GREEN_SIZE, 1, GLX_BLUE_SIZE, 1, 0 }; static int attributeList[] = { GLX_RGBA, GLX_DOUBLEBUFFER, GLX_RED_SIZE, 1, GLX_GREEN_SIZE, 1, GLX_BLUE_SIZE, 1, 0 };
@ -488,10 +488,10 @@ public:
vsyncCtx = glXCreateContext(vsyncDisp, vi, nullptr, True); vsyncCtx = glXCreateContext(vsyncDisp, vi, nullptr, True);
if (!vsyncCtx) if (!vsyncCtx)
Log.report(LogVisor::FatalError, "unable to make new vsync GLX context"); Log.report(logvisor::Fatal, "unable to make new vsync GLX context");
if (!glXMakeCurrent(vsyncDisp, DefaultRootWindow(vsyncDisp), vsyncCtx)) if (!glXMakeCurrent(vsyncDisp, DefaultRootWindow(vsyncDisp), vsyncCtx))
Log.report(LogVisor::FatalError, "unable to make vsync context current"); Log.report(logvisor::Fatal, "unable to make vsync context current");
} }
initcv.notify_one(); initcv.notify_one();
@ -500,7 +500,7 @@ public:
unsigned int sync; unsigned int sync;
int err = glXWaitVideoSyncSGI(1, 0, &sync); int err = glXWaitVideoSyncSGI(1, 0, &sync);
if (err) if (err)
Log.report(LogVisor::FatalError, "wait err"); Log.report(logvisor::Fatal, "wait err");
m_vsynccv.notify_one(); m_vsynccv.notify_one();
} }
@ -520,7 +520,7 @@ public:
{ {
XLockDisplay(m_xDisp); XLockDisplay(m_xDisp);
if (!glXMakeContextCurrent(m_xDisp, m_glxWindow, m_glxWindow, m_glxCtx)) if (!glXMakeContextCurrent(m_xDisp, m_glxWindow, m_glxWindow, m_glxCtx))
Log.report(LogVisor::FatalError, "unable to make GLX context current"); Log.report(logvisor::Fatal, "unable to make GLX context current");
XUnlockDisplay(m_xDisp); XUnlockDisplay(m_xDisp);
} }
@ -557,10 +557,10 @@ public:
} }
XSetErrorHandler(oldHandler); XSetErrorHandler(oldHandler);
if (!m_mainCtx) if (!m_mainCtx)
Log.report(LogVisor::FatalError, "unable to make main GLX context"); Log.report(logvisor::Fatal, "unable to make main GLX context");
} }
if (!glXMakeContextCurrent(m_xDisp, m_glxWindow, m_glxWindow, m_mainCtx)) if (!glXMakeContextCurrent(m_xDisp, m_glxWindow, m_glxWindow, m_mainCtx))
Log.report(LogVisor::FatalError, "unable to make main GLX context current"); Log.report(logvisor::Fatal, "unable to make main GLX context current");
XUnlockDisplay(m_xDisp); XUnlockDisplay(m_xDisp);
return getDataFactory(); return getDataFactory();
} }
@ -580,10 +580,10 @@ public:
} }
XSetErrorHandler(oldHandler); XSetErrorHandler(oldHandler);
if (!m_loadCtx) if (!m_loadCtx)
Log.report(LogVisor::FatalError, "unable to make load GLX context"); Log.report(logvisor::Fatal, "unable to make load GLX context");
} }
if (!glXMakeContextCurrent(m_xDisp, m_glxWindow, m_glxWindow, m_loadCtx)) if (!glXMakeContextCurrent(m_xDisp, m_glxWindow, m_glxWindow, m_loadCtx))
Log.report(LogVisor::FatalError, "unable to make load GLX context current"); Log.report(logvisor::Fatal, "unable to make load GLX context current");
XUnlockDisplay(m_xDisp); XUnlockDisplay(m_xDisp);
return getDataFactory(); return getDataFactory();
} }
@ -613,7 +613,7 @@ struct GraphicsContextXlibVulkan : GraphicsContextXlib
static void ThrowIfFailed(VkResult res) static void ThrowIfFailed(VkResult res)
{ {
if (res != VK_SUCCESS) if (res != VK_SUCCESS)
Log.report(LogVisor::FatalError, "%d\n", res); Log.report(logvisor::Fatal, "%d\n", res);
} }
public: public:
@ -631,7 +631,7 @@ public:
fbConfigs = glXGetFBConfigs(display, defaultScreen, &numFBConfigs); fbConfigs = glXGetFBConfigs(display, defaultScreen, &numFBConfigs);
if (!fbConfigs || numFBConfigs == 0) if (!fbConfigs || numFBConfigs == 0)
{ {
Log.report(LogVisor::FatalError, "glXGetFBConfigs failed"); Log.report(logvisor::Fatal, "glXGetFBConfigs failed");
return; return;
} }
@ -677,7 +677,7 @@ public:
if (!m_fbconfig) if (!m_fbconfig)
{ {
Log.report(LogVisor::FatalError, "unable to find suitable pixel format"); Log.report(logvisor::Fatal, "unable to find suitable pixel format");
return; return;
} }
@ -731,7 +731,7 @@ public:
glXWaitVideoSyncSGI = (glXWaitVideoSyncSGIProc) glXWaitVideoSyncSGI = (glXWaitVideoSyncSGIProc)
glXGetProcAddressARB((const GLubyte*)"glXWaitVideoSyncSGI"); glXGetProcAddressARB((const GLubyte*)"glXWaitVideoSyncSGI");
if (!glXWaitVideoSyncSGI) if (!glXWaitVideoSyncSGI)
Log.report(LogVisor::FatalError, "unable to resolve glXWaitVideoSyncSGI"); Log.report(logvisor::Fatal, "unable to resolve glXWaitVideoSyncSGI");
} }
if (m_ctx->m_instance == VK_NULL_HANDLE) if (m_ctx->m_instance == VK_NULL_HANDLE)
@ -772,7 +772,7 @@ public:
/* Generate error if could not find a queue that supports both a graphics /* Generate error if could not find a queue that supports both a graphics
* and present */ * and present */
if (m_ctx->m_graphicsQueueFamilyIndex == UINT32_MAX) if (m_ctx->m_graphicsQueueFamilyIndex == UINT32_MAX)
Log.report(LogVisor::FatalError, Log.report(logvisor::Fatal,
"Could not find a queue that supports both graphics and present"); "Could not find a queue that supports both graphics and present");
m_ctx->initDevice(); m_ctx->initDevice();
@ -781,13 +781,13 @@ public:
{ {
/* Subsequent window, verify present */ /* Subsequent window, verify present */
if (supportsPresent[m_ctx->m_graphicsQueueFamilyIndex] == VK_FALSE) if (supportsPresent[m_ctx->m_graphicsQueueFamilyIndex] == VK_FALSE)
Log.report(LogVisor::FatalError, "subsequent surface doesn't support present"); Log.report(logvisor::Fatal, "subsequent surface doesn't support present");
} }
free(supportsPresent); free(supportsPresent);
if (!vkGetPhysicalDeviceXcbPresentationSupportKHR(m_ctx->m_gpus[0], m_ctx->m_graphicsQueueFamilyIndex, m_xcbConn, m_visualid)) if (!vkGetPhysicalDeviceXcbPresentationSupportKHR(m_ctx->m_gpus[0], m_ctx->m_graphicsQueueFamilyIndex, m_xcbConn, m_visualid))
{ {
Log.report(LogVisor::FatalError, "XCB visual doesn't support vulkan present"); Log.report(logvisor::Fatal, "XCB visual doesn't support vulkan present");
return; return;
} }
@ -809,7 +809,7 @@ public:
m_format = surfFormats[0].format; m_format = surfFormats[0].format;
} }
else else
Log.report(LogVisor::FatalError, "no surface formats available for Vulkan swapchain"); Log.report(logvisor::Fatal, "no surface formats available for Vulkan swapchain");
m_ctx->initSwapChain(m_windowCtx, m_surface, m_format); m_ctx->initSwapChain(m_windowCtx, m_surface, m_format);
@ -827,7 +827,7 @@ public:
vsyncDisp = XOpenDisplay(0); vsyncDisp = XOpenDisplay(0);
if (!vsyncDisp) if (!vsyncDisp)
Log.report(LogVisor::FatalError, "unable to open new vsync display"); Log.report(logvisor::Fatal, "unable to open new vsync display");
XLockDisplay(vsyncDisp); XLockDisplay(vsyncDisp);
static int attributeList[] = { GLX_RGBA, GLX_DOUBLEBUFFER, GLX_RED_SIZE, 1, GLX_GREEN_SIZE, 1, GLX_BLUE_SIZE, 1, 0 }; static int attributeList[] = { GLX_RGBA, GLX_DOUBLEBUFFER, GLX_RED_SIZE, 1, GLX_GREEN_SIZE, 1, GLX_BLUE_SIZE, 1, 0 };
@ -835,10 +835,10 @@ public:
vsyncCtx = glXCreateContext(vsyncDisp, vi, nullptr, True); vsyncCtx = glXCreateContext(vsyncDisp, vi, nullptr, True);
if (!vsyncCtx) if (!vsyncCtx)
Log.report(LogVisor::FatalError, "unable to make new vsync GLX context"); Log.report(logvisor::Fatal, "unable to make new vsync GLX context");
if (!glXMakeCurrent(vsyncDisp, DefaultRootWindow(vsyncDisp), vsyncCtx)) if (!glXMakeCurrent(vsyncDisp, DefaultRootWindow(vsyncDisp), vsyncCtx))
Log.report(LogVisor::FatalError, "unable to make vsync context current"); Log.report(logvisor::Fatal, "unable to make vsync context current");
} }
initcv.notify_one(); initcv.notify_one();
@ -847,7 +847,7 @@ public:
unsigned int sync; unsigned int sync;
int err = glXWaitVideoSyncSGI(1, 0, &sync); int err = glXWaitVideoSyncSGI(1, 0, &sync);
if (err) if (err)
Log.report(LogVisor::FatalError, "wait err"); Log.report(logvisor::Fatal, "wait err");
m_vsynccv.notify_one(); m_vsynccv.notify_one();
} }
@ -1372,14 +1372,14 @@ public:
if (XGetWindowProperty(m_xDisp, m_windowId, S_ATOMS->m_clipdata, 0, 32, False, AnyPropertyType, if (XGetWindowProperty(m_xDisp, m_windowId, S_ATOMS->m_clipdata, 0, 32, False, AnyPropertyType,
&type, &format, &nitems, &rem, &data)) &type, &format, &nitems, &rem, &data))
{ {
Log.report(LogVisor::FatalError, "Clipboard allocation failed"); Log.report(logvisor::Fatal, "Clipboard allocation failed");
XUnlockDisplay(m_xDisp); XUnlockDisplay(m_xDisp);
return {}; return {};
} }
if (rem != 0) if (rem != 0)
{ {
Log.report(LogVisor::FatalError, "partial clipboard read"); Log.report(logvisor::Fatal, "partial clipboard read");
XUnlockDisplay(m_xDisp); XUnlockDisplay(m_xDisp);
return {}; return {};
} }

@ -1 +0,0 @@
Subproject commit 55b81ec091e9f0e57bd7d092a396916234b1ada5

1
logvisor Submodule

@ -0,0 +1 @@
Subproject commit db415516f6742bd3fe4d2616d478b232cc33ab34

View File

@ -1,2 +1,2 @@
add_executable(booTest WIN32 main.cpp) add_executable(booTest WIN32 main.cpp)
target_link_libraries(booTest Boo LogVisor ${BOO_SYS_LIBS}) target_link_libraries(booTest boo logvisor ${BOO_SYS_LIBS})

View File

@ -5,7 +5,7 @@
#include <thread> #include <thread>
#include <mutex> #include <mutex>
#include <condition_variable> #include <condition_variable>
#include <LogVisor/LogVisor.hpp> #include "logvisor/logvisor.hpp"
#if _WIN32 #if _WIN32
#include <boo/graphicsdev/D3D.hpp> #include <boo/graphicsdev/D3D.hpp>
@ -490,10 +490,10 @@ int wmain(int argc, const boo::SystemChar** argv)
int main(int argc, const boo::SystemChar** argv) int main(int argc, const boo::SystemChar** argv)
#endif #endif
{ {
LogVisor::RegisterConsoleLogger(); logvisor::RegisterConsoleLogger();
boo::TestApplicationCallback appCb; boo::TestApplicationCallback appCb;
int ret = ApplicationRun(boo::IApplication::EPlatformType::Auto, int ret = ApplicationRun(boo::IApplication::EPlatformType::Auto,
appCb, _S("boo"), _S("Boo"), argc, argv); appCb, _S("boo"), _S("boo"), argc, argv);
printf("IM DYING!!\n"); printf("IM DYING!!\n");
return ret; return ret;
} }
@ -510,7 +510,7 @@ int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE, LPWSTR lpCmdLine, int)
for (int i=0 ; i<argc ; ++i) for (int i=0 ; i<argc ; ++i)
booArgv[i+1] = argv[i]; booArgv[i+1] = argv[i];
LogVisor::CreateWin32Console(); logvisor::CreateWin32Console();
return wmain(argc+1, booArgv); return wmain(argc+1, booArgv);
} }
#endif #endif