Commit 3bb2bbea by Jamie Madill Committed by Commit Bot

Program: Sampler uniform query in front-end.

We have this information stored in the front-end sampler bindings. This solves sampler uniform query across the various back-ends. Turns on a bunch of uniform_api dEQP tests. Bug: angleproject:2612 Change-Id: If8752a26438595ad103598369df360e2f5e12d53 Reviewed-on: https://chromium-review.googlesource.com/1101572 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarLuc Ferron <lucferron@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 8c379f36
...@@ -1952,54 +1952,77 @@ void Program::setUniformMatrix4x3fv(GLint location, ...@@ -1952,54 +1952,77 @@ void Program::setUniformMatrix4x3fv(GLint location,
mProgram->setUniformMatrix4x3fv(location, clampedCount, transpose, v); mProgram->setUniformMatrix4x3fv(location, clampedCount, transpose, v);
} }
GLuint Program::getSamplerUniformBinding(const VariableLocation &uniformLocation) const
{
GLuint samplerIndex = mState.getSamplerIndexFromUniformIndex(uniformLocation.index);
const std::vector<GLuint> &boundTextureUnits =
mState.mSamplerBindings[samplerIndex].boundTextureUnits;
return boundTextureUnits[uniformLocation.arrayIndex];
}
void Program::getUniformfv(const Context *context, GLint location, GLfloat *v) const void Program::getUniformfv(const Context *context, GLint location, GLfloat *v) const
{ {
const auto &uniformLocation = mState.getUniformLocations()[location]; const VariableLocation &uniformLocation = mState.getUniformLocations()[location];
const auto &uniform = mState.getUniforms()[uniformLocation.index]; const LinkedUniform &uniform = mState.getUniforms()[uniformLocation.index];
if (uniform.isSampler())
{
*v = static_cast<GLfloat>(getSamplerUniformBinding(uniformLocation));
return;
}
GLenum nativeType = gl::VariableComponentType(uniform.type); const GLenum nativeType = gl::VariableComponentType(uniform.type);
if (nativeType == GL_FLOAT) if (nativeType == GL_FLOAT)
{ {
mProgram->getUniformfv(context, location, v); mProgram->getUniformfv(context, location, v);
} }
else else
{ {
getUniformInternal(context, v, location, nativeType, getUniformInternal(context, v, location, nativeType, VariableComponentCount(uniform.type));
gl::VariableComponentCount(uniform.type));
} }
} }
void Program::getUniformiv(const Context *context, GLint location, GLint *v) const void Program::getUniformiv(const Context *context, GLint location, GLint *v) const
{ {
const auto &uniformLocation = mState.getUniformLocations()[location]; const VariableLocation &uniformLocation = mState.getUniformLocations()[location];
const auto &uniform = mState.getUniforms()[uniformLocation.index]; const LinkedUniform &uniform = mState.getUniforms()[uniformLocation.index];
GLenum nativeType = gl::VariableComponentType(uniform.type); if (uniform.isSampler())
{
*v = static_cast<GLint>(getSamplerUniformBinding(uniformLocation));
return;
}
const GLenum nativeType = gl::VariableComponentType(uniform.type);
if (nativeType == GL_INT || nativeType == GL_BOOL) if (nativeType == GL_INT || nativeType == GL_BOOL)
{ {
mProgram->getUniformiv(context, location, v); mProgram->getUniformiv(context, location, v);
} }
else else
{ {
getUniformInternal(context, v, location, nativeType, getUniformInternal(context, v, location, nativeType, VariableComponentCount(uniform.type));
gl::VariableComponentCount(uniform.type));
} }
} }
void Program::getUniformuiv(const Context *context, GLint location, GLuint *v) const void Program::getUniformuiv(const Context *context, GLint location, GLuint *v) const
{ {
const auto &uniformLocation = mState.getUniformLocations()[location]; const VariableLocation &uniformLocation = mState.getUniformLocations()[location];
const auto &uniform = mState.getUniforms()[uniformLocation.index]; const LinkedUniform &uniform = mState.getUniforms()[uniformLocation.index];
if (uniform.isSampler())
{
*v = getSamplerUniformBinding(uniformLocation);
return;
}
GLenum nativeType = gl::VariableComponentType(uniform.type); const GLenum nativeType = VariableComponentType(uniform.type);
if (nativeType == GL_UNSIGNED_INT) if (nativeType == GL_UNSIGNED_INT)
{ {
mProgram->getUniformuiv(context, location, v); mProgram->getUniformuiv(context, location, v);
} }
else else
{ {
getUniformInternal(context, v, location, nativeType, getUniformInternal(context, v, location, nativeType, VariableComponentCount(uniform.type));
gl::VariableComponentCount(uniform.type));
} }
} }
......
...@@ -819,6 +819,8 @@ class Program final : angle::NonCopyable, public LabeledObject ...@@ -819,6 +819,8 @@ class Program final : angle::NonCopyable, public LabeledObject
template <typename T> template <typename T>
GLint getActiveInterfaceBlockMaxNameLength(const std::vector<T> &resources) const; GLint getActiveInterfaceBlockMaxNameLength(const std::vector<T> &resources) const;
GLuint getSamplerUniformBinding(const VariableLocation &uniformLocation) const;
ProgramState mState; ProgramState mState;
rx::ProgramImpl *mProgram; rx::ProgramImpl *mProgram;
......
...@@ -512,11 +512,7 @@ void ProgramVk::getUniformImpl(GLint location, T *v, GLenum entryPointType) cons ...@@ -512,11 +512,7 @@ void ProgramVk::getUniformImpl(GLint location, T *v, GLenum entryPointType) cons
const gl::VariableLocation &locationInfo = mState.getUniformLocations()[location]; const gl::VariableLocation &locationInfo = mState.getUniformLocations()[location];
const gl::LinkedUniform &linkedUniform = mState.getUniforms()[locationInfo.index]; const gl::LinkedUniform &linkedUniform = mState.getUniforms()[locationInfo.index];
if (linkedUniform.isSampler()) ASSERT(!linkedUniform.isSampler());
{
UNIMPLEMENTED();
return;
}
const gl::ShaderType shaderType = linkedUniform.getFirstShaderTypeWhereActive(); const gl::ShaderType shaderType = linkedUniform.getFirstShaderTypeWhereActive();
ASSERT(shaderType != gl::ShaderType::InvalidEnum); ASSERT(shaderType != gl::ShaderType::InvalidEnum);
......
...@@ -313,31 +313,6 @@ ...@@ -313,31 +313,6 @@
2598 VULKAN : dEQP-GLES2.functional.rasterization.primitives.line* = SKIP 2598 VULKAN : dEQP-GLES2.functional.rasterization.primitives.line* = SKIP
2599 VULKAN : dEQP-GLES2.functional.rasterization.limits.points = SKIP 2599 VULKAN : dEQP-GLES2.functional.rasterization.limits.points = SKIP
2161 VULKAN : dEQP-GLES2.functional.uniform_api.value.initial.get_uniform.basic.sampler* = SKIP
2161 VULKAN : dEQP-GLES2.functional.uniform_api.value.initial.get_uniform.basic_array.sampler2D_* = SKIP
2161 VULKAN : dEQP-GLES2.functional.uniform_api.value.initial.get_uniform.basic_struct.sampler2D_* = SKIP
2161 VULKAN : dEQP-GLES2.functional.uniform_api.value.initial.get_uniform.struct_in_array.sampler2D_* = SKIP
2161 VULKAN : dEQP-GLES2.functional.uniform_api.value.initial.get_uniform.array_in_struct.sampler2D_* = SKIP
2161 VULKAN : dEQP-GLES2.functional.uniform_api.value.initial.get_uniform.nested_structs_arrays.sampler2D_* = SKIP
2161 VULKAN : dEQP-GLES2.functional.uniform_api.value.assigned.by_pointer.get_uniform.basic.sampler* = SKIP
2161 VULKAN : dEQP-GLES2.functional.uniform_api.value.assigned.by_pointer.get_uniform.basic_array.sampler2D_* = SKIP
2161 VULKAN : dEQP-GLES2.functional.uniform_api.value.assigned.by_pointer.get_uniform.basic_struct.sampler2D_* = SKIP
2161 VULKAN : dEQP-GLES2.functional.uniform_api.value.assigned.by_pointer.get_uniform.struct_in_array.sampler2D_* = SKIP
2161 VULKAN : dEQP-GLES2.functional.uniform_api.value.assigned.by_pointer.get_uniform.array_in_struct.sampler2D_* = SKIP
2161 VULKAN : dEQP-GLES2.functional.uniform_api.value.assigned.by_pointer.get_uniform.nested_structs_arrays.sampler2D_* = SKIP
2161 VULKAN : dEQP-GLES2.functional.uniform_api.value.assigned.by_pointer.get_uniform.basic_array_first_elem_without_brackets.sampler2D* = SKIP
2161 VULKAN : dEQP-GLES2.functional.uniform_api.value.assigned.by_value.get_uniform.basic.sampler* = SKIP
2161 VULKAN : dEQP-GLES2.functional.uniform_api.value.assigned.by_value.get_uniform.basic_array.sampler2D_* = SKIP
2161 VULKAN : dEQP-GLES2.functional.uniform_api.value.assigned.by_value.get_uniform.basic_struct.sampler2D_* = SKIP
2161 VULKAN : dEQP-GLES2.functional.uniform_api.value.assigned.by_value.get_uniform.struct_in_array.sampler2D_* = SKIP
2161 VULKAN : dEQP-GLES2.functional.uniform_api.value.assigned.by_value.get_uniform.array_in_struct.sampler2D_* = SKIP
2161 VULKAN : dEQP-GLES2.functional.uniform_api.value.assigned.by_value.get_uniform.nested_structs_arrays.sampler2D_* = SKIP
2161 VULKAN : dEQP-GLES2.functional.uniform_api.value.assigned.by_value.get_uniform.basic_array_first_elem_without_brackets.sampler2D_* = SKIP
2161 VULKAN : dEQP-GLES2.functional.uniform_api.value.assigned.basic_array_assign_full.array_in_struct.sampler2D_* = SKIP
2161 VULKAN : dEQP-GLES2.functional.uniform_api.value.assigned.basic_array_assign_full.basic_array.sampler2D_* = SKIP
2161 VULKAN : dEQP-GLES2.functional.uniform_api.value.assigned.basic_array_assign_partial.basic_array.sampler2D_* = SKIP
2161 VULKAN : dEQP-GLES2.functional.uniform_api.value.assigned.basic_array_assign_partial.array_in_struct.sampler2D_* = SKIP
2161 VULKAN : dEQP-GLES2.functional.uniform_api.value.assigned.unused_uniforms.sampler2D_* = SKIP
2161 VULKAN : dEQP-GLES2.functional.uniform_api.random.* = SKIP 2161 VULKAN : dEQP-GLES2.functional.uniform_api.random.* = SKIP
2600 VULKAN : dEQP-GLES2.functional.state_query.shader.uniform_value_sampler = SKIP 2600 VULKAN : dEQP-GLES2.functional.state_query.shader.uniform_value_sampler = SKIP
2601 VULKAN : dEQP-GLES2.functional.clipping.* = SKIP 2601 VULKAN : dEQP-GLES2.functional.clipping.* = SKIP
......
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