mirror of https://github.com/AxioDL/boo.git
Merge pull request #17 from lioncash/override
General: Make use of override where applicable
This commit is contained in:
commit
5cff0c19bd
|
@ -15,11 +15,11 @@ struct DeferredWindowEvents : public IWindowCallback {
|
|||
DeferredWindowEvents(Receiver& rec) : m_rec(rec) {}
|
||||
|
||||
bool m_destroyed = false;
|
||||
void destroyed() { m_destroyed = true; }
|
||||
void destroyed() override { m_destroyed = true; }
|
||||
|
||||
bool m_hasResize = false;
|
||||
SWindowRect m_latestResize;
|
||||
void resized(const SWindowRect& rect, bool sync) {
|
||||
void resized(const SWindowRect& rect, bool sync) override {
|
||||
std::unique_lock<std::mutex> lk(m_mt);
|
||||
m_latestResize = rect;
|
||||
m_hasResize = true;
|
||||
|
@ -112,7 +112,7 @@ struct DeferredWindowEvents : public IWindowCallback {
|
|||
};
|
||||
std::vector<Command> m_cmds;
|
||||
|
||||
void mouseDown(const SWindowCoord& coord, EMouseButton button, EModifierKey mods) {
|
||||
void mouseDown(const SWindowCoord& coord, EMouseButton button, EModifierKey mods) override {
|
||||
std::unique_lock<std::mutex> lk(m_mt);
|
||||
m_cmds.emplace_back(Command::Type::MouseDown);
|
||||
m_cmds.back().m_coord = coord;
|
||||
|
@ -120,7 +120,7 @@ struct DeferredWindowEvents : public IWindowCallback {
|
|||
m_cmds.back().m_mods = mods;
|
||||
}
|
||||
|
||||
void mouseUp(const SWindowCoord& coord, EMouseButton button, EModifierKey mods) {
|
||||
void mouseUp(const SWindowCoord& coord, EMouseButton button, EModifierKey mods) override {
|
||||
std::unique_lock<std::mutex> lk(m_mt);
|
||||
m_cmds.emplace_back(Command::Type::MouseUp);
|
||||
m_cmds.back().m_coord = coord;
|
||||
|
@ -128,53 +128,53 @@ struct DeferredWindowEvents : public IWindowCallback {
|
|||
m_cmds.back().m_mods = mods;
|
||||
}
|
||||
|
||||
void mouseMove(const SWindowCoord& coord) {
|
||||
void mouseMove(const SWindowCoord& coord) override {
|
||||
std::unique_lock<std::mutex> lk(m_mt);
|
||||
m_cmds.emplace_back(Command::Type::MouseMove);
|
||||
m_cmds.back().m_coord = coord;
|
||||
}
|
||||
|
||||
void mouseEnter(const SWindowCoord& coord) {
|
||||
void mouseEnter(const SWindowCoord& coord) override {
|
||||
std::unique_lock<std::mutex> lk(m_mt);
|
||||
m_cmds.emplace_back(Command::Type::MouseEnter);
|
||||
m_cmds.back().m_coord = coord;
|
||||
}
|
||||
|
||||
void mouseLeave(const SWindowCoord& coord) {
|
||||
void mouseLeave(const SWindowCoord& coord) override {
|
||||
std::unique_lock<std::mutex> lk(m_mt);
|
||||
m_cmds.emplace_back(Command::Type::MouseLeave);
|
||||
m_cmds.back().m_coord = coord;
|
||||
}
|
||||
|
||||
void scroll(const SWindowCoord& coord, const SScrollDelta& scroll) {
|
||||
void scroll(const SWindowCoord& coord, const SScrollDelta& scroll) override {
|
||||
std::unique_lock<std::mutex> lk(m_mt);
|
||||
m_cmds.emplace_back(Command::Type::Scroll);
|
||||
m_cmds.back().m_coord = coord;
|
||||
m_cmds.back().m_scroll = scroll;
|
||||
}
|
||||
|
||||
void touchDown(const STouchCoord& coord, uintptr_t tid) {
|
||||
void touchDown(const STouchCoord& coord, uintptr_t tid) override {
|
||||
std::unique_lock<std::mutex> lk(m_mt);
|
||||
m_cmds.emplace_back(Command::Type::TouchDown);
|
||||
m_cmds.back().m_tCoord = coord;
|
||||
m_cmds.back().m_tid = tid;
|
||||
}
|
||||
|
||||
void touchUp(const STouchCoord& coord, uintptr_t tid) {
|
||||
void touchUp(const STouchCoord& coord, uintptr_t tid) override {
|
||||
std::unique_lock<std::mutex> lk(m_mt);
|
||||
m_cmds.emplace_back(Command::Type::TouchUp);
|
||||
m_cmds.back().m_tCoord = coord;
|
||||
m_cmds.back().m_tid = tid;
|
||||
}
|
||||
|
||||
void touchMove(const STouchCoord& coord, uintptr_t tid) {
|
||||
void touchMove(const STouchCoord& coord, uintptr_t tid) override {
|
||||
std::unique_lock<std::mutex> lk(m_mt);
|
||||
m_cmds.emplace_back(Command::Type::TouchMove);
|
||||
m_cmds.back().m_tCoord = coord;
|
||||
m_cmds.back().m_tid = tid;
|
||||
}
|
||||
|
||||
void charKeyDown(unsigned long charCode, EModifierKey mods, bool isRepeat) {
|
||||
void charKeyDown(unsigned long charCode, EModifierKey mods, bool isRepeat) override {
|
||||
std::unique_lock<std::mutex> lk(m_mt);
|
||||
m_cmds.emplace_back(Command::Type::CharKeyDown);
|
||||
m_cmds.back().m_charcode = charCode;
|
||||
|
@ -182,14 +182,14 @@ struct DeferredWindowEvents : public IWindowCallback {
|
|||
m_cmds.back().m_isRepeat = isRepeat;
|
||||
}
|
||||
|
||||
void charKeyUp(unsigned long charCode, EModifierKey mods) {
|
||||
void charKeyUp(unsigned long charCode, EModifierKey mods) override {
|
||||
std::unique_lock<std::mutex> lk(m_mt);
|
||||
m_cmds.emplace_back(Command::Type::CharKeyUp);
|
||||
m_cmds.back().m_charcode = charCode;
|
||||
m_cmds.back().m_mods = mods;
|
||||
}
|
||||
|
||||
void specialKeyDown(ESpecialKey key, EModifierKey mods, bool isRepeat) {
|
||||
void specialKeyDown(ESpecialKey key, EModifierKey mods, bool isRepeat) override {
|
||||
std::unique_lock<std::mutex> lk(m_mt);
|
||||
m_cmds.emplace_back(Command::Type::SpecialKeyDown);
|
||||
m_cmds.back().m_special = key;
|
||||
|
@ -197,27 +197,27 @@ struct DeferredWindowEvents : public IWindowCallback {
|
|||
m_cmds.back().m_isRepeat = isRepeat;
|
||||
}
|
||||
|
||||
void specialKeyUp(ESpecialKey key, EModifierKey mods) {
|
||||
void specialKeyUp(ESpecialKey key, EModifierKey mods) override {
|
||||
std::unique_lock<std::mutex> lk(m_mt);
|
||||
m_cmds.emplace_back(Command::Type::SpecialKeyUp);
|
||||
m_cmds.back().m_special = key;
|
||||
m_cmds.back().m_mods = mods;
|
||||
}
|
||||
|
||||
void modKeyDown(EModifierKey mod, bool isRepeat) {
|
||||
void modKeyDown(EModifierKey mod, bool isRepeat) override {
|
||||
std::unique_lock<std::mutex> lk(m_mt);
|
||||
m_cmds.emplace_back(Command::Type::ModKeyDown);
|
||||
m_cmds.back().m_mods = mod;
|
||||
m_cmds.back().m_isRepeat = isRepeat;
|
||||
}
|
||||
|
||||
void modKeyUp(EModifierKey mod) {
|
||||
void modKeyUp(EModifierKey mod) override {
|
||||
std::unique_lock<std::mutex> lk(m_mt);
|
||||
m_cmds.emplace_back(Command::Type::ModKeyUp);
|
||||
m_cmds.back().m_mods = mod;
|
||||
}
|
||||
|
||||
ITextInputCallback* getTextInputCallback() { return m_rec.getTextInputCallback(); }
|
||||
ITextInputCallback* getTextInputCallback() override { return m_rec.getTextInputCallback(); }
|
||||
|
||||
void dispatchEvents() {
|
||||
std::unique_lock<std::mutex> lk(m_mt);
|
||||
|
|
|
@ -35,7 +35,7 @@ protected:
|
|||
: IMIDIPort(parent, virt), IMIDIReceiver(std::move(receiver)) {}
|
||||
|
||||
public:
|
||||
virtual ~IMIDIIn();
|
||||
~IMIDIIn() override;
|
||||
};
|
||||
|
||||
class IMIDIOut : public IMIDIPort {
|
||||
|
@ -43,7 +43,7 @@ protected:
|
|||
IMIDIOut(IAudioVoiceEngine* parent, bool virt) : IMIDIPort(parent, virt) {}
|
||||
|
||||
public:
|
||||
virtual ~IMIDIOut();
|
||||
~IMIDIOut() override;
|
||||
virtual size_t send(const void* buf, size_t len) const = 0;
|
||||
};
|
||||
|
||||
|
@ -53,7 +53,7 @@ protected:
|
|||
: IMIDIPort(parent, virt), IMIDIReceiver(std::move(receiver)) {}
|
||||
|
||||
public:
|
||||
virtual ~IMIDIInOut();
|
||||
~IMIDIInOut() override;
|
||||
virtual size_t send(const void* buf, size_t len) const = 0;
|
||||
};
|
||||
|
||||
|
|
|
@ -15,32 +15,32 @@ class MIDIEncoder : public IMIDIReader {
|
|||
public:
|
||||
MIDIEncoder(Sender& sender) : m_sender(sender) {}
|
||||
|
||||
void noteOff(uint8_t chan, uint8_t key, uint8_t velocity);
|
||||
void noteOn(uint8_t chan, uint8_t key, uint8_t velocity);
|
||||
void notePressure(uint8_t chan, uint8_t key, uint8_t pressure);
|
||||
void controlChange(uint8_t chan, uint8_t control, uint8_t value);
|
||||
void programChange(uint8_t chan, uint8_t program);
|
||||
void channelPressure(uint8_t chan, uint8_t pressure);
|
||||
void pitchBend(uint8_t chan, int16_t pitch);
|
||||
void noteOff(uint8_t chan, uint8_t key, uint8_t velocity) override;
|
||||
void noteOn(uint8_t chan, uint8_t key, uint8_t velocity) override;
|
||||
void notePressure(uint8_t chan, uint8_t key, uint8_t pressure) override;
|
||||
void controlChange(uint8_t chan, uint8_t control, uint8_t value) override;
|
||||
void programChange(uint8_t chan, uint8_t program) override;
|
||||
void channelPressure(uint8_t chan, uint8_t pressure) override;
|
||||
void pitchBend(uint8_t chan, int16_t pitch) override;
|
||||
|
||||
void allSoundOff(uint8_t chan);
|
||||
void resetAllControllers(uint8_t chan);
|
||||
void localControl(uint8_t chan, bool on);
|
||||
void allNotesOff(uint8_t chan);
|
||||
void omniMode(uint8_t chan, bool on);
|
||||
void polyMode(uint8_t chan, bool on);
|
||||
void allSoundOff(uint8_t chan) override;
|
||||
void resetAllControllers(uint8_t chan) override;
|
||||
void localControl(uint8_t chan, bool on) override;
|
||||
void allNotesOff(uint8_t chan) override;
|
||||
void omniMode(uint8_t chan, bool on) override;
|
||||
void polyMode(uint8_t chan, bool on) override;
|
||||
|
||||
void sysex(const void* data, size_t len);
|
||||
void timeCodeQuarterFrame(uint8_t message, uint8_t value);
|
||||
void songPositionPointer(uint16_t pointer);
|
||||
void songSelect(uint8_t song);
|
||||
void tuneRequest();
|
||||
void sysex(const void* data, size_t len) override;
|
||||
void timeCodeQuarterFrame(uint8_t message, uint8_t value) override;
|
||||
void songPositionPointer(uint16_t pointer) override;
|
||||
void songSelect(uint8_t song) override;
|
||||
void tuneRequest() override;
|
||||
|
||||
void startSeq();
|
||||
void continueSeq();
|
||||
void stopSeq();
|
||||
void startSeq() override;
|
||||
void continueSeq() override;
|
||||
void stopSeq() override;
|
||||
|
||||
void reset();
|
||||
void reset() override;
|
||||
};
|
||||
|
||||
} // namespace boo
|
||||
|
|
|
@ -17,10 +17,10 @@ struct BaseGraphicsData;
|
|||
|
||||
class D3D11DataFactory : public IGraphicsDataFactory {
|
||||
public:
|
||||
virtual ~D3D11DataFactory() = default;
|
||||
~D3D11DataFactory() override = default;
|
||||
|
||||
Platform platform() const { return Platform::D3D11; }
|
||||
const SystemChar* platformName() const { return _SYS_STR("D3D11"); }
|
||||
Platform platform() const override { return Platform::D3D11; }
|
||||
const SystemChar* platformName() const override { return _SYS_STR("D3D11"); }
|
||||
|
||||
class Context final : public IGraphicsDataFactory::Context {
|
||||
friend class D3D11DataFactoryImpl;
|
||||
|
@ -30,28 +30,30 @@ public:
|
|||
~Context();
|
||||
|
||||
public:
|
||||
Platform platform() const { return Platform::D3D11; }
|
||||
const SystemChar* platformName() const { return _SYS_STR("D3D11"); }
|
||||
Platform platform() const override { return Platform::D3D11; }
|
||||
const SystemChar* platformName() const override { return _SYS_STR("D3D11"); }
|
||||
|
||||
ObjToken<IGraphicsBufferS> newStaticBuffer(BufferUse use, const void* data, size_t stride, size_t count);
|
||||
ObjToken<IGraphicsBufferD> newDynamicBuffer(BufferUse use, size_t stride, size_t count);
|
||||
ObjToken<IGraphicsBufferS> newStaticBuffer(BufferUse use, const void* data, size_t stride, size_t count) override;
|
||||
ObjToken<IGraphicsBufferD> newDynamicBuffer(BufferUse use, size_t stride, size_t count) override;
|
||||
|
||||
ObjToken<ITextureS> newStaticTexture(size_t width, size_t height, size_t mips, TextureFormat fmt,
|
||||
TextureClampMode clampMode, const void* data, size_t sz);
|
||||
TextureClampMode clampMode, const void* data, size_t sz) override;
|
||||
ObjToken<ITextureSA> newStaticArrayTexture(size_t width, size_t height, size_t layers, size_t mips,
|
||||
TextureFormat fmt, TextureClampMode clampMode, const void* data,
|
||||
size_t sz);
|
||||
ObjToken<ITextureD> newDynamicTexture(size_t width, size_t height, TextureFormat fmt, TextureClampMode clampMode);
|
||||
size_t sz) override;
|
||||
ObjToken<ITextureD> newDynamicTexture(size_t width, size_t height, TextureFormat fmt,
|
||||
TextureClampMode clampMode) override;
|
||||
ObjToken<ITextureR> newRenderTexture(size_t width, size_t height, TextureClampMode clampMode, size_t colorBindCount,
|
||||
size_t depthBindCount);
|
||||
ObjToken<ITextureCubeR> newCubeRenderTexture(size_t width, size_t mips);
|
||||
size_t depthBindCount) override;
|
||||
ObjToken<ITextureCubeR> newCubeRenderTexture(size_t width, size_t mips) override;
|
||||
|
||||
ObjToken<IShaderStage> newShaderStage(const uint8_t* data, size_t size, PipelineStage stage);
|
||||
ObjToken<IShaderStage> newShaderStage(const uint8_t* data, size_t size, PipelineStage stage) override;
|
||||
|
||||
ObjToken<IShaderPipeline> newShaderPipeline(ObjToken<IShaderStage> vertex, ObjToken<IShaderStage> fragment,
|
||||
ObjToken<IShaderStage> geometry, ObjToken<IShaderStage> control,
|
||||
ObjToken<IShaderStage> evaluation, const VertexFormatInfo& vtxFmt,
|
||||
const AdditionalPipelineInfo& additionalInfo, bool asynchronous = true);
|
||||
const AdditionalPipelineInfo& additionalInfo,
|
||||
bool asynchronous = true) override;
|
||||
|
||||
ObjToken<IShaderDataBinding>
|
||||
newShaderDataBinding(const ObjToken<IShaderPipeline>& pipeline, const ObjToken<IGraphicsBuffer>& vbo,
|
||||
|
@ -59,7 +61,7 @@ public:
|
|||
size_t ubufCount, const ObjToken<IGraphicsBuffer>* ubufs, const PipelineStage* ubufStages,
|
||||
const size_t* ubufOffs, const size_t* ubufSizes, size_t texCount,
|
||||
const ObjToken<ITexture>* texs, const int* bindIdxs, const bool* bindDepth,
|
||||
size_t baseVert = 0, size_t baseInst = 0);
|
||||
size_t baseVert = 0, size_t baseInst = 0) override;
|
||||
};
|
||||
|
||||
static std::vector<uint8_t> CompileHLSL(const char* source, PipelineStage stage);
|
||||
|
|
|
@ -25,35 +25,38 @@ public:
|
|||
~Context();
|
||||
|
||||
public:
|
||||
Platform platform() const { return Platform::OpenGL; }
|
||||
const SystemChar* platformName() const { return _SYS_STR("OpenGL"); }
|
||||
Platform platform() const override { return Platform::OpenGL; }
|
||||
const SystemChar* platformName() const override { return _SYS_STR("OpenGL"); }
|
||||
|
||||
ObjToken<IGraphicsBufferS> newStaticBuffer(BufferUse use, const void* data, size_t stride, size_t count);
|
||||
ObjToken<IGraphicsBufferD> newDynamicBuffer(BufferUse use, size_t stride, size_t count);
|
||||
ObjToken<IGraphicsBufferS> newStaticBuffer(BufferUse use, const void* data, size_t stride, size_t count) override;
|
||||
ObjToken<IGraphicsBufferD> newDynamicBuffer(BufferUse use, size_t stride, size_t count) override;
|
||||
|
||||
ObjToken<ITextureS> newStaticTexture(size_t width, size_t height, size_t mips, TextureFormat fmt,
|
||||
TextureClampMode clampMode, const void* data, size_t sz);
|
||||
TextureClampMode clampMode, const void* data, size_t sz) override;
|
||||
ObjToken<ITextureSA> newStaticArrayTexture(size_t width, size_t height, size_t layers, size_t mips,
|
||||
TextureFormat fmt, TextureClampMode clampMode, const void* data,
|
||||
size_t sz);
|
||||
ObjToken<ITextureD> newDynamicTexture(size_t width, size_t height, TextureFormat fmt, TextureClampMode clampMode);
|
||||
size_t sz) override;
|
||||
ObjToken<ITextureD> newDynamicTexture(size_t width, size_t height, TextureFormat fmt,
|
||||
TextureClampMode clampMode) override;
|
||||
ObjToken<ITextureR> newRenderTexture(size_t width, size_t height, TextureClampMode clampMode,
|
||||
size_t colorBindingCount, size_t depthBindingCount);
|
||||
ObjToken<ITextureCubeR> newCubeRenderTexture(size_t width, size_t mips);
|
||||
size_t colorBindingCount, size_t depthBindingCount) override;
|
||||
ObjToken<ITextureCubeR> newCubeRenderTexture(size_t width, size_t mips) override;
|
||||
|
||||
ObjToken<IShaderStage> newShaderStage(const uint8_t* data, size_t size, PipelineStage stage);
|
||||
ObjToken<IShaderStage> newShaderStage(const uint8_t* data, size_t size, PipelineStage stage) override;
|
||||
|
||||
ObjToken<IShaderPipeline> newShaderPipeline(ObjToken<IShaderStage> vertex, ObjToken<IShaderStage> fragment,
|
||||
ObjToken<IShaderStage> geometry, ObjToken<IShaderStage> control,
|
||||
ObjToken<IShaderStage> evaluation, const VertexFormatInfo& vtxFmt,
|
||||
const AdditionalPipelineInfo& additionalInfo, bool asynchronous = true);
|
||||
const AdditionalPipelineInfo& additionalInfo,
|
||||
bool asynchronous = true) override;
|
||||
|
||||
ObjToken<IShaderDataBinding> newShaderDataBinding(
|
||||
const ObjToken<IShaderPipeline>& pipeline, const ObjToken<IGraphicsBuffer>& vbo,
|
||||
const ObjToken<IGraphicsBuffer>& instVbo, const ObjToken<IGraphicsBuffer>& ibo, size_t ubufCount,
|
||||
const ObjToken<IGraphicsBuffer>* ubufs, const PipelineStage* ubufStages, const size_t* ubufOffs,
|
||||
const size_t* ubufSizes, size_t texCount, const ObjToken<ITexture>* texs, const int* texBindIdx,
|
||||
const bool* depthBind, size_t baseVert = 0, size_t baseInst = 0);
|
||||
ObjToken<IShaderDataBinding>
|
||||
newShaderDataBinding(const ObjToken<IShaderPipeline>& pipeline, const ObjToken<IGraphicsBuffer>& vbo,
|
||||
const ObjToken<IGraphicsBuffer>& instVbo, const ObjToken<IGraphicsBuffer>& ibo,
|
||||
size_t ubufCount, const ObjToken<IGraphicsBuffer>* ubufs, const PipelineStage* ubufStages,
|
||||
const size_t* ubufOffs, const size_t* ubufSizes, size_t texCount,
|
||||
const ObjToken<ITexture>* texs, const int* texBindIdx, const bool* depthBind,
|
||||
size_t baseVert = 0, size_t baseInst = 0) override;
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -67,14 +67,14 @@ class DolphinSmashAdapter final : public TDeviceBase<IDolphinSmashAdapterCallbac
|
|||
uint8_t m_rumbleRequest = 0;
|
||||
bool m_hardStop[4] = {false};
|
||||
uint8_t m_rumbleState = 0xf; /* Force initial send of stop-rumble command */
|
||||
void deviceDisconnected();
|
||||
void initialCycle();
|
||||
void transferCycle();
|
||||
void finalCycle();
|
||||
void deviceDisconnected() override;
|
||||
void initialCycle() override;
|
||||
void transferCycle() override;
|
||||
void finalCycle() override;
|
||||
|
||||
public:
|
||||
DolphinSmashAdapter(DeviceToken* token);
|
||||
~DolphinSmashAdapter();
|
||||
~DolphinSmashAdapter() override;
|
||||
|
||||
void setCallback(IDolphinSmashAdapterCallback* cb) {
|
||||
TDeviceBase<IDolphinSmashAdapterCallback>::setCallback(cb);
|
||||
|
|
|
@ -112,15 +112,15 @@ class DualshockPad final : public TDeviceBase<IDualshockPadCallback> {
|
|||
uint8_t m_rumbleIntensity[2];
|
||||
EDualshockLED m_led;
|
||||
DualshockOutReport m_report;
|
||||
void deviceDisconnected();
|
||||
void initialCycle();
|
||||
void transferCycle();
|
||||
void finalCycle();
|
||||
void receivedHIDReport(const uint8_t* data, size_t length, HIDReportType tp, uint32_t message);
|
||||
void deviceDisconnected() override;
|
||||
void initialCycle() override;
|
||||
void transferCycle() override;
|
||||
void finalCycle() override;
|
||||
void receivedHIDReport(const uint8_t* data, size_t length, HIDReportType tp, uint32_t message) override;
|
||||
|
||||
public:
|
||||
DualshockPad(DeviceToken* token);
|
||||
~DualshockPad();
|
||||
~DualshockPad() override;
|
||||
|
||||
void startRumble(EDualshockMotor motor, uint8_t duration = 254, uint8_t intensity = 255) {
|
||||
m_rumbleRequest |= motor;
|
||||
|
|
|
@ -18,11 +18,11 @@ class GenericPad final : public TDeviceBase<IGenericPadCallback> {
|
|||
|
||||
public:
|
||||
GenericPad(DeviceToken* token);
|
||||
~GenericPad();
|
||||
~GenericPad() override;
|
||||
|
||||
void deviceDisconnected();
|
||||
void initialCycle();
|
||||
void receivedHIDReport(const uint8_t* data, size_t length, HIDReportType tp, uint32_t message);
|
||||
void deviceDisconnected() override;
|
||||
void initialCycle() override;
|
||||
void receivedHIDReport(const uint8_t* data, size_t length, HIDReportType tp, uint32_t message) override;
|
||||
|
||||
void enumerateValues(const std::function<bool(const HIDMainItem& item)>& valueCB) const;
|
||||
};
|
||||
|
|
|
@ -35,14 +35,14 @@ struct INintendoPowerACallback {
|
|||
|
||||
class NintendoPowerA final : public TDeviceBase<INintendoPowerACallback> {
|
||||
NintendoPowerAState m_last;
|
||||
void deviceDisconnected();
|
||||
void initialCycle();
|
||||
void transferCycle();
|
||||
void finalCycle();
|
||||
void receivedHIDReport(const uint8_t* data, size_t length, HIDReportType tp, uint32_t message);
|
||||
void deviceDisconnected() override;
|
||||
void initialCycle() override;
|
||||
void transferCycle() override;
|
||||
void finalCycle() override;
|
||||
void receivedHIDReport(const uint8_t* data, size_t length, HIDReportType tp, uint32_t message) override;
|
||||
|
||||
public:
|
||||
NintendoPowerA(DeviceToken*);
|
||||
~NintendoPowerA();
|
||||
~NintendoPowerA() override;
|
||||
};
|
||||
} // namespace boo
|
||||
|
|
|
@ -36,7 +36,7 @@ class XInputPad final : public TDeviceBase<IXInputPadCallback> {
|
|||
|
||||
public:
|
||||
XInputPad(DeviceToken* token) : TDeviceBase<IXInputPadCallback>(dev_typeid(XInputPad), token) {}
|
||||
void deviceDisconnected() {
|
||||
void deviceDisconnected() override {
|
||||
std::lock_guard<std::mutex> lk(m_callbackLock);
|
||||
if (m_callback)
|
||||
m_callback->controllerDisconnected();
|
||||
|
|
|
@ -130,9 +130,9 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine {
|
|||
return {AudioChannelSet::Unknown, 48000.0};
|
||||
}
|
||||
|
||||
std::string getCurrentAudioOutput() const { return CFStringGetCStringPtr(m_devName.get(), kCFStringEncodingUTF8); }
|
||||
std::string getCurrentAudioOutput() const override { return CFStringGetCStringPtr(m_devName.get(), kCFStringEncodingUTF8); }
|
||||
|
||||
bool setCurrentAudioOutput(const char* name) {
|
||||
bool setCurrentAudioOutput(const char* name) override {
|
||||
m_devName = CFPointer<CFStringRef>::adopt(CFStringCreateWithCString(nullptr, name, kCFStringEncodingUTF8));
|
||||
_rebuildAudioQueue();
|
||||
return true;
|
||||
|
@ -336,14 +336,14 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine {
|
|||
MIDIIn(AQSAudioVoiceEngine* parent, bool virt, ReceiveFunctor&& receiver)
|
||||
: IMIDIIn(parent, virt, std::move(receiver)) {}
|
||||
|
||||
~MIDIIn() {
|
||||
~MIDIIn() override {
|
||||
if (m_midi)
|
||||
MIDIEndpointDispose(m_midi);
|
||||
if (m_midiPort)
|
||||
MIDIPortDispose(m_midiPort);
|
||||
}
|
||||
|
||||
std::string description() const {
|
||||
std::string description() const override {
|
||||
CFPointer<CFStringRef> namestr;
|
||||
const char* nameCstr;
|
||||
if (MIDIObjectGetStringProperty(m_midi, kMIDIPropertyName, &namestr))
|
||||
|
@ -362,14 +362,14 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine {
|
|||
|
||||
MIDIOut(AQSAudioVoiceEngine* parent, bool virt) : IMIDIOut(parent, virt) {}
|
||||
|
||||
~MIDIOut() {
|
||||
~MIDIOut() override {
|
||||
if (m_midi)
|
||||
MIDIEndpointDispose(m_midi);
|
||||
if (m_midiPort)
|
||||
MIDIPortDispose(m_midiPort);
|
||||
}
|
||||
|
||||
std::string description() const {
|
||||
std::string description() const override {
|
||||
CFPointer<CFStringRef> namestr;
|
||||
const char* nameCstr;
|
||||
if (MIDIObjectGetStringProperty(m_midi, kMIDIPropertyName, &namestr))
|
||||
|
@ -381,7 +381,7 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine {
|
|||
return nameCstr;
|
||||
}
|
||||
|
||||
size_t send(const void* buf, size_t len) const {
|
||||
size_t send(const void* buf, size_t len) const override {
|
||||
union {
|
||||
MIDIPacketList head;
|
||||
Byte storage[512];
|
||||
|
@ -408,7 +408,7 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine {
|
|||
MIDIInOut(AQSAudioVoiceEngine* parent, bool virt, ReceiveFunctor&& receiver)
|
||||
: IMIDIInOut(parent, virt, std::move(receiver)) {}
|
||||
|
||||
~MIDIInOut() {
|
||||
~MIDIInOut() override {
|
||||
if (m_midiIn)
|
||||
MIDIEndpointDispose(m_midiIn);
|
||||
if (m_midiPortIn)
|
||||
|
@ -419,7 +419,7 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine {
|
|||
MIDIPortDispose(m_midiPortOut);
|
||||
}
|
||||
|
||||
std::string description() const {
|
||||
std::string description() const override {
|
||||
CFPointer<CFStringRef> namestr;
|
||||
const char* nameCstr;
|
||||
if (MIDIObjectGetStringProperty(m_midiIn, kMIDIPropertyName, &namestr))
|
||||
|
@ -431,7 +431,7 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine {
|
|||
return nameCstr;
|
||||
}
|
||||
|
||||
size_t send(const void* buf, size_t len) const {
|
||||
size_t send(const void* buf, size_t len) const override {
|
||||
union {
|
||||
MIDIPacketList head;
|
||||
Byte storage[512];
|
||||
|
@ -452,7 +452,7 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine {
|
|||
unsigned m_midiInCounter = 0;
|
||||
unsigned m_midiOutCounter = 0;
|
||||
|
||||
std::unique_ptr<IMIDIIn> newVirtualMIDIIn(ReceiveFunctor&& receiver) {
|
||||
std::unique_ptr<IMIDIIn> newVirtualMIDIIn(ReceiveFunctor&& receiver) override {
|
||||
if (!m_midiClient)
|
||||
return {};
|
||||
|
||||
|
@ -477,7 +477,7 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine {
|
|||
return ret;
|
||||
}
|
||||
|
||||
std::unique_ptr<IMIDIOut> newVirtualMIDIOut() {
|
||||
std::unique_ptr<IMIDIOut> newVirtualMIDIOut() override {
|
||||
if (!m_midiClient)
|
||||
return {};
|
||||
|
||||
|
@ -500,7 +500,7 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine {
|
|||
return ret;
|
||||
}
|
||||
|
||||
std::unique_ptr<IMIDIInOut> newVirtualMIDIInOut(ReceiveFunctor&& receiver) {
|
||||
std::unique_ptr<IMIDIInOut> newVirtualMIDIInOut(ReceiveFunctor&& receiver) override {
|
||||
if (!m_midiClient)
|
||||
return {};
|
||||
|
||||
|
@ -537,7 +537,7 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine {
|
|||
return ret;
|
||||
}
|
||||
|
||||
std::unique_ptr<IMIDIIn> newRealMIDIIn(const char* name, ReceiveFunctor&& receiver) {
|
||||
std::unique_ptr<IMIDIIn> newRealMIDIIn(const char* name, ReceiveFunctor&& receiver) override {
|
||||
if (!m_midiClient)
|
||||
return {};
|
||||
|
||||
|
@ -561,7 +561,7 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine {
|
|||
return ret;
|
||||
}
|
||||
|
||||
std::unique_ptr<IMIDIOut> newRealMIDIOut(const char* name) {
|
||||
std::unique_ptr<IMIDIOut> newRealMIDIOut(const char* name) override {
|
||||
if (!m_midiClient)
|
||||
return {};
|
||||
|
||||
|
@ -584,7 +584,7 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine {
|
|||
return ret;
|
||||
}
|
||||
|
||||
std::unique_ptr<IMIDIInOut> newRealMIDIInOut(const char* name, ReceiveFunctor&& receiver) {
|
||||
std::unique_ptr<IMIDIInOut> newRealMIDIInOut(const char* name, ReceiveFunctor&& receiver) override {
|
||||
if (!m_midiClient)
|
||||
return {};
|
||||
|
||||
|
@ -623,7 +623,7 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine {
|
|||
return ret;
|
||||
}
|
||||
|
||||
bool useMIDILock() const { return true; }
|
||||
bool useMIDILock() const override { return true; }
|
||||
|
||||
static void SampleRateChanged(AQSAudioVoiceEngine* engine, AudioQueueRef inAQ, AudioQueuePropertyID inID) {
|
||||
engine->m_needsRebuild = true;
|
||||
|
@ -841,14 +841,14 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine {
|
|||
MIDIClientCreate(CFSTR("Boo MIDI"), nullptr, nullptr, &m_midiClient);
|
||||
}
|
||||
|
||||
~AQSAudioVoiceEngine() {
|
||||
~AQSAudioVoiceEngine() override {
|
||||
m_cbRunning = false;
|
||||
AudioQueueDispose(m_queue, true);
|
||||
if (m_midiClient)
|
||||
MIDIClientDispose(m_midiClient);
|
||||
}
|
||||
|
||||
void pumpAndMixVoices() {
|
||||
void pumpAndMixVoices() override {
|
||||
while (CFRunLoopRunInMode(m_runLoopMode.get(), 0, true) == kCFRunLoopRunHandledSource) {}
|
||||
if (m_needsRebuild) {
|
||||
_rebuildAudioQueue();
|
||||
|
|
|
@ -80,16 +80,16 @@ class AudioSubmix : public ListNode<AudioSubmix, BaseAudioVoiceEngine*, IAudioSu
|
|||
public:
|
||||
static AudioSubmix*& _getHeadPtr(BaseAudioVoiceEngine* head);
|
||||
static std::unique_lock<std::recursive_mutex> _getHeadLock(BaseAudioVoiceEngine* head);
|
||||
std::unique_lock<std::recursive_mutex> destructorLock();
|
||||
std::unique_lock<std::recursive_mutex> destructorLock() override;
|
||||
|
||||
AudioSubmix(BaseAudioVoiceEngine& root, IAudioSubmixCallback* cb, int busId, bool mainOut);
|
||||
~AudioSubmix();
|
||||
~AudioSubmix() override;
|
||||
|
||||
void resetSendLevels();
|
||||
void setSendLevel(IAudioSubmix* submix, float level, bool slew);
|
||||
void resetSendLevels() override;
|
||||
void setSendLevel(IAudioSubmix* submix, float level, bool slew) override;
|
||||
const AudioVoiceEngineMixInfo& mixInfo() const;
|
||||
double getSampleRate() const;
|
||||
SubmixFormat getSampleFormat() const;
|
||||
double getSampleRate() const override;
|
||||
SubmixFormat getSampleFormat() const override;
|
||||
};
|
||||
|
||||
template <>
|
||||
|
|
|
@ -64,13 +64,13 @@ protected:
|
|||
public:
|
||||
static AudioVoice*& _getHeadPtr(BaseAudioVoiceEngine* head);
|
||||
static std::unique_lock<std::recursive_mutex> _getHeadLock(BaseAudioVoiceEngine* head);
|
||||
std::unique_lock<std::recursive_mutex> destructorLock();
|
||||
std::unique_lock<std::recursive_mutex> destructorLock() override;
|
||||
|
||||
~AudioVoice();
|
||||
void resetSampleRate(double sampleRate);
|
||||
void setPitchRatio(double ratio, bool slew);
|
||||
void start();
|
||||
void stop();
|
||||
~AudioVoice() override;
|
||||
void resetSampleRate(double sampleRate) override;
|
||||
void setPitchRatio(double ratio, bool slew) override;
|
||||
void start() override;
|
||||
void stop() override;
|
||||
double getSampleRateIn() const { return m_sampleRateIn; }
|
||||
double getSampleRateOut() const { return m_sampleRateOut; }
|
||||
};
|
||||
|
@ -91,7 +91,7 @@ inline size_t AudioVoice::pumpAndMix<float>(size_t frames) {
|
|||
class AudioVoiceMono : public AudioVoice {
|
||||
std::unordered_map<IAudioSubmix*, AudioMatrixMono> m_sendMatrices;
|
||||
bool m_silentOut = false;
|
||||
void _resetSampleRate(double sampleRate);
|
||||
void _resetSampleRate(double sampleRate) override;
|
||||
|
||||
static size_t SRCCallback(AudioVoiceMono* ctx, int16_t** data, size_t requestedLen);
|
||||
|
||||
|
@ -99,21 +99,21 @@ class AudioVoiceMono : public AudioVoice {
|
|||
|
||||
template <typename T>
|
||||
size_t _pumpAndMix(size_t frames);
|
||||
size_t pumpAndMix16(size_t frames) { return _pumpAndMix<int16_t>(frames); }
|
||||
size_t pumpAndMix32(size_t frames) { return _pumpAndMix<int32_t>(frames); }
|
||||
size_t pumpAndMixFlt(size_t frames) { return _pumpAndMix<float>(frames); }
|
||||
size_t pumpAndMix16(size_t frames) override { return _pumpAndMix<int16_t>(frames); }
|
||||
size_t pumpAndMix32(size_t frames) override { return _pumpAndMix<int32_t>(frames); }
|
||||
size_t pumpAndMixFlt(size_t frames) override { return _pumpAndMix<float>(frames); }
|
||||
|
||||
public:
|
||||
AudioVoiceMono(BaseAudioVoiceEngine& root, IAudioVoiceCallback* cb, double sampleRate, bool dynamicRate);
|
||||
void resetChannelLevels();
|
||||
void setMonoChannelLevels(IAudioSubmix* submix, const float coefs[8], bool slew);
|
||||
void setStereoChannelLevels(IAudioSubmix* submix, const float coefs[8][2], bool slew);
|
||||
void resetChannelLevels() override;
|
||||
void setMonoChannelLevels(IAudioSubmix* submix, const float coefs[8], bool slew) override;
|
||||
void setStereoChannelLevels(IAudioSubmix* submix, const float coefs[8][2], bool slew) override;
|
||||
};
|
||||
|
||||
class AudioVoiceStereo : public AudioVoice {
|
||||
std::unordered_map<IAudioSubmix*, AudioMatrixStereo> m_sendMatrices;
|
||||
bool m_silentOut = false;
|
||||
void _resetSampleRate(double sampleRate);
|
||||
void _resetSampleRate(double sampleRate) override;
|
||||
|
||||
static size_t SRCCallback(AudioVoiceStereo* ctx, int16_t** data, size_t requestedLen);
|
||||
|
||||
|
@ -121,15 +121,15 @@ class AudioVoiceStereo : public AudioVoice {
|
|||
|
||||
template <typename T>
|
||||
size_t _pumpAndMix(size_t frames);
|
||||
size_t pumpAndMix16(size_t frames) { return _pumpAndMix<int16_t>(frames); }
|
||||
size_t pumpAndMix32(size_t frames) { return _pumpAndMix<int32_t>(frames); }
|
||||
size_t pumpAndMixFlt(size_t frames) { return _pumpAndMix<float>(frames); }
|
||||
size_t pumpAndMix16(size_t frames) override { return _pumpAndMix<int16_t>(frames); }
|
||||
size_t pumpAndMix32(size_t frames) override { return _pumpAndMix<int32_t>(frames); }
|
||||
size_t pumpAndMixFlt(size_t frames) override { return _pumpAndMix<float>(frames); }
|
||||
|
||||
public:
|
||||
AudioVoiceStereo(BaseAudioVoiceEngine& root, IAudioVoiceCallback* cb, double sampleRate, bool dynamicRate);
|
||||
void resetChannelLevels();
|
||||
void setMonoChannelLevels(IAudioSubmix* submix, const float coefs[8], bool slew);
|
||||
void setStereoChannelLevels(IAudioSubmix* submix, const float coefs[8][2], bool slew);
|
||||
void resetChannelLevels() override;
|
||||
void setMonoChannelLevels(IAudioSubmix* submix, const float coefs[8], bool slew) override;
|
||||
void setStereoChannelLevels(IAudioSubmix* submix, const float coefs[8][2], bool slew) override;
|
||||
};
|
||||
|
||||
} // namespace boo
|
||||
|
|
|
@ -57,22 +57,24 @@ protected:
|
|||
|
||||
public:
|
||||
BaseAudioVoiceEngine() : m_mainSubmix(std::make_unique<AudioSubmix>(*this, nullptr, -1, false)) {}
|
||||
~BaseAudioVoiceEngine();
|
||||
ObjToken<IAudioVoice> allocateNewMonoVoice(double sampleRate, IAudioVoiceCallback* cb, bool dynamicPitch = false);
|
||||
~BaseAudioVoiceEngine() override;
|
||||
ObjToken<IAudioVoice> allocateNewMonoVoice(double sampleRate, IAudioVoiceCallback* cb,
|
||||
bool dynamicPitch = false) override;
|
||||
|
||||
ObjToken<IAudioVoice> allocateNewStereoVoice(double sampleRate, IAudioVoiceCallback* cb, bool dynamicPitch = false);
|
||||
ObjToken<IAudioVoice> allocateNewStereoVoice(double sampleRate, IAudioVoiceCallback* cb,
|
||||
bool dynamicPitch = false) override;
|
||||
|
||||
ObjToken<IAudioSubmix> allocateNewSubmix(bool mainOut, IAudioSubmixCallback* cb, int busId);
|
||||
ObjToken<IAudioSubmix> allocateNewSubmix(bool mainOut, IAudioSubmixCallback* cb, int busId) override;
|
||||
|
||||
void setCallbackInterface(IAudioVoiceEngineCallback* cb);
|
||||
void setCallbackInterface(IAudioVoiceEngineCallback* cb) override;
|
||||
|
||||
void setVolume(float vol);
|
||||
bool enableLtRt(bool enable);
|
||||
void setVolume(float vol) override;
|
||||
bool enableLtRt(bool enable) override;
|
||||
const AudioVoiceEngineMixInfo& mixInfo() const;
|
||||
const AudioVoiceEngineMixInfo& clientMixInfo() const;
|
||||
AudioChannelSet getAvailableSet() { return clientMixInfo().m_channels; }
|
||||
void pumpAndMixVoices() {}
|
||||
size_t get5MsFrames() const { return m_5msFrames; }
|
||||
AudioChannelSet getAvailableSet() override { return clientMixInfo().m_channels; }
|
||||
void pumpAndMixVoices() override {}
|
||||
size_t get5MsFrames() const override { return m_5msFrames; }
|
||||
};
|
||||
|
||||
template <>
|
||||
|
|
|
@ -25,12 +25,12 @@ struct LinuxMidi : BaseAudioVoiceEngine {
|
|||
}
|
||||
}
|
||||
|
||||
~LinuxMidi() {
|
||||
~LinuxMidi() override {
|
||||
for (auto& p : m_openHandles)
|
||||
p.second->_disown();
|
||||
}
|
||||
|
||||
std::vector<std::pair<std::string, std::string>> enumerateMIDIInputs() const {
|
||||
std::vector<std::pair<std::string, std::string>> enumerateMIDIInputs() const override {
|
||||
std::vector<std::pair<std::string, std::string>> ret;
|
||||
int status;
|
||||
int card = -1; /* use -1 to prime the pump of iterating through card list */
|
||||
|
@ -83,7 +83,7 @@ struct LinuxMidi : BaseAudioVoiceEngine {
|
|||
return ret;
|
||||
}
|
||||
|
||||
bool supportsVirtualMIDIIn() const { return true; }
|
||||
bool supportsVirtualMIDIIn() const override { return true; }
|
||||
|
||||
static void MIDIFreeProc(void* midiStatus) { snd_rawmidi_status_free((snd_rawmidi_status_t*)midiStatus); }
|
||||
|
||||
|
@ -126,7 +126,7 @@ struct LinuxMidi : BaseAudioVoiceEngine {
|
|||
, m_midi(midi)
|
||||
, m_midiThread(std::bind(MIDIReceiveProc, m_midi, m_receiver)) {}
|
||||
|
||||
~MIDIIn() {
|
||||
~MIDIIn() override {
|
||||
if (m_parent)
|
||||
static_cast<LinuxMidi*>(m_parent)->_removeOpenHandle(this);
|
||||
pthread_cancel(m_midiThread.native_handle());
|
||||
|
@ -135,7 +135,7 @@ struct LinuxMidi : BaseAudioVoiceEngine {
|
|||
snd_rawmidi_close(m_midi);
|
||||
}
|
||||
|
||||
std::string description() const {
|
||||
std::string description() const override {
|
||||
snd_rawmidi_info_t* info;
|
||||
snd_rawmidi_info_alloca(&info);
|
||||
snd_rawmidi_info(m_midi, info);
|
||||
|
@ -148,13 +148,13 @@ struct LinuxMidi : BaseAudioVoiceEngine {
|
|||
snd_rawmidi_t* m_midi;
|
||||
MIDIOut(LinuxMidi* parent, snd_rawmidi_t* midi, bool virt) : IMIDIOut(parent, virt), m_midi(midi) {}
|
||||
|
||||
~MIDIOut() {
|
||||
~MIDIOut() override {
|
||||
if (m_parent)
|
||||
static_cast<LinuxMidi*>(m_parent)->_removeOpenHandle(this);
|
||||
snd_rawmidi_close(m_midi);
|
||||
}
|
||||
|
||||
std::string description() const {
|
||||
std::string description() const override {
|
||||
snd_rawmidi_info_t* info;
|
||||
snd_rawmidi_info_alloca(&info);
|
||||
snd_rawmidi_info(m_midi, info);
|
||||
|
@ -162,7 +162,9 @@ struct LinuxMidi : BaseAudioVoiceEngine {
|
|||
return ret;
|
||||
}
|
||||
|
||||
size_t send(const void* buf, size_t len) const { return size_t(std::max(0l, snd_rawmidi_write(m_midi, buf, len))); }
|
||||
size_t send(const void* buf, size_t len) const override {
|
||||
return size_t(std::max(0l, snd_rawmidi_write(m_midi, buf, len)));
|
||||
}
|
||||
};
|
||||
|
||||
struct MIDIInOut : public IMIDIInOut {
|
||||
|
@ -176,7 +178,7 @@ struct LinuxMidi : BaseAudioVoiceEngine {
|
|||
, m_midiOut(midiOut)
|
||||
, m_midiThread(std::bind(MIDIReceiveProc, m_midiIn, m_receiver)) {}
|
||||
|
||||
~MIDIInOut() {
|
||||
~MIDIInOut() override {
|
||||
if (m_parent)
|
||||
static_cast<LinuxMidi*>(m_parent)->_removeOpenHandle(this);
|
||||
pthread_cancel(m_midiThread.native_handle());
|
||||
|
@ -186,7 +188,7 @@ struct LinuxMidi : BaseAudioVoiceEngine {
|
|||
snd_rawmidi_close(m_midiOut);
|
||||
}
|
||||
|
||||
std::string description() const {
|
||||
std::string description() const override {
|
||||
snd_rawmidi_info_t* info;
|
||||
snd_rawmidi_info_alloca(&info);
|
||||
snd_rawmidi_info(m_midiIn, info);
|
||||
|
@ -194,12 +196,12 @@ struct LinuxMidi : BaseAudioVoiceEngine {
|
|||
return ret;
|
||||
}
|
||||
|
||||
size_t send(const void* buf, size_t len) const {
|
||||
size_t send(const void* buf, size_t len) const override {
|
||||
return size_t(std::max(0l, snd_rawmidi_write(m_midiOut, buf, len)));
|
||||
}
|
||||
};
|
||||
|
||||
std::unique_ptr<IMIDIIn> newVirtualMIDIIn(ReceiveFunctor&& receiver) {
|
||||
std::unique_ptr<IMIDIIn> newVirtualMIDIIn(ReceiveFunctor&& receiver) override {
|
||||
int status;
|
||||
snd_rawmidi_t* midi;
|
||||
status = snd_rawmidi_open(&midi, nullptr, "virtual", 0);
|
||||
|
@ -208,7 +210,7 @@ struct LinuxMidi : BaseAudioVoiceEngine {
|
|||
return std::make_unique<MIDIIn>(nullptr, midi, true, std::move(receiver));
|
||||
}
|
||||
|
||||
std::unique_ptr<IMIDIOut> newVirtualMIDIOut() {
|
||||
std::unique_ptr<IMIDIOut> newVirtualMIDIOut() override {
|
||||
int status;
|
||||
snd_rawmidi_t* midi;
|
||||
status = snd_rawmidi_open(nullptr, &midi, "virtual", 0);
|
||||
|
@ -217,7 +219,7 @@ struct LinuxMidi : BaseAudioVoiceEngine {
|
|||
return std::make_unique<MIDIOut>(nullptr, midi, true);
|
||||
}
|
||||
|
||||
std::unique_ptr<IMIDIInOut> newVirtualMIDIInOut(ReceiveFunctor&& receiver) {
|
||||
std::unique_ptr<IMIDIInOut> newVirtualMIDIInOut(ReceiveFunctor&& receiver) override {
|
||||
int status;
|
||||
snd_rawmidi_t* midiIn;
|
||||
snd_rawmidi_t* midiOut;
|
||||
|
@ -227,7 +229,7 @@ struct LinuxMidi : BaseAudioVoiceEngine {
|
|||
return std::make_unique<MIDIInOut>(nullptr, midiIn, midiOut, true, std::move(receiver));
|
||||
}
|
||||
|
||||
std::unique_ptr<IMIDIIn> newRealMIDIIn(const char* name, ReceiveFunctor&& receiver) {
|
||||
std::unique_ptr<IMIDIIn> newRealMIDIIn(const char* name, ReceiveFunctor&& receiver) override {
|
||||
snd_rawmidi_t* midi;
|
||||
int status = snd_rawmidi_open(&midi, nullptr, name, 0);
|
||||
if (status)
|
||||
|
@ -237,7 +239,7 @@ struct LinuxMidi : BaseAudioVoiceEngine {
|
|||
return ret;
|
||||
}
|
||||
|
||||
std::unique_ptr<IMIDIOut> newRealMIDIOut(const char* name) {
|
||||
std::unique_ptr<IMIDIOut> newRealMIDIOut(const char* name) override {
|
||||
snd_rawmidi_t* midi;
|
||||
int status = snd_rawmidi_open(nullptr, &midi, name, 0);
|
||||
if (status)
|
||||
|
@ -247,7 +249,7 @@ struct LinuxMidi : BaseAudioVoiceEngine {
|
|||
return ret;
|
||||
}
|
||||
|
||||
std::unique_ptr<IMIDIInOut> newRealMIDIInOut(const char* name, ReceiveFunctor&& receiver) {
|
||||
std::unique_ptr<IMIDIInOut> newRealMIDIInOut(const char* name, ReceiveFunctor&& receiver) override {
|
||||
snd_rawmidi_t* midiIn;
|
||||
snd_rawmidi_t* midiOut;
|
||||
int status = snd_rawmidi_open(&midiIn, &midiOut, name, 0);
|
||||
|
@ -258,7 +260,7 @@ struct LinuxMidi : BaseAudioVoiceEngine {
|
|||
return ret;
|
||||
}
|
||||
|
||||
bool useMIDILock() const { return true; }
|
||||
bool useMIDILock() const override { return true; }
|
||||
};
|
||||
|
||||
} // namespace boo
|
||||
|
|
|
@ -154,7 +154,7 @@ struct PulseAudioVoiceEngine : LinuxMidi {
|
|||
m_mainloop = nullptr;
|
||||
}
|
||||
|
||||
~PulseAudioVoiceEngine() {
|
||||
~PulseAudioVoiceEngine() override {
|
||||
if (m_stream) {
|
||||
pa_stream_disconnect(m_stream);
|
||||
pa_stream_unref(m_stream);
|
||||
|
@ -279,14 +279,14 @@ struct PulseAudioVoiceEngine : LinuxMidi {
|
|||
return ret;
|
||||
}
|
||||
|
||||
std::string getCurrentAudioOutput() const { return m_sinkName; }
|
||||
std::string getCurrentAudioOutput() const override { return m_sinkName; }
|
||||
|
||||
bool m_sinkOk = false;
|
||||
static void _checkAudioSinkReply(pa_context* c, const pa_sink_info* i, int eol, PulseAudioVoiceEngine* userdata) {
|
||||
if (i)
|
||||
userdata->m_sinkOk = true;
|
||||
}
|
||||
bool setCurrentAudioOutput(const char* name) {
|
||||
bool setCurrentAudioOutput(const char* name) override {
|
||||
m_sinkOk = false;
|
||||
pa_operation* op;
|
||||
op = pa_context_get_sink_info_by_name(m_ctx, name, pa_sink_info_cb_t(_checkAudioSinkReply), this);
|
||||
|
@ -308,7 +308,7 @@ struct PulseAudioVoiceEngine : LinuxMidi {
|
|||
}
|
||||
}
|
||||
|
||||
void pumpAndMixVoices() {
|
||||
void pumpAndMixVoices() override {
|
||||
if (!m_stream) {
|
||||
/* Dummy pump mode - use failsafe defaults for 1/60sec of samples */
|
||||
m_mixInfo.m_sampleRate = 32000.0;
|
||||
|
|
|
@ -70,11 +70,11 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
|
|||
|
||||
// IUnknown methods -- AddRef, Release, and QueryInterface
|
||||
|
||||
ULONG STDMETHODCALLTYPE AddRef() {
|
||||
ULONG STDMETHODCALLTYPE AddRef() override {
|
||||
return InterlockedIncrement(&_cRef);
|
||||
}
|
||||
|
||||
ULONG STDMETHODCALLTYPE Release() {
|
||||
ULONG STDMETHODCALLTYPE Release() override {
|
||||
ULONG ulRef = InterlockedDecrement(&_cRef);
|
||||
if (0 == ulRef) {
|
||||
delete this;
|
||||
|
@ -82,7 +82,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
|
|||
return ulRef;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, VOID** ppvInterface) {
|
||||
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, VOID** ppvInterface) override {
|
||||
if (IID_IUnknown == riid) {
|
||||
AddRef();
|
||||
*ppvInterface = (IUnknown*)this;
|
||||
|
@ -98,18 +98,20 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
|
|||
|
||||
// Callback methods for device-event notifications.
|
||||
|
||||
HRESULT STDMETHODCALLTYPE OnDefaultDeviceChanged(EDataFlow flow, ERole role, LPCWSTR pwstrDeviceId) {
|
||||
HRESULT STDMETHODCALLTYPE OnDefaultDeviceChanged(EDataFlow flow, ERole role, LPCWSTR pwstrDeviceId) override {
|
||||
m_parent.m_rebuild = true;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE OnDeviceAdded(LPCWSTR pwstrDeviceId) { return S_OK; }
|
||||
HRESULT STDMETHODCALLTYPE OnDeviceAdded(LPCWSTR pwstrDeviceId) override { return S_OK; }
|
||||
|
||||
HRESULT STDMETHODCALLTYPE OnDeviceRemoved(LPCWSTR pwstrDeviceId) { return S_OK; }
|
||||
HRESULT STDMETHODCALLTYPE OnDeviceRemoved(LPCWSTR pwstrDeviceId) override { return S_OK; }
|
||||
|
||||
HRESULT STDMETHODCALLTYPE OnDeviceStateChanged(LPCWSTR pwstrDeviceId, DWORD dwNewState) { return S_OK; }
|
||||
HRESULT STDMETHODCALLTYPE OnDeviceStateChanged(LPCWSTR pwstrDeviceId, DWORD dwNewState) override { return S_OK; }
|
||||
|
||||
HRESULT STDMETHODCALLTYPE OnPropertyValueChanged(LPCWSTR pwstrDeviceId, const PROPERTYKEY key) { return S_OK; }
|
||||
HRESULT STDMETHODCALLTYPE OnPropertyValueChanged(LPCWSTR pwstrDeviceId, const PROPERTYKEY key) override {
|
||||
return S_OK;
|
||||
}
|
||||
} m_notificationClient;
|
||||
#endif
|
||||
|
||||
|
@ -386,7 +388,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
|
|||
_resetSampleRate();
|
||||
}
|
||||
|
||||
void pumpAndMixVoices() {
|
||||
void pumpAndMixVoices() override {
|
||||
#if WINDOWS_STORE
|
||||
if (!m_ready)
|
||||
return;
|
||||
|
@ -463,9 +465,9 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
|
|||
}
|
||||
}
|
||||
|
||||
std::string getCurrentAudioOutput() const { return m_sinkName; }
|
||||
std::string getCurrentAudioOutput() const override { return m_sinkName; }
|
||||
|
||||
bool setCurrentAudioOutput(const char* name) {
|
||||
bool setCurrentAudioOutput(const char* name) override {
|
||||
ComPtr<IMMDevice> newDevice;
|
||||
if (FAILED(m_enumerator->GetDevice(MBSTWCS(name).c_str(), &newDevice))) {
|
||||
Log.report(logvisor::Error, fmt("unable to obtain audio device {}"), name);
|
||||
|
@ -477,7 +479,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
|
|||
return true;
|
||||
}
|
||||
|
||||
std::vector<std::pair<std::string, std::string>> enumerateAudioOutputs() const {
|
||||
std::vector<std::pair<std::string, std::string>> enumerateAudioOutputs() const override {
|
||||
std::vector<std::pair<std::string, std::string>> ret;
|
||||
|
||||
ComPtr<IMMDeviceCollection> collection;
|
||||
|
@ -507,7 +509,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
|
|||
}
|
||||
|
||||
#if !WINDOWS_STORE
|
||||
std::vector<std::pair<std::string, std::string>> enumerateMIDIInputs() const {
|
||||
std::vector<std::pair<std::string, std::string>> enumerateMIDIInputs() const override {
|
||||
std::vector<std::pair<std::string, std::string>> ret;
|
||||
|
||||
UINT numInDevices = midiInGetNumDevs();
|
||||
|
@ -547,7 +549,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
|
|||
return ret;
|
||||
}
|
||||
|
||||
bool supportsVirtualMIDIIn() const {
|
||||
bool supportsVirtualMIDIIn() const override {
|
||||
#ifdef TE_VIRTUAL_MIDI
|
||||
WORD major, minor, release, build;
|
||||
return virtualMIDIGetDriverVersionPROC &&
|
||||
|
@ -588,9 +590,9 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
|
|||
|
||||
VMIDIIn(WASAPIAudioVoiceEngine* parent, ReceiveFunctor&& receiver) : IMIDIIn(parent, true, std::move(receiver)) {}
|
||||
|
||||
~VMIDIIn() { virtualMIDIClosePortPROC(m_midi); }
|
||||
~VMIDIIn() override { virtualMIDIClosePortPROC(m_midi); }
|
||||
|
||||
std::string description() const { return "Virtual MIDI-In"; }
|
||||
std::string description() const override { return "Virtual MIDI-In"; }
|
||||
};
|
||||
|
||||
struct VMIDIOut : public IMIDIOut {
|
||||
|
@ -598,11 +600,11 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
|
|||
|
||||
VMIDIOut(WASAPIAudioVoiceEngine* parent) : IMIDIOut(parent, true) {}
|
||||
|
||||
~VMIDIOut() { virtualMIDIClosePortPROC(m_midi); }
|
||||
~VMIDIOut() override { virtualMIDIClosePortPROC(m_midi); }
|
||||
|
||||
std::string description() const { return "Virtual MIDI-Out"; }
|
||||
std::string description() const override { return "Virtual MIDI-Out"; }
|
||||
|
||||
size_t send(const void* buf, size_t len) const {
|
||||
size_t send(const void* buf, size_t len) const override {
|
||||
return virtualMIDISendDataPROC(m_midi, (LPBYTE)buf, len) ? len : 0;
|
||||
}
|
||||
};
|
||||
|
@ -613,11 +615,11 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
|
|||
VMIDIInOut(WASAPIAudioVoiceEngine* parent, ReceiveFunctor&& receiver)
|
||||
: IMIDIInOut(parent, true, std::move(receiver)) {}
|
||||
|
||||
~VMIDIInOut() { virtualMIDIClosePortPROC(m_midi); }
|
||||
~VMIDIInOut() override { virtualMIDIClosePortPROC(m_midi); }
|
||||
|
||||
std::string description() const { return "Virtual MIDI-In/Out"; }
|
||||
std::string description() const override { return "Virtual MIDI-In/Out"; }
|
||||
|
||||
size_t send(const void* buf, size_t len) const {
|
||||
size_t send(const void* buf, size_t len) const override {
|
||||
return virtualMIDISendDataPROC(m_midi, (LPBYTE)buf, len) ? len : 0;
|
||||
}
|
||||
};
|
||||
|
@ -628,9 +630,9 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
|
|||
|
||||
MIDIIn(WASAPIAudioVoiceEngine* parent, ReceiveFunctor&& receiver) : IMIDIIn(parent, false, std::move(receiver)) {}
|
||||
|
||||
~MIDIIn() { midiInClose(m_midi); }
|
||||
~MIDIIn() override { midiInClose(m_midi); }
|
||||
|
||||
std::string description() const {
|
||||
std::string description() const override {
|
||||
UINT id = 0;
|
||||
midiInGetID(m_midi, &id);
|
||||
MIDIINCAPS caps;
|
||||
|
@ -664,13 +666,13 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
|
|||
midiStreamOpen(&m_strm, &id, 1, NULL, NULL, CALLBACK_NULL);
|
||||
}
|
||||
|
||||
~MIDIOut() {
|
||||
~MIDIOut() override {
|
||||
midiStreamClose(m_strm);
|
||||
midiOutUnprepareHeader(m_midi, &m_hdr, sizeof(m_hdr));
|
||||
midiOutClose(m_midi);
|
||||
}
|
||||
|
||||
std::string description() const {
|
||||
std::string description() const override {
|
||||
UINT id = 0;
|
||||
midiOutGetID(m_midi, &id);
|
||||
MIDIOUTCAPS caps;
|
||||
|
@ -684,7 +686,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
|
|||
#endif
|
||||
}
|
||||
|
||||
size_t send(const void* buf, size_t len) const {
|
||||
size_t send(const void* buf, size_t len) const override {
|
||||
memcpy(const_cast<MIDIOut*>(this)->m_buf, buf, std::min(len, size_t(512)));
|
||||
const_cast<MIDIOut*>(this)->m_hdr.dwBytesRecorded = len;
|
||||
midiStreamOut(m_strm, LPMIDIHDR(&m_hdr), sizeof(m_hdr));
|
||||
|
@ -713,14 +715,14 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
|
|||
midiStreamOpen(&m_strm, &id, 1, NULL, NULL, CALLBACK_NULL);
|
||||
}
|
||||
|
||||
~MIDIInOut() {
|
||||
~MIDIInOut() override {
|
||||
midiInClose(m_midiIn);
|
||||
midiStreamClose(m_strm);
|
||||
midiOutUnprepareHeader(m_midiOut, &m_hdr, sizeof(m_hdr));
|
||||
midiOutClose(m_midiOut);
|
||||
}
|
||||
|
||||
std::string description() const {
|
||||
std::string description() const override {
|
||||
UINT id = 0;
|
||||
midiOutGetID(m_midiOut, &id);
|
||||
MIDIOUTCAPS caps;
|
||||
|
@ -734,7 +736,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
|
|||
#endif
|
||||
}
|
||||
|
||||
size_t send(const void* buf, size_t len) const {
|
||||
size_t send(const void* buf, size_t len) const override {
|
||||
memcpy(const_cast<uint8_t*>(m_buf), buf, std::min(len, size_t(512)));
|
||||
const_cast<MIDIHDR&>(m_hdr).dwBytesRecorded = len;
|
||||
midiStreamOut(m_strm, LPMIDIHDR(&m_hdr), sizeof(m_hdr));
|
||||
|
@ -742,7 +744,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
|
|||
}
|
||||
};
|
||||
|
||||
std::unique_ptr<IMIDIIn> newVirtualMIDIIn(ReceiveFunctor&& receiver) {
|
||||
std::unique_ptr<IMIDIIn> newVirtualMIDIIn(ReceiveFunctor&& receiver) override {
|
||||
#ifdef TE_VIRTUAL_MIDI
|
||||
if (!virtualMIDICreatePortEx2PROC)
|
||||
return {};
|
||||
|
@ -764,7 +766,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
|
|||
#endif
|
||||
}
|
||||
|
||||
std::unique_ptr<IMIDIOut> newVirtualMIDIOut() {
|
||||
std::unique_ptr<IMIDIOut> newVirtualMIDIOut() override {
|
||||
#ifdef TE_VIRTUAL_MIDI
|
||||
if (!virtualMIDICreatePortEx2PROC)
|
||||
return {};
|
||||
|
@ -785,7 +787,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
|
|||
#endif
|
||||
}
|
||||
|
||||
std::unique_ptr<IMIDIInOut> newVirtualMIDIInOut(ReceiveFunctor&& receiver) {
|
||||
std::unique_ptr<IMIDIInOut> newVirtualMIDIInOut(ReceiveFunctor&& receiver) override {
|
||||
#ifdef TE_VIRTUAL_MIDI
|
||||
if (!virtualMIDICreatePortEx2PROC)
|
||||
return {};
|
||||
|
@ -807,7 +809,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
|
|||
#endif
|
||||
}
|
||||
|
||||
std::unique_ptr<IMIDIIn> newRealMIDIIn(const char* name, ReceiveFunctor&& receiver) {
|
||||
std::unique_ptr<IMIDIIn> newRealMIDIIn(const char* name, ReceiveFunctor&& receiver) override {
|
||||
if (strncmp(name, "in", 2))
|
||||
return {};
|
||||
long id = strtol(name + 2, nullptr, 10);
|
||||
|
@ -824,7 +826,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
|
|||
return ret;
|
||||
}
|
||||
|
||||
std::unique_ptr<IMIDIOut> newRealMIDIOut(const char* name) {
|
||||
std::unique_ptr<IMIDIOut> newRealMIDIOut(const char* name) override {
|
||||
if (strncmp(name, "out", 3))
|
||||
return {};
|
||||
long id = strtol(name + 3, nullptr, 10);
|
||||
|
@ -840,7 +842,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
|
|||
return ret;
|
||||
}
|
||||
|
||||
std::unique_ptr<IMIDIInOut> newRealMIDIInOut(const char* name, ReceiveFunctor&& receiver) {
|
||||
std::unique_ptr<IMIDIInOut> newRealMIDIInOut(const char* name, ReceiveFunctor&& receiver) override {
|
||||
const char* in = strstr(name, "in");
|
||||
const char* out = strstr(name, "out");
|
||||
|
||||
|
@ -866,21 +868,21 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
|
|||
return ret;
|
||||
}
|
||||
|
||||
bool useMIDILock() const { return true; }
|
||||
bool useMIDILock() const override { return true; }
|
||||
#else
|
||||
std::vector<std::pair<std::string, std::string>> enumerateMIDIDevices() const { return {}; }
|
||||
std::vector<std::pair<std::string, std::string>> enumerateMIDIDevices() const override { return {}; }
|
||||
|
||||
std::unique_ptr<IMIDIIn> newVirtualMIDIIn(ReceiveFunctor&& receiver) { return {}; }
|
||||
std::unique_ptr<IMIDIIn> newVirtualMIDIIn(ReceiveFunctor&& receiver) override { return {}; }
|
||||
|
||||
std::unique_ptr<IMIDIOut> newVirtualMIDIOut() { return {}; }
|
||||
std::unique_ptr<IMIDIOut> newVirtualMIDIOut() override { return {}; }
|
||||
|
||||
std::unique_ptr<IMIDIInOut> newVirtualMIDIInOut(ReceiveFunctor&& receiver) { return {}; }
|
||||
std::unique_ptr<IMIDIInOut> newVirtualMIDIInOut(ReceiveFunctor&& receiver) override { return {}; }
|
||||
|
||||
std::unique_ptr<IMIDIIn> newRealMIDIIn(const char* name, ReceiveFunctor&& receiver) { return {}; }
|
||||
std::unique_ptr<IMIDIIn> newRealMIDIIn(const char* name, ReceiveFunctor&& receiver) override { return {}; }
|
||||
|
||||
std::unique_ptr<IMIDIOut> newRealMIDIOut(const char* name) { return {}; }
|
||||
std::unique_ptr<IMIDIOut> newRealMIDIOut(const char* name) override { return {}; }
|
||||
|
||||
std::unique_ptr<IMIDIInOut> newRealMIDIInOut(const char* name, ReceiveFunctor&& receiver) { return {}; }
|
||||
std::unique_ptr<IMIDIInOut> newRealMIDIInOut(const char* name, ReceiveFunctor&& receiver) override { return {}; }
|
||||
|
||||
bool useMIDILock() const { return false; }
|
||||
#endif
|
||||
|
|
|
@ -11,15 +11,17 @@ struct WAVOutVoiceEngine : BaseAudioVoiceEngine {
|
|||
|
||||
AudioChannelSet _getAvailableSet() { return AudioChannelSet::Stereo; }
|
||||
|
||||
std::string getCurrentAudioOutput() const { return "wavout"; }
|
||||
std::string getCurrentAudioOutput() const override { return "wavout"; }
|
||||
|
||||
bool setCurrentAudioOutput(const char* name) { return false; }
|
||||
bool setCurrentAudioOutput(const char* name) override { return false; }
|
||||
|
||||
std::vector<std::pair<std::string, std::string>> enumerateAudioOutputs() const { return {{"wavout", "WAVOut"}}; }
|
||||
std::vector<std::pair<std::string, std::string>> enumerateAudioOutputs() const override {
|
||||
return {{"wavout", "WAVOut"}};
|
||||
}
|
||||
|
||||
std::vector<std::pair<std::string, std::string>> enumerateMIDIInputs() const { return {}; }
|
||||
std::vector<std::pair<std::string, std::string>> enumerateMIDIInputs() const override { return {}; }
|
||||
|
||||
bool supportsVirtualMIDIIn() const { return false; }
|
||||
bool supportsVirtualMIDIIn() const override { return false; }
|
||||
|
||||
ReceiveFunctor* m_midiReceiver = nullptr;
|
||||
|
||||
|
@ -27,26 +29,26 @@ struct WAVOutVoiceEngine : BaseAudioVoiceEngine {
|
|||
MIDIIn(WAVOutVoiceEngine* parent, bool virt, ReceiveFunctor&& receiver)
|
||||
: IMIDIIn(parent, virt, std::move(receiver)) {}
|
||||
|
||||
std::string description() const { return "WAVOut MIDI"; }
|
||||
std::string description() const override { return "WAVOut MIDI"; }
|
||||
};
|
||||
|
||||
std::unique_ptr<IMIDIIn> newVirtualMIDIIn(ReceiveFunctor&& receiver) {
|
||||
std::unique_ptr<IMIDIIn> newVirtualMIDIIn(ReceiveFunctor&& receiver) override {
|
||||
std::unique_ptr<IMIDIIn> ret = std::make_unique<MIDIIn>(nullptr, true, std::move(receiver));
|
||||
m_midiReceiver = &ret->m_receiver;
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::unique_ptr<IMIDIOut> newVirtualMIDIOut() { return {}; }
|
||||
std::unique_ptr<IMIDIOut> newVirtualMIDIOut() override { return {}; }
|
||||
|
||||
std::unique_ptr<IMIDIInOut> newVirtualMIDIInOut(ReceiveFunctor&& receiver) { return {}; }
|
||||
std::unique_ptr<IMIDIInOut> newVirtualMIDIInOut(ReceiveFunctor&& receiver) override { return {}; }
|
||||
|
||||
std::unique_ptr<IMIDIIn> newRealMIDIIn(const char* name, ReceiveFunctor&& receiver) { return {}; }
|
||||
std::unique_ptr<IMIDIIn> newRealMIDIIn(const char* name, ReceiveFunctor&& receiver) override { return {}; }
|
||||
|
||||
std::unique_ptr<IMIDIOut> newRealMIDIOut(const char* name) { return {}; }
|
||||
std::unique_ptr<IMIDIOut> newRealMIDIOut(const char* name) override { return {}; }
|
||||
|
||||
std::unique_ptr<IMIDIInOut> newRealMIDIInOut(const char* name, ReceiveFunctor&& receiver) { return {}; }
|
||||
std::unique_ptr<IMIDIInOut> newRealMIDIInOut(const char* name, ReceiveFunctor&& receiver) override { return {}; }
|
||||
|
||||
bool useMIDILock() const { return false; }
|
||||
bool useMIDILock() const override { return false; }
|
||||
|
||||
FILE* m_fp = nullptr;
|
||||
size_t m_bytesWritten = 0;
|
||||
|
@ -207,7 +209,7 @@ struct WAVOutVoiceEngine : BaseAudioVoiceEngine {
|
|||
fclose(m_fp);
|
||||
}
|
||||
|
||||
~WAVOutVoiceEngine() { finishWav(); }
|
||||
~WAVOutVoiceEngine() override { finishWav(); }
|
||||
|
||||
void _buildAudioRenderClient() {
|
||||
m_5msFrames = m_mixInfo.m_sampleRate * 5 / 1000;
|
||||
|
@ -221,7 +223,7 @@ struct WAVOutVoiceEngine : BaseAudioVoiceEngine {
|
|||
_resetSampleRate();
|
||||
}
|
||||
|
||||
void pumpAndMixVoices() {
|
||||
void pumpAndMixVoices() override {
|
||||
size_t frameSz = 4 * m_mixInfo.m_channelMap.m_channelCount;
|
||||
_pumpAndMixVoices(m_5msFrames, m_interleavedBuf.data());
|
||||
fwrite(m_interleavedBuf.data(), 1, m_5msFrames * frameSz, m_fp);
|
||||
|
|
|
@ -98,7 +98,7 @@ public:
|
|||
size_t m_stride;
|
||||
size_t m_count;
|
||||
ComPtr<ID3D11Buffer> m_buf;
|
||||
~D3D11GraphicsBufferS() = default;
|
||||
~D3D11GraphicsBufferS() override = default;
|
||||
};
|
||||
|
||||
template <class DataCls>
|
||||
|
@ -127,11 +127,11 @@ public:
|
|||
size_t m_stride;
|
||||
size_t m_count;
|
||||
ComPtr<ID3D11Buffer> m_bufs[3];
|
||||
~D3D11GraphicsBufferD() = default;
|
||||
~D3D11GraphicsBufferD() override = default;
|
||||
|
||||
void load(const void* data, size_t sz);
|
||||
void* map(size_t sz);
|
||||
void unmap();
|
||||
void load(const void* data, size_t sz) override;
|
||||
void* map(size_t sz) override;
|
||||
void unmap() override;
|
||||
};
|
||||
|
||||
class D3D11TextureS : public GraphicsDataNode<ITextureS> {
|
||||
|
@ -200,7 +200,7 @@ class D3D11TextureS : public GraphicsDataNode<ITextureS> {
|
|||
public:
|
||||
ComPtr<ID3D11Texture2D> m_tex;
|
||||
ComPtr<ID3D11ShaderResourceView> m_srv;
|
||||
~D3D11TextureS() = default;
|
||||
~D3D11TextureS() override = default;
|
||||
};
|
||||
|
||||
class D3D11TextureSA : public GraphicsDataNode<ITextureSA> {
|
||||
|
@ -256,7 +256,7 @@ class D3D11TextureSA : public GraphicsDataNode<ITextureSA> {
|
|||
public:
|
||||
ComPtr<ID3D11Texture2D> m_tex;
|
||||
ComPtr<ID3D11ShaderResourceView> m_srv;
|
||||
~D3D11TextureSA() = default;
|
||||
~D3D11TextureSA() override = default;
|
||||
};
|
||||
|
||||
class D3D11TextureD : public GraphicsDataNode<ITextureD> {
|
||||
|
@ -306,11 +306,11 @@ class D3D11TextureD : public GraphicsDataNode<ITextureD> {
|
|||
public:
|
||||
ComPtr<ID3D11Texture2D> m_texs[3];
|
||||
ComPtr<ID3D11ShaderResourceView> m_srvs[3];
|
||||
~D3D11TextureD() = default;
|
||||
~D3D11TextureD() override = default;
|
||||
|
||||
void load(const void* data, size_t sz);
|
||||
void* map(size_t sz);
|
||||
void unmap();
|
||||
void load(const void* data, size_t sz) override;
|
||||
void* map(size_t sz) override;
|
||||
void unmap() override;
|
||||
};
|
||||
|
||||
#define MAX_BIND_TEXS 4
|
||||
|
@ -398,7 +398,7 @@ public:
|
|||
ComPtr<ID3D11Texture2D> m_depthBindTex[MAX_BIND_TEXS];
|
||||
ComPtr<ID3D11ShaderResourceView> m_depthSrv[MAX_BIND_TEXS];
|
||||
|
||||
~D3D11TextureR() = default;
|
||||
~D3D11TextureR() override = default;
|
||||
|
||||
void resize(D3D11Context* ctx, size_t width, size_t height) {
|
||||
if (width < 1)
|
||||
|
@ -455,7 +455,7 @@ public:
|
|||
|
||||
ComPtr<ID3D11ShaderResourceView> m_colorSrv;
|
||||
|
||||
~D3D11TextureCubeR() = default;
|
||||
~D3D11TextureCubeR() override = default;
|
||||
|
||||
void resize(D3D11Context* ctx, size_t width, size_t mips) {
|
||||
if (width < 1)
|
||||
|
@ -687,7 +687,7 @@ public:
|
|||
D3D11_PRIMITIVE_TOPOLOGY m_topology;
|
||||
size_t m_stride = 0;
|
||||
size_t m_instStride = 0;
|
||||
~D3D11ShaderPipeline() = default;
|
||||
~D3D11ShaderPipeline() override = default;
|
||||
D3D11ShaderPipeline& operator=(const D3D11ShaderPipeline&) = delete;
|
||||
D3D11ShaderPipeline(const D3D11ShaderPipeline&) = delete;
|
||||
|
||||
|
@ -703,7 +703,7 @@ public:
|
|||
ctx->IASetInputLayout(m_inLayout.Get());
|
||||
ctx->IASetPrimitiveTopology(m_topology);
|
||||
}
|
||||
bool isReady() const { return true; }
|
||||
bool isReady() const override { return true; }
|
||||
};
|
||||
|
||||
struct D3D11ShaderDataBinding : public GraphicsDataNode<IShaderDataBinding> {
|
||||
|
@ -919,8 +919,8 @@ struct D3D11ShaderDataBinding : public GraphicsDataNode<IShaderDataBinding> {
|
|||
};
|
||||
|
||||
struct D3D11CommandQueue final : IGraphicsCommandQueue {
|
||||
Platform platform() const { return IGraphicsDataFactory::Platform::D3D11; }
|
||||
const SystemChar* platformName() const { return _SYS_STR("D3D11"); }
|
||||
Platform platform() const override { return IGraphicsDataFactory::Platform::D3D11; }
|
||||
const SystemChar* platformName() const override { return _SYS_STR("D3D11"); }
|
||||
D3D11Context* m_ctx;
|
||||
D3D11Context::Window* m_windowCtx;
|
||||
IGraphicsContext* m_parent;
|
||||
|
@ -964,20 +964,20 @@ struct D3D11CommandQueue final : IGraphicsCommandQueue {
|
|||
m_deferredCtx.As(&m_deferredAnnot);
|
||||
}
|
||||
|
||||
void startRenderer();
|
||||
void startRenderer() override;
|
||||
|
||||
void stopRenderer() {
|
||||
void stopRenderer() override {
|
||||
m_running = false;
|
||||
m_cv.notify_one();
|
||||
m_thr.join();
|
||||
}
|
||||
|
||||
~D3D11CommandQueue() {
|
||||
~D3D11CommandQueue() override {
|
||||
if (m_running)
|
||||
stopRenderer();
|
||||
}
|
||||
|
||||
void setShaderDataBinding(const boo::ObjToken<IShaderDataBinding>& binding) {
|
||||
void setShaderDataBinding(const boo::ObjToken<IShaderDataBinding>& binding) override {
|
||||
D3D11ShaderDataBinding* cbind = binding.cast<D3D11ShaderDataBinding>();
|
||||
cbind->bind(m_deferredCtx.Get(), m_fillBuf);
|
||||
m_cmdLists[m_fillBuf].resTokens.push_back(binding.get());
|
||||
|
@ -989,7 +989,7 @@ struct D3D11CommandQueue final : IGraphicsCommandQueue {
|
|||
}
|
||||
|
||||
boo::ObjToken<ITexture> m_boundTarget;
|
||||
void setRenderTarget(const boo::ObjToken<ITextureR>& target) {
|
||||
void setRenderTarget(const boo::ObjToken<ITextureR>& target) override {
|
||||
D3D11TextureR* ctarget = target.cast<D3D11TextureR>();
|
||||
ID3D11RenderTargetView* view[] = {ctarget->m_rtv.Get()};
|
||||
m_deferredCtx->OMSetRenderTargets(1, view, ctarget->m_dsv.Get());
|
||||
|
@ -998,7 +998,7 @@ struct D3D11CommandQueue final : IGraphicsCommandQueue {
|
|||
|
||||
static constexpr int CubeFaceRemap[] = {0, 1, 3, 2, 4, 5};
|
||||
int m_boundFace = 0;
|
||||
void setRenderTarget(const ObjToken<ITextureCubeR>& target, int face) {
|
||||
void setRenderTarget(const ObjToken<ITextureCubeR>& target, int face) override {
|
||||
face = CubeFaceRemap[face];
|
||||
D3D11TextureCubeR* ctarget = target.cast<D3D11TextureCubeR>();
|
||||
ID3D11RenderTargetView* view[] = {ctarget->m_rtv[face].Get()};
|
||||
|
@ -1007,7 +1007,7 @@ struct D3D11CommandQueue final : IGraphicsCommandQueue {
|
|||
m_boundFace = face;
|
||||
}
|
||||
|
||||
void setViewport(const SWindowRect& rect, float znear, float zfar) {
|
||||
void setViewport(const SWindowRect& rect, float znear, float zfar) override {
|
||||
if (m_boundTarget) {
|
||||
int boundHeight = 0;
|
||||
switch (m_boundTarget->type()) {
|
||||
|
@ -1034,7 +1034,7 @@ struct D3D11CommandQueue final : IGraphicsCommandQueue {
|
|||
}
|
||||
}
|
||||
|
||||
void setScissor(const SWindowRect& rect) {
|
||||
void setScissor(const SWindowRect& rect) override {
|
||||
if (m_boundTarget) {
|
||||
D3D11TextureR* ctarget = m_boundTarget.cast<D3D11TextureR>();
|
||||
int boundHeight = 0;
|
||||
|
@ -1059,32 +1059,32 @@ struct D3D11CommandQueue final : IGraphicsCommandQueue {
|
|||
}
|
||||
|
||||
std::unordered_map<D3D11TextureR*, std::pair<size_t, size_t>> m_texResizes;
|
||||
void resizeRenderTexture(const boo::ObjToken<ITextureR>& tex, size_t width, size_t height) {
|
||||
void resizeRenderTexture(const boo::ObjToken<ITextureR>& tex, size_t width, size_t height) override {
|
||||
D3D11TextureR* ctex = tex.cast<D3D11TextureR>();
|
||||
std::unique_lock<std::mutex> lk(m_mt);
|
||||
m_texResizes[ctex] = std::make_pair(width, height);
|
||||
}
|
||||
|
||||
std::unordered_map<D3D11TextureCubeR*, std::pair<size_t, size_t>> m_cubeTexResizes;
|
||||
void resizeRenderTexture(const boo::ObjToken<ITextureCubeR>& tex, size_t width, size_t mips) {
|
||||
void resizeRenderTexture(const boo::ObjToken<ITextureCubeR>& tex, size_t width, size_t mips) override {
|
||||
D3D11TextureCubeR* ctex = tex.cast<D3D11TextureCubeR>();
|
||||
std::unique_lock<std::mutex> lk(m_mt);
|
||||
m_cubeTexResizes[ctex] = std::make_pair(width, mips);
|
||||
}
|
||||
|
||||
void generateMipmaps(const ObjToken<ITextureCubeR>& tex);
|
||||
void generateMipmaps(const ObjToken<ITextureCubeR>& tex) override;
|
||||
|
||||
void schedulePostFrameHandler(std::function<void(void)>&& func) { func(); }
|
||||
void schedulePostFrameHandler(std::function<void()>&& func) override { func(); }
|
||||
|
||||
float m_clearColor[4] = {0.0, 0.0, 0.0, 0.0};
|
||||
void setClearColor(const float rgba[4]) {
|
||||
void setClearColor(const float rgba[4]) override {
|
||||
m_clearColor[0] = rgba[0];
|
||||
m_clearColor[1] = rgba[1];
|
||||
m_clearColor[2] = rgba[2];
|
||||
m_clearColor[3] = rgba[3];
|
||||
}
|
||||
|
||||
void clearTarget(bool render = true, bool depth = true) {
|
||||
void clearTarget(bool render = true, bool depth = true) override {
|
||||
if (!m_boundTarget)
|
||||
return;
|
||||
switch (m_boundTarget->type()) {
|
||||
|
@ -1109,15 +1109,15 @@ struct D3D11CommandQueue final : IGraphicsCommandQueue {
|
|||
}
|
||||
}
|
||||
|
||||
void draw(size_t start, size_t count) { m_deferredCtx->Draw(count, start); }
|
||||
void draw(size_t start, size_t count) override { m_deferredCtx->Draw(count, start); }
|
||||
|
||||
void drawIndexed(size_t start, size_t count) { m_deferredCtx->DrawIndexed(count, start, 0); }
|
||||
void drawIndexed(size_t start, size_t count) override { m_deferredCtx->DrawIndexed(count, start, 0); }
|
||||
|
||||
void drawInstances(size_t start, size_t count, size_t instCount, size_t startInst) {
|
||||
void drawInstances(size_t start, size_t count, size_t instCount, size_t startInst) override {
|
||||
m_deferredCtx->DrawInstanced(count, instCount, start, startInst);
|
||||
}
|
||||
|
||||
void drawInstancesIndexed(size_t start, size_t count, size_t instCount, size_t startInst) {
|
||||
void drawInstancesIndexed(size_t start, size_t count, size_t instCount, size_t startInst) override {
|
||||
m_deferredCtx->DrawIndexedInstanced(count, instCount, start, 0, startInst);
|
||||
}
|
||||
|
||||
|
@ -1147,7 +1147,7 @@ struct D3D11CommandQueue final : IGraphicsCommandQueue {
|
|||
}
|
||||
|
||||
void resolveBindTexture(const boo::ObjToken<ITextureR>& texture, const SWindowRect& rect, bool tlOrigin, int bindIdx,
|
||||
bool color, bool depth, bool clearDepth) {
|
||||
bool color, bool depth, bool clearDepth) override {
|
||||
const D3D11TextureR* tex = texture.cast<D3D11TextureR>();
|
||||
_resolveBindTexture(m_deferredCtx.Get(), tex, rect, tlOrigin, bindIdx, color, depth);
|
||||
if (clearDepth)
|
||||
|
@ -1155,17 +1155,17 @@ struct D3D11CommandQueue final : IGraphicsCommandQueue {
|
|||
}
|
||||
|
||||
boo::ObjToken<ITextureR> m_doPresent;
|
||||
void resolveDisplay(const boo::ObjToken<ITextureR>& source) { m_doPresent = source; }
|
||||
void resolveDisplay(const boo::ObjToken<ITextureR>& source) override { m_doPresent = source; }
|
||||
|
||||
void execute();
|
||||
void execute() override;
|
||||
|
||||
#ifdef BOO_GRAPHICS_DEBUG_GROUPS
|
||||
void pushDebugGroup(const char* name, const std::array<float, 4>& color) {
|
||||
void pushDebugGroup(const char* name, const std::array<float, 4>& color) override {
|
||||
if (m_deferredAnnot)
|
||||
m_deferredAnnot->BeginEvent(MBSTWCS(name).c_str());
|
||||
}
|
||||
|
||||
void popDebugGroup() {
|
||||
void popDebugGroup() override {
|
||||
if (m_deferredAnnot)
|
||||
m_deferredAnnot->EndEvent();
|
||||
}
|
||||
|
@ -1282,18 +1282,18 @@ public:
|
|||
m_ctx->m_sampleCount = flp2(m_ctx->m_sampleCount - 1);
|
||||
}
|
||||
|
||||
boo::ObjToken<IGraphicsBufferD> newPoolBuffer(BufferUse use, size_t stride, size_t count __BooTraceArgs) {
|
||||
boo::ObjToken<IGraphicsBufferD> newPoolBuffer(BufferUse use, size_t stride, size_t count __BooTraceArgs) override {
|
||||
D3D11CommandQueue* q = static_cast<D3D11CommandQueue*>(m_parent->getCommandQueue());
|
||||
boo::ObjToken<BaseGraphicsPool> pool(new BaseGraphicsPool(*this __BooTraceArgsUse));
|
||||
return {new D3D11GraphicsBufferD<BaseGraphicsPool>(pool, q, use, m_ctx, stride, count)};
|
||||
}
|
||||
|
||||
void commitTransaction(const FactoryCommitFunc& trans __BooTraceArgs) {
|
||||
void commitTransaction(const FactoryCommitFunc& trans __BooTraceArgs) override {
|
||||
D3D11DataFactory::Context ctx(*this __BooTraceArgsUse);
|
||||
trans(ctx);
|
||||
}
|
||||
|
||||
void setDisplayGamma(float gamma) {
|
||||
void setDisplayGamma(float gamma) override {
|
||||
if (m_ctx->m_fbFormat == DXGI_FORMAT_R16G16B16A16_FLOAT)
|
||||
m_gamma = gamma * 2.2f;
|
||||
else
|
||||
|
@ -1302,12 +1302,12 @@ public:
|
|||
UpdateGammaLUT(m_gammaLUT.get(), m_gamma);
|
||||
}
|
||||
|
||||
bool isTessellationSupported(uint32_t& maxPatchSizeOut) {
|
||||
bool isTessellationSupported(uint32_t& maxPatchSizeOut) override {
|
||||
maxPatchSizeOut = 32;
|
||||
return true;
|
||||
}
|
||||
void waitUntilShadersReady() {}
|
||||
bool areShadersReady() { return true; }
|
||||
void waitUntilShadersReady() override {}
|
||||
bool areShadersReady() override { return true; }
|
||||
};
|
||||
|
||||
void D3D11CommandQueue::generateMipmaps(const ObjToken<ITextureCubeR>& tex) {
|
||||
|
|
|
@ -119,25 +119,25 @@ class GLDataFactoryImpl final : public GLDataFactory, public GraphicsDataFactory
|
|||
public:
|
||||
GLDataFactoryImpl(IGraphicsContext* parent, GLContext* glCtx) : m_parent(parent), m_glCtx(glCtx) {}
|
||||
|
||||
Platform platform() const { return Platform::OpenGL; }
|
||||
const SystemChar* platformName() const { return _SYS_STR("OpenGL"); }
|
||||
void commitTransaction(const FactoryCommitFunc& trans __BooTraceArgs);
|
||||
ObjToken<IGraphicsBufferD> newPoolBuffer(BufferUse use, size_t stride, size_t count __BooTraceArgs);
|
||||
Platform platform() const override { return Platform::OpenGL; }
|
||||
const SystemChar* platformName() const override { return _SYS_STR("OpenGL"); }
|
||||
void commitTransaction(const FactoryCommitFunc& trans __BooTraceArgs) override;
|
||||
ObjToken<IGraphicsBufferD> newPoolBuffer(BufferUse use, size_t stride, size_t count __BooTraceArgs) override;
|
||||
|
||||
void setDisplayGamma(float gamma) {
|
||||
void setDisplayGamma(float gamma) override {
|
||||
m_gamma = gamma;
|
||||
if (gamma != 1.f)
|
||||
UpdateGammaLUT(m_gammaLUT.get(), gamma);
|
||||
}
|
||||
|
||||
bool isTessellationSupported(uint32_t& maxPatchSizeOut) {
|
||||
bool isTessellationSupported(uint32_t& maxPatchSizeOut) override {
|
||||
maxPatchSizeOut = m_maxPatchSize;
|
||||
return m_hasTessellation;
|
||||
}
|
||||
|
||||
void waitUntilShadersReady() {}
|
||||
void waitUntilShadersReady() override {}
|
||||
|
||||
bool areShadersReady() { return true; }
|
||||
bool areShadersReady() override { return true; }
|
||||
};
|
||||
|
||||
static const GLenum USE_TABLE[] = {GL_INVALID_ENUM, GL_ARRAY_BUFFER, GL_ELEMENT_ARRAY_BUFFER, GL_UNIFORM_BUFFER};
|
||||
|
@ -156,7 +156,7 @@ class GLGraphicsBufferS : public GraphicsDataNode<IGraphicsBufferS> {
|
|||
}
|
||||
|
||||
public:
|
||||
~GLGraphicsBufferS() { glDeleteBuffers(1, &m_buf); }
|
||||
~GLGraphicsBufferS() override { glDeleteBuffers(1, &m_buf); }
|
||||
|
||||
void bindVertex() const { glBindBuffer(GL_ARRAY_BUFFER, m_buf); }
|
||||
void bindIndex() const { glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_buf); }
|
||||
|
@ -189,7 +189,7 @@ class GLGraphicsBufferD : public GraphicsDataNode<IGraphicsBufferD, DataCls> {
|
|||
}
|
||||
|
||||
public:
|
||||
~GLGraphicsBufferD() { glDeleteBuffers(3, m_bufs); }
|
||||
~GLGraphicsBufferD() override { glDeleteBuffers(3, m_bufs); }
|
||||
|
||||
void update(int b) {
|
||||
int slot = 1 << b;
|
||||
|
@ -200,17 +200,17 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
void load(const void* data, size_t sz) {
|
||||
void load(const void* data, size_t sz) override {
|
||||
size_t bufSz = std::min(sz, m_cpuSz);
|
||||
memcpy(m_cpuBuf.get(), data, bufSz);
|
||||
m_validMask = 0;
|
||||
}
|
||||
void* map(size_t sz) {
|
||||
void* map(size_t sz) override {
|
||||
if (sz > m_cpuSz)
|
||||
return nullptr;
|
||||
return m_cpuBuf.get();
|
||||
}
|
||||
void unmap() { m_validMask = 0; }
|
||||
void unmap() override { m_validMask = 0; }
|
||||
void bindVertex(int b) { glBindBuffer(GL_ARRAY_BUFFER, m_bufs[b]); }
|
||||
void bindIndex(int b) { glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_bufs[b]); }
|
||||
void bindUniform(size_t idx, int b) { glBindBufferBase(GL_UNIFORM_BUFFER, idx, m_bufs[b]); }
|
||||
|
@ -347,9 +347,9 @@ class GLTextureS : public GraphicsDataNode<ITextureS> {
|
|||
}
|
||||
|
||||
public:
|
||||
~GLTextureS() { glDeleteTextures(1, &m_tex); }
|
||||
~GLTextureS() override { glDeleteTextures(1, &m_tex); }
|
||||
|
||||
void setClampMode(TextureClampMode mode) {
|
||||
void setClampMode(TextureClampMode mode) override {
|
||||
if (m_clampMode == mode)
|
||||
return;
|
||||
m_clampMode = mode;
|
||||
|
@ -419,9 +419,9 @@ class GLTextureSA : public GraphicsDataNode<ITextureSA> {
|
|||
}
|
||||
|
||||
public:
|
||||
~GLTextureSA() { glDeleteTextures(1, &m_tex); }
|
||||
~GLTextureSA() override { glDeleteTextures(1, &m_tex); }
|
||||
|
||||
void setClampMode(TextureClampMode mode) {
|
||||
void setClampMode(TextureClampMode mode) override {
|
||||
if (m_clampMode == mode)
|
||||
return;
|
||||
m_clampMode = mode;
|
||||
|
@ -484,7 +484,7 @@ class GLTextureD : public GraphicsDataNode<ITextureD> {
|
|||
}
|
||||
|
||||
public:
|
||||
~GLTextureD() { glDeleteTextures(3, m_texs); }
|
||||
~GLTextureD() override { glDeleteTextures(3, m_texs); }
|
||||
|
||||
void update(int b) {
|
||||
int slot = 1 << b;
|
||||
|
@ -496,19 +496,19 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
void load(const void* data, size_t sz) {
|
||||
void load(const void* data, size_t sz) override {
|
||||
size_t bufSz = std::min(sz, m_cpuSz);
|
||||
memcpy(m_cpuBuf.get(), data, bufSz);
|
||||
m_validMask = 0;
|
||||
}
|
||||
void* map(size_t sz) {
|
||||
void* map(size_t sz) override {
|
||||
if (sz > m_cpuSz)
|
||||
return nullptr;
|
||||
return m_cpuBuf.get();
|
||||
}
|
||||
void unmap() { m_validMask = 0; }
|
||||
void unmap() override { m_validMask = 0; }
|
||||
|
||||
void setClampMode(TextureClampMode mode) {
|
||||
void setClampMode(TextureClampMode mode) override {
|
||||
if (m_clampMode == mode)
|
||||
return;
|
||||
m_clampMode = mode;
|
||||
|
@ -544,7 +544,7 @@ class GLTextureR : public GraphicsDataNode<ITextureR> {
|
|||
GLenum colorFormat, TextureClampMode clampMode, size_t colorBindCount, size_t depthBindCount);
|
||||
|
||||
public:
|
||||
~GLTextureR() {
|
||||
~GLTextureR() override {
|
||||
glDeleteTextures(2, m_texs);
|
||||
glDeleteTextures(MAX_BIND_TEXS * 2, m_bindTexs[0]);
|
||||
if (m_samples > 1)
|
||||
|
@ -552,7 +552,7 @@ public:
|
|||
glDeleteFramebuffers(1, &m_fbo);
|
||||
}
|
||||
|
||||
void setClampMode(TextureClampMode mode) {
|
||||
void setClampMode(TextureClampMode mode) override {
|
||||
for (size_t i = 0; i < m_colorBindCount; ++i) {
|
||||
glBindTexture(GL_TEXTURE_2D, m_bindTexs[0][i]);
|
||||
SetClampMode(GL_TEXTURE_2D, mode);
|
||||
|
@ -619,12 +619,12 @@ class GLTextureCubeR : public GraphicsDataNode<ITextureCubeR> {
|
|||
GLTextureCubeR(const ObjToken<BaseGraphicsData>& parent, GLCommandQueue* q, size_t width, size_t mips, GLenum colorFormat);
|
||||
|
||||
public:
|
||||
~GLTextureCubeR() {
|
||||
~GLTextureCubeR() override {
|
||||
glDeleteTextures(2, m_texs);
|
||||
glDeleteFramebuffers(6, m_fbos);
|
||||
}
|
||||
|
||||
void setClampMode(TextureClampMode mode) {}
|
||||
void setClampMode(TextureClampMode mode) override {}
|
||||
|
||||
void bind(size_t idx) const {
|
||||
glActiveTexture(GL_TEXTURE0 + idx);
|
||||
|
@ -768,7 +768,7 @@ class GLShaderStage : public GraphicsDataNode<IShaderStage> {
|
|||
}
|
||||
|
||||
public:
|
||||
~GLShaderStage() {
|
||||
~GLShaderStage() override {
|
||||
if (m_shad)
|
||||
glDeleteShader(m_shad);
|
||||
}
|
||||
|
@ -844,7 +844,7 @@ protected:
|
|||
}
|
||||
|
||||
public:
|
||||
~GLShaderPipeline() {
|
||||
~GLShaderPipeline() override {
|
||||
if (m_prog)
|
||||
glDeleteProgram(m_prog);
|
||||
}
|
||||
|
@ -967,7 +967,7 @@ public:
|
|||
return m_prog;
|
||||
}
|
||||
|
||||
bool isReady() const { return true; }
|
||||
bool isReady() const override { return true; }
|
||||
};
|
||||
|
||||
ObjToken<IShaderStage> GLDataFactory::Context::newShaderStage(const uint8_t* data, size_t size, PipelineStage stage) {
|
||||
|
@ -1025,7 +1025,7 @@ struct GLShaderDataBinding : GraphicsDataNode<IShaderDataBinding> {
|
|||
const int* bindTexIdx, const bool* depthBind, size_t baseVert, size_t baseInst,
|
||||
GLCommandQueue* q);
|
||||
|
||||
~GLShaderDataBinding();
|
||||
~GLShaderDataBinding() override;
|
||||
|
||||
void bind(int b) const {
|
||||
GLShaderPipeline& pipeline = *m_pipeline.cast<GLShaderPipeline>();
|
||||
|
@ -1114,8 +1114,8 @@ static const GLenum SEMANTIC_TYPE_TABLE[] = {GL_INVALID_ENUM, GL_FLOAT, GL_FLOA
|
|||
GL_UNSIGNED_BYTE, GL_FLOAT, GL_FLOAT, GL_FLOAT, GL_FLOAT};
|
||||
|
||||
struct GLCommandQueue final : IGraphicsCommandQueue {
|
||||
Platform platform() const { return IGraphicsDataFactory::Platform::OpenGL; }
|
||||
const SystemChar* platformName() const { return _SYS_STR("OpenGL"); }
|
||||
Platform platform() const override { return IGraphicsDataFactory::Platform::OpenGL; }
|
||||
const SystemChar* platformName() const override { return _SYS_STR("OpenGL"); }
|
||||
IGraphicsContext* m_parent = nullptr;
|
||||
GLContext* m_glCtx = nullptr;
|
||||
|
||||
|
@ -1579,13 +1579,13 @@ struct GLCommandQueue final : IGraphicsCommandQueue {
|
|||
|
||||
GLCommandQueue(IGraphicsContext* parent, GLContext* glCtx) : m_parent(parent), m_glCtx(glCtx) {}
|
||||
|
||||
void startRenderer() {
|
||||
void startRenderer() override {
|
||||
std::unique_lock<std::mutex> lk(m_initmt);
|
||||
m_thr = std::thread(RenderingWorker, this);
|
||||
m_initcv.wait(lk);
|
||||
}
|
||||
|
||||
void stopRenderer() {
|
||||
void stopRenderer() override {
|
||||
if (m_running) {
|
||||
m_running = false;
|
||||
m_cv.notify_one();
|
||||
|
@ -1596,28 +1596,28 @@ struct GLCommandQueue final : IGraphicsCommandQueue {
|
|||
}
|
||||
}
|
||||
|
||||
~GLCommandQueue() { stopRenderer(); }
|
||||
~GLCommandQueue() override { stopRenderer(); }
|
||||
|
||||
void setShaderDataBinding(const ObjToken<IShaderDataBinding>& binding) {
|
||||
void setShaderDataBinding(const ObjToken<IShaderDataBinding>& binding) override {
|
||||
std::vector<Command>& cmds = m_cmdBufs[m_fillBuf];
|
||||
cmds.emplace_back(Command::Op::SetShaderDataBinding);
|
||||
cmds.back().binding = binding;
|
||||
}
|
||||
|
||||
void setRenderTarget(const ObjToken<ITextureR>& target) {
|
||||
void setRenderTarget(const ObjToken<ITextureR>& target) override {
|
||||
std::vector<Command>& cmds = m_cmdBufs[m_fillBuf];
|
||||
cmds.emplace_back(Command::Op::SetRenderTarget);
|
||||
cmds.back().target = target.get();
|
||||
}
|
||||
|
||||
void setRenderTarget(const ObjToken<ITextureCubeR>& target, int face) {
|
||||
void setRenderTarget(const ObjToken<ITextureCubeR>& target, int face) override {
|
||||
std::vector<Command>& cmds = m_cmdBufs[m_fillBuf];
|
||||
cmds.emplace_back(Command::Op::SetCubeRenderTarget);
|
||||
cmds.back().target = target.get();
|
||||
cmds.back().bindIdx = face;
|
||||
}
|
||||
|
||||
void setViewport(const SWindowRect& rect, float znear, float zfar) {
|
||||
void setViewport(const SWindowRect& rect, float znear, float zfar) override {
|
||||
std::vector<Command>& cmds = m_cmdBufs[m_fillBuf];
|
||||
cmds.emplace_back(Command::Op::SetViewport);
|
||||
cmds.back().viewport.rect = rect;
|
||||
|
@ -1625,33 +1625,33 @@ struct GLCommandQueue final : IGraphicsCommandQueue {
|
|||
cmds.back().viewport.zfar = zfar;
|
||||
}
|
||||
|
||||
void setScissor(const SWindowRect& rect) {
|
||||
void setScissor(const SWindowRect& rect) override {
|
||||
std::vector<Command>& cmds = m_cmdBufs[m_fillBuf];
|
||||
cmds.emplace_back(Command::Op::SetScissor);
|
||||
cmds.back().viewport.rect = rect;
|
||||
}
|
||||
|
||||
void resizeRenderTexture(const ObjToken<ITextureR>& tex, size_t width, size_t height) {
|
||||
void resizeRenderTexture(const ObjToken<ITextureR>& tex, size_t width, size_t height) override {
|
||||
std::unique_lock<std::mutex> lk(m_mt);
|
||||
GLTextureR* texgl = tex.cast<GLTextureR>();
|
||||
m_pendingResizes.push_back({texgl, width, height});
|
||||
}
|
||||
|
||||
void resizeRenderTexture(const ObjToken<ITextureCubeR>& tex, size_t width, size_t mips) {
|
||||
void resizeRenderTexture(const ObjToken<ITextureCubeR>& tex, size_t width, size_t mips) override {
|
||||
std::unique_lock<std::mutex> lk(m_mt);
|
||||
GLTextureCubeR* texgl = tex.cast<GLTextureCubeR>();
|
||||
m_pendingCubeResizes.push_back({texgl, width, mips});
|
||||
}
|
||||
|
||||
void generateMipmaps(const ObjToken<ITextureCubeR>& tex) {
|
||||
void generateMipmaps(const ObjToken<ITextureCubeR>& tex) override {
|
||||
std::vector<Command>& cmds = m_cmdBufs[m_fillBuf];
|
||||
cmds.emplace_back(Command::Op::GenerateMips);
|
||||
cmds.back().target = tex.get();
|
||||
}
|
||||
|
||||
void schedulePostFrameHandler(std::function<void(void)>&& func) { m_pendingPosts1.push_back(std::move(func)); }
|
||||
void schedulePostFrameHandler(std::function<void()>&& func) override { m_pendingPosts1.push_back(std::move(func)); }
|
||||
|
||||
void setClearColor(const float rgba[4]) {
|
||||
void setClearColor(const float rgba[4]) override {
|
||||
std::vector<Command>& cmds = m_cmdBufs[m_fillBuf];
|
||||
cmds.emplace_back(Command::Op::SetClearColor);
|
||||
cmds.back().rgba[0] = rgba[0];
|
||||
|
@ -1660,7 +1660,7 @@ struct GLCommandQueue final : IGraphicsCommandQueue {
|
|||
cmds.back().rgba[3] = rgba[3];
|
||||
}
|
||||
|
||||
void clearTarget(bool render = true, bool depth = true) {
|
||||
void clearTarget(bool render = true, bool depth = true) override {
|
||||
std::vector<Command>& cmds = m_cmdBufs[m_fillBuf];
|
||||
cmds.emplace_back(Command::Op::ClearTarget);
|
||||
cmds.back().flags = 0;
|
||||
|
@ -1670,21 +1670,21 @@ struct GLCommandQueue final : IGraphicsCommandQueue {
|
|||
cmds.back().flags |= GL_DEPTH_BUFFER_BIT;
|
||||
}
|
||||
|
||||
void draw(size_t start, size_t count) {
|
||||
void draw(size_t start, size_t count) override {
|
||||
std::vector<Command>& cmds = m_cmdBufs[m_fillBuf];
|
||||
cmds.emplace_back(Command::Op::Draw);
|
||||
cmds.back().start = start;
|
||||
cmds.back().count = count;
|
||||
}
|
||||
|
||||
void drawIndexed(size_t start, size_t count) {
|
||||
void drawIndexed(size_t start, size_t count) override {
|
||||
std::vector<Command>& cmds = m_cmdBufs[m_fillBuf];
|
||||
cmds.emplace_back(Command::Op::DrawIndexed);
|
||||
cmds.back().start = start;
|
||||
cmds.back().count = count;
|
||||
}
|
||||
|
||||
void drawInstances(size_t start, size_t count, size_t instCount, size_t startInst) {
|
||||
void drawInstances(size_t start, size_t count, size_t instCount, size_t startInst) override {
|
||||
std::vector<Command>& cmds = m_cmdBufs[m_fillBuf];
|
||||
cmds.emplace_back(Command::Op::DrawInstances);
|
||||
cmds.back().start = start;
|
||||
|
@ -1693,7 +1693,7 @@ struct GLCommandQueue final : IGraphicsCommandQueue {
|
|||
cmds.back().startInst = startInst;
|
||||
}
|
||||
|
||||
void drawInstancesIndexed(size_t start, size_t count, size_t instCount, size_t startInst) {
|
||||
void drawInstancesIndexed(size_t start, size_t count, size_t instCount, size_t startInst) override {
|
||||
std::vector<Command>& cmds = m_cmdBufs[m_fillBuf];
|
||||
cmds.emplace_back(Command::Op::DrawInstancesIndexed);
|
||||
cmds.back().start = start;
|
||||
|
@ -1703,7 +1703,7 @@ struct GLCommandQueue final : IGraphicsCommandQueue {
|
|||
}
|
||||
|
||||
void resolveBindTexture(const ObjToken<ITextureR>& texture, const SWindowRect& rect, bool tlOrigin, int bindIdx,
|
||||
bool color, bool depth, bool clearDepth) {
|
||||
bool color, bool depth, bool clearDepth) override {
|
||||
GLTextureR* tex = texture.cast<GLTextureR>();
|
||||
std::vector<Command>& cmds = m_cmdBufs[m_fillBuf];
|
||||
cmds.emplace_back(Command::Op::ResolveBindTexture);
|
||||
|
@ -1723,7 +1723,7 @@ struct GLCommandQueue final : IGraphicsCommandQueue {
|
|||
targetRect.size[1] = intersectRect.size[1];
|
||||
}
|
||||
|
||||
void resolveDisplay(const ObjToken<ITextureR>& source) {
|
||||
void resolveDisplay(const ObjToken<ITextureR>& source) override {
|
||||
std::vector<Command>& cmds = m_cmdBufs[m_fillBuf];
|
||||
cmds.emplace_back(Command::Op::Present);
|
||||
cmds.back().source = source;
|
||||
|
@ -1749,7 +1749,7 @@ struct GLCommandQueue final : IGraphicsCommandQueue {
|
|||
m_pendingCubeFboAdds.push_back(tex);
|
||||
}
|
||||
|
||||
void execute() {
|
||||
void execute() override {
|
||||
BOO_MSAN_NO_INTERCEPT
|
||||
SCOPED_GRAPHICS_DEBUG_GROUP(this, "GLCommandQueue::execute", {1.f, 0.f, 0.f, 1.f});
|
||||
std::unique_lock<std::mutex> lk(m_mt);
|
||||
|
|
|
@ -39,7 +39,7 @@ class HIDDeviceWinUSB final : public IHIDDevice {
|
|||
std::condition_variable m_initCond;
|
||||
std::thread m_thread;
|
||||
|
||||
bool _sendUSBInterruptTransfer(const uint8_t* data, size_t length) {
|
||||
bool _sendUSBInterruptTransfer(const uint8_t* data, size_t length) override {
|
||||
if (m_usbHandle) {
|
||||
ULONG lengthTransferred = 0;
|
||||
if (!WinUsb_WritePipe(m_usbHandle, m_usbIntfOutPipe, (PUCHAR)data, (ULONG)length, &lengthTransferred, NULL) ||
|
||||
|
@ -50,7 +50,7 @@ class HIDDeviceWinUSB final : public IHIDDevice {
|
|||
return false;
|
||||
}
|
||||
|
||||
size_t _receiveUSBInterruptTransfer(uint8_t* data, size_t length) {
|
||||
size_t _receiveUSBInterruptTransfer(uint8_t* data, size_t length) override {
|
||||
if (m_usbHandle) {
|
||||
ULONG lengthTransferred = 0;
|
||||
if (!WinUsb_ReadPipe(m_usbHandle, m_usbIntfInPipe, (PUCHAR)data, (ULONG)length, &lengthTransferred, NULL))
|
||||
|
@ -199,14 +199,14 @@ class HIDDeviceWinUSB final : public IHIDDevice {
|
|||
device->m_hidHandle = nullptr;
|
||||
}
|
||||
|
||||
void _deviceDisconnected() { m_runningTransferLoop = false; }
|
||||
void _deviceDisconnected() override { m_runningTransferLoop = false; }
|
||||
|
||||
std::vector<uint8_t> m_sendBuf;
|
||||
std::vector<uint8_t> m_recvBuf;
|
||||
|
||||
const PHIDP_PREPARSED_DATA _getReportDescriptor() { return m_preparsedData; }
|
||||
const PHIDP_PREPARSED_DATA _getReportDescriptor() override { return m_preparsedData; }
|
||||
|
||||
bool _sendHIDReport(const uint8_t* data, size_t length, HIDReportType tp, uint32_t message) {
|
||||
bool _sendHIDReport(const uint8_t* data, size_t length, HIDReportType tp, uint32_t message) override {
|
||||
size_t maxOut = std::max(m_minFeatureSz, std::max(m_minOutputSz, length));
|
||||
if (m_sendBuf.size() < maxOut)
|
||||
m_sendBuf.resize(maxOut);
|
||||
|
@ -250,7 +250,7 @@ class HIDDeviceWinUSB final : public IHIDDevice {
|
|||
return true;
|
||||
}
|
||||
|
||||
size_t _receiveHIDReport(uint8_t* data, size_t length, HIDReportType tp, uint32_t message) {
|
||||
size_t _receiveHIDReport(uint8_t* data, size_t length, HIDReportType tp, uint32_t message) override {
|
||||
size_t maxIn = std::max(m_minFeatureSz, std::max(m_minInputSz, length));
|
||||
if (m_recvBuf.size() < maxIn)
|
||||
m_recvBuf.resize(maxIn);
|
||||
|
@ -273,7 +273,7 @@ public:
|
|||
HIDDeviceWinUSB(DeviceToken& token, const std::shared_ptr<DeviceBase>& devImp)
|
||||
: m_token(token), m_devImp(devImp), m_devPath(token.getDevicePath()) {}
|
||||
|
||||
void _startThread() {
|
||||
void _startThread() override {
|
||||
std::unique_lock<std::mutex> lk(m_initMutex);
|
||||
DeviceType dType = m_token.getDeviceType();
|
||||
if (dType == DeviceType::USB)
|
||||
|
@ -287,7 +287,7 @@ public:
|
|||
m_initCond.wait(lk);
|
||||
}
|
||||
|
||||
~HIDDeviceWinUSB() {
|
||||
~HIDDeviceWinUSB() override {
|
||||
m_runningTransferLoop = false;
|
||||
if (m_thread.joinable())
|
||||
m_thread.detach();
|
||||
|
|
|
@ -227,29 +227,29 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
~HIDListenerWinUSB() {
|
||||
~HIDListenerWinUSB() override {
|
||||
m_xinputRunning = false;
|
||||
if (m_xinputThread.joinable())
|
||||
m_xinputThread.join();
|
||||
}
|
||||
|
||||
/* Automatic device scanning */
|
||||
bool startScanning() {
|
||||
bool startScanning() override {
|
||||
m_scanningEnabled = true;
|
||||
return true;
|
||||
}
|
||||
bool stopScanning() {
|
||||
bool stopScanning() override {
|
||||
m_scanningEnabled = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Manual device scanning */
|
||||
bool scanNow() {
|
||||
bool scanNow() override {
|
||||
_pollDevices(nullptr);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool _extDevConnect(const char* path) {
|
||||
bool _extDevConnect(const char* path) override {
|
||||
char upperPath[1024];
|
||||
strcpy_s(upperPath, 1024, path);
|
||||
CharUpperA(upperPath);
|
||||
|
@ -258,7 +258,7 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
bool _extDevDisconnect(const char* path) {
|
||||
bool _extDevDisconnect(const char* path) override {
|
||||
char upperPath[1024];
|
||||
strcpy_s(upperPath, 1024, path);
|
||||
CharUpperA(upperPath);
|
||||
|
|
|
@ -110,7 +110,7 @@ public:
|
|||
Log.report(logvisor::Info, fmt("using Metal renderer"));
|
||||
}
|
||||
|
||||
EPlatformType getPlatformType() const {
|
||||
EPlatformType getPlatformType() const override {
|
||||
return EPlatformType::Cocoa;
|
||||
}
|
||||
|
||||
|
@ -118,7 +118,7 @@ public:
|
|||
int m_clientReturn = 0;
|
||||
bool m_terminateNow = false;
|
||||
|
||||
int run() {
|
||||
int run() override {
|
||||
/* Spawn client thread */
|
||||
m_clientThread = std::thread([&]() {
|
||||
std::string thrName = std::string(getFriendlyName()) + " Client Thread";
|
||||
|
@ -161,23 +161,23 @@ public:
|
|||
[NSApp terminate:nil];
|
||||
}
|
||||
|
||||
SystemStringView getUniqueName() const {
|
||||
SystemStringView getUniqueName() const override {
|
||||
return m_uniqueName;
|
||||
}
|
||||
|
||||
SystemStringView getFriendlyName() const {
|
||||
SystemStringView getFriendlyName() const override {
|
||||
return m_friendlyName;
|
||||
}
|
||||
|
||||
SystemStringView getProcessName() const {
|
||||
SystemStringView getProcessName() const override {
|
||||
return m_pname;
|
||||
}
|
||||
|
||||
const std::vector<SystemString>& getArgs() const {
|
||||
const std::vector<SystemString>& getArgs() const override {
|
||||
return m_args;
|
||||
}
|
||||
|
||||
std::shared_ptr<IWindow> newWindow(std::string_view title) {
|
||||
std::shared_ptr<IWindow> newWindow(std::string_view title) override {
|
||||
auto newWindow = _WindowCocoaNew(title, &m_metalCtx);
|
||||
m_windows[newWindow->getPlatformHandle()] = newWindow;
|
||||
return newWindow;
|
||||
|
|
|
@ -139,7 +139,7 @@ protected:
|
|||
}
|
||||
|
||||
public:
|
||||
~GraphicsContextCocoa() {
|
||||
~GraphicsContextCocoa() override {
|
||||
if (m_dispLink) {
|
||||
CVDisplayLinkStop(m_dispLink);
|
||||
CVDisplayLinkRelease(m_dispLink);
|
||||
|
@ -223,36 +223,36 @@ public:
|
|||
m_dataFactory = _NewGLDataFactory(this, glCtx);
|
||||
}
|
||||
|
||||
~GraphicsContextCocoaGL()
|
||||
~GraphicsContextCocoaGL() override
|
||||
{
|
||||
m_commandQueue->stopRenderer();
|
||||
fmt::print(fmt("CONTEXT DESTROYED\n"));
|
||||
}
|
||||
|
||||
void _setCallback(IWindowCallback* cb)
|
||||
void _setCallback(IWindowCallback* cb) override
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> lk(m_callbackMutex);
|
||||
m_callback = cb;
|
||||
}
|
||||
|
||||
EGraphicsAPI getAPI() const
|
||||
EGraphicsAPI getAPI() const override
|
||||
{
|
||||
return m_api;
|
||||
}
|
||||
|
||||
EPixelFormat getPixelFormat() const
|
||||
EPixelFormat getPixelFormat() const override
|
||||
{
|
||||
return m_pf;
|
||||
}
|
||||
|
||||
void setPixelFormat(EPixelFormat pf)
|
||||
void setPixelFormat(EPixelFormat pf) override
|
||||
{
|
||||
if (pf > EPixelFormat::RGBAF32_Z24)
|
||||
return;
|
||||
m_pf = pf;
|
||||
}
|
||||
|
||||
bool initializeContext(void*)
|
||||
bool initializeContext(void*) override
|
||||
{
|
||||
m_nsContext = [[GraphicsContextCocoaGLInternal alloc] initWithBooContext:this];
|
||||
if (!m_nsContext)
|
||||
|
@ -266,26 +266,26 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
void makeCurrent()
|
||||
void makeCurrent() override
|
||||
{
|
||||
[[m_nsContext openGLContext] makeCurrentContext];
|
||||
}
|
||||
|
||||
void postInit()
|
||||
void postInit() override
|
||||
{
|
||||
}
|
||||
|
||||
IGraphicsCommandQueue* getCommandQueue()
|
||||
IGraphicsCommandQueue* getCommandQueue() override
|
||||
{
|
||||
return m_commandQueue.get();
|
||||
}
|
||||
|
||||
IGraphicsDataFactory* getDataFactory()
|
||||
IGraphicsDataFactory* getDataFactory() override
|
||||
{
|
||||
return m_dataFactory.get();
|
||||
}
|
||||
|
||||
IGraphicsDataFactory* getMainContextDataFactory()
|
||||
IGraphicsDataFactory* getMainContextDataFactory() override
|
||||
{
|
||||
if (!m_mainCtx)
|
||||
{
|
||||
|
@ -298,7 +298,7 @@ public:
|
|||
return m_dataFactory.get();
|
||||
}
|
||||
|
||||
IGraphicsDataFactory* getLoadContextDataFactory()
|
||||
IGraphicsDataFactory* getLoadContextDataFactory() override
|
||||
{
|
||||
if (!m_loadCtx)
|
||||
{
|
||||
|
@ -311,12 +311,12 @@ public:
|
|||
return m_dataFactory.get();
|
||||
}
|
||||
|
||||
void present()
|
||||
void present() override
|
||||
{
|
||||
[[m_nsContext openGLContext] flushBuffer];
|
||||
}
|
||||
|
||||
BooCocoaResponder* responder() const
|
||||
BooCocoaResponder* responder() const override
|
||||
{
|
||||
if (!m_nsContext)
|
||||
return nullptr;
|
||||
|
@ -384,31 +384,31 @@ public:
|
|||
m_dataFactory = _NewMetalDataFactory(this, metalCtx);
|
||||
}
|
||||
|
||||
~GraphicsContextCocoaMetal() {
|
||||
~GraphicsContextCocoaMetal() override {
|
||||
m_commandQueue->stopRenderer();
|
||||
m_metalCtx->m_windows.erase(m_parentWindow);
|
||||
}
|
||||
|
||||
void _setCallback(IWindowCallback* cb) {
|
||||
void _setCallback(IWindowCallback* cb) override {
|
||||
std::lock_guard<std::recursive_mutex> lk(m_callbackMutex);
|
||||
m_callback = cb;
|
||||
}
|
||||
|
||||
EGraphicsAPI getAPI() const {
|
||||
EGraphicsAPI getAPI() const override {
|
||||
return m_api;
|
||||
}
|
||||
|
||||
EPixelFormat getPixelFormat() const {
|
||||
EPixelFormat getPixelFormat() const override {
|
||||
return m_pf;
|
||||
}
|
||||
|
||||
void setPixelFormat(EPixelFormat pf) {
|
||||
void setPixelFormat(EPixelFormat pf) override {
|
||||
if (pf > EPixelFormat::RGBAF32_Z24)
|
||||
return;
|
||||
m_pf = pf;
|
||||
}
|
||||
|
||||
bool initializeContext(void*) {
|
||||
bool initializeContext(void*) override {
|
||||
MetalContext::Window& w = m_metalCtx->m_windows[m_parentWindow];
|
||||
m_nsContext = [[GraphicsContextCocoaMetalInternal alloc] initWithBooContext:this];
|
||||
if (!m_nsContext)
|
||||
|
@ -423,32 +423,32 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
void makeCurrent() {
|
||||
void makeCurrent() override {
|
||||
}
|
||||
|
||||
void postInit() {
|
||||
void postInit() override {
|
||||
}
|
||||
|
||||
IGraphicsCommandQueue* getCommandQueue() {
|
||||
IGraphicsCommandQueue* getCommandQueue() override {
|
||||
return m_commandQueue.get();
|
||||
}
|
||||
|
||||
IGraphicsDataFactory* getDataFactory() {
|
||||
IGraphicsDataFactory* getDataFactory() override {
|
||||
return m_dataFactory.get();
|
||||
}
|
||||
|
||||
IGraphicsDataFactory* getMainContextDataFactory() {
|
||||
IGraphicsDataFactory* getMainContextDataFactory() override {
|
||||
return m_dataFactory.get();
|
||||
}
|
||||
|
||||
IGraphicsDataFactory* getLoadContextDataFactory() {
|
||||
IGraphicsDataFactory* getLoadContextDataFactory() override {
|
||||
return m_dataFactory.get();
|
||||
}
|
||||
|
||||
void present() {
|
||||
void present() override {
|
||||
}
|
||||
|
||||
BooCocoaResponder* responder() const {
|
||||
BooCocoaResponder* responder() const override {
|
||||
if (!m_nsContext)
|
||||
return nullptr;
|
||||
return m_nsContext->resp;
|
||||
|
@ -1252,47 +1252,47 @@ public:
|
|||
m_nsWindow = nullptr;
|
||||
}
|
||||
|
||||
~WindowCocoa() {
|
||||
~WindowCocoa() override {
|
||||
APP->_deletedWindow(this);
|
||||
}
|
||||
|
||||
void setCallback(IWindowCallback* cb) {
|
||||
void setCallback(IWindowCallback* cb) override {
|
||||
m_gfxCtx->_setCallback(cb);
|
||||
}
|
||||
|
||||
void closeWindow() {
|
||||
void closeWindow() override {
|
||||
dispatch_sync(dispatch_get_main_queue(),
|
||||
^{
|
||||
[m_nsWindow close];
|
||||
});
|
||||
}
|
||||
|
||||
void showWindow() {
|
||||
void showWindow() override {
|
||||
dispatch_sync(dispatch_get_main_queue(),
|
||||
^{
|
||||
[m_nsWindow makeKeyAndOrderFront:nil];
|
||||
});
|
||||
}
|
||||
|
||||
void hideWindow() {
|
||||
void hideWindow() override {
|
||||
dispatch_sync(dispatch_get_main_queue(),
|
||||
^{
|
||||
[m_nsWindow orderOut:nil];
|
||||
});
|
||||
}
|
||||
|
||||
std::string getTitle() {
|
||||
std::string getTitle() override {
|
||||
return [[m_nsWindow title] UTF8String];
|
||||
}
|
||||
|
||||
void setTitle(std::string_view title) {
|
||||
void setTitle(std::string_view title) override {
|
||||
dispatch_sync(dispatch_get_main_queue(),
|
||||
^{
|
||||
[m_nsWindow setTitle:[NSString stringWithUTF8String:title.data()]];
|
||||
});
|
||||
}
|
||||
|
||||
void setCursor(EMouseCursor cursor) {
|
||||
void setCursor(EMouseCursor cursor) override {
|
||||
if (cursor == m_cursor)
|
||||
return;
|
||||
m_cursor = cursor;
|
||||
|
@ -1320,14 +1320,14 @@ public:
|
|||
});
|
||||
}
|
||||
|
||||
void setWaitCursor(bool wait) {}
|
||||
void setWaitCursor(bool wait) override {}
|
||||
|
||||
double getWindowRefreshRate() const {
|
||||
double getWindowRefreshRate() const override {
|
||||
/* TODO: Actually get refresh rate */
|
||||
return 60.0;
|
||||
}
|
||||
|
||||
void setWindowFrameDefault() {
|
||||
void setWindowFrameDefault() override {
|
||||
dispatch_sync(dispatch_get_main_queue(),
|
||||
^{
|
||||
NSScreen* mainScreen = [NSScreen mainScreen];
|
||||
|
@ -1338,7 +1338,7 @@ public:
|
|||
});
|
||||
}
|
||||
|
||||
void getWindowFrame(float& xOut, float& yOut, float& wOut, float& hOut) const {
|
||||
void getWindowFrame(float& xOut, float& yOut, float& wOut, float& hOut) const override {
|
||||
NSView* view = [m_nsWindow contentView];
|
||||
NSRect wFrame = [view convertRectToBacking:view.frame];
|
||||
xOut = wFrame.origin.x;
|
||||
|
@ -1347,7 +1347,7 @@ public:
|
|||
hOut = wFrame.size.height;
|
||||
}
|
||||
|
||||
void getWindowFrame(int& xOut, int& yOut, int& wOut, int& hOut) const {
|
||||
void getWindowFrame(int& xOut, int& yOut, int& wOut, int& hOut) const override {
|
||||
NSView* view = [m_nsWindow contentView];
|
||||
NSRect wFrame = [view convertRectToBacking:view.frame];
|
||||
xOut = wFrame.origin.x;
|
||||
|
@ -1356,7 +1356,7 @@ public:
|
|||
hOut = wFrame.size.height;
|
||||
}
|
||||
|
||||
void setWindowFrame(float x, float y, float w, float h) {
|
||||
void setWindowFrame(float x, float y, float w, float h) override {
|
||||
dispatch_sync(dispatch_get_main_queue(),
|
||||
^{
|
||||
[m_nsWindow setContentSize:NSMakeSize(w, h)];
|
||||
|
@ -1364,7 +1364,7 @@ public:
|
|||
});
|
||||
}
|
||||
|
||||
void setWindowFrame(int x, int y, int w, int h) {
|
||||
void setWindowFrame(int x, int y, int w, int h) override {
|
||||
dispatch_sync(dispatch_get_main_queue(),
|
||||
^{
|
||||
[m_nsWindow setContentSize:NSMakeSize(w, h)];
|
||||
|
@ -1372,15 +1372,15 @@ public:
|
|||
});
|
||||
}
|
||||
|
||||
float getVirtualPixelFactor() const {
|
||||
float getVirtualPixelFactor() const override {
|
||||
return [m_nsWindow backingScaleFactor];
|
||||
}
|
||||
|
||||
bool isFullscreen() const {
|
||||
bool isFullscreen() const override {
|
||||
return ([m_nsWindow styleMask] & NSWindowStyleMaskFullScreen) == NSWindowStyleMaskFullScreen;
|
||||
}
|
||||
|
||||
void setFullscreen(bool fs) {
|
||||
void setFullscreen(bool fs) override {
|
||||
if ((fs && !isFullscreen()) || (!fs && isFullscreen()))
|
||||
dispatch_sync(dispatch_get_main_queue(),
|
||||
^{
|
||||
|
@ -1388,7 +1388,7 @@ public:
|
|||
});
|
||||
}
|
||||
|
||||
void claimKeyboardFocus(const int coord[2]) {
|
||||
void claimKeyboardFocus(const int coord[2]) override {
|
||||
BooCocoaResponder* resp = m_gfxCtx->responder();
|
||||
if (resp) {
|
||||
dispatch_async(dispatch_get_main_queue(),
|
||||
|
@ -1401,7 +1401,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
bool clipboardCopy(EClipboardType type, const uint8_t* data, size_t sz) {
|
||||
bool clipboardCopy(EClipboardType type, const uint8_t* data, size_t sz) override {
|
||||
NSPasteboard* pb = [NSPasteboard generalPasteboard];
|
||||
[pb clearContents];
|
||||
NSData* d = [NSData dataWithBytes:data length:sz];
|
||||
|
@ -1409,7 +1409,7 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
std::unique_ptr<uint8_t[]> clipboardPaste(EClipboardType type, size_t& sz) {
|
||||
std::unique_ptr<uint8_t[]> clipboardPaste(EClipboardType type, size_t& sz) override {
|
||||
NSPasteboard* pb = [NSPasteboard generalPasteboard];
|
||||
NSData* d = [pb dataForType:ClipboardTypes[int(type)]];
|
||||
if (!d)
|
||||
|
@ -1420,11 +1420,11 @@ public:
|
|||
return ret;
|
||||
}
|
||||
|
||||
ETouchType getTouchType() const {
|
||||
ETouchType getTouchType() const override {
|
||||
return ETouchType::Trackpad;
|
||||
}
|
||||
|
||||
void setStyle(EWindowStyle style) {
|
||||
void setStyle(EWindowStyle style) override {
|
||||
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 101000
|
||||
if ((style & EWindowStyle::Titlebar) != EWindowStyle::None)
|
||||
m_nsWindow.titleVisibility = NSWindowTitleVisible;
|
||||
|
@ -1443,7 +1443,7 @@ public:
|
|||
m_nsWindow.styleMask &= ~NSWindowStyleMaskResizable;
|
||||
}
|
||||
|
||||
EWindowStyle getStyle() const {
|
||||
EWindowStyle getStyle() const override {
|
||||
EWindowStyle retval = EWindowStyle::None;
|
||||
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 101000
|
||||
retval |= m_nsWindow.titleVisibility == NSWindowTitleVisible ? EWindowStyle::Titlebar : EWindowStyle::None;
|
||||
|
@ -1455,34 +1455,34 @@ public:
|
|||
return retval;
|
||||
}
|
||||
|
||||
void setTouchBarProvider(void* provider) {
|
||||
void setTouchBarProvider(void* provider) override {
|
||||
dispatch_sync(dispatch_get_main_queue(),
|
||||
^{
|
||||
[m_nsWindow setTouchBarProvider:(__bridge_transfer id) provider];
|
||||
});
|
||||
}
|
||||
|
||||
int waitForRetrace() {
|
||||
int waitForRetrace() override {
|
||||
return static_cast<GraphicsContextCocoa*>(m_gfxCtx)->waitForRetrace();
|
||||
}
|
||||
|
||||
uintptr_t getPlatformHandle() const {
|
||||
uintptr_t getPlatformHandle() const override {
|
||||
return (uintptr_t) m_nsWindow;
|
||||
}
|
||||
|
||||
IGraphicsCommandQueue* getCommandQueue() {
|
||||
IGraphicsCommandQueue* getCommandQueue() override {
|
||||
return m_gfxCtx->getCommandQueue();
|
||||
}
|
||||
|
||||
IGraphicsDataFactory* getDataFactory() {
|
||||
IGraphicsDataFactory* getDataFactory() override {
|
||||
return m_gfxCtx->getDataFactory();
|
||||
}
|
||||
|
||||
IGraphicsDataFactory* getMainContextDataFactory() {
|
||||
IGraphicsDataFactory* getMainContextDataFactory() override {
|
||||
return m_gfxCtx->getMainContextDataFactory();
|
||||
}
|
||||
|
||||
IGraphicsDataFactory* getLoadContextDataFactory() {
|
||||
IGraphicsDataFactory* getLoadContextDataFactory() override {
|
||||
return m_gfxCtx->getLoadContextDataFactory();
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ class ApplicationNX : public IApplication {
|
|||
|
||||
NXContext m_nxCtx;
|
||||
|
||||
void _deletedWindow(IWindow* window) {}
|
||||
void _deletedWindow(IWindow* window) override {}
|
||||
|
||||
public:
|
||||
ApplicationNX(IApplicationCallback& callback, std::string_view uniqueName, std::string_view friendlyName,
|
||||
|
@ -29,9 +29,9 @@ public:
|
|||
uint32_t anisotropy, bool deepColor, bool singleInstance)
|
||||
: m_callback(callback), m_uniqueName(uniqueName), m_friendlyName(friendlyName), m_pname(pname), m_args(args) {}
|
||||
|
||||
EPlatformType getPlatformType() const { return EPlatformType::NX; }
|
||||
EPlatformType getPlatformType() const override { return EPlatformType::NX; }
|
||||
|
||||
int run() {
|
||||
int run() override {
|
||||
/* Spawn client thread */
|
||||
int clientReturn = INT_MIN;
|
||||
std::mutex initmt;
|
||||
|
@ -63,16 +63,16 @@ public:
|
|||
return 0;
|
||||
}
|
||||
|
||||
std::string_view getUniqueName() const { return m_uniqueName; }
|
||||
std::string_view getUniqueName() const override { return m_uniqueName; }
|
||||
|
||||
std::string_view getFriendlyName() const { return m_friendlyName; }
|
||||
std::string_view getFriendlyName() const override { return m_friendlyName; }
|
||||
|
||||
std::string_view getProcessName() const { return m_pname; }
|
||||
std::string_view getProcessName() const override { return m_pname; }
|
||||
|
||||
const std::vector<std::string>& getArgs() const { return m_args; }
|
||||
const std::vector<std::string>& getArgs() const override { return m_args; }
|
||||
|
||||
std::shared_ptr<IWindow> m_window;
|
||||
std::shared_ptr<IWindow> newWindow(std::string_view title) {
|
||||
std::shared_ptr<IWindow> newWindow(std::string_view title) override {
|
||||
if (m_window)
|
||||
Log.report(logvisor::Fatal, fmt("Only 1 window allowed on NX"));
|
||||
m_window = _WindowNXNew(title, &m_nxCtx);
|
||||
|
|
|
@ -21,18 +21,18 @@ public:
|
|||
m_commandQueue = _NewNXCommandQueue(nxCtx, this);
|
||||
}
|
||||
|
||||
EGraphicsAPI getAPI() const { return EGraphicsAPI::NX; }
|
||||
EPixelFormat getPixelFormat() const { return EPixelFormat::RGBA8; }
|
||||
void setPixelFormat(EPixelFormat pf) {}
|
||||
bool initializeContext(void* handle) { return m_nxCtx->initialize(); }
|
||||
void makeCurrent() {}
|
||||
void postInit() {}
|
||||
void present() {}
|
||||
EGraphicsAPI getAPI() const override { return EGraphicsAPI::NX; }
|
||||
EPixelFormat getPixelFormat() const override { return EPixelFormat::RGBA8; }
|
||||
void setPixelFormat(EPixelFormat pf) override {}
|
||||
bool initializeContext(void* handle) override { return m_nxCtx->initialize(); }
|
||||
void makeCurrent() override {}
|
||||
void postInit() override {}
|
||||
void present() override {}
|
||||
|
||||
IGraphicsCommandQueue* getCommandQueue() { return m_commandQueue.get(); }
|
||||
IGraphicsDataFactory* getDataFactory() { return m_dataFactory.get(); }
|
||||
IGraphicsDataFactory* getMainContextDataFactory() { return m_dataFactory.get(); }
|
||||
IGraphicsDataFactory* getLoadContextDataFactory() { return m_dataFactory.get(); }
|
||||
IGraphicsCommandQueue* getCommandQueue() override { return m_commandQueue.get(); }
|
||||
IGraphicsDataFactory* getDataFactory() override { return m_dataFactory.get(); }
|
||||
IGraphicsDataFactory* getMainContextDataFactory() override { return m_dataFactory.get(); }
|
||||
IGraphicsDataFactory* getLoadContextDataFactory() override { return m_dataFactory.get(); }
|
||||
};
|
||||
|
||||
class WindowNX : public IWindow {
|
||||
|
@ -45,20 +45,20 @@ public:
|
|||
m_gfxCtx->initializeContext(nullptr);
|
||||
}
|
||||
|
||||
void setCallback(IWindowCallback* cb) { m_callback = cb; }
|
||||
void setCallback(IWindowCallback* cb) override { m_callback = cb; }
|
||||
|
||||
void closeWindow() {}
|
||||
void showWindow() {}
|
||||
void hideWindow() {}
|
||||
void closeWindow() override {}
|
||||
void showWindow() override {}
|
||||
void hideWindow() override {}
|
||||
|
||||
SystemString getTitle() { return m_title; }
|
||||
void setTitle(SystemStringView title) { m_title = title; }
|
||||
SystemString getTitle() override { return m_title; }
|
||||
void setTitle(SystemStringView title) override { m_title = title; }
|
||||
|
||||
void setCursor(EMouseCursor cursor) {}
|
||||
void setWaitCursor(bool wait) {}
|
||||
void setCursor(EMouseCursor cursor) override {}
|
||||
void setWaitCursor(bool wait) override {}
|
||||
|
||||
void setWindowFrameDefault() {}
|
||||
void getWindowFrame(float& xOut, float& yOut, float& wOut, float& hOut) const {
|
||||
void setWindowFrameDefault() override {}
|
||||
void getWindowFrame(float& xOut, float& yOut, float& wOut, float& hOut) const override {
|
||||
u32 width, height;
|
||||
gfxGetFramebufferResolution(&width, &height);
|
||||
xOut = 0;
|
||||
|
@ -66,7 +66,7 @@ public:
|
|||
wOut = width;
|
||||
hOut = height;
|
||||
}
|
||||
void getWindowFrame(int& xOut, int& yOut, int& wOut, int& hOut) const {
|
||||
void getWindowFrame(int& xOut, int& yOut, int& wOut, int& hOut) const override {
|
||||
u32 width, height;
|
||||
gfxGetFramebufferResolution(&width, &height);
|
||||
xOut = 0;
|
||||
|
@ -74,37 +74,37 @@ public:
|
|||
wOut = width;
|
||||
hOut = height;
|
||||
}
|
||||
void setWindowFrame(float x, float y, float w, float h) {}
|
||||
void setWindowFrame(int x, int y, int w, int h) {}
|
||||
float getVirtualPixelFactor() const { return 1.f; }
|
||||
void setWindowFrame(float x, float y, float w, float h) override {}
|
||||
void setWindowFrame(int x, int y, int w, int h) override {}
|
||||
float getVirtualPixelFactor() const override { return 1.f; }
|
||||
|
||||
bool isFullscreen() const { return true; }
|
||||
void setFullscreen(bool fs) {}
|
||||
bool isFullscreen() const override { return true; }
|
||||
void setFullscreen(bool fs) override {}
|
||||
|
||||
void claimKeyboardFocus(const int coord[2]) {}
|
||||
bool clipboardCopy(EClipboardType type, const uint8_t* data, size_t sz) { return false; }
|
||||
std::unique_ptr<uint8_t[]> clipboardPaste(EClipboardType type, size_t& sz) { return {}; }
|
||||
void claimKeyboardFocus(const int coord[2]) override {}
|
||||
bool clipboardCopy(EClipboardType type, const uint8_t* data, size_t sz) override { return false; }
|
||||
std::unique_ptr<uint8_t[]> clipboardPaste(EClipboardType type, size_t& sz) override { return {}; }
|
||||
|
||||
void waitForRetrace() {}
|
||||
void waitForRetrace() override {}
|
||||
|
||||
uintptr_t getPlatformHandle() const { return 0; }
|
||||
bool _incomingEvent(void* event) {
|
||||
uintptr_t getPlatformHandle() const override { return 0; }
|
||||
bool _incomingEvent(void* event) override {
|
||||
(void)event;
|
||||
return false;
|
||||
}
|
||||
void _cleanup() {}
|
||||
void _cleanup() override {}
|
||||
|
||||
ETouchType getTouchType() const { return ETouchType::Display; }
|
||||
ETouchType getTouchType() const override { return ETouchType::Display; }
|
||||
|
||||
void setStyle(EWindowStyle style) {}
|
||||
EWindowStyle getStyle() const { return EWindowStyle::None; }
|
||||
void setStyle(EWindowStyle style) override {}
|
||||
EWindowStyle getStyle() const override { return EWindowStyle::None; }
|
||||
|
||||
void setTouchBarProvider(void*) {}
|
||||
void setTouchBarProvider(void*) override {}
|
||||
|
||||
IGraphicsCommandQueue* getCommandQueue() { return m_gfxCtx->getCommandQueue(); }
|
||||
IGraphicsDataFactory* getDataFactory() { return m_gfxCtx->getDataFactory(); }
|
||||
IGraphicsDataFactory* getMainContextDataFactory() { return m_gfxCtx->getMainContextDataFactory(); }
|
||||
IGraphicsDataFactory* getLoadContextDataFactory() { return m_gfxCtx->getLoadContextDataFactory(); }
|
||||
IGraphicsCommandQueue* getCommandQueue() override { return m_gfxCtx->getCommandQueue(); }
|
||||
IGraphicsDataFactory* getDataFactory() override { return m_gfxCtx->getDataFactory(); }
|
||||
IGraphicsDataFactory* getMainContextDataFactory() override { return m_gfxCtx->getMainContextDataFactory(); }
|
||||
IGraphicsDataFactory* getLoadContextDataFactory() override { return m_gfxCtx->getLoadContextDataFactory(); }
|
||||
};
|
||||
|
||||
std::shared_ptr<IWindow> _WindowNXNew(std::string_view title, NXContext* nxCtx) {
|
||||
|
|
|
@ -49,7 +49,7 @@ class ApplicationUWP final : public IApplication {
|
|||
|
||||
Boo3DAppContextUWP m_3dCtx;
|
||||
|
||||
void _deletedWindow(IWindow* window) {}
|
||||
void _deletedWindow(IWindow* window) override {}
|
||||
|
||||
public:
|
||||
ApplicationUWP(IApplicationCallback& callback, SystemStringView uniqueName, SystemStringView friendlyName,
|
||||
|
@ -180,10 +180,10 @@ public:
|
|||
Log.report(logvisor::Fatal, fmt("system doesn't support D3D11 or D3D12"));
|
||||
}
|
||||
|
||||
EPlatformType getPlatformType() const { return EPlatformType::UWP; }
|
||||
EPlatformType getPlatformType() const override { return EPlatformType::UWP; }
|
||||
|
||||
std::thread m_clientThread;
|
||||
int run() {
|
||||
int run() override {
|
||||
/* Spawn client thread */
|
||||
int clientReturn = 0;
|
||||
m_clientThread = std::thread([&]() {
|
||||
|
@ -203,15 +203,15 @@ public:
|
|||
m_clientThread.join();
|
||||
}
|
||||
|
||||
SystemStringView getUniqueName() const { return m_uniqueName; }
|
||||
SystemStringView getUniqueName() const override { return m_uniqueName; }
|
||||
|
||||
SystemStringView getFriendlyName() const { return m_friendlyName; }
|
||||
SystemStringView getFriendlyName() const override { return m_friendlyName; }
|
||||
|
||||
SystemStringView getProcessName() const { return m_pname; }
|
||||
SystemStringView getProcessName() const override { return m_pname; }
|
||||
|
||||
const std::vector<SystemString>& getArgs() const { return m_args; }
|
||||
const std::vector<SystemString>& getArgs() const override { return m_args; }
|
||||
|
||||
std::shared_ptr<IWindow> newWindow(SystemStringView title, uint32_t sampleCount) {
|
||||
std::shared_ptr<IWindow> newWindow(SystemStringView title, uint32_t sampleCount) override {
|
||||
if (!m_issuedWindow) {
|
||||
m_issuedWindow = true;
|
||||
return m_window;
|
||||
|
|
|
@ -86,7 +86,7 @@ class ApplicationWin32 final : public IApplication {
|
|||
PFN_vkGetInstanceProcAddr m_getVkProc = nullptr;
|
||||
#endif
|
||||
|
||||
void _deletedWindow(IWindow* window) { m_allWindows.erase(HWND(window->getPlatformHandle())); }
|
||||
void _deletedWindow(IWindow* window) override { m_allWindows.erase(HWND(window->getPlatformHandle())); }
|
||||
|
||||
public:
|
||||
ApplicationWin32(IApplicationCallback& callback, SystemStringView uniqueName, SystemStringView friendlyName,
|
||||
|
@ -272,7 +272,7 @@ public:
|
|||
Log.report(logvisor::Fatal, fmt("system doesn't support Vulkan, D3D11, or OpenGL"));
|
||||
}
|
||||
|
||||
EPlatformType getPlatformType() const { return EPlatformType::Win32; }
|
||||
EPlatformType getPlatformType() const override { return EPlatformType::Win32; }
|
||||
|
||||
LRESULT winHwndHandler(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
|
||||
/* Lookup boo window instance */
|
||||
|
@ -358,7 +358,7 @@ public:
|
|||
g_nwcv.notify_one();
|
||||
}
|
||||
|
||||
int run() {
|
||||
int run() override {
|
||||
g_mainThreadId = GetCurrentThreadId();
|
||||
|
||||
/* Spawn client thread */
|
||||
|
@ -424,22 +424,22 @@ public:
|
|||
return clientReturn;
|
||||
}
|
||||
|
||||
~ApplicationWin32() {
|
||||
~ApplicationWin32() override {
|
||||
for (auto& p : m_allWindows)
|
||||
if (auto w = p.second.lock())
|
||||
w->_cleanup();
|
||||
}
|
||||
|
||||
SystemStringView getUniqueName() const { return m_uniqueName; }
|
||||
SystemStringView getUniqueName() const override { return m_uniqueName; }
|
||||
|
||||
SystemStringView getFriendlyName() const { return m_friendlyName; }
|
||||
SystemStringView getFriendlyName() const override { return m_friendlyName; }
|
||||
|
||||
SystemStringView getProcessName() const { return m_pname; }
|
||||
SystemStringView getProcessName() const override { return m_pname; }
|
||||
|
||||
const std::vector<SystemString>& getArgs() const { return m_args; }
|
||||
const std::vector<SystemString>& getArgs() const override { return m_args; }
|
||||
|
||||
std::shared_ptr<IWindow> m_mwret;
|
||||
std::shared_ptr<IWindow> newWindow(SystemStringView title) {
|
||||
std::shared_ptr<IWindow> newWindow(SystemStringView title) override {
|
||||
if (GetCurrentThreadId() != g_mainThreadId) {
|
||||
std::unique_lock<std::mutex> lk(g_nwmt);
|
||||
if (!PostThreadMessageW(g_mainThreadId, WM_USER, WPARAM(&title), 0))
|
||||
|
|
|
@ -117,7 +117,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
~GraphicsContextUWPD3D() {
|
||||
~GraphicsContextUWPD3D() override {
|
||||
#if _WIN32_WINNT_WIN10
|
||||
if (m_3dCtx.m_ctx12.m_dev)
|
||||
m_3dCtx.m_ctx12.m_windows.erase(m_parentWindow);
|
||||
|
@ -126,33 +126,33 @@ public:
|
|||
m_3dCtx.m_ctx11.m_windows.erase(m_parentWindow);
|
||||
}
|
||||
|
||||
void _setCallback(IWindowCallback* cb) { m_callback = cb; }
|
||||
void _setCallback(IWindowCallback* cb) override { m_callback = cb; }
|
||||
|
||||
EGraphicsAPI getAPI() const { return m_api; }
|
||||
EGraphicsAPI getAPI() const override { return m_api; }
|
||||
|
||||
EPixelFormat getPixelFormat() const { return m_pf; }
|
||||
EPixelFormat getPixelFormat() const override { return m_pf; }
|
||||
|
||||
void setPixelFormat(EPixelFormat pf) {
|
||||
void setPixelFormat(EPixelFormat pf) override {
|
||||
if (pf > EPixelFormat::RGBAF32_Z24)
|
||||
return;
|
||||
m_pf = pf;
|
||||
}
|
||||
|
||||
bool initializeContext(void*) { return true; }
|
||||
bool initializeContext(void*) override { return true; }
|
||||
|
||||
void makeCurrent() {}
|
||||
void makeCurrent() override {}
|
||||
|
||||
void postInit() {}
|
||||
void postInit() override {}
|
||||
|
||||
void present() {}
|
||||
void present() override {}
|
||||
|
||||
IGraphicsCommandQueue* getCommandQueue() { return m_commandQueue; }
|
||||
IGraphicsCommandQueue* getCommandQueue() override { return m_commandQueue; }
|
||||
|
||||
IGraphicsDataFactory* getDataFactory() { return m_dataFactory; }
|
||||
IGraphicsDataFactory* getDataFactory() override { return m_dataFactory; }
|
||||
|
||||
IGraphicsDataFactory* getMainContextDataFactory() { return m_dataFactory; }
|
||||
IGraphicsDataFactory* getMainContextDataFactory() override { return m_dataFactory; }
|
||||
|
||||
IGraphicsDataFactory* getLoadContextDataFactory() { return m_dataFactory; }
|
||||
IGraphicsDataFactory* getLoadContextDataFactory() override { return m_dataFactory; }
|
||||
};
|
||||
|
||||
static uint32_t translateKeysym(CoreWindow ^ window, VirtualKey sym, ESpecialKey& specialSym,
|
||||
|
@ -304,76 +304,78 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
~WindowUWP() {}
|
||||
~WindowUWP() override = default;
|
||||
|
||||
void setCallback(IWindowCallback* cb) { m_callback = cb; }
|
||||
void setCallback(IWindowCallback* cb) override { m_callback = cb; }
|
||||
|
||||
void closeWindow() { m_coreWindow->Close(); }
|
||||
void closeWindow() override { m_coreWindow->Close(); }
|
||||
|
||||
void showWindow() {}
|
||||
void showWindow() override {}
|
||||
|
||||
void hideWindow() {}
|
||||
void hideWindow() override {}
|
||||
|
||||
SystemString getTitle() { return SystemString(m_appView->Title->Data()); }
|
||||
SystemString getTitle() override { return SystemString(m_appView->Title->Data()); }
|
||||
|
||||
void setTitle(SystemStringView title) { m_appView->Title = ref new Platform::String(title.data()); }
|
||||
void setTitle(SystemStringView title) override { m_appView->Title = ref new Platform::String(title.data()); }
|
||||
|
||||
void setCursor(EMouseCursor cursor) {}
|
||||
void setCursor(EMouseCursor cursor) override {}
|
||||
|
||||
void setWaitCursor(bool wait) {}
|
||||
void setWaitCursor(bool wait) override {}
|
||||
|
||||
double getWindowRefreshRate() const {
|
||||
/* TODO: Actually get refresh rate */
|
||||
return 60.0;
|
||||
}
|
||||
|
||||
void setWindowFrameDefault() {}
|
||||
void setWindowFrameDefault() override {}
|
||||
|
||||
void getWindowFrame(float& xOut, float& yOut, float& wOut, float& hOut) const {
|
||||
void getWindowFrame(float& xOut, float& yOut, float& wOut, float& hOut) const override {
|
||||
xOut = m_bounds.X * m_dispInfoDpiFactor;
|
||||
yOut = m_bounds.Y * m_dispInfoDpiFactor;
|
||||
wOut = m_bounds.Width * m_dispInfoDpiFactor;
|
||||
hOut = m_bounds.Height * m_dispInfoDpiFactor;
|
||||
}
|
||||
|
||||
void getWindowFrame(int& xOut, int& yOut, int& wOut, int& hOut) const {
|
||||
void getWindowFrame(int& xOut, int& yOut, int& wOut, int& hOut) const override {
|
||||
xOut = m_bounds.X * m_dispInfoDpiFactor;
|
||||
yOut = m_bounds.Y * m_dispInfoDpiFactor;
|
||||
wOut = m_bounds.Width * m_dispInfoDpiFactor;
|
||||
hOut = m_bounds.Height * m_dispInfoDpiFactor;
|
||||
}
|
||||
|
||||
void setWindowFrame(float x, float y, float w, float h) {}
|
||||
void setWindowFrame(float x, float y, float w, float h) override {}
|
||||
|
||||
void setWindowFrame(int x, int y, int w, int h) {}
|
||||
void setWindowFrame(int x, int y, int w, int h) override {}
|
||||
|
||||
float getVirtualPixelFactor() const { return m_dispInfoDpiFactor; }
|
||||
float getVirtualPixelFactor() const override { return m_dispInfoDpiFactor; }
|
||||
|
||||
bool isFullscreen() const { return ApplicationView::GetForCurrentView()->IsFullScreenMode; }
|
||||
bool isFullscreen() const override { return ApplicationView::GetForCurrentView()->IsFullScreenMode; }
|
||||
|
||||
void setFullscreen(bool fs) {
|
||||
void setFullscreen(bool fs) override {
|
||||
if (fs)
|
||||
ApplicationView::GetForCurrentView()->TryEnterFullScreenMode();
|
||||
else
|
||||
ApplicationView::GetForCurrentView()->ExitFullScreenMode();
|
||||
}
|
||||
|
||||
void claimKeyboardFocus(const int coord[2]) {}
|
||||
void claimKeyboardFocus(const int coord[2]) override {}
|
||||
|
||||
bool clipboardCopy(EClipboardType type, const uint8_t* data, size_t sz) { return false; }
|
||||
bool clipboardCopy(EClipboardType type, const uint8_t* data, size_t sz) override { return false; }
|
||||
|
||||
std::unique_ptr<uint8_t[]> clipboardPaste(EClipboardType type, size_t& sz) { return std::unique_ptr<uint8_t[]>(); }
|
||||
std::unique_ptr<uint8_t[]> clipboardPaste(EClipboardType type, size_t& sz) override {
|
||||
return std::unique_ptr<uint8_t[]>();
|
||||
}
|
||||
|
||||
int waitForRetrace(IAudioVoiceEngine* engine) {
|
||||
int waitForRetrace(IAudioVoiceEngine* engine) override {
|
||||
if (engine)
|
||||
engine->pumpAndMixVoices();
|
||||
m_gfxCtx->m_output->WaitForVBlank();
|
||||
return 1;
|
||||
}
|
||||
|
||||
uintptr_t getPlatformHandle() const { return 0; }
|
||||
uintptr_t getPlatformHandle() const override { return 0; }
|
||||
|
||||
bool _incomingEvent(void* ev) { return false; }
|
||||
bool _incomingEvent(void* ev) override { return false; }
|
||||
|
||||
void OnKeyDown(CoreWindow ^ window, KeyEventArgs ^ keyEventArgs) {
|
||||
ESpecialKey specialKey;
|
||||
|
@ -469,23 +471,23 @@ public:
|
|||
m_callback->resized(rect, false);
|
||||
}
|
||||
|
||||
ETouchType getTouchType() const { return ETouchType::None; }
|
||||
ETouchType getTouchType() const override { return ETouchType::None; }
|
||||
|
||||
void setStyle(EWindowStyle style) {}
|
||||
void setStyle(EWindowStyle style) override {}
|
||||
|
||||
EWindowStyle getStyle() const {
|
||||
EWindowStyle getStyle() const override {
|
||||
EWindowStyle retval = EWindowStyle::None;
|
||||
return retval;
|
||||
}
|
||||
|
||||
IGraphicsCommandQueue* getCommandQueue() { return m_gfxCtx->getCommandQueue(); }
|
||||
IGraphicsDataFactory* getDataFactory() { return m_gfxCtx->getDataFactory(); }
|
||||
IGraphicsCommandQueue* getCommandQueue() override { return m_gfxCtx->getCommandQueue(); }
|
||||
IGraphicsDataFactory* getDataFactory() override { return m_gfxCtx->getDataFactory(); }
|
||||
|
||||
/* Creates a new context on current thread!! Call from main client thread */
|
||||
IGraphicsDataFactory* getMainContextDataFactory() { return m_gfxCtx->getMainContextDataFactory(); }
|
||||
IGraphicsDataFactory* getMainContextDataFactory() override { return m_gfxCtx->getMainContextDataFactory(); }
|
||||
|
||||
/* Creates a new context on current thread!! Call from client loading thread */
|
||||
IGraphicsDataFactory* getLoadContextDataFactory() { return m_gfxCtx->getLoadContextDataFactory(); }
|
||||
IGraphicsDataFactory* getLoadContextDataFactory() override { return m_gfxCtx->getLoadContextDataFactory(); }
|
||||
};
|
||||
|
||||
std::shared_ptr<IWindow> _WindowUWPNew(SystemStringView title, Boo3DAppContextUWP& d3dCtx) {
|
||||
|
|
|
@ -88,35 +88,35 @@ public:
|
|||
Log.report(logvisor::Fatal, fmt("unable to get DXGI output"));
|
||||
}
|
||||
|
||||
~GraphicsContextWin32D3D() { m_3dCtx.m_ctx11.m_windows.erase(m_parentWindow); }
|
||||
~GraphicsContextWin32D3D() override { m_3dCtx.m_ctx11.m_windows.erase(m_parentWindow); }
|
||||
|
||||
void _setCallback(IWindowCallback* cb) { m_callback = cb; }
|
||||
void _setCallback(IWindowCallback* cb) override { m_callback = cb; }
|
||||
|
||||
EGraphicsAPI getAPI() const { return m_api; }
|
||||
EGraphicsAPI getAPI() const override { return m_api; }
|
||||
|
||||
EPixelFormat getPixelFormat() const { return m_pf; }
|
||||
EPixelFormat getPixelFormat() const override { return m_pf; }
|
||||
|
||||
void setPixelFormat(EPixelFormat pf) {
|
||||
void setPixelFormat(EPixelFormat pf) override {
|
||||
if (pf > EPixelFormat::RGBAF32_Z24)
|
||||
return;
|
||||
m_pf = pf;
|
||||
}
|
||||
|
||||
bool initializeContext(void*) { return true; }
|
||||
bool initializeContext(void*) override { return true; }
|
||||
|
||||
void makeCurrent() {}
|
||||
void makeCurrent() override {}
|
||||
|
||||
void postInit() {}
|
||||
void postInit() override {}
|
||||
|
||||
void present() {}
|
||||
void present() override {}
|
||||
|
||||
IGraphicsCommandQueue* getCommandQueue() { return m_commandQueue.get(); }
|
||||
IGraphicsCommandQueue* getCommandQueue() override { return m_commandQueue.get(); }
|
||||
|
||||
IGraphicsDataFactory* getDataFactory() { return m_dataFactory.get(); }
|
||||
IGraphicsDataFactory* getDataFactory() override { return m_dataFactory.get(); }
|
||||
|
||||
IGraphicsDataFactory* getMainContextDataFactory() { return m_dataFactory.get(); }
|
||||
IGraphicsDataFactory* getMainContextDataFactory() override { return m_dataFactory.get(); }
|
||||
|
||||
IGraphicsDataFactory* getLoadContextDataFactory() { return m_dataFactory.get(); }
|
||||
IGraphicsDataFactory* getLoadContextDataFactory() override { return m_dataFactory.get(); }
|
||||
};
|
||||
|
||||
struct GraphicsContextWin32GL : GraphicsContextWin32 {
|
||||
|
@ -249,23 +249,23 @@ public:
|
|||
m_commandQueue->startRenderer();
|
||||
}
|
||||
|
||||
~GraphicsContextWin32GL() { m_3dCtx.m_ctxOgl.m_windows.erase(m_parentWindow); }
|
||||
~GraphicsContextWin32GL() override { m_3dCtx.m_ctxOgl.m_windows.erase(m_parentWindow); }
|
||||
|
||||
void _setCallback(IWindowCallback* cb) { m_callback = cb; }
|
||||
void _setCallback(IWindowCallback* cb) override { m_callback = cb; }
|
||||
|
||||
EGraphicsAPI getAPI() const { return m_api; }
|
||||
EGraphicsAPI getAPI() const override { return m_api; }
|
||||
|
||||
EPixelFormat getPixelFormat() const { return m_pf; }
|
||||
EPixelFormat getPixelFormat() const override { return m_pf; }
|
||||
|
||||
void setPixelFormat(EPixelFormat pf) {
|
||||
void setPixelFormat(EPixelFormat pf) override {
|
||||
if (pf > EPixelFormat::RGBAF32_Z24)
|
||||
return;
|
||||
m_pf = pf;
|
||||
}
|
||||
|
||||
bool initializeContext(void*) { return true; }
|
||||
bool initializeContext(void*) override { return true; }
|
||||
|
||||
void makeCurrent() {
|
||||
void makeCurrent() override {
|
||||
OGLContext::Window& w = m_3dCtx.m_ctxOgl.m_windows[m_parentWindow];
|
||||
// if (!wglMakeCurrent(w.m_deviceContext, w.m_mainContext))
|
||||
// Log.report(logvisor::Fatal, fmt("unable to make WGL context current"));
|
||||
|
@ -277,7 +277,7 @@ public:
|
|||
Log.report(logvisor::Fatal, fmt("unable to make WGL context current"));
|
||||
}
|
||||
|
||||
void postInit() {
|
||||
void postInit() override {
|
||||
// OGLContext::Window& w = m_3dCtx.m_ctxOgl.m_windows[m_parentWindow];
|
||||
|
||||
// wglCreateContextAttribsARB = (PFNWGLCREATECONTEXTATTRIBSARBPROC)
|
||||
|
@ -293,18 +293,18 @@ public:
|
|||
wglSwapIntervalEXT(1);
|
||||
}
|
||||
|
||||
void present() {
|
||||
void present() override {
|
||||
OGLContext::Window& w = m_3dCtx.m_ctxOgl.m_windows[m_parentWindow];
|
||||
SwapBuffers(w.m_deviceContext);
|
||||
}
|
||||
|
||||
IGraphicsCommandQueue* getCommandQueue() { return m_commandQueue.get(); }
|
||||
IGraphicsCommandQueue* getCommandQueue() override { return m_commandQueue.get(); }
|
||||
|
||||
IGraphicsDataFactory* getDataFactory() { return m_dataFactory.get(); }
|
||||
IGraphicsDataFactory* getDataFactory() override { return m_dataFactory.get(); }
|
||||
|
||||
/* Creates a new context on current thread!! Call from client loading thread */
|
||||
HGLRC m_mainCtx = 0;
|
||||
IGraphicsDataFactory* getMainContextDataFactory() {
|
||||
IGraphicsDataFactory* getMainContextDataFactory() override {
|
||||
OGLContext::Window& w = m_3dCtx.m_ctxOgl.m_windows[m_parentWindow];
|
||||
if (!m_mainCtx) {
|
||||
m_mainCtx = wglCreateContextAttribsARB(w.m_deviceContext, w.m_mainContext, ContextAttribs);
|
||||
|
@ -318,7 +318,7 @@ public:
|
|||
|
||||
/* Creates a new context on current thread!! Call from client loading thread */
|
||||
HGLRC m_loadCtx = 0;
|
||||
IGraphicsDataFactory* getLoadContextDataFactory() {
|
||||
IGraphicsDataFactory* getLoadContextDataFactory() override {
|
||||
OGLContext::Window& w = m_3dCtx.m_ctxOgl.m_windows[m_parentWindow];
|
||||
if (!m_loadCtx) {
|
||||
m_loadCtx = wglCreateContextAttribsARB(w.m_deviceContext, w.m_mainContext, ContextAttribs);
|
||||
|
@ -400,7 +400,7 @@ public:
|
|||
m_ctx->m_windows.erase(m_parentWindow);
|
||||
}
|
||||
|
||||
~GraphicsContextWin32Vulkan() { destroy(); }
|
||||
~GraphicsContextWin32Vulkan() override { destroy(); }
|
||||
|
||||
VulkanContext::Window* m_windowCtx = nullptr;
|
||||
|
||||
|
@ -409,19 +409,19 @@ public:
|
|||
m_ctx->resizeSwapChain(*m_windowCtx, m_surface, m_format, m_colorspace, rect);
|
||||
}
|
||||
|
||||
void _setCallback(IWindowCallback* cb) { m_callback = cb; }
|
||||
void _setCallback(IWindowCallback* cb) override { m_callback = cb; }
|
||||
|
||||
EGraphicsAPI getAPI() const { return m_api; }
|
||||
EGraphicsAPI getAPI() const override { return m_api; }
|
||||
|
||||
EPixelFormat getPixelFormat() const { return m_pf; }
|
||||
EPixelFormat getPixelFormat() const override { return m_pf; }
|
||||
|
||||
void setPixelFormat(EPixelFormat pf) {
|
||||
void setPixelFormat(EPixelFormat pf) override {
|
||||
if (pf > EPixelFormat::RGBAF32_Z24)
|
||||
return;
|
||||
m_pf = pf;
|
||||
}
|
||||
|
||||
bool initializeContext(void*) {
|
||||
bool initializeContext(void*) override {
|
||||
m_windowCtx = m_ctx->m_windows.emplace(std::make_pair(m_parentWindow, std::make_unique<VulkanContext::Window>()))
|
||||
.first->second.get();
|
||||
m_windowCtx->m_hwnd = m_hwnd;
|
||||
|
@ -509,19 +509,19 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
void makeCurrent() {}
|
||||
void makeCurrent() override {}
|
||||
|
||||
void postInit() {}
|
||||
void postInit() override {}
|
||||
|
||||
IGraphicsCommandQueue* getCommandQueue() { return m_commandQueue.get(); }
|
||||
IGraphicsCommandQueue* getCommandQueue() override { return m_commandQueue.get(); }
|
||||
|
||||
IGraphicsDataFactory* getDataFactory() { return m_dataFactory.get(); }
|
||||
IGraphicsDataFactory* getDataFactory() override { return m_dataFactory.get(); }
|
||||
|
||||
IGraphicsDataFactory* getMainContextDataFactory() { return getDataFactory(); }
|
||||
IGraphicsDataFactory* getMainContextDataFactory() override { return getDataFactory(); }
|
||||
|
||||
IGraphicsDataFactory* getLoadContextDataFactory() { return getDataFactory(); }
|
||||
IGraphicsDataFactory* getLoadContextDataFactory() override { return getDataFactory(); }
|
||||
|
||||
void present() {}
|
||||
void present() override {}
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -874,37 +874,37 @@ public:
|
|||
m_gfxCtx.reset(new GraphicsContextWin32D3D(api, this, m_hwnd, b3dCtx));
|
||||
}
|
||||
|
||||
void _cleanup() { m_gfxCtx.reset(); }
|
||||
void _cleanup() override { m_gfxCtx.reset(); }
|
||||
|
||||
void setCallback(IWindowCallback* cb) { m_callback = cb; }
|
||||
void setCallback(IWindowCallback* cb) override { m_callback = cb; }
|
||||
|
||||
void closeWindow() {
|
||||
void closeWindow() override {
|
||||
// TODO: Perform thread-coalesced deallocation
|
||||
ShowWindow(m_hwnd, SW_HIDE);
|
||||
}
|
||||
|
||||
void showWindow() { ShowWindow(m_hwnd, SW_SHOW); }
|
||||
void showWindow() override { ShowWindow(m_hwnd, SW_SHOW); }
|
||||
|
||||
void hideWindow() { ShowWindow(m_hwnd, SW_HIDE); }
|
||||
void hideWindow() override { ShowWindow(m_hwnd, SW_HIDE); }
|
||||
|
||||
SystemString getTitle() {
|
||||
SystemString getTitle() override {
|
||||
wchar_t title[256];
|
||||
int c = GetWindowTextW(m_hwnd, title, 256);
|
||||
return SystemString(title, c);
|
||||
}
|
||||
|
||||
void setTitle(SystemStringView title) { SetWindowTextW(m_hwnd, title.data()); }
|
||||
void setTitle(SystemStringView title) override { SetWindowTextW(m_hwnd, title.data()); }
|
||||
|
||||
static void _setCursor(HCURSOR cur) { PostThreadMessageW(g_mainThreadId, WM_USER + 2, WPARAM(cur), 0); }
|
||||
|
||||
void setCursor(EMouseCursor cursor) {
|
||||
void setCursor(EMouseCursor cursor) override {
|
||||
if (cursor == m_cursor && !m_cursorWait)
|
||||
return;
|
||||
m_cursor = cursor;
|
||||
_setCursor(GetWin32Cursor(cursor));
|
||||
}
|
||||
|
||||
void setWaitCursor(bool wait) {
|
||||
void setWaitCursor(bool wait) override {
|
||||
if (wait && !m_cursorWait) {
|
||||
_setCursor(WIN32_CURSORS.m_wait);
|
||||
m_cursorWait = true;
|
||||
|
@ -914,12 +914,12 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
double getWindowRefreshRate() const {
|
||||
double getWindowRefreshRate() const override {
|
||||
/* TODO: Actually get refresh rate */
|
||||
return 60.0;
|
||||
}
|
||||
|
||||
void setWindowFrameDefault() {
|
||||
void setWindowFrameDefault() override {
|
||||
MONITORINFO monInfo = {};
|
||||
monInfo.cbSize = sizeof(MONITORINFO);
|
||||
HMONITOR mon = MonitorFromWindow(m_hwnd, MONITOR_DEFAULTTOPRIMARY);
|
||||
|
@ -929,7 +929,7 @@ public:
|
|||
setWindowFrame(x, y, w, h);
|
||||
}
|
||||
|
||||
void getWindowFrame(float& xOut, float& yOut, float& wOut, float& hOut) const {
|
||||
void getWindowFrame(float& xOut, float& yOut, float& wOut, float& hOut) const override {
|
||||
RECT rct;
|
||||
GetClientRect(m_hwnd, &rct);
|
||||
POINT pt;
|
||||
|
@ -942,7 +942,7 @@ public:
|
|||
hOut = rct.bottom;
|
||||
}
|
||||
|
||||
void getWindowFrame(int& xOut, int& yOut, int& wOut, int& hOut) const {
|
||||
void getWindowFrame(int& xOut, int& yOut, int& wOut, int& hOut) const override {
|
||||
RECT rct;
|
||||
GetClientRect(m_hwnd, &rct);
|
||||
POINT pt;
|
||||
|
@ -955,15 +955,15 @@ public:
|
|||
hOut = rct.bottom;
|
||||
}
|
||||
|
||||
void setWindowFrame(float x, float y, float w, float h) { setWindowFrame(int(x), int(y), int(w), int(h)); }
|
||||
void setWindowFrame(float x, float y, float w, float h) override { setWindowFrame(int(x), int(y), int(w), int(h)); }
|
||||
|
||||
void setWindowFrame(int x, int y, int w, int h) {
|
||||
void setWindowFrame(int x, int y, int w, int h) override {
|
||||
RECT r = {x, y, x + w, y + h};
|
||||
AdjustWindowRect(&r, WS_OVERLAPPEDWINDOW, FALSE);
|
||||
MoveWindow(m_hwnd, r.left, r.top, r.right - r.left, r.bottom - r.top, true);
|
||||
}
|
||||
|
||||
float getVirtualPixelFactor() const {
|
||||
float getVirtualPixelFactor() const override {
|
||||
#if _WIN32_WINNT_WINBLUE
|
||||
if (MyGetScaleFactorForMonitor) {
|
||||
DEVICE_SCALE_FACTOR Factor;
|
||||
|
@ -977,9 +977,9 @@ public:
|
|||
return 1.f;
|
||||
}
|
||||
|
||||
bool isFullscreen() const { return m_gfxCtx->m_3dCtx.isFullscreen(this); }
|
||||
bool isFullscreen() const override { return m_gfxCtx->m_3dCtx.isFullscreen(this); }
|
||||
|
||||
void setFullscreen(bool fs) { m_gfxCtx->m_3dCtx.setFullscreen(this, fs); }
|
||||
void setFullscreen(bool fs) override { m_gfxCtx->m_3dCtx.setFullscreen(this, fs); }
|
||||
|
||||
void _immSetOpenStatus(bool open) {
|
||||
if (GetCurrentThreadId() != g_mainThreadId) {
|
||||
|
@ -1005,7 +1005,7 @@ public:
|
|||
ImmSetCompositionWindow(m_imc, &m_cForm);
|
||||
}
|
||||
|
||||
void claimKeyboardFocus(const int coord[2]) {
|
||||
void claimKeyboardFocus(const int coord[2]) override {
|
||||
if (!coord) {
|
||||
//_immSetOpenStatus(false);
|
||||
return;
|
||||
|
@ -1014,7 +1014,7 @@ public:
|
|||
//_immSetOpenStatus(true);
|
||||
}
|
||||
|
||||
bool clipboardCopy(EClipboardType type, const uint8_t* data, size_t sz) {
|
||||
bool clipboardCopy(EClipboardType type, const uint8_t* data, size_t sz) override {
|
||||
switch (type) {
|
||||
case EClipboardType::String: {
|
||||
HGLOBAL gStr = MakeANSICRLF(reinterpret_cast<const char*>(data), sz);
|
||||
|
@ -1038,7 +1038,7 @@ public:
|
|||
return false;
|
||||
}
|
||||
|
||||
std::unique_ptr<uint8_t[]> clipboardPaste(EClipboardType type, size_t& sz) {
|
||||
std::unique_ptr<uint8_t[]> clipboardPaste(EClipboardType type, size_t& sz) override {
|
||||
switch (type) {
|
||||
case EClipboardType::String: {
|
||||
OpenClipboard(m_hwnd);
|
||||
|
@ -1068,9 +1068,12 @@ public:
|
|||
return std::unique_ptr<uint8_t[]>();
|
||||
}
|
||||
|
||||
int waitForRetrace() { m_gfxCtx->m_output->WaitForVBlank(); return 1; }
|
||||
int waitForRetrace() override {
|
||||
m_gfxCtx->m_output->WaitForVBlank();
|
||||
return 1;
|
||||
}
|
||||
|
||||
uintptr_t getPlatformHandle() const { return uintptr_t(m_hwnd); }
|
||||
uintptr_t getPlatformHandle() const override { return uintptr_t(m_hwnd); }
|
||||
|
||||
void buttonDown(HWNDEvent& e, EMouseButton button) {
|
||||
if (m_callback) {
|
||||
|
@ -1105,7 +1108,7 @@ public:
|
|||
}
|
||||
|
||||
bool mouseTracking = false;
|
||||
bool _incomingEvent(void* ev) {
|
||||
bool _incomingEvent(void* ev) override {
|
||||
HWNDEvent& e = *static_cast<HWNDEvent*>(ev);
|
||||
switch (e.uMsg) {
|
||||
case WM_CLOSE:
|
||||
|
@ -1288,9 +1291,9 @@ public:
|
|||
return false;
|
||||
}
|
||||
|
||||
ETouchType getTouchType() const { return ETouchType::None; }
|
||||
ETouchType getTouchType() const override { return ETouchType::None; }
|
||||
|
||||
void setStyle(EWindowStyle style) {
|
||||
void setStyle(EWindowStyle style) override {
|
||||
LONG sty = GetWindowLong(m_hwnd, GWL_STYLE);
|
||||
|
||||
if ((style & EWindowStyle::Titlebar) != EWindowStyle::None)
|
||||
|
@ -1311,7 +1314,7 @@ public:
|
|||
SetWindowLong(m_hwnd, GWL_STYLE, sty);
|
||||
}
|
||||
|
||||
EWindowStyle getStyle() const {
|
||||
EWindowStyle getStyle() const override {
|
||||
LONG sty = GetWindowLong(m_hwnd, GWL_STYLE);
|
||||
EWindowStyle retval = EWindowStyle::None;
|
||||
if ((sty & WS_CAPTION) != 0)
|
||||
|
@ -1323,14 +1326,14 @@ public:
|
|||
return retval;
|
||||
}
|
||||
|
||||
IGraphicsCommandQueue* getCommandQueue() { return m_gfxCtx->getCommandQueue(); }
|
||||
IGraphicsDataFactory* getDataFactory() { return m_gfxCtx->getDataFactory(); }
|
||||
IGraphicsCommandQueue* getCommandQueue() override { return m_gfxCtx->getCommandQueue(); }
|
||||
IGraphicsDataFactory* getDataFactory() override { return m_gfxCtx->getDataFactory(); }
|
||||
|
||||
/* Creates a new context on current thread!! Call from main client thread */
|
||||
IGraphicsDataFactory* getMainContextDataFactory() { return m_gfxCtx->getMainContextDataFactory(); }
|
||||
IGraphicsDataFactory* getMainContextDataFactory() override { return m_gfxCtx->getMainContextDataFactory(); }
|
||||
|
||||
/* Creates a new context on current thread!! Call from client loading thread */
|
||||
IGraphicsDataFactory* getLoadContextDataFactory() { return m_gfxCtx->getLoadContextDataFactory(); }
|
||||
IGraphicsDataFactory* getLoadContextDataFactory() override { return m_gfxCtx->getLoadContextDataFactory(); }
|
||||
};
|
||||
|
||||
std::shared_ptr<IWindow> _WindowWin32New(SystemStringView title, Boo3DAppContextWin32& d3dCtx) {
|
||||
|
|
|
@ -19,7 +19,7 @@ class ApplicationWayland final : public IApplication {
|
|||
const std::vector<std::string> m_args;
|
||||
bool m_singleInstance;
|
||||
|
||||
void _deletedWindow(IWindow* window) { (void)window; }
|
||||
void _deletedWindow(IWindow* window) override { (void)window; }
|
||||
|
||||
public:
|
||||
ApplicationWayland(IApplicationCallback& callback, std::string_view uniqueName, std::string_view friendlyName,
|
||||
|
@ -35,19 +35,19 @@ public:
|
|||
(void)m_singleInstance;
|
||||
}
|
||||
|
||||
EPlatformType getPlatformType() const { return EPlatformType::Wayland; }
|
||||
EPlatformType getPlatformType() const override { return EPlatformType::Wayland; }
|
||||
|
||||
int run() { return 0; }
|
||||
int run() override { return 0; }
|
||||
|
||||
std::string_view getUniqueName() const { return m_uniqueName; }
|
||||
std::string_view getUniqueName() const override { return m_uniqueName; }
|
||||
|
||||
std::string_view getFriendlyName() const { return m_friendlyName; }
|
||||
std::string_view getFriendlyName() const override { return m_friendlyName; }
|
||||
|
||||
std::string_view getProcessName() const { return m_pname; }
|
||||
std::string_view getProcessName() const override { return m_pname; }
|
||||
|
||||
const std::vector<std::string>& getArgs() const { return m_args; }
|
||||
const std::vector<std::string>& getArgs() const override { return m_args; }
|
||||
|
||||
std::shared_ptr<IWindow> newWindow(std::string_view title) { return _WindowWaylandNew(title); }
|
||||
std::shared_ptr<IWindow> newWindow(std::string_view title) override { return _WindowWaylandNew(title); }
|
||||
};
|
||||
|
||||
} // namespace boo
|
||||
|
|
|
@ -196,7 +196,7 @@ class ApplicationXlib final : public IApplication {
|
|||
}
|
||||
#endif
|
||||
|
||||
void _deletedWindow(IWindow* window) { m_windows.erase((Window)window->getPlatformHandle()); }
|
||||
void _deletedWindow(IWindow* window) override { m_windows.erase((Window)window->getPlatformHandle()); }
|
||||
|
||||
public:
|
||||
ApplicationXlib(IApplicationCallback& callback, std::string_view uniqueName, std::string_view friendlyName,
|
||||
|
@ -368,7 +368,7 @@ public:
|
|||
XFlush(m_xDisp);
|
||||
}
|
||||
|
||||
~ApplicationXlib() {
|
||||
~ApplicationXlib() override {
|
||||
for (auto& p : m_windows)
|
||||
if (auto w = p.second.lock())
|
||||
w->_cleanup();
|
||||
|
@ -385,7 +385,7 @@ public:
|
|||
XCloseDisplay(m_xDisp);
|
||||
}
|
||||
|
||||
EPlatformType getPlatformType() const { return EPlatformType::Xlib; }
|
||||
EPlatformType getPlatformType() const override { return EPlatformType::Xlib; }
|
||||
|
||||
/* Empty handler for SIGINT */
|
||||
static void _sigint(int) {}
|
||||
|
@ -414,7 +414,7 @@ public:
|
|||
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
|
||||
}
|
||||
|
||||
int run() {
|
||||
int run() override {
|
||||
if (!m_xDisp)
|
||||
return 1;
|
||||
|
||||
|
@ -512,15 +512,15 @@ public:
|
|||
return clientReturn;
|
||||
}
|
||||
|
||||
std::string_view getUniqueName() const { return m_uniqueName; }
|
||||
std::string_view getUniqueName() const override { return m_uniqueName; }
|
||||
|
||||
std::string_view getFriendlyName() const { return m_friendlyName; }
|
||||
std::string_view getFriendlyName() const override { return m_friendlyName; }
|
||||
|
||||
std::string_view getProcessName() const { return m_pname; }
|
||||
std::string_view getProcessName() const override { return m_pname; }
|
||||
|
||||
const std::vector<std::string>& getArgs() const { return m_args; }
|
||||
const std::vector<std::string>& getArgs() const override { return m_args; }
|
||||
|
||||
std::shared_ptr<IWindow> newWindow(std::string_view title) {
|
||||
std::shared_ptr<IWindow> newWindow(std::string_view title) override {
|
||||
XLockDisplay(m_xDisp);
|
||||
#if BOO_HAS_VULKAN
|
||||
std::shared_ptr<IWindow> newWindow = _WindowXlibNew(title, m_xDisp, m_xcbConn, m_xDefaultScreen, m_xIM, m_bestStyle,
|
||||
|
|
|
@ -19,35 +19,35 @@ public:
|
|||
GraphicsContextWayland(EGraphicsAPI api, IWindow* parentWindow)
|
||||
: m_api(api), m_pf(EPixelFormat::RGBA8), m_parentWindow(parentWindow) {}
|
||||
|
||||
~GraphicsContextWayland() {}
|
||||
~GraphicsContextWayland() override = default;
|
||||
|
||||
void _setCallback(IWindowCallback* cb) { m_callback = cb; }
|
||||
void _setCallback(IWindowCallback* cb) override { m_callback = cb; }
|
||||
|
||||
EGraphicsAPI getAPI() const { return m_api; }
|
||||
EGraphicsAPI getAPI() const override { return m_api; }
|
||||
|
||||
EPixelFormat getPixelFormat() const { return m_pf; }
|
||||
EPixelFormat getPixelFormat() const override { return m_pf; }
|
||||
|
||||
void setPixelFormat(EPixelFormat pf) {
|
||||
void setPixelFormat(EPixelFormat pf) override {
|
||||
if (pf > EPixelFormat::RGBAF32_Z24)
|
||||
return;
|
||||
m_pf = pf;
|
||||
}
|
||||
|
||||
bool initializeContext(void*) { return false; }
|
||||
bool initializeContext(void*) override { return false; }
|
||||
|
||||
void makeCurrent() {}
|
||||
void makeCurrent() override {}
|
||||
|
||||
void postInit() {}
|
||||
void postInit() override {}
|
||||
|
||||
IGraphicsCommandQueue* getCommandQueue() { return nullptr; }
|
||||
IGraphicsCommandQueue* getCommandQueue() override { return nullptr; }
|
||||
|
||||
IGraphicsDataFactory* getDataFactory() { return nullptr; }
|
||||
IGraphicsDataFactory* getDataFactory() override { return nullptr; }
|
||||
|
||||
IGraphicsDataFactory* getMainContextDataFactory() { return nullptr; }
|
||||
IGraphicsDataFactory* getMainContextDataFactory() override { return nullptr; }
|
||||
|
||||
IGraphicsDataFactory* getLoadContextDataFactory() { return nullptr; }
|
||||
IGraphicsDataFactory* getLoadContextDataFactory() override { return nullptr; }
|
||||
|
||||
void present() {}
|
||||
void present() override {}
|
||||
};
|
||||
|
||||
struct WindowWayland : IWindow {
|
||||
|
@ -55,65 +55,65 @@ struct WindowWayland : IWindow {
|
|||
|
||||
WindowWayland(std::string_view title) : m_gfxCtx(IGraphicsContext::EGraphicsAPI::OpenGL3_3, this) {}
|
||||
|
||||
~WindowWayland() {}
|
||||
~WindowWayland() override = default;
|
||||
|
||||
void setCallback(IWindowCallback* cb) {}
|
||||
void setCallback(IWindowCallback* cb) override {}
|
||||
|
||||
void closeWindow() {}
|
||||
void closeWindow() override {}
|
||||
|
||||
void showWindow() {}
|
||||
void showWindow() override {}
|
||||
|
||||
void hideWindow() {}
|
||||
void hideWindow() override {}
|
||||
|
||||
std::string getTitle() { return ""; }
|
||||
std::string getTitle() override { return ""; }
|
||||
|
||||
void setTitle(std::string_view title) {}
|
||||
void setTitle(std::string_view title) override {}
|
||||
|
||||
void setCursor(EMouseCursor cursor) {}
|
||||
void setCursor(EMouseCursor cursor) override {}
|
||||
|
||||
void setWaitCursor(bool wait) {}
|
||||
void setWaitCursor(bool wait) override {}
|
||||
|
||||
double getWindowRefreshRate() const { return 60.0; }
|
||||
double getWindowRefreshRate() const override { return 60.0; }
|
||||
|
||||
void setWindowFrameDefault() {}
|
||||
void setWindowFrameDefault() override {}
|
||||
|
||||
void getWindowFrame(float& xOut, float& yOut, float& wOut, float& hOut) const {}
|
||||
void getWindowFrame(float& xOut, float& yOut, float& wOut, float& hOut) const override {}
|
||||
|
||||
void getWindowFrame(int& xOut, int& yOut, int& wOut, int& hOut) const {}
|
||||
void getWindowFrame(int& xOut, int& yOut, int& wOut, int& hOut) const override {}
|
||||
|
||||
void setWindowFrame(float x, float y, float w, float h) {}
|
||||
void setWindowFrame(float x, float y, float w, float h) override {}
|
||||
|
||||
void setWindowFrame(int x, int y, int w, int h) {}
|
||||
void setWindowFrame(int x, int y, int w, int h) override {}
|
||||
|
||||
float getVirtualPixelFactor() const { return 0; }
|
||||
float getVirtualPixelFactor() const override { return 0; }
|
||||
|
||||
void setStyle(EWindowStyle /*style*/) {}
|
||||
void setStyle(EWindowStyle /*style*/) override {}
|
||||
|
||||
EWindowStyle getStyle() const { return EWindowStyle::None; }
|
||||
EWindowStyle getStyle() const override { return EWindowStyle::None; }
|
||||
|
||||
bool isFullscreen() const { return false; }
|
||||
bool isFullscreen() const override { return false; }
|
||||
|
||||
void setFullscreen(bool fs) {}
|
||||
void setFullscreen(bool fs) override {}
|
||||
|
||||
void claimKeyboardFocus(const int coord[2]) {}
|
||||
void claimKeyboardFocus(const int coord[2]) override {}
|
||||
|
||||
bool clipboardCopy(EClipboardType type, const uint8_t* data, size_t sz) { return false; }
|
||||
bool clipboardCopy(EClipboardType type, const uint8_t* data, size_t sz) override { return false; }
|
||||
|
||||
std::unique_ptr<uint8_t[]> clipboardPaste(EClipboardType type, size_t& sz) { return std::unique_ptr<uint8_t[]>(); }
|
||||
std::unique_ptr<uint8_t[]> clipboardPaste(EClipboardType type, size_t& sz) override { return std::unique_ptr<uint8_t[]>(); }
|
||||
|
||||
int waitForRetrace() { return 1; }
|
||||
int waitForRetrace() override { return 1; }
|
||||
|
||||
uintptr_t getPlatformHandle() const { return 0; }
|
||||
uintptr_t getPlatformHandle() const override { return 0; }
|
||||
|
||||
ETouchType getTouchType() const { return ETouchType::None; }
|
||||
ETouchType getTouchType() const override { return ETouchType::None; }
|
||||
|
||||
IGraphicsCommandQueue* getCommandQueue() { return m_gfxCtx.getCommandQueue(); }
|
||||
IGraphicsCommandQueue* getCommandQueue() override { return m_gfxCtx.getCommandQueue(); }
|
||||
|
||||
IGraphicsDataFactory* getDataFactory() { return m_gfxCtx.getDataFactory(); }
|
||||
IGraphicsDataFactory* getDataFactory() override { return m_gfxCtx.getDataFactory(); }
|
||||
|
||||
IGraphicsDataFactory* getMainContextDataFactory() { return m_gfxCtx.getMainContextDataFactory(); }
|
||||
IGraphicsDataFactory* getMainContextDataFactory() override { return m_gfxCtx.getMainContextDataFactory(); }
|
||||
|
||||
IGraphicsDataFactory* getLoadContextDataFactory() { return m_gfxCtx.getLoadContextDataFactory(); }
|
||||
IGraphicsDataFactory* getLoadContextDataFactory() override { return m_gfxCtx.getLoadContextDataFactory(); }
|
||||
};
|
||||
|
||||
std::shared_ptr<IWindow> _WindowWaylandNew(std::string_view title) { return std::make_shared<WindowWayland>(title); }
|
||||
|
|
|
@ -356,7 +356,7 @@ public:
|
|||
visualIdOut = m_visualid;
|
||||
}
|
||||
|
||||
void destroy() {
|
||||
void destroy() override {
|
||||
if (m_glxCtx) {
|
||||
glXDestroyContext(m_xDisp, m_glxCtx);
|
||||
m_glxCtx = nullptr;
|
||||
|
@ -371,23 +371,23 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
~GraphicsContextXlibGLX() { destroy(); }
|
||||
~GraphicsContextXlibGLX() override { destroy(); }
|
||||
|
||||
void resized(const SWindowRect& rect) {}
|
||||
void resized(const SWindowRect& rect) override {}
|
||||
|
||||
void _setCallback(IWindowCallback* cb) { m_callback = cb; }
|
||||
void _setCallback(IWindowCallback* cb) override { m_callback = cb; }
|
||||
|
||||
EGraphicsAPI getAPI() const { return m_api; }
|
||||
EGraphicsAPI getAPI() const override { return m_api; }
|
||||
|
||||
EPixelFormat getPixelFormat() const { return m_pf; }
|
||||
EPixelFormat getPixelFormat() const override { return m_pf; }
|
||||
|
||||
void setPixelFormat(EPixelFormat pf) {
|
||||
void setPixelFormat(EPixelFormat pf) override {
|
||||
if (pf > EPixelFormat::RGBAF32_Z24)
|
||||
return;
|
||||
m_pf = pf;
|
||||
}
|
||||
|
||||
bool initializeContext(void*) {
|
||||
bool initializeContext(void*) override {
|
||||
if (!glXCreateContextAttribsARB) {
|
||||
glXCreateContextAttribsARB =
|
||||
(glXCreateContextAttribsARBProc)glXGetProcAddressARB((const GLubyte*)"glXCreateContextAttribsARB");
|
||||
|
@ -424,25 +424,25 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
void makeCurrent() {
|
||||
void makeCurrent() override {
|
||||
XLockDisplay(m_xDisp);
|
||||
if (!glXMakeContextCurrent(m_xDisp, m_glxWindow, m_glxWindow, m_glxCtx))
|
||||
Log.report(logvisor::Fatal, fmt("unable to make GLX context current"));
|
||||
XUnlockDisplay(m_xDisp);
|
||||
}
|
||||
|
||||
void postInit() {
|
||||
void postInit() override {
|
||||
GLXExtensionCheck();
|
||||
XLockDisplay(m_xDisp);
|
||||
GLXEnableVSync(m_xDisp, m_glxWindow);
|
||||
XUnlockDisplay(m_xDisp);
|
||||
}
|
||||
|
||||
IGraphicsCommandQueue* getCommandQueue() { return m_commandQueue.get(); }
|
||||
IGraphicsCommandQueue* getCommandQueue() override { return m_commandQueue.get(); }
|
||||
|
||||
IGraphicsDataFactory* getDataFactory() { return m_dataFactory.get(); }
|
||||
IGraphicsDataFactory* getDataFactory() override { return m_dataFactory.get(); }
|
||||
|
||||
IGraphicsDataFactory* getMainContextDataFactory() {
|
||||
IGraphicsDataFactory* getMainContextDataFactory() override {
|
||||
XLockDisplay(m_xDisp);
|
||||
if (!m_mainCtx) {
|
||||
s_glxError = false;
|
||||
|
@ -458,7 +458,7 @@ public:
|
|||
return getDataFactory();
|
||||
}
|
||||
|
||||
IGraphicsDataFactory* getLoadContextDataFactory() {
|
||||
IGraphicsDataFactory* getLoadContextDataFactory() override {
|
||||
XLockDisplay(m_xDisp);
|
||||
if (!m_loadCtx) {
|
||||
s_glxError = false;
|
||||
|
@ -474,7 +474,7 @@ public:
|
|||
return getDataFactory();
|
||||
}
|
||||
|
||||
void present() { glXSwapBuffers(m_xDisp, m_glxWindow); }
|
||||
void present() override { glXSwapBuffers(m_xDisp, m_glxWindow); }
|
||||
};
|
||||
|
||||
#if BOO_HAS_VULKAN
|
||||
|
@ -520,28 +520,28 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
~GraphicsContextXlibVulkan() { destroy(); }
|
||||
~GraphicsContextXlibVulkan() override { destroy(); }
|
||||
|
||||
VulkanContext::Window* m_windowCtx = nullptr;
|
||||
|
||||
void resized(const SWindowRect& rect) {
|
||||
void resized(const SWindowRect& rect) override {
|
||||
if (m_windowCtx)
|
||||
m_ctx->resizeSwapChain(*m_windowCtx, m_surface, m_format, m_colorspace, rect);
|
||||
}
|
||||
|
||||
void _setCallback(IWindowCallback* cb) { m_callback = cb; }
|
||||
void _setCallback(IWindowCallback* cb) override { m_callback = cb; }
|
||||
|
||||
EGraphicsAPI getAPI() const { return m_api; }
|
||||
EGraphicsAPI getAPI() const override { return m_api; }
|
||||
|
||||
EPixelFormat getPixelFormat() const { return m_pf; }
|
||||
EPixelFormat getPixelFormat() const override { return m_pf; }
|
||||
|
||||
void setPixelFormat(EPixelFormat pf) {
|
||||
void setPixelFormat(EPixelFormat pf) override {
|
||||
if (pf > EPixelFormat::RGBAF32_Z24)
|
||||
return;
|
||||
m_pf = pf;
|
||||
}
|
||||
|
||||
bool initializeContext(void* getVkProc) {
|
||||
bool initializeContext(void* getVkProc) override {
|
||||
if (m_ctx->m_instance == VK_NULL_HANDLE)
|
||||
m_ctx->initVulkan(APP->getUniqueName(), PFN_vkGetInstanceProcAddr(getVkProc));
|
||||
|
||||
|
@ -637,19 +637,19 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
void makeCurrent() {}
|
||||
void makeCurrent() override {}
|
||||
|
||||
void postInit() {}
|
||||
void postInit() override {}
|
||||
|
||||
IGraphicsCommandQueue* getCommandQueue() { return m_commandQueue.get(); }
|
||||
IGraphicsCommandQueue* getCommandQueue() override { return m_commandQueue.get(); }
|
||||
|
||||
IGraphicsDataFactory* getDataFactory() { return m_dataFactory.get(); }
|
||||
IGraphicsDataFactory* getDataFactory() override { return m_dataFactory.get(); }
|
||||
|
||||
IGraphicsDataFactory* getMainContextDataFactory() { return getDataFactory(); }
|
||||
IGraphicsDataFactory* getMainContextDataFactory() override { return getDataFactory(); }
|
||||
|
||||
IGraphicsDataFactory* getLoadContextDataFactory() { return getDataFactory(); }
|
||||
IGraphicsDataFactory* getLoadContextDataFactory() override { return getDataFactory(); }
|
||||
|
||||
void present() {}
|
||||
void present() override {}
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -848,38 +848,38 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
~WindowXlib() {
|
||||
~WindowXlib() override {
|
||||
_cleanup();
|
||||
if (APP)
|
||||
APP->_deletedWindow(this);
|
||||
}
|
||||
|
||||
void setCallback(IWindowCallback* cb) {
|
||||
void setCallback(IWindowCallback* cb) override {
|
||||
XLockDisplay(m_xDisp);
|
||||
m_callback = cb;
|
||||
XUnlockDisplay(m_xDisp);
|
||||
}
|
||||
|
||||
void closeWindow() {
|
||||
void closeWindow() override {
|
||||
// TODO: Free window resources and prevent further access
|
||||
XLockDisplay(m_xDisp);
|
||||
XUnmapWindow(m_xDisp, m_windowId);
|
||||
XUnlockDisplay(m_xDisp);
|
||||
}
|
||||
|
||||
void showWindow() {
|
||||
void showWindow() override {
|
||||
XLockDisplay(m_xDisp);
|
||||
XMapWindow(m_xDisp, m_windowId);
|
||||
XUnlockDisplay(m_xDisp);
|
||||
}
|
||||
|
||||
void hideWindow() {
|
||||
void hideWindow() override {
|
||||
XLockDisplay(m_xDisp);
|
||||
XUnmapWindow(m_xDisp, m_windowId);
|
||||
XUnlockDisplay(m_xDisp);
|
||||
}
|
||||
|
||||
std::string getTitle() {
|
||||
std::string getTitle() override {
|
||||
unsigned long nitems;
|
||||
Atom actualType;
|
||||
int actualFormat;
|
||||
|
@ -897,7 +897,7 @@ public:
|
|||
return std::string();
|
||||
}
|
||||
|
||||
void setTitle(std::string_view title) {
|
||||
void setTitle(std::string_view title) override {
|
||||
XLockDisplay(m_xDisp);
|
||||
|
||||
/* Set the title of the window */
|
||||
|
@ -914,7 +914,7 @@ public:
|
|||
XUnlockDisplay(m_xDisp);
|
||||
}
|
||||
|
||||
void setCursor(EMouseCursor cursor) {
|
||||
void setCursor(EMouseCursor cursor) override {
|
||||
if (cursor == m_cursor && !m_cursorWait)
|
||||
return;
|
||||
m_cursor = cursor;
|
||||
|
@ -923,7 +923,7 @@ public:
|
|||
XUnlockDisplay(m_xDisp);
|
||||
}
|
||||
|
||||
void setWaitCursor(bool wait) {
|
||||
void setWaitCursor(bool wait) override {
|
||||
if (wait && !m_cursorWait) {
|
||||
XLockDisplay(m_xDisp);
|
||||
XDefineCursor(m_xDisp, m_windowId, X_CURSORS.m_wait);
|
||||
|
@ -942,7 +942,7 @@ public:
|
|||
return 60.0;
|
||||
}
|
||||
|
||||
double getWindowRefreshRate() const {
|
||||
double getWindowRefreshRate() const override {
|
||||
BOO_MSAN_NO_INTERCEPT
|
||||
double ret = 60.0;
|
||||
int nmonitors;
|
||||
|
@ -969,7 +969,7 @@ public:
|
|||
return ret;
|
||||
}
|
||||
|
||||
void setWindowFrameDefault() {
|
||||
void setWindowFrameDefault() override {
|
||||
BOO_MSAN_NO_INTERCEPT
|
||||
int x, y, w, h, nmonitors;
|
||||
Screen* screen = DefaultScreenOfDisplay(m_xDisp);
|
||||
|
@ -986,7 +986,7 @@ public:
|
|||
XUnlockDisplay(m_xDisp);
|
||||
}
|
||||
|
||||
void getWindowFrame(float& xOut, float& yOut, float& wOut, float& hOut) const {
|
||||
void getWindowFrame(float& xOut, float& yOut, float& wOut, float& hOut) const override {
|
||||
BOO_MSAN_NO_INTERCEPT
|
||||
XWindowAttributes attrs = {};
|
||||
XLockDisplay(m_xDisp);
|
||||
|
@ -998,7 +998,7 @@ public:
|
|||
hOut = attrs.height;
|
||||
}
|
||||
|
||||
void getWindowFrame(int& xOut, int& yOut, int& wOut, int& hOut) const {
|
||||
void getWindowFrame(int& xOut, int& yOut, int& wOut, int& hOut) const override {
|
||||
BOO_MSAN_NO_INTERCEPT
|
||||
XWindowAttributes attrs = {};
|
||||
XLockDisplay(m_xDisp);
|
||||
|
@ -1010,7 +1010,7 @@ public:
|
|||
hOut = attrs.height;
|
||||
}
|
||||
|
||||
void setWindowFrame(float x, float y, float w, float h) {
|
||||
void setWindowFrame(float x, float y, float w, float h) override {
|
||||
BOO_MSAN_NO_INTERCEPT
|
||||
XWindowChanges values = {(int)x, (int)y, (int)w, (int)h};
|
||||
XLockDisplay(m_xDisp);
|
||||
|
@ -1018,7 +1018,7 @@ public:
|
|||
XUnlockDisplay(m_xDisp);
|
||||
}
|
||||
|
||||
void setWindowFrame(int x, int y, int w, int h) {
|
||||
void setWindowFrame(int x, int y, int w, int h) override {
|
||||
BOO_MSAN_NO_INTERCEPT
|
||||
XWindowChanges values = {x, y, w, h};
|
||||
XLockDisplay(m_xDisp);
|
||||
|
@ -1026,9 +1026,9 @@ public:
|
|||
XUnlockDisplay(m_xDisp);
|
||||
}
|
||||
|
||||
float getVirtualPixelFactor() const { return m_pixelFactor; }
|
||||
float getVirtualPixelFactor() const override { return m_pixelFactor; }
|
||||
|
||||
bool isFullscreen() const {
|
||||
bool isFullscreen() const override {
|
||||
return m_inFs;
|
||||
unsigned long nitems;
|
||||
Atom actualType;
|
||||
|
@ -1054,7 +1054,7 @@ public:
|
|||
return false;
|
||||
}
|
||||
|
||||
void setStyle(EWindowStyle style) {
|
||||
void setStyle(EWindowStyle style) override {
|
||||
struct {
|
||||
unsigned long flags;
|
||||
unsigned long functions;
|
||||
|
@ -1086,9 +1086,9 @@ public:
|
|||
m_styleFlags = style;
|
||||
}
|
||||
|
||||
EWindowStyle getStyle() const { return m_styleFlags; }
|
||||
EWindowStyle getStyle() const override { return m_styleFlags; }
|
||||
|
||||
void setFullscreen(bool fs) {
|
||||
void setFullscreen(bool fs) override {
|
||||
if (fs == m_inFs)
|
||||
return;
|
||||
|
||||
|
@ -1121,7 +1121,7 @@ public:
|
|||
}
|
||||
} m_clipData;
|
||||
|
||||
void claimKeyboardFocus(const int coord[2]) {
|
||||
void claimKeyboardFocus(const int coord[2]) override {
|
||||
if (m_xIC) {
|
||||
XLockDisplay(m_xDisp);
|
||||
if (!coord) {
|
||||
|
@ -1139,7 +1139,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
bool clipboardCopy(EClipboardType type, const uint8_t* data, size_t sz) {
|
||||
bool clipboardCopy(EClipboardType type, const uint8_t* data, size_t sz) override {
|
||||
Atom xType = GetClipboardTypeAtom(type);
|
||||
if (!xType)
|
||||
return false;
|
||||
|
@ -1155,7 +1155,7 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
std::unique_ptr<uint8_t[]> clipboardPaste(EClipboardType type, size_t& sz) {
|
||||
std::unique_ptr<uint8_t[]> clipboardPaste(EClipboardType type, size_t& sz) override {
|
||||
Atom xType = GetClipboardTypeAtom(type);
|
||||
if (!xType)
|
||||
return {};
|
||||
|
@ -1273,7 +1273,7 @@ public:
|
|||
return lhs.tv_nsec - rhs.tv_nsec;
|
||||
}
|
||||
|
||||
int waitForRetrace() {
|
||||
int waitForRetrace() override {
|
||||
BOO_MSAN_NO_INTERCEPT
|
||||
struct timespec tp = {};
|
||||
clock_gettime(CLOCK_REALTIME, &tp);
|
||||
|
@ -1306,7 +1306,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
uintptr_t getPlatformHandle() const { return (uintptr_t)m_windowId; }
|
||||
uintptr_t getPlatformHandle() const override { return (uintptr_t)m_windowId; }
|
||||
|
||||
void _pointingDeviceChanged(int deviceId) {
|
||||
int nDevices;
|
||||
|
@ -1414,7 +1414,7 @@ public:
|
|||
}
|
||||
#endif
|
||||
|
||||
bool _incomingEvent(void* e) {
|
||||
bool _incomingEvent(void* e) override {
|
||||
XEvent* event = (XEvent*)e;
|
||||
switch (event->type) {
|
||||
case SelectionRequest: {
|
||||
|
@ -1708,7 +1708,7 @@ public:
|
|||
return false;
|
||||
}
|
||||
|
||||
void _cleanup() {
|
||||
void _cleanup() override {
|
||||
if (m_gfxCtx) {
|
||||
XLockDisplay(m_xDisp);
|
||||
m_gfxCtx->destroy();
|
||||
|
@ -1720,15 +1720,15 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
ETouchType getTouchType() const { return m_touchType; }
|
||||
ETouchType getTouchType() const override { return m_touchType; }
|
||||
|
||||
IGraphicsCommandQueue* getCommandQueue() { return m_gfxCtx->getCommandQueue(); }
|
||||
IGraphicsCommandQueue* getCommandQueue() override { return m_gfxCtx->getCommandQueue(); }
|
||||
|
||||
IGraphicsDataFactory* getDataFactory() { return m_gfxCtx->getDataFactory(); }
|
||||
IGraphicsDataFactory* getDataFactory() override { return m_gfxCtx->getDataFactory(); }
|
||||
|
||||
IGraphicsDataFactory* getMainContextDataFactory() { return m_gfxCtx->getMainContextDataFactory(); }
|
||||
IGraphicsDataFactory* getMainContextDataFactory() override { return m_gfxCtx->getMainContextDataFactory(); }
|
||||
|
||||
IGraphicsDataFactory* getLoadContextDataFactory() { return m_gfxCtx->getLoadContextDataFactory(); }
|
||||
IGraphicsDataFactory* getLoadContextDataFactory() override { return m_gfxCtx->getLoadContextDataFactory(); }
|
||||
|
||||
bool _isWindowMapped() {
|
||||
XWindowAttributes attr;
|
||||
|
|
Loading…
Reference in New Issue