Commit 8b7d8144 by Corentin Wallez Committed by Commit Bot

Clamp "count" in glUniform* before passing to the backend

The OpenGL spec allows "count" to overflow safely implemented but some drivers like the Intel Windows OpenGL driver don't handle this correctly and crash on overflow tests. BUG=661413 Change-Id: I10de9292c75daa375f002850900bb5e1cbfce3b6 Reviewed-on: https://chromium-review.googlesource.com/411387Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
parent 15ac534a
...@@ -460,11 +460,15 @@ class Program final : angle::NonCopyable, public LabeledObject ...@@ -460,11 +460,15 @@ class Program final : angle::NonCopyable, public LabeledObject
void defineUniformBlock(const sh::InterfaceBlock &interfaceBlock, GLenum shaderType); void defineUniformBlock(const sh::InterfaceBlock &interfaceBlock, GLenum shaderType);
// Both these function update the cached uniform values and return a modified "count"
// so that the uniform update doesn't overflow the uniform.
template <typename T> template <typename T>
void setUniformInternal(GLint location, GLsizei count, const T *v); GLsizei setUniformInternal(GLint location, GLsizei count, int vectorSize, const T *v);
template <size_t cols, size_t rows, typename T> template <size_t cols, size_t rows, typename T>
void setMatrixUniformInternal(GLint location, GLsizei count, GLboolean transpose, const T *v); GLsizei setMatrixUniformInternal(GLint location,
GLsizei count,
GLboolean transpose,
const T *v);
template <typename DestT> template <typename DestT>
void getUniformInternal(GLint location, DestT *dataOut) const; void getUniformInternal(GLint location, DestT *dataOut) const;
......
...@@ -462,13 +462,6 @@ TEST_P(UniformTestES3, TranposedMatrixArrayUniformStateQuery) ...@@ -462,13 +462,6 @@ TEST_P(UniformTestES3, TranposedMatrixArrayUniformStateQuery)
// Check that trying setting too many elements of an array doesn't overflow // Check that trying setting too many elements of an array doesn't overflow
TEST_P(UniformTestES3, OverflowArray) TEST_P(UniformTestES3, OverflowArray)
{ {
// TODO(cwallez): fix on the Wintel OpenGL driver
if (IsIntel() && IsOpenGL() && IsWindows())
{
std::cout << "Test skipped on Intel Windows OpenGL." << std::endl;
return;
}
const std::string &vertexShader = const std::string &vertexShader =
"#version 300 es\n" "#version 300 es\n"
"void main() { gl_Position = vec4(1); }"; "void main() { gl_Position = vec4(1); }";
......
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