Commit 972e6465 authored by Paul Lemire's avatar Paul Lemire
Browse files

Merge "Merge remote-tracking branch '5.13' into 5.14"

parents b71e3b7b d15a80e5
......@@ -500,7 +500,8 @@ void Renderer::releaseGraphicsResources()
QOpenGLContext *context = m_submissionContext->openGLContext();
Q_ASSERT(context);
if (context->makeCurrent(offscreenSurface)) {
if (context->thread() == QThread::currentThread() && context->makeCurrent(offscreenSurface)) {
// Clean up the graphics context and any resources
const QVector<HGLTexture> activeTexturesHandles = m_nodesManager->glTextureManager()->activeHandles();
......
......@@ -102,6 +102,12 @@ int LIGHT_COLOR_NAMES[MAX_LIGHTS];
int LIGHT_INTENSITY_NAMES[MAX_LIGHTS];
QString LIGHT_STRUCT_NAMES[MAX_LIGHTS];
int LIGHT_POSITION_UNROLL_NAMES[MAX_LIGHTS];
int LIGHT_TYPE_UNROLL_NAMES[MAX_LIGHTS];
int LIGHT_COLOR_UNROLL_NAMES[MAX_LIGHTS];
int LIGHT_INTENSITY_UNROLL_NAMES[MAX_LIGHTS];
QString LIGHT_STRUCT_UNROLL_NAMES[MAX_LIGHTS];
bool wasInitialized = false;
} // anonymous namespace
......@@ -261,6 +267,12 @@ RenderView::RenderView()
LIGHT_TYPE_NAMES[i] = StringToInt::lookupId(LIGHT_STRUCT_NAMES[i] + LIGHT_TYPE_NAME);
LIGHT_COLOR_NAMES[i] = StringToInt::lookupId(LIGHT_STRUCT_NAMES[i] + LIGHT_COLOR_NAME);
LIGHT_INTENSITY_NAMES[i] = StringToInt::lookupId(LIGHT_STRUCT_NAMES[i] + LIGHT_INTENSITY_NAME);
LIGHT_STRUCT_UNROLL_NAMES[i] = QLatin1String("light_") + QLatin1Char(char('0' + i));
LIGHT_POSITION_UNROLL_NAMES[i] = StringToInt::lookupId(LIGHT_STRUCT_UNROLL_NAMES[i] + LIGHT_POSITION_NAME);
LIGHT_TYPE_UNROLL_NAMES[i] = StringToInt::lookupId(LIGHT_STRUCT_UNROLL_NAMES[i] + LIGHT_TYPE_NAME);
LIGHT_COLOR_UNROLL_NAMES[i] = StringToInt::lookupId(LIGHT_STRUCT_UNROLL_NAMES[i] + LIGHT_COLOR_NAME);
LIGHT_INTENSITY_UNROLL_NAMES[i] = StringToInt::lookupId(LIGHT_STRUCT_UNROLL_NAMES[i] + LIGHT_INTENSITY_NAME);
}
}
}
......@@ -1008,6 +1020,11 @@ void RenderView::setShaderAndUniforms(RenderCommand *command,
setUniformValue(command->m_parameterPack, LIGHT_COLOR_NAMES[lightIdx], Vector3D(1.0f, 1.0f, 1.0f));
setUniformValue(command->m_parameterPack, LIGHT_INTENSITY_NAMES[lightIdx], 0.5f);
setUniformValue(command->m_parameterPack, LIGHT_POSITION_UNROLL_NAMES[lightIdx], worldPos);
setUniformValue(command->m_parameterPack, LIGHT_TYPE_UNROLL_NAMES[lightIdx], int(QAbstractLight::PointLight));
setUniformValue(command->m_parameterPack, LIGHT_COLOR_UNROLL_NAMES[lightIdx], Vector3D(1.0f, 1.0f, 1.0f));
setUniformValue(command->m_parameterPack, LIGHT_INTENSITY_UNROLL_NAMES[lightIdx], 0.5f);
// There is no risk in doing that even if multithreaded
// since we are sure that a shaderData is unique for a given light
// and won't ever be referenced as a Component either
......@@ -1016,6 +1033,7 @@ void RenderView::setShaderAndUniforms(RenderCommand *command,
shaderData->updateWorldTransform(*worldTransform);
setDefaultUniformBlockShaderDataValue(command->m_parameterPack, shader, shaderData, LIGHT_STRUCT_NAMES[lightIdx]);
setDefaultUniformBlockShaderDataValue(command->m_parameterPack, shader, shaderData, LIGHT_STRUCT_UNROLL_NAMES[lightIdx]);
++lightIdx;
}
}
......@@ -1030,6 +1048,11 @@ void RenderView::setShaderAndUniforms(RenderCommand *command,
setUniformValue(command->m_parameterPack, LIGHT_TYPE_NAMES[0], int(QAbstractLight::PointLight));
setUniformValue(command->m_parameterPack, LIGHT_COLOR_NAMES[0], Vector3D(1.0f, 1.0f, 1.0f));
setUniformValue(command->m_parameterPack, LIGHT_INTENSITY_NAMES[0], 0.5f);
setUniformValue(command->m_parameterPack, LIGHT_POSITION_UNROLL_NAMES[0], Vector3D(10.0f, 10.0f, 0.0f));
setUniformValue(command->m_parameterPack, LIGHT_TYPE_UNROLL_NAMES[0], int(QAbstractLight::PointLight));
setUniformValue(command->m_parameterPack, LIGHT_COLOR_UNROLL_NAMES[0], Vector3D(1.0f, 1.0f, 1.0f));
setUniformValue(command->m_parameterPack, LIGHT_INTENSITY_UNROLL_NAMES[0], 0.5f);
}
// Environment Light
......
......@@ -138,6 +138,27 @@ void QAbstractTexturePrivate::setHandleType(QAbstractTexture::HandleType type)
will create 2 identical textures on the GPU, no sharing will take place.
*/
/*!
\qmltype AbstractTexture
\instantiates Qt3DRender::QAbstractTexture
\inqmlmodule Qt3D.Render
\since 5.5
\brief A base class to be used to provide textures.
The AbstractTexture class shouldn't be used directly but rather through one
of its subclasses. Each subclass implements a given texture target (2D,
2DArray, 3D, CubeMap ...) Each subclass provides a set of functors for each
layer, cube map face and mipmap level. In turn the backend uses those
functor to properly fill a corresponding OpenGL texture with data. It is
expected the functor does as minimal processing as possible so as not to
slow down textures generation and upload. If the content of a texture is
the result of a slow procedural generation process, it is recommended not
to implement this directly in a functor.
All textures are unique. If you instantiate twice the same texture this
will create 2 identical textures on the GPU, no sharing will take place.
*/
/*!
\enum Qt3DRender::QAbstractTexture::CubeMapFace
......@@ -408,6 +429,12 @@ void QAbstractTexture::setSize(int w, int h, int d)
Holds the width of the texture provider.
*/
/*!
\qmlproperty int Qt3DRender::QAbstractTexture::width
Holds the width of the texture provider.
*/
/*!
Set the width of the texture provider to \a width.
*/
......@@ -423,6 +450,11 @@ void QAbstractTexture::setWidth(int width)
/*!
\property Qt3DRender::QAbstractTexture::height
Holds the height of the texture provider.
*/
/*!
\qmlproperty int Qt3DRender::QAbstractTexture::height
Holds the height of the texture provider.
*/
/*!
......@@ -440,6 +472,11 @@ void QAbstractTexture::setHeight(int height)
/*!
\property Qt3DRender::QAbstractTexture::depth
Holds the depth of the texture provider.
*/
/*!
\qmlproperty int Qt3DRender::QAbstractTexture::depth
Holds the depth of the texture provider.
*/
/*!
......@@ -487,6 +524,15 @@ int QAbstractTexture::depth() const
Holds the maximum layer count of the texture provider. By default, the
maximum layer count is 1.
\note this has a meaning only for texture providers that have 3D or
array target formats.
*/
/*!
\qmlproperty int Qt3DRender::QAbstractTexture::layers
Holds the maximum layer count of the texture provider. By default, the
maximum layer count is 1.
\note this has a meaning only for texture providers that have 3D or
array target formats.
*/
......@@ -520,6 +566,15 @@ int QAbstractTexture::layers() const
Holds the number of samples per texel for the texture provider.
By default, the number of samples is 1.
\note this has a meaning only for texture providers that have multisample
formats.
*/
/*!
\qmlproperty int Qt3DRender::QAbstractTexture::samples
Holds the number of samples per texel for the texture provider.
By default, the number of samples is 1.
\note this has a meaning only for texture providers that have multisample
formats.
*/
......@@ -550,6 +605,11 @@ int QAbstractTexture::samples() const
/*!
\property Qt3DRender::QAbstractTexture::format
Holds the format of the texture provider.
*/
/*!
\qmlproperty TextureFormat Qt3DRender::QAbstractTexture::format
Holds the format of the texture provider.
*/
/*!
......@@ -576,6 +636,11 @@ QAbstractTexture::TextureFormat QAbstractTexture::format() const
/*!
\property Qt3DRender::QAbstractTexture::status readonly
Holds the current status of the texture provider.
*/
/*!
\qmlproperty Status Qt3DRender::QAbstractTexture::status readonly
Holds the current status of the texture provider.
*/
......@@ -645,6 +710,13 @@ QAbstractTexture::Status QAbstractTexture::status() const
Holds the target format of the texture provider.
\note The target format can only be set once.
*/
/*!
\qmlproperty Target Qt3DRender::QAbstractTexture::target readonly
Holds the target format of the texture provider.
\note The target format can only be set once.
*/
/*!
......@@ -738,6 +810,11 @@ QVector<QAbstractTextureImage *> QAbstractTexture::textureImages() const
/*!
\property Qt3DRender::QAbstractTexture::generateMipMaps
Holds whether the texture provider should auto generate mipmaps.
*/
/*!
\qmlproperty bool Qt3DRender::QAbstractTexture::generateMipMaps
Holds whether the texture provider should auto generate mipmaps.
*/
/*!
......@@ -762,6 +839,11 @@ bool QAbstractTexture::generateMipMaps() const
/*!
\property Qt3DRender::QAbstractTexture::minificationFilter
Holds the minification filter of the texture provider.
*/
/*!
\qmlproperty Filter Qt3DRender::QAbstractTexture::minificationFilter
Holds the minification filter of the texture provider.
*/
/*!
......@@ -796,6 +878,11 @@ void QAbstractTexture::setMinificationFilter(Filter f)
/*!
\property Qt3DRender::QAbstractTexture::magnificationFilter
Holds the magnification filter of the texture provider.
*/
/*!
\qmlproperty Filter Qt3DRender::QAbstractTexture::magnificationFilter
Holds the magnification filter of the texture provider.
*/
/*!
......@@ -825,6 +912,11 @@ QAbstractTexture::Filter QAbstractTexture::magnificationFilter() const
/*!
\property Qt3DRender::QAbstractTexture::wrapMode
Holds the wrap mode of the texture provider.
*/
/*!
\qmlproperty QTextureWrapMode Qt3DRender::QAbstractTexture::wrapMode
Holds the wrap mode of the texture provider.
*/
/*!
......@@ -856,6 +948,11 @@ QTextureWrapMode *QAbstractTexture::wrapMode()
/*!
\property Qt3DRender::QAbstractTexture::maximumAnisotropy
Holds the maximum anisotropy of the texture provider.
*/
/*!
\qmlproperty bool Qt3DRender::QAbstractTexture::maximumAnisotropy
Holds the maximum anisotropy of the texture provider.
*/
/*!
......@@ -882,6 +979,11 @@ float QAbstractTexture::maximumAnisotropy() const
/*!
\property Qt3DRender::QAbstractTexture::ComparisonFunction
Holds the comparison function of the texture provider.
*/
/*!
\qmlproperty ComparisonFunction Qt3DRender::QAbstractTexture::ComparisonFunction
Holds the comparison function of the texture provider.
*/
/*!
......@@ -908,6 +1010,12 @@ QAbstractTexture::ComparisonFunction QAbstractTexture::comparisonFunction() cons
/*!
\property Qt3DRender::QAbstractTexture::ComparisonMode
Holds the comparison mode of the texture provider.
*/
/*!
\qmlproperty ComparisonMode Qt3DRender::QAbstractTexture::ComparisonMode
Holds the comparison mode of the texture provider.
*/
/*!
......
......@@ -1161,6 +1161,13 @@ void TextureDownloadRequest::onCompleted()
\since 5.5
\brief A QAbstractTexture with a Target1D target format.
*/
/*!
\qmltype Texture1D
\instantiates Qt3DRender::QTexture1D
\inqmlmodule Qt3D.Render
\since 5.5
\brief An AbstractTexture with a Target1D target format.
*/
/*!
Constructs a new Qt3DRender::QTexture1D instance with \a parent as parent.
......@@ -1182,6 +1189,13 @@ QTexture1D::~QTexture1D()
\since 5.5
\brief A QAbstractTexture with a Target1DArray target format.
*/
/*!
\qmltype Texture1DArray
\instantiates Qt3DRender::QTexture1DArray
\inqmlmodule Qt3D.Render
\since 5.5
\brief An AbstractTexture with a Target1DArray target format.
*/
/*!
Constructs a new Qt3DRender::QTexture1DArray instance with \a parent as parent.
......@@ -1203,6 +1217,13 @@ QTexture1DArray::~QTexture1DArray()
\since 5.5
\brief A QAbstractTexture with a Target2D target format.
*/
/*!
\qmltype Texture2D
\instantiates Qt3DRender::QTexture2D
\inqmlmodule Qt3D.Render
\since 5.5
\brief An AbstractTexture with a Target2D target format.
*/
/*!
Constructs a new Qt3DRender::QTexture2D instance with \a parent as parent.
......@@ -1224,6 +1245,13 @@ QTexture2D::~QTexture2D()
\since 5.5
\brief A QAbstractTexture with a Target2DArray target format.
*/
/*!
\qmltype Texture2DArray
\instantiates Qt3DRender::QTexture2DArray
\inqmlmodule Qt3D.Render
\since 5.5
\brief An AbstractTexture with a Target2DArray target format.
*/
/*!
Constructs a new Qt3DRender::QTexture2DArray instance with \a parent as parent.
......@@ -1245,6 +1273,13 @@ QTexture2DArray::~QTexture2DArray()
\since 5.5
\brief A QAbstractTexture with a Target3D target format.
*/
/*!
\qmltype Texture3D
\instantiates Qt3DRender::QTexture3D
\inqmlmodule Qt3D.Render
\since 5.5
\brief An AbstractTexture with a Target3D target format.
*/
/*!
Constructs a new Qt3DRender::QTexture3D instance with \a parent as parent.
......@@ -1266,6 +1301,13 @@ QTexture3D::~QTexture3D()
\since 5.5
\brief A QAbstractTexture with a TargetCubeMap target format.
*/
/*!
\qmltype TextureCubeMap
\instantiates Qt3DRender::QTextureCubeMap
\inqmlmodule Qt3D.Render
\since 5.5
\brief An AbstractTexture with a TargetCubeMap target format.
*/
/*!
Constructs a new Qt3DRender::QTextureCubeMap instance with \a parent as parent.
......@@ -1287,6 +1329,13 @@ QTextureCubeMap::~QTextureCubeMap()
\since 5.5
\brief A QAbstractTexture with a TargetCubeMapArray target format.
*/
/*!
\qmltype TextureCubeMapArray
\instantiates Qt3DRender::QTextureCubeMapArray
\inqmlmodule Qt3D.Render
\since 5.5
\brief An AbstractTexture with a TargetCubeMapArray target format.
*/
/*!
Constructs a new Qt3DRender::QTextureCubeMapArray instance with \a parent as parent.
......@@ -1308,6 +1357,13 @@ QTextureCubeMapArray::~QTextureCubeMapArray()
\since 5.5
\brief A QAbstractTexture with a Target2DMultisample target format.
*/
/*!
\qmltype Texture2DMultisample
\instantiates Qt3DRender::QTexture2DMultisample
\inqmlmodule Qt3D.Render
\since 5.5
\brief An AbstractTexture with a Target2DMultisample target format.
*/
/*!
Constructs a new Qt3DRender::QTexture2DMultisample instance with \a parent as parent.
......@@ -1329,6 +1385,13 @@ QTexture2DMultisample::~QTexture2DMultisample()
\since 5.5
\brief A QAbstractTexture with a Target2DMultisampleArray target format.
*/
/*!
\qmltype Texture2DMultisampleArray
\instantiates Qt3DRender::QTexture2DMultisampleArray
\inqmlmodule Qt3D.Render
\since 5.5
\brief An AbstractTexture with a Target2DMultisampleArray target format.
*/
/*!
Constructs a new Qt3DRender::QTexture2DMultisampleArray instance with \a parent as parent.
......@@ -1350,6 +1413,13 @@ QTexture2DMultisampleArray::~QTexture2DMultisampleArray()
\since 5.5
\brief A QAbstractTexture with a TargetRectangle target format.
*/
/*!
\qmltype TextureRectangle
\instantiates Qt3DRender::QTextureRectangle
\inqmlmodule Qt3D.Render
\since 5.5
\brief An AbstractTexture with a TargetRectangle target format.
*/
/*!
Constructs a new Qt3DRender::QTextureRectangle instance with \a parent as parent.
......@@ -1371,6 +1441,13 @@ QTextureRectangle::~QTextureRectangle()
\since 5.5
\brief A QAbstractTexture with a TargetBuffer target format.
*/
/*!
\qmltype TextureBuffer
\instantiates Qt3DRender::QTextureBuffer
\inqmlmodule Qt3D.Render
\since 5.5
\brief An AbstractTexture with a TargetBuffer target format.
*/
/*!
Constructs a new Qt3DRender::QTextureBuffer instance with \a parent as parent.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment