Commit b28c662c by Nicolas Capens

Fix clamping viewport dimensions on specification.

The spec states that glViewport() silently clamps the viewport width and height to GL_MAX_VIEWPORT_DIMS[0] and GL_MAX_VIEWPORT_DIMS[1], respectively. Bug b/34078120 Change-Id: Ifeec0d6b601ce8a3825796fa551eea1f46150002 Reviewed-on: https://swiftshader-review.googlesource.com/8371Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <capn@google.com> Tested-by: 's avatarNicolas Capens <capn@google.com>
parent bd85ab21
...@@ -40,6 +40,8 @@ ...@@ -40,6 +40,8 @@
#include <EGL/eglext.h> #include <EGL/eglext.h>
#include <algorithm>
namespace es2 namespace es2
{ {
Context::Context(egl::Display *display, const Context *shareContext, EGLint clientVersion) Context::Context(egl::Display *display, const Context *shareContext, EGLint clientVersion)
...@@ -667,8 +669,8 @@ void Context::setViewportParams(GLint x, GLint y, GLsizei width, GLsizei height) ...@@ -667,8 +669,8 @@ void Context::setViewportParams(GLint x, GLint y, GLsizei width, GLsizei height)
{ {
mState.viewportX = x; mState.viewportX = x;
mState.viewportY = y; mState.viewportY = y;
mState.viewportWidth = width; mState.viewportWidth = std::min<GLsizei>(width, IMPLEMENTATION_MAX_RENDERBUFFER_SIZE); // GL_MAX_VIEWPORT_DIMS[0]
mState.viewportHeight = height; mState.viewportHeight = std::min<GLsizei>(height, IMPLEMENTATION_MAX_RENDERBUFFER_SIZE); // GL_MAX_VIEWPORT_DIMS[1]
} }
void Context::setScissorParams(GLint x, GLint y, GLsizei width, GLsizei height) void Context::setScissorParams(GLint x, GLint y, GLsizei width, GLsizei height)
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include "Shader/PixelShader.hpp" #include "Shader/PixelShader.hpp"
#include "Shader/VertexShader.hpp" #include "Shader/VertexShader.hpp"
#include <algorithm>
#include <string> #include <string>
#include <stdlib.h> #include <stdlib.h>
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include "utilities.h" #include "utilities.h"
#include <string> #include <string>
#include <algorithm>
namespace es2 namespace es2
{ {
......
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