Commit 36037b7e by Alexis Hetu Committed by Alexis Hétu

Added uniform buffer queries

Implemented binding/size/start related queries for uniform buffers. Change-Id: I9d36c92201a7f0df86b1d882ca6d9f04b372bad6 Reviewed-on: https://swiftshader-review.googlesource.com/4750Tested-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <capn@google.com>
parent 314531aa
......@@ -2444,6 +2444,31 @@ template<typename T> bool Context::getTransformFeedbackiv(GLuint xfb, GLenum pna
return true;
}
template bool Context::getUniformBufferiv<GLint>(GLuint index, GLenum pname, GLint *param) const;
template bool Context::getUniformBufferiv<GLint64>(GLuint index, GLenum pname, GLint64 *param) const;
template<typename T> bool Context::getUniformBufferiv(GLuint index, GLenum pname, T *param) const
{
const UniformBufferBinding& uniformBuffer = mState.uniformBuffers[index];
switch(pname)
{
case GL_UNIFORM_BUFFER_BINDING: // name, initially 0
*param = uniformBuffer.get().name();
break;
case GL_UNIFORM_BUFFER_SIZE: // indexed[n] 64-bit integer, initially 0
*param = uniformBuffer.getSize();
break;
case GL_UNIFORM_BUFFER_START: // indexed[n] 64-bit integer, initially 0
*param = uniformBuffer.getOffset();
break;
default:
return false;
}
return true;
}
bool Context::getQueryParameterInfo(GLenum pname, GLenum *type, unsigned int *numParams) const
{
// Please note: the query type returned for DEPTH_CLEAR_VALUE in this implementation
......
......@@ -628,7 +628,8 @@ public:
bool getFloatv(GLenum pname, GLfloat *params) const;
template<typename T> bool getIntegerv(GLenum pname, T *params) const;
bool getBooleanv(GLenum pname, GLboolean *params) const;
template<typename T> bool getTransformFeedbackiv(GLuint xfb, GLenum pname, T *param) const;
template<typename T> bool getTransformFeedbackiv(GLuint index, GLenum pname, T *param) const;
template<typename T> bool getUniformBufferiv(GLuint index, GLenum pname, T *param) const;
void samplerParameteri(GLuint sampler, GLenum pname, GLint param);
void samplerParameterf(GLuint sampler, GLenum pname, GLfloat param);
GLint getSamplerParameteri(GLuint sampler, GLenum pname);
......
......@@ -1827,6 +1827,7 @@ GL_APICALL void GL_APIENTRY glGetIntegeri_v(GLenum target, GLuint index, GLint *
if(context)
{
if(!context->getTransformFeedbackiv(index, target, data) &&
!context->getUniformBufferiv(index, target, data) &&
!context->getIntegerv(target, data))
{
GLenum nativeType;
......@@ -3235,7 +3236,8 @@ GL_APICALL void GL_APIENTRY glGetInteger64i_v(GLenum target, GLuint index, GLint
if(context)
{
if(!context->getTransformFeedbackiv(index, target, data) &&
!context->getIntegerv(target, data))
!context->getUniformBufferiv(index, target, data) &&
!context->getIntegerv(target, data))
{
GLenum nativeType;
unsigned int numParams = 0;
......
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