2017-10-28 02:10:06 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
2017-03-31 17:29:14 +03:00
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#include "RenderTextureHost.h"
|
2020-04-05 06:49:51 +03:00
|
|
|
|
|
|
|
#include "GLContext.h"
|
2017-06-07 18:44:05 +03:00
|
|
|
#include "RenderThread.h"
|
2017-03-31 17:29:14 +03:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace wr {
|
|
|
|
|
2018-09-03 22:43:31 +03:00
|
|
|
void ActivateBindAndTexParameteri(gl::GLContext* aGL, GLenum aActiveTexture,
|
|
|
|
GLenum aBindTarget, GLuint aBindTexture,
|
|
|
|
wr::ImageRendering aRendering) {
|
|
|
|
aGL->fActiveTexture(aActiveTexture);
|
|
|
|
aGL->fBindTexture(aBindTarget, aBindTexture);
|
|
|
|
aGL->fTexParameteri(aBindTarget, LOCAL_GL_TEXTURE_MIN_FILTER,
|
|
|
|
aRendering == wr::ImageRendering::Pixelated
|
|
|
|
? LOCAL_GL_NEAREST
|
|
|
|
: LOCAL_GL_LINEAR);
|
|
|
|
aGL->fTexParameteri(aBindTarget, LOCAL_GL_TEXTURE_MAG_FILTER,
|
|
|
|
aRendering == wr::ImageRendering::Pixelated
|
|
|
|
? LOCAL_GL_NEAREST
|
|
|
|
: LOCAL_GL_LINEAR);
|
|
|
|
}
|
|
|
|
|
2019-04-04 01:05:27 +03:00
|
|
|
RenderTextureHost::RenderTextureHost()
|
|
|
|
: mCachedRendering(wr::ImageRendering::Auto) {
|
|
|
|
MOZ_COUNT_CTOR(RenderTextureHost);
|
|
|
|
}
|
2017-03-31 17:29:14 +03:00
|
|
|
|
|
|
|
RenderTextureHost::~RenderTextureHost() {
|
2017-06-07 18:44:05 +03:00
|
|
|
MOZ_ASSERT(RenderThread::IsInRenderThread());
|
2017-03-31 17:29:14 +03:00
|
|
|
MOZ_COUNT_DTOR(RenderTextureHost);
|
|
|
|
}
|
|
|
|
|
2018-09-03 22:43:31 +03:00
|
|
|
bool RenderTextureHost::IsFilterUpdateNecessary(wr::ImageRendering aRendering) {
|
|
|
|
return mCachedRendering != aRendering;
|
|
|
|
}
|
|
|
|
|
2020-08-13 00:25:17 +03:00
|
|
|
wr::WrExternalImage RenderTextureHost::Lock(uint8_t aChannelIndex,
|
|
|
|
gl::GLContext* aGL,
|
|
|
|
wr::ImageRendering aRendering) {
|
|
|
|
return InvalidToWrExternalImage();
|
|
|
|
}
|
|
|
|
|
|
|
|
wr::WrExternalImage RenderTextureHost::LockSWGL(uint8_t aChannelIndex,
|
|
|
|
void* aContext,
|
|
|
|
wr::ImageRendering aRendering) {
|
|
|
|
return InvalidToWrExternalImage();
|
|
|
|
}
|
|
|
|
|
2017-03-31 17:29:14 +03:00
|
|
|
} // namespace wr
|
|
|
|
} // namespace mozilla
|