Commit 05881a0f by Geoff Lang

Add caps for transform feedback limits from table 6.34.

BUG=angle:658 Change-Id: Ifd8c620080c8de486ffb7c8f9e985be1aba516c1 Reviewed-on: https://chromium-review.googlesource.com/207376Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Tested-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 3a61c321
...@@ -409,7 +409,11 @@ Caps::Caps() ...@@ -409,7 +409,11 @@ Caps::Caps()
maxCombinedFragmentUniformComponents(0), maxCombinedFragmentUniformComponents(0),
maxVaryingComponents(0), maxVaryingComponents(0),
maxVaryingVectors(0), maxVaryingVectors(0),
maxCombinedTextureImageUnits(0) maxCombinedTextureImageUnits(0),
maxTransformFeedbackInterleavedComponents(0),
maxTransformFeedbackSeparateAttributes(0),
maxTransformFeedbackSeparateComponents(0)
{ {
} }
......
...@@ -261,6 +261,11 @@ struct Caps ...@@ -261,6 +261,11 @@ struct Caps
GLuint maxVaryingComponents; GLuint maxVaryingComponents;
GLuint maxVaryingVectors; GLuint maxVaryingVectors;
GLuint maxCombinedTextureImageUnits; GLuint maxCombinedTextureImageUnits;
// Table 6.34, implementation dependent transform feedback limits
GLuint maxTransformFeedbackInterleavedComponents;
GLuint maxTransformFeedbackSeparateAttributes;
GLuint maxTransformFeedbackSeparateComponents;
}; };
} }
......
...@@ -924,9 +924,9 @@ void Context::getIntegerv(GLenum pname, GLint *params) ...@@ -924,9 +924,9 @@ void Context::getIntegerv(GLenum pname, GLint *params)
case GL_MINOR_VERSION: *params = 0; break; case GL_MINOR_VERSION: *params = 0; break;
case GL_MAX_ELEMENTS_INDICES: *params = mCaps.maxElementsIndices; break; case GL_MAX_ELEMENTS_INDICES: *params = mCaps.maxElementsIndices; break;
case GL_MAX_ELEMENTS_VERTICES: *params = mCaps.maxElementsVertices; break; case GL_MAX_ELEMENTS_VERTICES: *params = mCaps.maxElementsVertices; break;
case GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS: *params = mRenderer->getMaxTransformFeedbackInterleavedComponents(); break; case GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS: *params = mCaps.maxTransformFeedbackInterleavedComponents; break;
case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS: *params = mRenderer->getMaxTransformFeedbackBuffers(); break; case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS: *params = mCaps.maxTransformFeedbackSeparateAttributes; break;
case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS: *params = mRenderer->getMaxTransformFeedbackSeparateComponents(); break; case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS: *params = mCaps.maxTransformFeedbackSeparateComponents; break;
case GL_NUM_COMPRESSED_TEXTURE_FORMATS: *params = mCaps.compressedTextureFormats.size(); break; case GL_NUM_COMPRESSED_TEXTURE_FORMATS: *params = mCaps.compressedTextureFormats.size(); break;
case GL_MAX_SAMPLES_ANGLE: *params = mExtensions.maxSamples; break; case GL_MAX_SAMPLES_ANGLE: *params = mExtensions.maxSamples; break;
case GL_IMPLEMENTATION_COLOR_READ_TYPE: case GL_IMPLEMENTATION_COLOR_READ_TYPE:
...@@ -1907,11 +1907,6 @@ const Extensions &Context::getExtensions() const ...@@ -1907,11 +1907,6 @@ const Extensions &Context::getExtensions() const
return mExtensions; return mExtensions;
} }
unsigned int Context::getMaxTransformFeedbackBufferBindings() const
{
return mRenderer->getMaxTransformFeedbackBuffers();
}
void Context::getCurrentReadFormatType(GLenum *internalFormat, GLenum *format, GLenum *type) void Context::getCurrentReadFormatType(GLenum *internalFormat, GLenum *format, GLenum *type)
{ {
Framebuffer *framebuffer = mState.getReadFramebuffer(); Framebuffer *framebuffer = mState.getReadFramebuffer();
......
...@@ -210,7 +210,6 @@ class Context ...@@ -210,7 +210,6 @@ class Context
const TextureCapsMap &getTextureCaps() const; const TextureCapsMap &getTextureCaps() const;
const Extensions &getExtensions() const; const Extensions &getExtensions() const;
unsigned int getMaxTransformFeedbackBufferBindings() const;
const std::string &getRendererString() const; const std::string &getRendererString() const;
const std::string &getExtensionString() const; const std::string &getExtensionString() const;
......
...@@ -2228,8 +2228,9 @@ bool ProgramBinary::gatherTransformFeedbackLinkedVaryings(InfoLog &infoLog, cons ...@@ -2228,8 +2228,9 @@ bool ProgramBinary::gatherTransformFeedbackLinkedVaryings(InfoLog &infoLog, cons
std::vector<LinkedVarying> *outTransformFeedbackLinkedVaryings) const std::vector<LinkedVarying> *outTransformFeedbackLinkedVaryings) const
{ {
size_t totalComponents = 0; size_t totalComponents = 0;
const size_t maxSeparateComponents = mRenderer->getMaxTransformFeedbackSeparateComponents();
const size_t maxInterleavedComponents = mRenderer->getMaxTransformFeedbackInterleavedComponents(); // TODO (geofflang): Use context's caps.
const gl::Caps &caps = mRenderer->getRendererCaps();
// Gather the linked varyings that are used for transform feedback, they should all exist. // Gather the linked varyings that are used for transform feedback, they should all exist.
outTransformFeedbackLinkedVaryings->clear(); outTransformFeedbackLinkedVaryings->clear();
...@@ -2251,10 +2252,10 @@ bool ProgramBinary::gatherTransformFeedbackLinkedVaryings(InfoLog &infoLog, cons ...@@ -2251,10 +2252,10 @@ bool ProgramBinary::gatherTransformFeedbackLinkedVaryings(InfoLog &infoLog, cons
size_t componentCount = linkedVaryings[j].semanticIndexCount * 4; size_t componentCount = linkedVaryings[j].semanticIndexCount * 4;
if (transformFeedbackBufferMode == GL_SEPARATE_ATTRIBS && if (transformFeedbackBufferMode == GL_SEPARATE_ATTRIBS &&
componentCount > maxSeparateComponents) componentCount > caps.maxTransformFeedbackSeparateComponents)
{ {
infoLog.append("Transform feedback varying's %s components (%u) exceed the maximum separate components (%u).", infoLog.append("Transform feedback varying's %s components (%u) exceed the maximum separate components (%u).",
linkedVaryings[j].name.c_str(), componentCount, maxSeparateComponents); linkedVaryings[j].name.c_str(), componentCount, caps.maxTransformFeedbackSeparateComponents);
return false; return false;
} }
...@@ -2270,10 +2271,10 @@ bool ProgramBinary::gatherTransformFeedbackLinkedVaryings(InfoLog &infoLog, cons ...@@ -2270,10 +2271,10 @@ bool ProgramBinary::gatherTransformFeedbackLinkedVaryings(InfoLog &infoLog, cons
ASSERT(found); ASSERT(found);
} }
if (transformFeedbackBufferMode == GL_INTERLEAVED_ATTRIBS && totalComponents > maxInterleavedComponents) if (transformFeedbackBufferMode == GL_INTERLEAVED_ATTRIBS && totalComponents > caps.maxTransformFeedbackInterleavedComponents)
{ {
infoLog.append("Transform feedback varying total components (%u) exceed the maximum interleaved components (%u).", infoLog.append("Transform feedback varying total components (%u) exceed the maximum interleaved components (%u).",
totalComponents, maxInterleavedComponents); totalComponents, caps.maxTransformFeedbackInterleavedComponents);
return false; return false;
} }
......
...@@ -5636,8 +5636,10 @@ void __stdcall glGetIntegeri_v(GLenum target, GLuint index, GLint* data) ...@@ -5636,8 +5636,10 @@ void __stdcall glGetIntegeri_v(GLenum target, GLuint index, GLint* data)
case GL_TRANSFORM_FEEDBACK_BUFFER_START: case GL_TRANSFORM_FEEDBACK_BUFFER_START:
case GL_TRANSFORM_FEEDBACK_BUFFER_SIZE: case GL_TRANSFORM_FEEDBACK_BUFFER_SIZE:
case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING: case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING:
if (index >= context->getMaxTransformFeedbackBufferBindings()) if (index >= caps.maxTransformFeedbackSeparateAttributes)
{
return gl::error(GL_INVALID_VALUE); return gl::error(GL_INVALID_VALUE);
}
break; break;
case GL_UNIFORM_BUFFER_START: case GL_UNIFORM_BUFFER_START:
case GL_UNIFORM_BUFFER_SIZE: case GL_UNIFORM_BUFFER_SIZE:
...@@ -5770,7 +5772,7 @@ void __stdcall glBindBufferRange(GLenum target, GLuint index, GLuint buffer, GLi ...@@ -5770,7 +5772,7 @@ void __stdcall glBindBufferRange(GLenum target, GLuint index, GLuint buffer, GLi
switch (target) switch (target)
{ {
case GL_TRANSFORM_FEEDBACK_BUFFER: case GL_TRANSFORM_FEEDBACK_BUFFER:
if (index >= context->getMaxTransformFeedbackBufferBindings()) if (index >= caps.maxTransformFeedbackSeparateAttributes)
{ {
return gl::error(GL_INVALID_VALUE); return gl::error(GL_INVALID_VALUE);
} }
...@@ -5842,7 +5844,7 @@ void __stdcall glBindBufferBase(GLenum target, GLuint index, GLuint buffer) ...@@ -5842,7 +5844,7 @@ void __stdcall glBindBufferBase(GLenum target, GLuint index, GLuint buffer)
switch (target) switch (target)
{ {
case GL_TRANSFORM_FEEDBACK_BUFFER: case GL_TRANSFORM_FEEDBACK_BUFFER:
if (index >= context->getMaxTransformFeedbackBufferBindings()) if (index >= caps.maxTransformFeedbackSeparateAttributes)
{ {
return gl::error(GL_INVALID_VALUE); return gl::error(GL_INVALID_VALUE);
} }
...@@ -5896,12 +5898,13 @@ void __stdcall glTransformFeedbackVaryings(GLuint program, GLsizei count, const ...@@ -5896,12 +5898,13 @@ void __stdcall glTransformFeedbackVaryings(GLuint program, GLsizei count, const
return gl::error(GL_INVALID_VALUE); return gl::error(GL_INVALID_VALUE);
} }
const gl::Caps &caps = context->getCaps();
switch (bufferMode) switch (bufferMode)
{ {
case GL_INTERLEAVED_ATTRIBS: case GL_INTERLEAVED_ATTRIBS:
break; break;
case GL_SEPARATE_ATTRIBS: case GL_SEPARATE_ATTRIBS:
if (static_cast<GLuint>(count) > context->getMaxTransformFeedbackBufferBindings()) if (static_cast<GLuint>(count) > caps.maxTransformFeedbackSeparateAttributes)
{ {
return gl::error(GL_INVALID_VALUE); return gl::error(GL_INVALID_VALUE);
} }
...@@ -7139,8 +7142,10 @@ void __stdcall glGetInteger64i_v(GLenum target, GLuint index, GLint64* data) ...@@ -7139,8 +7142,10 @@ void __stdcall glGetInteger64i_v(GLenum target, GLuint index, GLint64* data)
case GL_TRANSFORM_FEEDBACK_BUFFER_START: case GL_TRANSFORM_FEEDBACK_BUFFER_START:
case GL_TRANSFORM_FEEDBACK_BUFFER_SIZE: case GL_TRANSFORM_FEEDBACK_BUFFER_SIZE:
case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING: case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING:
if (index >= context->getMaxTransformFeedbackBufferBindings()) if (index >= caps.maxTransformFeedbackSeparateAttributes)
{
return gl::error(GL_INVALID_VALUE); return gl::error(GL_INVALID_VALUE);
}
break; break;
case GL_UNIFORM_BUFFER_START: case GL_UNIFORM_BUFFER_START:
case GL_UNIFORM_BUFFER_SIZE: case GL_UNIFORM_BUFFER_SIZE:
......
...@@ -163,9 +163,6 @@ class Renderer ...@@ -163,9 +163,6 @@ class Renderer
virtual unsigned int getReservedFragmentUniformVectors() const = 0; virtual unsigned int getReservedFragmentUniformVectors() const = 0;
virtual unsigned int getReservedVertexUniformBuffers() const = 0; virtual unsigned int getReservedVertexUniformBuffers() const = 0;
virtual unsigned int getReservedFragmentUniformBuffers() const = 0; virtual unsigned int getReservedFragmentUniformBuffers() const = 0;
virtual unsigned int getMaxTransformFeedbackBuffers() const = 0;
virtual unsigned int getMaxTransformFeedbackSeparateComponents() const = 0;
virtual unsigned int getMaxTransformFeedbackInterleavedComponents() const = 0;
virtual bool getShareHandleSupport() const = 0; virtual bool getShareHandleSupport() const = 0;
virtual bool getPostSubBufferSupport() const = 0; virtual bool getPostSubBufferSupport() const = 0;
......
...@@ -1795,45 +1795,6 @@ unsigned int Renderer11::getReservedFragmentUniformBuffers() const ...@@ -1795,45 +1795,6 @@ unsigned int Renderer11::getReservedFragmentUniformBuffers() const
return 2; return 2;
} }
unsigned int Renderer11::getMaxTransformFeedbackBuffers() const
{
META_ASSERT(gl::IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_BUFFERS >= D3D11_SO_BUFFER_SLOT_COUNT &&
gl::IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_BUFFERS >= D3D10_SO_BUFFER_SLOT_COUNT);
switch (mFeatureLevel)
{
case D3D_FEATURE_LEVEL_11_0:
return D3D11_SO_BUFFER_SLOT_COUNT;
case D3D_FEATURE_LEVEL_10_1:
return D3D10_1_SO_BUFFER_SLOT_COUNT;
case D3D_FEATURE_LEVEL_10_0:
return D3D10_SO_BUFFER_SLOT_COUNT;
default: UNREACHABLE();
return 0;
}
}
unsigned int Renderer11::getMaxTransformFeedbackSeparateComponents() const
{
switch (mFeatureLevel)
{
case D3D_FEATURE_LEVEL_11_0:
return getMaxTransformFeedbackInterleavedComponents() / getMaxTransformFeedbackBuffers();
case D3D_FEATURE_LEVEL_10_1:
case D3D_FEATURE_LEVEL_10_0:
// D3D 10 and 10.1 only allow one output per output slot if an output slot other than zero
// is used.
return 4;
default: UNREACHABLE();
return 0;
}
}
unsigned int Renderer11::getMaxTransformFeedbackInterleavedComponents() const
{
return (getRendererCaps().maxVaryingVectors * 4);
}
bool Renderer11::getShareHandleSupport() const bool Renderer11::getShareHandleSupport() const
{ {
// We only currently support share handles with BGRA surfaces, because // We only currently support share handles with BGRA surfaces, because
......
...@@ -107,9 +107,6 @@ class Renderer11 : public Renderer ...@@ -107,9 +107,6 @@ class Renderer11 : public Renderer
virtual unsigned int getReservedFragmentUniformVectors() const; virtual unsigned int getReservedFragmentUniformVectors() const;
virtual unsigned int getReservedVertexUniformBuffers() const; virtual unsigned int getReservedVertexUniformBuffers() const;
virtual unsigned int getReservedFragmentUniformBuffers() const; virtual unsigned int getReservedFragmentUniformBuffers() const;
virtual unsigned int getMaxTransformFeedbackBuffers() const;
virtual unsigned int getMaxTransformFeedbackSeparateComponents() const;
virtual unsigned int getMaxTransformFeedbackInterleavedComponents() const;
virtual bool getShareHandleSupport() const; virtual bool getShareHandleSupport() const;
virtual bool getPostSubBufferSupport() const; virtual bool getPostSubBufferSupport() const;
......
...@@ -795,6 +795,63 @@ static size_t GetMaximumConstantBufferSize(D3D_FEATURE_LEVEL featureLevel) ...@@ -795,6 +795,63 @@ static size_t GetMaximumConstantBufferSize(D3D_FEATURE_LEVEL featureLevel)
} }
} }
static size_t GetMaximumStreamOutputBuffers(D3D_FEATURE_LEVEL featureLevel)
{
switch (featureLevel)
{
case D3D_FEATURE_LEVEL_11_1:
case D3D_FEATURE_LEVEL_11_0: return D3D11_SO_BUFFER_SLOT_COUNT;
case D3D_FEATURE_LEVEL_10_1: return D3D10_1_SO_BUFFER_SLOT_COUNT;
case D3D_FEATURE_LEVEL_10_0: return D3D10_SO_BUFFER_SLOT_COUNT;
case D3D_FEATURE_LEVEL_9_3:
case D3D_FEATURE_LEVEL_9_2:
case D3D_FEATURE_LEVEL_9_1: return 0;
default: UNREACHABLE(); return 0;
}
}
static size_t GetMaximumStreamOutputInterleavedComponenets(D3D_FEATURE_LEVEL featureLevel)
{
switch (featureLevel)
{
case D3D_FEATURE_LEVEL_11_1:
case D3D_FEATURE_LEVEL_11_0:
case D3D_FEATURE_LEVEL_10_1:
case D3D_FEATURE_LEVEL_10_0: return GetMaximumVertexOutputVectors(featureLevel) * 4;
case D3D_FEATURE_LEVEL_9_3:
case D3D_FEATURE_LEVEL_9_2:
case D3D_FEATURE_LEVEL_9_1: return 0;
default: UNREACHABLE(); return 0;
}
}
static size_t GetMaximumStreamOutputSeparateCompeonents(D3D_FEATURE_LEVEL featureLevel)
{
switch (featureLevel)
{
case D3D_FEATURE_LEVEL_11_1:
case D3D_FEATURE_LEVEL_11_0: return GetMaximumStreamOutputInterleavedComponenets(featureLevel) /
GetMaximumStreamOutputBuffers(featureLevel);
// D3D 10 and 10.1 only allow one output per output slot if an output slot other than zero is used.
case D3D_FEATURE_LEVEL_10_1:
case D3D_FEATURE_LEVEL_10_0: return 4;
case D3D_FEATURE_LEVEL_9_3:
case D3D_FEATURE_LEVEL_9_2:
case D3D_FEATURE_LEVEL_9_1: return 0;
default: UNREACHABLE(); return 0;
}
}
void GenerateCaps(ID3D11Device *device, gl::Caps *caps, gl::TextureCapsMap *textureCapsMap, gl::Extensions *extensions) void GenerateCaps(ID3D11Device *device, gl::Caps *caps, gl::TextureCapsMap *textureCapsMap, gl::Extensions *extensions)
{ {
GLuint maxSamples = 0; GLuint maxSamples = 0;
...@@ -887,6 +944,11 @@ void GenerateCaps(ID3D11Device *device, gl::Caps *caps, gl::TextureCapsMap *text ...@@ -887,6 +944,11 @@ void GenerateCaps(ID3D11Device *device, gl::Caps *caps, gl::TextureCapsMap *text
caps->maxVaryingVectors = GetMaximumVertexOutputVectors(featureLevel); caps->maxVaryingVectors = GetMaximumVertexOutputVectors(featureLevel);
caps->maxCombinedTextureImageUnits = caps->maxVertexTextureImageUnits + caps->maxFragmentInputComponents; caps->maxCombinedTextureImageUnits = caps->maxVertexTextureImageUnits + caps->maxFragmentInputComponents;
// Transform feedback limits
caps->maxTransformFeedbackInterleavedComponents = GetMaximumStreamOutputInterleavedComponenets(featureLevel);
caps->maxTransformFeedbackSeparateAttributes = GetMaximumStreamOutputBuffers(featureLevel);
caps->maxTransformFeedbackSeparateComponents = GetMaximumStreamOutputSeparateCompeonents(featureLevel);
// GL extension support // GL extension support
extensions->setTextureExtensionSupport(*textureCapsMap); extensions->setTextureExtensionSupport(*textureCapsMap);
extensions->elementIndexUint = true; extensions->elementIndexUint = true;
......
...@@ -2209,21 +2209,6 @@ unsigned int Renderer9::getReservedFragmentUniformBuffers() const ...@@ -2209,21 +2209,6 @@ unsigned int Renderer9::getReservedFragmentUniformBuffers() const
return 0; return 0;
} }
unsigned int Renderer9::getMaxTransformFeedbackBuffers() const
{
return 0;
}
unsigned int Renderer9::getMaxTransformFeedbackSeparateComponents() const
{
return 0;
}
unsigned int Renderer9::getMaxTransformFeedbackInterleavedComponents() const
{
return 0;
}
bool Renderer9::getShareHandleSupport() const bool Renderer9::getShareHandleSupport() const
{ {
// PIX doesn't seem to support using share handles, so disable them. // PIX doesn't seem to support using share handles, so disable them.
......
...@@ -109,9 +109,6 @@ class Renderer9 : public Renderer ...@@ -109,9 +109,6 @@ class Renderer9 : public Renderer
virtual unsigned int getReservedFragmentUniformVectors() const; virtual unsigned int getReservedFragmentUniformVectors() const;
virtual unsigned int getReservedVertexUniformBuffers() const; virtual unsigned int getReservedVertexUniformBuffers() const;
virtual unsigned int getReservedFragmentUniformBuffers() const; virtual unsigned int getReservedFragmentUniformBuffers() const;
virtual unsigned int getMaxTransformFeedbackBuffers() const;
virtual unsigned int getMaxTransformFeedbackSeparateComponents() const;
virtual unsigned int getMaxTransformFeedbackInterleavedComponents() const;
virtual bool getShareHandleSupport() const; virtual bool getShareHandleSupport() const;
virtual bool getPostSubBufferSupport() const; virtual bool getPostSubBufferSupport() const;
......
...@@ -436,6 +436,11 @@ void GenerateCaps(IDirect3D9 *d3d9, IDirect3DDevice9 *device, D3DDEVTYPE deviceT ...@@ -436,6 +436,11 @@ void GenerateCaps(IDirect3D9 *d3d9, IDirect3DDevice9 *device, D3DDEVTYPE deviceT
caps->maxVaryingVectors = caps->maxVertexOutputComponents / 4; caps->maxVaryingVectors = caps->maxVertexOutputComponents / 4;
caps->maxCombinedTextureImageUnits = caps->maxVertexTextureImageUnits + caps->maxFragmentInputComponents; caps->maxCombinedTextureImageUnits = caps->maxVertexTextureImageUnits + caps->maxFragmentInputComponents;
// Transform feedback limits
caps->maxTransformFeedbackInterleavedComponents = 0;
caps->maxTransformFeedbackSeparateAttributes = 0;
caps->maxTransformFeedbackSeparateComponents = 0;
// GL extension support // GL extension support
extensions->setTextureExtensionSupport(*textureCapsMap); extensions->setTextureExtensionSupport(*textureCapsMap);
extensions->elementIndexUint = deviceCaps.MaxVertexIndex >= (1 << 16); extensions->elementIndexUint = deviceCaps.MaxVertexIndex >= (1 << 16);
......
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