mirror of
https://github.com/AxioDL/boo.git
synced 2025-12-08 21:17:50 +00:00
General: Make use of override where applicable
Continues the override modernizations, but now targeting boo.
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user