implemented samuel's requested changes

This commit is contained in:
Anna 2019-06-19 10:34:55 -07:00
parent 803fe1e178
commit a19efce173
2 changed files with 31 additions and 30 deletions

View file

@ -174,11 +174,11 @@ public:
glFinish(); glFinish();
} }
currentPlugin = newPlugin; currentPlugin = newPlugin;
}
_newPluginQueue.pop(); _newPluginQueue.pop();
_condition.notify_one(); _condition.notify_one();
} }
} }
}
// If there's no active plugin, just sleep // If there's no active plugin, just sleep
if (currentPlugin == nullptr) { if (currentPlugin == nullptr) {
@ -384,32 +384,29 @@ void OpenGLDisplayPlugin::customizeContext() {
} }
} }
if (!_drawTexturePipeline) {
gpu::StatePointer blendState = gpu::StatePointer(new gpu::State()); gpu::StatePointer blendState = gpu::StatePointer(new gpu::State());
blendState->setDepthTest(gpu::State::DepthTest(false)); blendState->setDepthTest(gpu::State::DepthTest(false));
blendState->setBlendFunction(true, blendState->setBlendFunction(true,
gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA, gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD,
gpu::State::FACTOR_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::ONE); gpu::State::INV_SRC_ALPHA,
gpu::State::FACTOR_ALPHA, gpu::State::BLEND_OP_ADD,
gpu::State::ONE);
gpu::StatePointer scissorState = gpu::StatePointer(new gpu::State()); gpu::StatePointer scissorState = gpu::StatePointer(new gpu::State());
scissorState->setDepthTest(gpu::State::DepthTest(false)); scissorState->setDepthTest(gpu::State::DepthTest(false));
scissorState->setScissorEnable(true); scissorState->setScissorEnable(true);
{
_drawTexturePipeline = gpu::Pipeline::create(gpu::Shader::createProgram(DrawTexture), scissorState); _drawTexturePipeline = gpu::Pipeline::create(gpu::Shader::createProgram(DrawTexture), scissorState);
}
{
_linearToSRGBPipeline = gpu::Pipeline::create(gpu::Shader::createProgram(DrawTextureGammaLinearToSRGB), scissorState); _linearToSRGBPipeline = gpu::Pipeline::create(gpu::Shader::createProgram(DrawTextureGammaLinearToSRGB), scissorState);
}
{
_SRGBToLinearPipeline = gpu::Pipeline::create(gpu::Shader::createProgram(DrawTextureGammaSRGBToLinear), scissorState); _SRGBToLinearPipeline = gpu::Pipeline::create(gpu::Shader::createProgram(DrawTextureGammaSRGBToLinear), scissorState);
}
{
_hudPipeline = gpu::Pipeline::create(gpu::Shader::createProgram(DrawTexture), blendState); _hudPipeline = gpu::Pipeline::create(gpu::Shader::createProgram(DrawTexture), blendState);
}
{
_mirrorHUDPipeline = gpu::Pipeline::create(gpu::Shader::createProgram(DrawTextureMirroredX), blendState); _mirrorHUDPipeline = gpu::Pipeline::create(gpu::Shader::createProgram(DrawTextureMirroredX), blendState);
}
{
_cursorPipeline = gpu::Pipeline::create(gpu::Shader::createProgram(DrawTransformedTexture), blendState); _cursorPipeline = gpu::Pipeline::create(gpu::Shader::createProgram(DrawTransformedTexture), blendState);
} }
@ -418,10 +415,14 @@ void OpenGLDisplayPlugin::customizeContext() {
void OpenGLDisplayPlugin::uncustomizeContext() { void OpenGLDisplayPlugin::uncustomizeContext() {
_cursorPipeline.reset(); _drawTexturePipeline.reset();
_linearToSRGBPipeline.reset();
_SRGBToLinearPipeline.reset();
_hudPipeline.reset(); _hudPipeline.reset();
_mirrorHUDPipeline.reset(); _mirrorHUDPipeline.reset();
_cursorPipeline.reset();
_compositeFramebuffer.reset(); _compositeFramebuffer.reset();
withPresentThreadLock([&] { withPresentThreadLock([&] {
_currentFrame.reset(); _currentFrame.reset();
_lastFrame = nullptr; _lastFrame = nullptr;

View file

@ -128,8 +128,8 @@ void PickManager::update() {
} }
{ {
int count = 0; int count = 0;
for (int i = 0; i < 4; i++) { for (int i = 0; i < _totalPickCounts.size(); i++) {
count += _totalPickCounts[i]; count += _totalPickCounts[PickQuery::Ray];
} }
PROFILE_RANGE_EX(picks, "RayPicks", 0xffff0000, (uint64_t)count); PROFILE_RANGE_EX(picks, "RayPicks", 0xffff0000, (uint64_t)count);