mirror of https://github.com/AxioDL/boo.git
More fixes
This commit is contained in:
parent
337c276ccb
commit
2df85e8f8b
|
@ -295,6 +295,8 @@ struct IGraphicsDataFactory
|
|||
virtual void commitTransaction(const std::function<bool(Context& ctx)>&)=0;
|
||||
|
||||
virtual ObjToken<IGraphicsBufferD> newPoolBuffer(BufferUse use, size_t stride, size_t count)=0;
|
||||
|
||||
virtual void setDisplayGamma(float gamma)=0;
|
||||
};
|
||||
|
||||
using GraphicsDataFactoryContext = IGraphicsDataFactory::Context;
|
||||
|
|
|
@ -1501,6 +1501,8 @@ public:
|
|||
m_sourceToBinary.erase(srcKey);
|
||||
m_sharedShaders.erase(binKey);
|
||||
}
|
||||
|
||||
void setDisplayGamma(float gamma) { /*UpdateGammaLUT(m_gammaLUT.get(), gamma);*/ }
|
||||
};
|
||||
|
||||
void D3D11CommandQueue::execute()
|
||||
|
|
|
@ -2088,6 +2088,8 @@ public:
|
|||
m_sourceToBinary.erase(srcKey);
|
||||
m_sharedShaders.erase(binKey);
|
||||
}
|
||||
|
||||
void setDisplayGamma(float gamma) { /*UpdateGammaLUT(m_gammaLUT.get(), gamma);*/ }
|
||||
};
|
||||
|
||||
void D3D12CommandQueue::execute()
|
||||
|
|
|
@ -50,10 +50,9 @@ BOO_GLSL_BINDING_HEAD
|
|||
"TBINDING1 uniform sampler2D gammaLUT;\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" //int linScale = int(65535.0 * texture(screenTex, vtf.uv).r);\n"
|
||||
" //colorOut = texelFetch(gammaLUT, ivec2(linScale % 256, linScale / 256), 0);\n"
|
||||
" //colorOut = vec4(texture(screenTex, vtf.uv).r, 0.0, 0.0, 1.0);\n"
|
||||
" colorOut = vec4(vtf.uv, 0.0, 1.0);\n"
|
||||
" ivec4 linScale = ivec4(texture(screenTex, vtf.uv) * vec4(65535.0));\n"
|
||||
" for (int i=0 ; i<3 ; ++i)\n"
|
||||
" colorOut[i] = texelFetch(gammaLUT, ivec2(linScale[i] % 256, linScale[i] / 256), 0).r;\n"
|
||||
"}\n";
|
||||
|
||||
namespace boo
|
||||
|
@ -77,7 +76,6 @@ class GLDataFactoryImpl : public GLDataFactory, public GraphicsDataFactoryHead
|
|||
GLContext* m_glCtx;
|
||||
std::unordered_map<uint64_t, std::unique_ptr<GLShareableShader>> m_sharedShaders;
|
||||
|
||||
#if 0
|
||||
ObjToken<IShaderPipeline> m_gammaShader;
|
||||
ObjToken<ITextureD> m_gammaLUT;
|
||||
ObjToken<IGraphicsBufferS> m_gammaVBO;
|
||||
|
@ -91,7 +89,7 @@ class GLDataFactoryImpl : public GLDataFactory, public GraphicsDataFactoryHead
|
|||
2, texNames, 0, nullptr, BlendFactor::One, BlendFactor::Zero,
|
||||
Primitive::TriStrips, ZTest::None, false, true, false, CullMode::None);
|
||||
m_gammaLUT = ctx.newDynamicTexture(256, 256, TextureFormat::I16, TextureClampMode::ClampToEdge);
|
||||
UpdateGammaLUT(m_gammaLUT.get(), 2.2f);
|
||||
UpdateGammaLUT(m_gammaLUT.get(), 1.0f);
|
||||
const struct Vert {
|
||||
float pos[4];
|
||||
float uv[4];
|
||||
|
@ -110,7 +108,6 @@ class GLDataFactoryImpl : public GLDataFactory, public GraphicsDataFactoryHead
|
|||
return true;
|
||||
});
|
||||
}
|
||||
#endif
|
||||
|
||||
public:
|
||||
GLDataFactoryImpl(IGraphicsContext* parent, GLContext* glCtx)
|
||||
|
@ -121,6 +118,8 @@ public:
|
|||
void commitTransaction(const FactoryCommitFunc&);
|
||||
ObjToken<IGraphicsBufferD> newPoolBuffer(BufferUse use, size_t stride, size_t count);
|
||||
void _unregisterShareableShader(uint64_t srcKey, uint64_t binKey) { m_sharedShaders.erase(srcKey); }
|
||||
|
||||
void setDisplayGamma(float gamma) { UpdateGammaLUT(m_gammaLUT.get(), gamma); }
|
||||
};
|
||||
|
||||
static const GLenum USE_TABLE[] =
|
||||
|
@ -324,10 +323,10 @@ class GLTextureS : public GraphicsDataNode<ITextureS>
|
|||
}
|
||||
else
|
||||
{
|
||||
//GLenum compType = intFormat == GL_R16 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_BYTE;
|
||||
GLenum compType = intFormat == GL_R16 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_BYTE;
|
||||
for (size_t i=0 ; i<mips ; ++i)
|
||||
{
|
||||
glTexImage2D(GL_TEXTURE_2D, i, intFormat, width, height, 0, format, GL_UNSIGNED_BYTE, dataIt);
|
||||
glTexImage2D(GL_TEXTURE_2D, i, intFormat, width, height, 0, format, compType, dataIt);
|
||||
dataIt += width * height * pxPitch;
|
||||
if (width > 1)
|
||||
width /= 2;
|
||||
|
@ -400,10 +399,10 @@ class GLTextureSA : public GraphicsDataNode<ITextureSA>
|
|||
Log.report(logvisor::Fatal, "unsupported tex format");
|
||||
}
|
||||
|
||||
//GLenum compType = intFormat == GL_R16 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_BYTE;
|
||||
GLenum compType = intFormat == GL_R16 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_BYTE;
|
||||
for (size_t i=0 ; i<mips ; ++i)
|
||||
{
|
||||
glTexImage3D(GL_TEXTURE_2D_ARRAY, i, intFormat, width, height, layers, 0, format, GL_UNSIGNED_BYTE, dataIt);
|
||||
glTexImage3D(GL_TEXTURE_2D_ARRAY, i, intFormat, width, height, layers, 0, format, compType, dataIt);
|
||||
dataIt += width * height * layers * pxPitch;
|
||||
if (width > 1)
|
||||
width /= 2;
|
||||
|
@ -466,15 +465,14 @@ class GLTextureD : public GraphicsDataNode<ITextureD>
|
|||
m_cpuSz = width * height * pxPitch;
|
||||
m_cpuBuf.reset(new uint8_t[m_cpuSz]);
|
||||
|
||||
//GLenum compType = m_intFormat == GL_R16 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_BYTE;
|
||||
GLenum compType = m_intFormat == GL_R16 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_BYTE;
|
||||
glGenTextures(3, m_texs);
|
||||
for (int i=0 ; i<3 ; ++i)
|
||||
{
|
||||
glBindTexture(GL_TEXTURE_2D, m_texs[i]);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, m_intFormat, width, height, 0, m_format, GL_UNSIGNED_BYTE, nullptr);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, m_intFormat, width, height, 0, m_format, compType, nullptr);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
|
||||
SetClampMode(GL_TEXTURE_2D, clampMode);
|
||||
}
|
||||
}
|
||||
|
@ -488,8 +486,8 @@ public:
|
|||
if ((slot & m_validMask) == 0)
|
||||
{
|
||||
glBindTexture(GL_TEXTURE_2D, m_texs[b]);
|
||||
//GLenum compType = m_intFormat == GL_R16 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_BYTE;
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, m_intFormat, m_width, m_height, 0, m_format, GL_UNSIGNED_BYTE, m_cpuBuf.get());
|
||||
GLenum compType = m_intFormat == GL_R16 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_BYTE;
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, m_intFormat, m_width, m_height, 0, m_format, compType, m_cpuBuf.get());
|
||||
m_validMask |= slot;
|
||||
}
|
||||
}
|
||||
|
@ -582,7 +580,7 @@ public:
|
|||
m_width = width;
|
||||
m_height = height;
|
||||
|
||||
//GLenum compType = m_colorFormat == GL_RGBA16 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_BYTE;
|
||||
GLenum compType = m_colorFormat == GL_RGBA16 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_BYTE;
|
||||
if (m_samples > 1)
|
||||
{
|
||||
glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, m_texs[0]);
|
||||
|
@ -593,7 +591,7 @@ public:
|
|||
else
|
||||
{
|
||||
glBindTexture(GL_TEXTURE_2D, m_texs[0]);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, m_colorFormat, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, m_colorFormat, width, height, 0, GL_RGBA, compType, nullptr);
|
||||
glBindTexture(GL_TEXTURE_2D, m_texs[1]);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT24, width, height, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, nullptr);
|
||||
|
||||
|
@ -607,7 +605,7 @@ public:
|
|||
if (m_bindTexs[0][i])
|
||||
{
|
||||
glBindTexture(GL_TEXTURE_2D, m_bindTexs[0][i]);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, m_colorFormat, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, m_colorFormat, width, height, 0, GL_RGBA, compType, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1318,8 +1316,8 @@ struct GLCommandQueue : IGraphicsCommandQueue
|
|||
{
|
||||
std::unique_lock<std::mutex> lk(self->m_initmt);
|
||||
self->m_parent->makeCurrent();
|
||||
if (glewInit() != GLEW_OK)
|
||||
Log.report(logvisor::Fatal, "unable to init glew");
|
||||
//if (glewInit() != GLEW_OK)
|
||||
// Log.report(logvisor::Fatal, "unable to init glew");
|
||||
const GLubyte* version = glGetString(GL_VERSION);
|
||||
Log.report(logvisor::Info, "OpenGL Version: %s", version);
|
||||
self->m_parent->postInit();
|
||||
|
@ -1336,7 +1334,7 @@ struct GLCommandQueue : IGraphicsCommandQueue
|
|||
self->m_glCtx->m_sampleCount =
|
||||
flp2(std::min(uint32_t(maxSamples), std::max(uint32_t(1), self->m_glCtx->m_sampleCount)) - 1);
|
||||
|
||||
//dataFactory->SetupGammaResources();
|
||||
dataFactory->SetupGammaResources();
|
||||
}
|
||||
self->m_initcv.notify_one();
|
||||
while (self->m_running)
|
||||
|
@ -1496,7 +1494,7 @@ struct GLCommandQueue : IGraphicsCommandQueue
|
|||
{
|
||||
if (const GLTextureR* tex = cmd.source.cast<GLTextureR>())
|
||||
{
|
||||
#if 0
|
||||
#if 1
|
||||
#ifndef NDEBUG
|
||||
if (!tex->m_colorBindCount)
|
||||
Log.report(logvisor::Fatal,
|
||||
|
@ -1505,12 +1503,8 @@ struct GLCommandQueue : IGraphicsCommandQueue
|
|||
glBindFramebuffer(GL_READ_FRAMEBUFFER, tex->m_fbo);
|
||||
if (tex->m_samples <= 1)
|
||||
{
|
||||
glActiveTexture(GL_TEXTURE9);
|
||||
glBindTexture(GL_TEXTURE_2D, tex->m_bindTexs[0][0]);
|
||||
glCopyTexSubImage2D(GL_TEXTURE_2D, 0,
|
||||
0, 0,
|
||||
0, 0,
|
||||
tex->m_width, tex->m_height);
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_2D, tex->m_texs[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1520,12 +1514,12 @@ struct GLCommandQueue : IGraphicsCommandQueue
|
|||
0, 0,
|
||||
tex->m_width, tex->m_height,
|
||||
GL_COLOR_BUFFER_BIT, GL_NEAREST);
|
||||
tex->bind(0, 0, false);
|
||||
}
|
||||
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
|
||||
dataFactory->m_gammaShader.cast<GLShaderPipeline>()->bind();
|
||||
dataFactory->m_gammaVFMT.cast<GLVertexFormat>()->bind(self->m_drawBuf);
|
||||
tex->bind(0, 0, false);
|
||||
dataFactory->m_gammaLUT.cast<GLTextureD>()->bind(1, self->m_drawBuf);
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
|
||||
|
@ -1797,7 +1791,7 @@ GLTextureR::GLTextureR(const ObjToken<BaseGraphicsData>& parent, GLCommandQueue*
|
|||
glGenTextures(depthBindingCount, m_bindTexs[1]);
|
||||
}
|
||||
|
||||
//GLenum compType = colorFormat == GL_RGBA16 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_BYTE;
|
||||
GLenum compType = colorFormat == GL_RGBA16 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_BYTE;
|
||||
if (samples > 1)
|
||||
{
|
||||
glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, m_texs[0]);
|
||||
|
@ -1808,7 +1802,11 @@ GLTextureR::GLTextureR(const ObjToken<BaseGraphicsData>& parent, GLCommandQueue*
|
|||
else
|
||||
{
|
||||
glBindTexture(GL_TEXTURE_2D, m_texs[0]);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, colorFormat, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, colorFormat, width, height, 0, GL_RGBA, compType, nullptr);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
glBindTexture(GL_TEXTURE_2D, m_texs[1]);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT24, width, height, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, nullptr);
|
||||
}
|
||||
|
@ -1816,7 +1814,7 @@ GLTextureR::GLTextureR(const ObjToken<BaseGraphicsData>& parent, GLCommandQueue*
|
|||
for (int i=0 ; i<colorBindingCount ; ++i)
|
||||
{
|
||||
glBindTexture(GL_TEXTURE_2D, m_bindTexs[0][i]);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, colorFormat, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, colorFormat, width, height, 0, GL_RGBA, compType, nullptr);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
SetClampMode(GL_TEXTURE_2D, clampMode);
|
||||
|
|
|
@ -59,6 +59,8 @@ public:
|
|||
m_sourceToBinary.erase(srcKey);
|
||||
m_sharedShaders.erase(binKey);
|
||||
}
|
||||
|
||||
void setDisplayGamma(float gamma) { /*UpdateGammaLUT(m_gammaLUT.get(), gamma);*/ }
|
||||
};
|
||||
|
||||
static inline void ThrowIfFailed(VkResult res)
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
static const int ContextAttribs[] =
|
||||
{
|
||||
WGL_CONTEXT_MAJOR_VERSION_ARB, 3,
|
||||
WGL_CONTEXT_MAJOR_VERSION_ARB, 3,
|
||||
WGL_CONTEXT_MINOR_VERSION_ARB, 3,
|
||||
WGL_CONTEXT_FLAGS_ARB, WGL_CONTEXT_CORE_PROFILE_BIT_ARB,
|
||||
//WGL_CONTEXT_FLAGS_ARB, WGL_CONTEXT_DEBUG_BIT_ARB,
|
||||
//WGL_CONTEXT_FLAGS_ARB, WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB,
|
||||
|
@ -276,9 +276,11 @@ public:
|
|||
int pf = ChoosePixelFormat(w.m_deviceContext, &pfd);
|
||||
SetPixelFormat(w.m_deviceContext, pf, &pfd);
|
||||
|
||||
#if 0
|
||||
#if 1
|
||||
HGLRC tmpCtx = wglCreateContext(w.m_deviceContext);
|
||||
wglMakeCurrent(w.m_deviceContext, tmpCtx);
|
||||
if (glewInit() != GLEW_OK)
|
||||
Log.report(logvisor::Fatal, "glewInit failed");
|
||||
wglCreateContextAttribsARB = (PFNWGLCREATECONTEXTATTRIBSARBPROC)
|
||||
wglGetProcAddress("wglCreateContextAttribsARB");
|
||||
wglChoosePixelFormatARB = (PFNWGLCHOOSEPIXELFORMATARBPROC)
|
||||
|
@ -314,8 +316,8 @@ public:
|
|||
#endif
|
||||
}
|
||||
|
||||
//w.m_mainContext = wglCreateContextAttribsARB(w.m_deviceContext, 0, ContextAttribs);
|
||||
w.m_mainContext = wglCreateContext(w.m_deviceContext);
|
||||
//w.m_mainContext = wglCreateContext(w.m_deviceContext);
|
||||
w.m_mainContext = wglCreateContextAttribsARB(w.m_deviceContext, 0, ContextAttribs);
|
||||
if (!w.m_mainContext)
|
||||
Log.report(logvisor::Fatal, "unable to create window's main context");
|
||||
if (m_3dCtx.m_ctxOgl.m_lastContext)
|
||||
|
@ -360,7 +362,13 @@ public:
|
|||
void makeCurrent()
|
||||
{
|
||||
OGLContext::Window& w = m_3dCtx.m_ctxOgl.m_windows[m_parentWindow];
|
||||
if (!wglMakeCurrent(w.m_deviceContext, w.m_mainContext))
|
||||
//if (!wglMakeCurrent(w.m_deviceContext, w.m_mainContext))
|
||||
// Log.report(logvisor::Fatal, "unable to make WGL context current");
|
||||
|
||||
w.m_renderContext = wglCreateContextAttribsARB(w.m_deviceContext, w.m_mainContext, ContextAttribs);
|
||||
if (!w.m_renderContext)
|
||||
Log.report(logvisor::Fatal, "unable to make new WGL context");
|
||||
if (!wglMakeCurrent(w.m_deviceContext, w.m_renderContext))
|
||||
Log.report(logvisor::Fatal, "unable to make WGL context current");
|
||||
}
|
||||
|
||||
|
@ -368,13 +376,13 @@ public:
|
|||
{
|
||||
OGLContext::Window& w = m_3dCtx.m_ctxOgl.m_windows[m_parentWindow];
|
||||
|
||||
wglCreateContextAttribsARB = (PFNWGLCREATECONTEXTATTRIBSARBPROC)
|
||||
wglGetProcAddress("wglCreateContextAttribsARB");
|
||||
w.m_renderContext = wglCreateContextAttribsARB(w.m_deviceContext, w.m_mainContext, ContextAttribs);
|
||||
if (!w.m_renderContext)
|
||||
Log.report(logvisor::Fatal, "unable to make new WGL context");
|
||||
if (!wglMakeCurrent(w.m_deviceContext, w.m_renderContext))
|
||||
Log.report(logvisor::Fatal, "unable to make WGL context current");
|
||||
//wglCreateContextAttribsARB = (PFNWGLCREATECONTEXTATTRIBSARBPROC)
|
||||
// wglGetProcAddress("wglCreateContextAttribsARB");
|
||||
//w.m_renderContext = wglCreateContextAttribsARB(w.m_deviceContext, w.m_mainContext, ContextAttribs);
|
||||
//if (!w.m_renderContext)
|
||||
// Log.report(logvisor::Fatal, "unable to make new WGL context");
|
||||
//if (!wglMakeCurrent(w.m_deviceContext, w.m_renderContext))
|
||||
// Log.report(logvisor::Fatal, "unable to make WGL context current");
|
||||
|
||||
if (!WGLEW_EXT_swap_control)
|
||||
Log.report(logvisor::Fatal, "WGL_EXT_swap_control not available");
|
||||
|
|
|
@ -257,7 +257,7 @@ struct CTestWindowCallback : IWindowCallback
|
|||
|
||||
void windowMoved(const SWindowRect& rect)
|
||||
{
|
||||
fprintf(stderr, "Moved %d, %d (%d, %d)\n", rect.size[0], rect.size[1], rect.location[0], rect.location[1]);
|
||||
//fprintf(stderr, "Moved %d, %d (%d, %d)\n", rect.size[0], rect.size[1], rect.location[0], rect.location[1]);
|
||||
}
|
||||
|
||||
void destroyed()
|
||||
|
@ -277,16 +277,8 @@ struct TestApplicationCallback : IApplicationCallback
|
|||
boo::ObjToken<IShaderDataBinding> m_binding;
|
||||
boo::ObjToken<ITextureR> m_renderTarget;
|
||||
|
||||
std::mutex m_mt;
|
||||
std::condition_variable m_cv;
|
||||
|
||||
std::mutex m_initmt;
|
||||
std::condition_variable m_initcv;
|
||||
|
||||
static void LoaderProc(TestApplicationCallback* self)
|
||||
{
|
||||
std::unique_lock<std::mutex> lk(self->m_initmt);
|
||||
|
||||
IGraphicsDataFactory* factory = self->mainWindow->getLoadContextDataFactory();
|
||||
|
||||
factory->commitTransaction([&](IGraphicsDataFactory::Context& ctx) -> bool
|
||||
|
@ -491,19 +483,6 @@ struct TestApplicationCallback : IApplicationCallback
|
|||
|
||||
return true;
|
||||
});
|
||||
|
||||
/* Return control to client */
|
||||
lk.unlock();
|
||||
self->m_initcv.notify_one();
|
||||
|
||||
/* Wait for exit */
|
||||
while (self->running)
|
||||
{
|
||||
std::unique_lock<std::mutex> lk(self->m_mt);
|
||||
self->m_cv.wait(lk);
|
||||
if (!self->running)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int appMain(IApplication* app)
|
||||
|
@ -517,9 +496,7 @@ struct TestApplicationCallback : IApplicationCallback
|
|||
|
||||
IGraphicsCommandQueue* gfxQ = mainWindow->getCommandQueue();
|
||||
|
||||
std::unique_lock<std::mutex> lk(m_initmt);
|
||||
std::thread loaderThread(LoaderProc, this);
|
||||
m_initcv.wait(lk);
|
||||
LoaderProc(this);
|
||||
|
||||
size_t frameIdx = 0;
|
||||
size_t lastCheck = 0;
|
||||
|
@ -551,7 +528,14 @@ struct TestApplicationCallback : IApplicationCallback
|
|||
r.location[1] = 0;
|
||||
gfxQ->setViewport(r);
|
||||
gfxQ->setScissor(r);
|
||||
float rgba[] = {std::max(0.f, sinf(frameIdx / 60.0)), std::max(0.f, cosf(frameIdx / 60.0)), 0.0, 1.0};
|
||||
//float rgba[] = {std::max(0.f, sinf(frameIdx / 60.0)), std::max(0.f, cosf(frameIdx / 60.0)), 0.0, 1.0};
|
||||
float gammaT = sinf(frameIdx / 60.0) + 1.f;
|
||||
//if (gammaT < 0.f)
|
||||
// gammaT = 1.f / ((1.f - gammaT) * 2.f);
|
||||
//else
|
||||
// gammaT = gammaT + 1.f;
|
||||
printf("%f\n", gammaT);
|
||||
mainWindow->getDataFactory()->setDisplayGamma(gammaT);
|
||||
//gfxQ->setClearColor(rgba);
|
||||
gfxQ->clearTarget();
|
||||
|
||||
|
@ -570,9 +554,10 @@ struct TestApplicationCallback : IApplicationCallback
|
|||
}
|
||||
}
|
||||
|
||||
m_renderTarget.reset();
|
||||
m_binding.reset();
|
||||
|
||||
gfxQ->stopRenderer();
|
||||
m_cv.notify_one();
|
||||
loaderThread.join();
|
||||
return 0;
|
||||
}
|
||||
void appQuitting(IApplication*)
|
||||
|
|
Loading…
Reference in New Issue