Commit 13a2f85b by Jamie Madill

Implement max elements indices and vertices.

ES3 has integer queries for the maximum recommended number of vertices and indices per draw call. These are roughly correlated to D3D's resource limits -- however, while ES3 has recommended limits D3D has hard limits. Change-Id: Ib653bc27e61607c78d0c5e70b0d97fea7af6464f Reviewed-on: https://chromium-review.googlesource.com/179670Reviewed-by: 's avatarShannon Woods <shannonwoods@chromium.org> Reviewed-by: 's avatarNicolas Capens <nicolascapens@chromium.org> Commit-Queue: Nicolas Capens <nicolascapens@chromium.org> Tested-by: 's avatarNicolas Capens <nicolascapens@chromium.org>
parent cd65ae16
...@@ -1688,6 +1688,8 @@ bool Context::getIntegerv(GLenum pname, GLint *params) ...@@ -1688,6 +1688,8 @@ bool Context::getIntegerv(GLenum pname, GLint *params)
case GL_MAX_COMBINED_UNIFORM_BLOCKS: *params = getMaximumCombinedUniformBufferBindings(); break; case GL_MAX_COMBINED_UNIFORM_BLOCKS: *params = getMaximumCombinedUniformBufferBindings(); break;
case GL_MAJOR_VERSION: *params = mClientVersion; break; case GL_MAJOR_VERSION: *params = mClientVersion; break;
case GL_MINOR_VERSION: *params = 0; break; case GL_MINOR_VERSION: *params = 0; break;
case GL_MAX_ELEMENTS_INDICES: *params = mRenderer->getMaxRecommendedElementsIndices(); break;
case GL_MAX_ELEMENTS_VERTICES: *params = mRenderer->getMaxRecommendedElementsVertices(); break;
case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS: *params = 0; UNIMPLEMENTED(); break; case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS: *params = 0; UNIMPLEMENTED(); break;
case GL_NUM_COMPRESSED_TEXTURE_FORMATS: case GL_NUM_COMPRESSED_TEXTURE_FORMATS:
params[0] = mNumCompressedTextureFormats; params[0] = mNumCompressedTextureFormats;
...@@ -2227,6 +2229,8 @@ bool Context::getQueryParameterInfo(GLenum pname, GLenum *type, unsigned int *nu ...@@ -2227,6 +2229,8 @@ bool Context::getQueryParameterInfo(GLenum pname, GLenum *type, unsigned int *nu
case GL_NUM_EXTENSIONS: case GL_NUM_EXTENSIONS:
case GL_MAJOR_VERSION: case GL_MAJOR_VERSION:
case GL_MINOR_VERSION: case GL_MINOR_VERSION:
case GL_MAX_ELEMENTS_INDICES:
case GL_MAX_ELEMENTS_VERTICES:
{ {
*type = GL_INT; *type = GL_INT;
*numParams = 1; *numParams = 1;
......
...@@ -198,6 +198,8 @@ class Renderer ...@@ -198,6 +198,8 @@ class Renderer
virtual bool getShareHandleSupport() const = 0; virtual bool getShareHandleSupport() const = 0;
virtual bool getDerivativeInstructionSupport() const = 0; virtual bool getDerivativeInstructionSupport() const = 0;
virtual bool getPostSubBufferSupport() const = 0; virtual bool getPostSubBufferSupport() const = 0;
virtual int getMaxRecommendedElementsIndices() const = 0;
virtual int getMaxRecommendedElementsVertices() const = 0;
virtual int getMajorShaderModel() const = 0; virtual int getMajorShaderModel() const = 0;
virtual float getMaxPointSize() const = 0; virtual float getMaxPointSize() const = 0;
......
...@@ -2165,6 +2165,24 @@ bool Renderer11::getPostSubBufferSupport() const ...@@ -2165,6 +2165,24 @@ bool Renderer11::getPostSubBufferSupport() const
return false; return false;
} }
int Renderer11::getMaxRecommendedElementsIndices() const
{
META_ASSERT(D3D11_REQ_DRAWINDEXED_INDEX_COUNT_2_TO_EXP == 32);
META_ASSERT(D3D10_REQ_DRAWINDEXED_INDEX_COUNT_2_TO_EXP == 32);
// D3D11 allows up to 2^32 elements, but we report max signed int for convenience.
return std::numeric_limits<GLint>::max();
}
int Renderer11::getMaxRecommendedElementsVertices() const
{
META_ASSERT(D3D11_REQ_DRAW_VERTEX_COUNT_2_TO_EXP == 32);
META_ASSERT(D3D10_REQ_DRAW_VERTEX_COUNT_2_TO_EXP == 32);
// D3D11 allows up to 2^32 elements, but we report max signed int for convenience.
return std::numeric_limits<GLint>::max();
}
int Renderer11::getMajorShaderModel() const int Renderer11::getMajorShaderModel() const
{ {
switch (mFeatureLevel) switch (mFeatureLevel)
......
...@@ -136,6 +136,8 @@ class Renderer11 : public Renderer ...@@ -136,6 +136,8 @@ class Renderer11 : public Renderer
virtual bool getShareHandleSupport() const; virtual bool getShareHandleSupport() const;
virtual bool getDerivativeInstructionSupport() const; virtual bool getDerivativeInstructionSupport() const;
virtual bool getPostSubBufferSupport() const; virtual bool getPostSubBufferSupport() const;
virtual int getMaxRecommendedElementsIndices() const;
virtual int getMaxRecommendedElementsVertices() const;
virtual int getMajorShaderModel() const; virtual int getMajorShaderModel() const;
virtual float getMaxPointSize() const; virtual float getMaxPointSize() const;
......
...@@ -2521,6 +2521,20 @@ bool Renderer9::getPostSubBufferSupport() const ...@@ -2521,6 +2521,20 @@ bool Renderer9::getPostSubBufferSupport() const
return true; return true;
} }
int Renderer9::getMaxRecommendedElementsIndices() const
{
// ES3 only
UNREACHABLE();
return 0;
}
int Renderer9::getMaxRecommendedElementsVertices() const
{
// ES3 only
UNREACHABLE();
return 0;
}
int Renderer9::getMajorShaderModel() const int Renderer9::getMajorShaderModel() const
{ {
return D3DSHADER_VERSION_MAJOR(mDeviceCaps.PixelShaderVersion); return D3DSHADER_VERSION_MAJOR(mDeviceCaps.PixelShaderVersion);
......
...@@ -149,6 +149,8 @@ class Renderer9 : public Renderer ...@@ -149,6 +149,8 @@ class Renderer9 : public Renderer
virtual bool getShareHandleSupport() const; virtual bool getShareHandleSupport() const;
virtual bool getDerivativeInstructionSupport() const; virtual bool getDerivativeInstructionSupport() const;
virtual bool getPostSubBufferSupport() const; virtual bool getPostSubBufferSupport() const;
virtual int getMaxRecommendedElementsIndices() const;
virtual int getMaxRecommendedElementsVertices() const;
virtual int getMajorShaderModel() const; virtual int getMajorShaderModel() const;
virtual float getMaxPointSize() const; virtual float getMaxPointSize() const;
......
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