mirror of https://github.com/qt/qt3d.git
Uniform: add handling of uniform of Image based types
Change-Id: I94adc182a0f744b022fb13f4e2dbd16e47e2ba71 Reviewed-by: Michael Brasser <michael.brasser@live.com>
This commit is contained in:
parent
bece22b638
commit
7f72710d73
|
|
@ -101,6 +101,7 @@ enum UniformType {
|
||||||
Mat3x4,
|
Mat3x4,
|
||||||
Mat4x3,
|
Mat4x3,
|
||||||
Sampler,
|
Sampler,
|
||||||
|
Image,
|
||||||
Unknown
|
Unknown
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -111,7 +112,8 @@ public:
|
||||||
ScalarValue,
|
ScalarValue,
|
||||||
NodeId,
|
NodeId,
|
||||||
TextureValue,
|
TextureValue,
|
||||||
BufferValue
|
BufferValue,
|
||||||
|
ShaderImageValue
|
||||||
};
|
};
|
||||||
|
|
||||||
// UniformValue implicitely converts doubles to floats to ensure
|
// UniformValue implicitely converts doubles to floats to ensure
|
||||||
|
|
|
||||||
|
|
@ -782,6 +782,7 @@ void GraphicsContext::applyUniform(const ShaderUniform &description, const Unifo
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case UniformType::Sampler:
|
case UniformType::Sampler:
|
||||||
|
case UniformType::Image:
|
||||||
case UniformType::Int:
|
case UniformType::Int:
|
||||||
applyUniformHelper<UniformType::Int>(description, v);
|
applyUniformHelper<UniformType::Int>(description, v);
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -110,6 +110,42 @@ QT_BEGIN_NAMESPACE
|
||||||
#ifndef GL_SHADER_STORAGE_BARRIER_BIT
|
#ifndef GL_SHADER_STORAGE_BARRIER_BIT
|
||||||
#define GL_SHADER_STORAGE_BARRIER_BIT 0x00002000
|
#define GL_SHADER_STORAGE_BARRIER_BIT 0x00002000
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef GL_IMAGE_2D
|
||||||
|
#define GL_IMAGE_2D 0x904D
|
||||||
|
#endif
|
||||||
|
#ifndef GL_IMAGE_3D
|
||||||
|
#define GL_IMAGE_3D 0x904E
|
||||||
|
#endif
|
||||||
|
#ifndef GL_IMAGE_CUBE
|
||||||
|
#define GL_IMAGE_CUBE 0x9050
|
||||||
|
#endif
|
||||||
|
#ifndef GL_IMAGE_2D_ARRAY
|
||||||
|
#define GL_IMAGE_2D_ARRAY 0x9053
|
||||||
|
#endif
|
||||||
|
#ifndef GL_INT_IMAGE_2D
|
||||||
|
#define GL_INT_IMAGE_2D 0x9058
|
||||||
|
#endif
|
||||||
|
#ifndef GL_INT_IMAGE_3D
|
||||||
|
#define GL_INT_IMAGE_3D 0x9059
|
||||||
|
#endif
|
||||||
|
#ifndef GL_INT_IMAGE_CUBE
|
||||||
|
#define GL_INT_IMAGE_CUBE 0x905B
|
||||||
|
#endif
|
||||||
|
#ifndef GL_INT_IMAGE_2D_ARRAY
|
||||||
|
#define GL_INT_IMAGE_2D_ARRAY 0x905E
|
||||||
|
#endif
|
||||||
|
#ifndef GL_UNSIGNED_INT_IMAGE_2D
|
||||||
|
#define GL_UNSIGNED_INT_IMAGE_2D 0x9063
|
||||||
|
#endif
|
||||||
|
#ifndef GL_UNSIGNED_INT_IMAGE_3D
|
||||||
|
#define GL_UNSIGNED_INT_IMAGE_3D 0x9064
|
||||||
|
#endif
|
||||||
|
#ifndef GL_UNSIGNED_INT_IMAGE_CUBE
|
||||||
|
#define GL_UNSIGNED_INT_IMAGE_CUBE 0x9066
|
||||||
|
#endif
|
||||||
|
#ifndef GL_UNSIGNED_INT_IMAGE_2D_ARRAY
|
||||||
|
#define GL_UNSIGNED_INT_IMAGE_2D_ARRAY 0x9069
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
namespace Qt3DRender {
|
namespace Qt3DRender {
|
||||||
|
|
@ -254,6 +290,19 @@ UniformType GraphicsHelperES3_1::uniformTypeFromGLType(GLenum glType)
|
||||||
case GL_INT_SAMPLER_2D_MULTISAMPLE:
|
case GL_INT_SAMPLER_2D_MULTISAMPLE:
|
||||||
case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE:
|
case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE:
|
||||||
return UniformType::Sampler;
|
return UniformType::Sampler;
|
||||||
|
case GL_IMAGE_2D:
|
||||||
|
case GL_IMAGE_3D:
|
||||||
|
case GL_IMAGE_CUBE:
|
||||||
|
case GL_IMAGE_2D_ARRAY:
|
||||||
|
case GL_INT_IMAGE_2D:
|
||||||
|
case GL_INT_IMAGE_3D:
|
||||||
|
case GL_INT_IMAGE_CUBE:
|
||||||
|
case GL_INT_IMAGE_2D_ARRAY:
|
||||||
|
case GL_UNSIGNED_INT_IMAGE_2D:
|
||||||
|
case GL_UNSIGNED_INT_IMAGE_3D:
|
||||||
|
case GL_UNSIGNED_INT_IMAGE_CUBE:
|
||||||
|
case GL_UNSIGNED_INT_IMAGE_2D_ARRAY:
|
||||||
|
return UniformType::Image;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return GraphicsHelperES3::uniformTypeFromGLType(glType);
|
return GraphicsHelperES3::uniformTypeFromGLType(glType);
|
||||||
|
|
@ -268,6 +317,18 @@ uint GraphicsHelperES3_1::uniformByteSize(const ShaderUniform &description)
|
||||||
case GL_SAMPLER_2D_MULTISAMPLE:
|
case GL_SAMPLER_2D_MULTISAMPLE:
|
||||||
case GL_INT_SAMPLER_2D_MULTISAMPLE:
|
case GL_INT_SAMPLER_2D_MULTISAMPLE:
|
||||||
case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE:
|
case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE:
|
||||||
|
case GL_IMAGE_2D:
|
||||||
|
case GL_IMAGE_3D:
|
||||||
|
case GL_IMAGE_CUBE:
|
||||||
|
case GL_IMAGE_2D_ARRAY:
|
||||||
|
case GL_INT_IMAGE_2D:
|
||||||
|
case GL_INT_IMAGE_3D:
|
||||||
|
case GL_INT_IMAGE_CUBE:
|
||||||
|
case GL_INT_IMAGE_2D_ARRAY:
|
||||||
|
case GL_UNSIGNED_INT_IMAGE_2D:
|
||||||
|
case GL_UNSIGNED_INT_IMAGE_3D:
|
||||||
|
case GL_UNSIGNED_INT_IMAGE_CUBE:
|
||||||
|
case GL_UNSIGNED_INT_IMAGE_2D_ARRAY:
|
||||||
rawByteSize = 4;
|
rawByteSize = 4;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,25 @@ QT_BEGIN_NAMESPACE
|
||||||
#define GL_PATCH_VERTICES 36466
|
#define GL_PATCH_VERTICES 36466
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef GL_IMAGE_BUFFER
|
||||||
|
#define GL_IMAGE_BUFFER 0x9051
|
||||||
|
#endif
|
||||||
|
#ifndef GL_IMAGE_CUBE_MAP_ARRAY
|
||||||
|
#define GL_IMAGE_CUBE_MAP_ARRAY 0x9054
|
||||||
|
#endif
|
||||||
|
#ifndef GL_INT_IMAGE_BUFFER
|
||||||
|
#define GL_INT_IMAGE_BUFFER 0x905C
|
||||||
|
#endif
|
||||||
|
#ifndef GL_INT_IMAGE_CUBE_MAP_ARRAY
|
||||||
|
#define GL_INT_IMAGE_CUBE_MAP_ARRAY 0x905F
|
||||||
|
#endif
|
||||||
|
#ifndef GL_UNSIGNED_INT_IMAGE_BUFFER
|
||||||
|
#define GL_UNSIGNED_INT_IMAGE_BUFFER 0x9067
|
||||||
|
#endif
|
||||||
|
#ifndef GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY
|
||||||
|
#define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY 0x906A
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace Qt3DRender {
|
namespace Qt3DRender {
|
||||||
namespace Render {
|
namespace Render {
|
||||||
|
|
||||||
|
|
@ -130,6 +149,44 @@ void GraphicsHelperES3_2::drawElementsInstancedBaseVertexBaseInstance(GLenum pri
|
||||||
baseVertex);
|
baseVertex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UniformType GraphicsHelperES3_2::uniformTypeFromGLType(GLenum glType)
|
||||||
|
{
|
||||||
|
switch (glType) {
|
||||||
|
case GL_IMAGE_BUFFER:
|
||||||
|
case GL_IMAGE_CUBE_MAP_ARRAY:
|
||||||
|
case GL_INT_IMAGE_BUFFER:
|
||||||
|
case GL_INT_IMAGE_CUBE_MAP_ARRAY:
|
||||||
|
case GL_UNSIGNED_INT_IMAGE_BUFFER:
|
||||||
|
case GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY:
|
||||||
|
return UniformType::Image;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return GraphicsHelperES3_1::uniformTypeFromGLType(glType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
uint GraphicsHelperES3_2::uniformByteSize(const ShaderUniform &description)
|
||||||
|
{
|
||||||
|
uint rawByteSize = 0;
|
||||||
|
|
||||||
|
switch (description.m_type) {
|
||||||
|
case GL_IMAGE_BUFFER:
|
||||||
|
case GL_IMAGE_CUBE_MAP_ARRAY:
|
||||||
|
case GL_INT_IMAGE_BUFFER:
|
||||||
|
case GL_INT_IMAGE_CUBE_MAP_ARRAY:
|
||||||
|
case GL_UNSIGNED_INT_IMAGE_BUFFER:
|
||||||
|
case GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY:
|
||||||
|
rawByteSize = 4;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
rawByteSize = GraphicsHelperES3_1::uniformByteSize(description);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return rawByteSize;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Render
|
} // namespace Render
|
||||||
} // namespace Qt3DRender
|
} // namespace Qt3DRender
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,9 @@ public:
|
||||||
bool frameBufferNeedsRenderBuffer(const Attachment &attachment) override;
|
bool frameBufferNeedsRenderBuffer(const Attachment &attachment) override;
|
||||||
void setVerticesPerPatch(GLint verticesPerPatch) override;
|
void setVerticesPerPatch(GLint verticesPerPatch) override;
|
||||||
void drawElementsInstancedBaseVertexBaseInstance(GLenum primitiveType, GLsizei primitiveCount, GLint indexType, void *indices, GLsizei instances, GLint baseVertex = 0, GLint baseInstance = 0) override;
|
void drawElementsInstancedBaseVertexBaseInstance(GLenum primitiveType, GLsizei primitiveCount, GLint indexType, void *indices, GLsizei instances, GLint baseVertex = 0, GLint baseInstance = 0) override;
|
||||||
|
UniformType uniformTypeFromGLType(GLenum glType) override;
|
||||||
|
uint uniformByteSize(const ShaderUniform &description) override;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Render
|
} // namespace Render
|
||||||
|
|
|
||||||
|
|
@ -79,6 +79,39 @@
|
||||||
# define GL_ATOMIC_COUNTER_BARRIER_BIT 0x00001000
|
# define GL_ATOMIC_COUNTER_BARRIER_BIT 0x00001000
|
||||||
# define GL_SHADER_STORAGE_BARRIER_BIT 0x00002000
|
# define GL_SHADER_STORAGE_BARRIER_BIT 0x00002000
|
||||||
# define GL_QUERY_BUFFER_BARRIER_BIT 0x00008000
|
# define GL_QUERY_BUFFER_BARRIER_BIT 0x00008000
|
||||||
|
# define GL_IMAGE_1D 0x904C
|
||||||
|
# define GL_IMAGE_2D 0x904D
|
||||||
|
# define GL_IMAGE_3D 0x904E
|
||||||
|
# define GL_IMAGE_2D_RECT 0x904F
|
||||||
|
# define GL_IMAGE_CUBE 0x9050
|
||||||
|
# define GL_IMAGE_BUFFER 0x9051
|
||||||
|
# define GL_IMAGE_1D_ARRAY 0x9052
|
||||||
|
# define GL_IMAGE_2D_ARRAY 0x9053
|
||||||
|
# define GL_IMAGE_CUBE_MAP_ARRAY 0x9054
|
||||||
|
# define GL_IMAGE_2D_MULTISAMPLE 0x9055
|
||||||
|
# define GL_IMAGE_2D_MULTISAMPLE_ARRAY 0x9056
|
||||||
|
# define GL_INT_IMAGE_1D 0x9057
|
||||||
|
# define GL_INT_IMAGE_2D 0x9058
|
||||||
|
# define GL_INT_IMAGE_3D 0x9059
|
||||||
|
# define GL_INT_IMAGE_2D_RECT 0x905A
|
||||||
|
# define GL_INT_IMAGE_CUBE 0x905B
|
||||||
|
# define GL_INT_IMAGE_BUFFER 0x905C
|
||||||
|
# define GL_INT_IMAGE_1D_ARRAY 0x905D
|
||||||
|
# define GL_INT_IMAGE_2D_ARRAY 0x905E
|
||||||
|
# define GL_INT_IMAGE_CUBE_MAP_ARRAY 0x905F
|
||||||
|
# define GL_INT_IMAGE_2D_MULTISAMPLE 0x9060
|
||||||
|
# define GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY 0x9061
|
||||||
|
# define GL_UNSIGNED_INT_IMAGE_1D 0x9062
|
||||||
|
# define GL_UNSIGNED_INT_IMAGE_2D 0x9063
|
||||||
|
# define GL_UNSIGNED_INT_IMAGE_3D 0x9064
|
||||||
|
# define GL_UNSIGNED_INT_IMAGE_2D_RECT 0x9065
|
||||||
|
# define GL_UNSIGNED_INT_IMAGE_CUBE 0x9066
|
||||||
|
# define GL_UNSIGNED_INT_IMAGE_BUFFER 0x9067
|
||||||
|
# define GL_UNSIGNED_INT_IMAGE_1D_ARRAY 0x9068
|
||||||
|
# define GL_UNSIGNED_INT_IMAGE_2D_ARRAY 0x9069
|
||||||
|
# define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY 0x906A
|
||||||
|
# define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE 0x906B
|
||||||
|
# define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY 0x906C
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
@ -635,6 +668,42 @@ UniformType GraphicsHelperGL4::uniformTypeFromGLType(GLenum type)
|
||||||
case GL_UNSIGNED_INT_SAMPLER_CUBE:
|
case GL_UNSIGNED_INT_SAMPLER_CUBE:
|
||||||
case GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY:
|
case GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY:
|
||||||
return UniformType::Sampler;
|
return UniformType::Sampler;
|
||||||
|
|
||||||
|
case GL_IMAGE_1D:
|
||||||
|
case GL_IMAGE_2D:
|
||||||
|
case GL_IMAGE_3D:
|
||||||
|
case GL_IMAGE_2D_RECT:
|
||||||
|
case GL_IMAGE_CUBE:
|
||||||
|
case GL_IMAGE_BUFFER:
|
||||||
|
case GL_IMAGE_1D_ARRAY:
|
||||||
|
case GL_IMAGE_2D_ARRAY:
|
||||||
|
case GL_IMAGE_CUBE_MAP_ARRAY:
|
||||||
|
case GL_IMAGE_2D_MULTISAMPLE:
|
||||||
|
case GL_IMAGE_2D_MULTISAMPLE_ARRAY:
|
||||||
|
case GL_INT_IMAGE_1D:
|
||||||
|
case GL_INT_IMAGE_2D:
|
||||||
|
case GL_INT_IMAGE_3D:
|
||||||
|
case GL_INT_IMAGE_2D_RECT:
|
||||||
|
case GL_INT_IMAGE_CUBE:
|
||||||
|
case GL_INT_IMAGE_BUFFER:
|
||||||
|
case GL_INT_IMAGE_1D_ARRAY:
|
||||||
|
case GL_INT_IMAGE_2D_ARRAY:
|
||||||
|
case GL_INT_IMAGE_CUBE_MAP_ARRAY:
|
||||||
|
case GL_INT_IMAGE_2D_MULTISAMPLE:
|
||||||
|
case GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY:
|
||||||
|
case GL_UNSIGNED_INT_IMAGE_1D:
|
||||||
|
case GL_UNSIGNED_INT_IMAGE_2D:
|
||||||
|
case GL_UNSIGNED_INT_IMAGE_3D:
|
||||||
|
case GL_UNSIGNED_INT_IMAGE_2D_RECT:
|
||||||
|
case GL_UNSIGNED_INT_IMAGE_CUBE:
|
||||||
|
case GL_UNSIGNED_INT_IMAGE_BUFFER:
|
||||||
|
case GL_UNSIGNED_INT_IMAGE_1D_ARRAY:
|
||||||
|
case GL_UNSIGNED_INT_IMAGE_2D_ARRAY:
|
||||||
|
case GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY:
|
||||||
|
case GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE:
|
||||||
|
case GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY:
|
||||||
|
return UniformType::Image;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// TO DO: Add support for Doubles and Images
|
// TO DO: Add support for Doubles and Images
|
||||||
Q_UNREACHABLE();
|
Q_UNREACHABLE();
|
||||||
|
|
@ -1033,7 +1102,40 @@ void GraphicsHelperGL4::buildUniformBuffer(const QVariant &v, const ShaderUnifor
|
||||||
case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE:
|
case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE:
|
||||||
case GL_SAMPLER_2D_MULTISAMPLE_ARRAY:
|
case GL_SAMPLER_2D_MULTISAMPLE_ARRAY:
|
||||||
case GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY:
|
case GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY:
|
||||||
case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY: {
|
case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY:
|
||||||
|
case GL_IMAGE_1D:
|
||||||
|
case GL_IMAGE_2D:
|
||||||
|
case GL_IMAGE_3D:
|
||||||
|
case GL_IMAGE_2D_RECT:
|
||||||
|
case GL_IMAGE_CUBE:
|
||||||
|
case GL_IMAGE_BUFFER:
|
||||||
|
case GL_IMAGE_1D_ARRAY:
|
||||||
|
case GL_IMAGE_2D_ARRAY:
|
||||||
|
case GL_IMAGE_CUBE_MAP_ARRAY:
|
||||||
|
case GL_IMAGE_2D_MULTISAMPLE:
|
||||||
|
case GL_IMAGE_2D_MULTISAMPLE_ARRAY:
|
||||||
|
case GL_INT_IMAGE_1D:
|
||||||
|
case GL_INT_IMAGE_2D:
|
||||||
|
case GL_INT_IMAGE_3D:
|
||||||
|
case GL_INT_IMAGE_2D_RECT:
|
||||||
|
case GL_INT_IMAGE_CUBE:
|
||||||
|
case GL_INT_IMAGE_BUFFER:
|
||||||
|
case GL_INT_IMAGE_1D_ARRAY:
|
||||||
|
case GL_INT_IMAGE_2D_ARRAY:
|
||||||
|
case GL_INT_IMAGE_CUBE_MAP_ARRAY:
|
||||||
|
case GL_INT_IMAGE_2D_MULTISAMPLE:
|
||||||
|
case GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY:
|
||||||
|
case GL_UNSIGNED_INT_IMAGE_1D:
|
||||||
|
case GL_UNSIGNED_INT_IMAGE_2D:
|
||||||
|
case GL_UNSIGNED_INT_IMAGE_3D:
|
||||||
|
case GL_UNSIGNED_INT_IMAGE_2D_RECT:
|
||||||
|
case GL_UNSIGNED_INT_IMAGE_CUBE:
|
||||||
|
case GL_UNSIGNED_INT_IMAGE_BUFFER:
|
||||||
|
case GL_UNSIGNED_INT_IMAGE_1D_ARRAY:
|
||||||
|
case GL_UNSIGNED_INT_IMAGE_2D_ARRAY:
|
||||||
|
case GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY:
|
||||||
|
case GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE:
|
||||||
|
case GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY: {
|
||||||
Q_ASSERT(description.m_size == 1);
|
Q_ASSERT(description.m_size == 1);
|
||||||
int value = v.toInt();
|
int value = v.toInt();
|
||||||
QGraphicsUtils::fillDataArray<GLint>(bufferData, &value, description, 1);
|
QGraphicsUtils::fillDataArray<GLint>(bufferData, &value, description, 1);
|
||||||
|
|
@ -1163,8 +1265,47 @@ uint GraphicsHelperGL4::uniformByteSize(const ShaderUniform &description)
|
||||||
case GL_SAMPLER_2D_MULTISAMPLE_ARRAY:
|
case GL_SAMPLER_2D_MULTISAMPLE_ARRAY:
|
||||||
case GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY:
|
case GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY:
|
||||||
case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY:
|
case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY:
|
||||||
|
case GL_IMAGE_1D:
|
||||||
|
case GL_IMAGE_2D:
|
||||||
|
case GL_IMAGE_3D:
|
||||||
|
case GL_IMAGE_2D_RECT:
|
||||||
|
case GL_IMAGE_CUBE:
|
||||||
|
case GL_IMAGE_BUFFER:
|
||||||
|
case GL_IMAGE_1D_ARRAY:
|
||||||
|
case GL_IMAGE_2D_ARRAY:
|
||||||
|
case GL_IMAGE_CUBE_MAP_ARRAY:
|
||||||
|
case GL_IMAGE_2D_MULTISAMPLE:
|
||||||
|
case GL_IMAGE_2D_MULTISAMPLE_ARRAY:
|
||||||
|
case GL_INT_IMAGE_1D:
|
||||||
|
case GL_INT_IMAGE_2D:
|
||||||
|
case GL_INT_IMAGE_3D:
|
||||||
|
case GL_INT_IMAGE_2D_RECT:
|
||||||
|
case GL_INT_IMAGE_CUBE:
|
||||||
|
case GL_INT_IMAGE_BUFFER:
|
||||||
|
case GL_INT_IMAGE_1D_ARRAY:
|
||||||
|
case GL_INT_IMAGE_2D_ARRAY:
|
||||||
|
case GL_INT_IMAGE_CUBE_MAP_ARRAY:
|
||||||
|
case GL_INT_IMAGE_2D_MULTISAMPLE:
|
||||||
|
case GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY:
|
||||||
|
case GL_UNSIGNED_INT_IMAGE_1D:
|
||||||
|
case GL_UNSIGNED_INT_IMAGE_2D:
|
||||||
|
case GL_UNSIGNED_INT_IMAGE_3D:
|
||||||
|
case GL_UNSIGNED_INT_IMAGE_2D_RECT:
|
||||||
|
case GL_UNSIGNED_INT_IMAGE_CUBE:
|
||||||
|
case GL_UNSIGNED_INT_IMAGE_BUFFER:
|
||||||
|
case GL_UNSIGNED_INT_IMAGE_1D_ARRAY:
|
||||||
|
case GL_UNSIGNED_INT_IMAGE_2D_ARRAY:
|
||||||
|
case GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY:
|
||||||
|
case GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE:
|
||||||
|
case GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY:
|
||||||
rawByteSize = 4;
|
rawByteSize = 4;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default: {
|
||||||
|
qWarning() << Q_FUNC_INFO << "unable to deduce rawByteSize for uniform type:" << description.m_type << "for uniform" << description.m_name;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return arrayStride ? rawByteSize * arrayStride : rawByteSize;
|
return arrayStride ? rawByteSize * arrayStride : rawByteSize;
|
||||||
|
|
|
||||||
|
|
@ -174,6 +174,28 @@ const QByteArray fragCodeSamplers = QByteArrayLiteral(
|
||||||
" texture(srect, texCoord);\n" \
|
" texture(srect, texCoord);\n" \
|
||||||
"}\n");
|
"}\n");
|
||||||
|
|
||||||
|
const QByteArray fragCodeImages = QByteArrayLiteral(
|
||||||
|
"#version 430 core\n" \
|
||||||
|
"in vec2 texCoord;\n" \
|
||||||
|
"out vec4 color;\n" \
|
||||||
|
"layout(location = 1, rgba32f) readonly uniform image1D s1;\n" \
|
||||||
|
"layout(location = 2, rg16f) readonly uniform image2D s2;\n" \
|
||||||
|
"layout(location = 3, r16f) readonly uniform image2DArray s2a;\n" \
|
||||||
|
"layout(location = 4, rg8) readonly uniform image3D s3;\n" \
|
||||||
|
"layout(location = 5, rgba16_snorm) readonly uniform imageCube scube;\n" \
|
||||||
|
"layout(location = 6, rg16) readonly uniform image2DRect srect;\n" \
|
||||||
|
"void main()\n" \
|
||||||
|
"{\n" \
|
||||||
|
" ivec2 coords = ivec2(texCoord);\n"\
|
||||||
|
" color = vec4(1, 0, 0, 1) *" \
|
||||||
|
" imageLoad(s1, coords.x) *" \
|
||||||
|
" imageLoad(s2, coords) *" \
|
||||||
|
" imageLoad(s2a, ivec3(coords, 0)) *" \
|
||||||
|
" imageLoad(s3, ivec3(coords, 0)) *" \
|
||||||
|
" imageLoad(scube, ivec3(coords, 0)) *" \
|
||||||
|
" imageLoad(srect, coords);\n" \
|
||||||
|
"}\n");
|
||||||
|
|
||||||
const QByteArray computeShader = QByteArrayLiteral(
|
const QByteArray computeShader = QByteArrayLiteral(
|
||||||
"#version 430 core\n" \
|
"#version 430 core\n" \
|
||||||
"uniform float particleStep;\n" \
|
"uniform float particleStep;\n" \
|
||||||
|
|
@ -1508,6 +1530,13 @@ private Q_SLOTS:
|
||||||
ADD_UNIFORM_ENTRY(fragCodeSamplers, GL_SAMPLER_3D, 4, 1, 4);
|
ADD_UNIFORM_ENTRY(fragCodeSamplers, GL_SAMPLER_3D, 4, 1, 4);
|
||||||
ADD_UNIFORM_ENTRY(fragCodeSamplers, GL_SAMPLER_CUBE, 5, 1, 4);
|
ADD_UNIFORM_ENTRY(fragCodeSamplers, GL_SAMPLER_CUBE, 5, 1, 4);
|
||||||
ADD_UNIFORM_ENTRY(fragCodeSamplers, GL_SAMPLER_2D_RECT, 6, 1, 4);
|
ADD_UNIFORM_ENTRY(fragCodeSamplers, GL_SAMPLER_2D_RECT, 6, 1, 4);
|
||||||
|
|
||||||
|
ADD_UNIFORM_ENTRY(fragCodeImages, GL_IMAGE_1D, 1, 1, 4);
|
||||||
|
ADD_UNIFORM_ENTRY(fragCodeImages, GL_IMAGE_2D, 2, 1, 4);
|
||||||
|
ADD_UNIFORM_ENTRY(fragCodeImages, GL_IMAGE_2D_ARRAY, 3, 1, 4);
|
||||||
|
ADD_UNIFORM_ENTRY(fragCodeImages, GL_IMAGE_3D, 4, 1, 4);
|
||||||
|
ADD_UNIFORM_ENTRY(fragCodeImages, GL_IMAGE_CUBE, 5, 1, 4);
|
||||||
|
ADD_UNIFORM_ENTRY(fragCodeImages, GL_IMAGE_2D_RECT, 6, 1, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
void uniformsByteSize()
|
void uniformsByteSize()
|
||||||
|
|
@ -2329,6 +2358,38 @@ private Q_SLOTS:
|
||||||
ADD_GL_TYPE_ENTRY(GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY, UniformType::Sampler);
|
ADD_GL_TYPE_ENTRY(GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY, UniformType::Sampler);
|
||||||
ADD_GL_TYPE_ENTRY(GL_UNSIGNED_INT_SAMPLER_CUBE, UniformType::Sampler);
|
ADD_GL_TYPE_ENTRY(GL_UNSIGNED_INT_SAMPLER_CUBE, UniformType::Sampler);
|
||||||
ADD_GL_TYPE_ENTRY(GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY, UniformType::Sampler);
|
ADD_GL_TYPE_ENTRY(GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY, UniformType::Sampler);
|
||||||
|
ADD_GL_TYPE_ENTRY(GL_IMAGE_1D, UniformType::Image);
|
||||||
|
ADD_GL_TYPE_ENTRY(GL_IMAGE_2D, UniformType::Image);
|
||||||
|
ADD_GL_TYPE_ENTRY(GL_IMAGE_3D, UniformType::Image);
|
||||||
|
ADD_GL_TYPE_ENTRY(GL_IMAGE_2D_RECT, UniformType::Image);
|
||||||
|
ADD_GL_TYPE_ENTRY(GL_IMAGE_CUBE, UniformType::Image);
|
||||||
|
ADD_GL_TYPE_ENTRY(GL_IMAGE_BUFFER, UniformType::Image);
|
||||||
|
ADD_GL_TYPE_ENTRY(GL_IMAGE_1D_ARRAY, UniformType::Image);
|
||||||
|
ADD_GL_TYPE_ENTRY(GL_IMAGE_2D_ARRAY, UniformType::Image);
|
||||||
|
ADD_GL_TYPE_ENTRY(GL_IMAGE_CUBE_MAP_ARRAY, UniformType::Image);
|
||||||
|
ADD_GL_TYPE_ENTRY(GL_IMAGE_2D_MULTISAMPLE, UniformType::Image);
|
||||||
|
ADD_GL_TYPE_ENTRY(GL_IMAGE_2D_MULTISAMPLE_ARRAY, UniformType::Image);
|
||||||
|
ADD_GL_TYPE_ENTRY(GL_INT_IMAGE_1D, UniformType::Image);
|
||||||
|
ADD_GL_TYPE_ENTRY(GL_INT_IMAGE_2D, UniformType::Image); ADD_GL_TYPE_ENTRY(GL_INT_IMAGE_3D, UniformType::Image);
|
||||||
|
ADD_GL_TYPE_ENTRY(GL_INT_IMAGE_2D_RECT, UniformType::Image);
|
||||||
|
ADD_GL_TYPE_ENTRY(GL_INT_IMAGE_CUBE, UniformType::Image);
|
||||||
|
ADD_GL_TYPE_ENTRY(GL_INT_IMAGE_BUFFER, UniformType::Image);
|
||||||
|
ADD_GL_TYPE_ENTRY(GL_INT_IMAGE_1D_ARRAY, UniformType::Image);
|
||||||
|
ADD_GL_TYPE_ENTRY(GL_INT_IMAGE_2D_ARRAY, UniformType::Image);
|
||||||
|
ADD_GL_TYPE_ENTRY(GL_INT_IMAGE_CUBE_MAP_ARRAY, UniformType::Image);
|
||||||
|
ADD_GL_TYPE_ENTRY(GL_INT_IMAGE_2D_MULTISAMPLE, UniformType::Image);
|
||||||
|
ADD_GL_TYPE_ENTRY(GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY, UniformType::Image);
|
||||||
|
ADD_GL_TYPE_ENTRY(GL_UNSIGNED_INT_IMAGE_1D, UniformType::Image);
|
||||||
|
ADD_GL_TYPE_ENTRY(GL_UNSIGNED_INT_IMAGE_2D, UniformType::Image);
|
||||||
|
ADD_GL_TYPE_ENTRY(GL_UNSIGNED_INT_IMAGE_3D, UniformType::Image);
|
||||||
|
ADD_GL_TYPE_ENTRY(GL_UNSIGNED_INT_IMAGE_2D_RECT, UniformType::Image);
|
||||||
|
ADD_GL_TYPE_ENTRY(GL_UNSIGNED_INT_IMAGE_CUBE, UniformType::Image);
|
||||||
|
ADD_GL_TYPE_ENTRY(GL_UNSIGNED_INT_IMAGE_BUFFER, UniformType::Image);
|
||||||
|
ADD_GL_TYPE_ENTRY(GL_UNSIGNED_INT_IMAGE_1D_ARRAY, UniformType::Image);
|
||||||
|
ADD_GL_TYPE_ENTRY(GL_UNSIGNED_INT_IMAGE_2D_ARRAY, UniformType::Image);
|
||||||
|
ADD_GL_TYPE_ENTRY(GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY, UniformType::Image);
|
||||||
|
ADD_GL_TYPE_ENTRY(GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE, UniformType::Image);
|
||||||
|
ADD_GL_TYPE_ENTRY(GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY, UniformType::Image);
|
||||||
}
|
}
|
||||||
|
|
||||||
void uniformTypeFromGLType()
|
void uniformTypeFromGLType()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue