Commit e76c5c3c by Tim Van Patten Committed by Commit Bot

Vulkan: Enable drawRangeElements()

Enable drawRangeElements() for the Vulkan backend and the associated tests. Test: angle_deqp_gles3_tests Bug: angleproject:3420 Change-Id: I98770631ce1387131bb45e2c1e9df24e911bc692 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1595101 Commit-Queue: Tim Van Patten <timvp@google.com> Reviewed-by: 's avatarShahbaz Youssefi <syoussefi@chromium.org>
parent b62fce15
......@@ -149,7 +149,7 @@ struct VertexAttribCurrentValueData
GLfloat FloatValues[4];
GLint IntValues[4];
GLuint UnsignedIntValues[4];
};
} Values;
VertexAttribType Type;
VertexAttribCurrentValueData();
......
......@@ -12,17 +12,17 @@ namespace gl
inline VertexAttribCurrentValueData::VertexAttribCurrentValueData()
: Type(gl::VertexAttribType::Float)
{
FloatValues[0] = 0.0f;
FloatValues[1] = 0.0f;
FloatValues[2] = 0.0f;
FloatValues[3] = 1.0f;
Values.FloatValues[0] = 0.0f;
Values.FloatValues[1] = 0.0f;
Values.FloatValues[2] = 0.0f;
Values.FloatValues[3] = 1.0f;
}
inline void VertexAttribCurrentValueData::setFloatValues(const GLfloat floatValues[4])
{
for (unsigned int valueIndex = 0; valueIndex < 4; valueIndex++)
{
FloatValues[valueIndex] = floatValues[valueIndex];
Values.FloatValues[valueIndex] = floatValues[valueIndex];
}
Type = gl::VertexAttribType::Float;
}
......@@ -31,7 +31,7 @@ inline void VertexAttribCurrentValueData::setIntValues(const GLint intValues[4])
{
for (unsigned int valueIndex = 0; valueIndex < 4; valueIndex++)
{
IntValues[valueIndex] = intValues[valueIndex];
Values.IntValues[valueIndex] = intValues[valueIndex];
}
Type = gl::VertexAttribType::Int;
}
......@@ -40,14 +40,14 @@ inline void VertexAttribCurrentValueData::setUnsignedIntValues(const GLuint unsi
{
for (unsigned int valueIndex = 0; valueIndex < 4; valueIndex++)
{
UnsignedIntValues[valueIndex] = unsignedIntValues[valueIndex];
Values.UnsignedIntValues[valueIndex] = unsignedIntValues[valueIndex];
}
Type = gl::VertexAttribType::UnsignedInt;
}
inline bool operator==(const VertexAttribCurrentValueData &a, const VertexAttribCurrentValueData &b)
{
return (a.Type == b.Type && memcmp(a.FloatValues, b.FloatValues, sizeof(float) * 4) == 0);
return (a.Type == b.Type && memcmp(&a.Values, &b.Values, sizeof(VertexAttribCurrentValueData::Values)) == 0);
}
inline bool operator!=(const VertexAttribCurrentValueData &a, const VertexAttribCurrentValueData &b)
......
......@@ -1378,7 +1378,7 @@ void QueryVertexAttribfv(const VertexAttribute &attrib,
GLenum pname,
GLfloat *params)
{
QueryVertexAttribBase(attrib, binding, currentValueData.FloatValues, pname, params);
QueryVertexAttribBase(attrib, binding, currentValueData.Values.FloatValues, pname, params);
}
void QueryVertexAttribiv(const VertexAttribute &attrib,
......@@ -1387,7 +1387,7 @@ void QueryVertexAttribiv(const VertexAttribute &attrib,
GLenum pname,
GLint *params)
{
QueryVertexAttribBase(attrib, binding, currentValueData.FloatValues, pname, params);
QueryVertexAttribBase(attrib, binding, currentValueData.Values.FloatValues, pname, params);
}
void QueryVertexAttribPointerv(const VertexAttribute &attrib, GLenum pname, void **pointer)
......@@ -1410,7 +1410,7 @@ void QueryVertexAttribIiv(const VertexAttribute &attrib,
GLenum pname,
GLint *params)
{
QueryVertexAttribBase(attrib, binding, currentValueData.IntValues, pname, params);
QueryVertexAttribBase(attrib, binding, currentValueData.Values.IntValues, pname, params);
}
void QueryVertexAttribIuiv(const VertexAttribute &attrib,
......@@ -1419,7 +1419,8 @@ void QueryVertexAttribIuiv(const VertexAttribute &attrib,
GLenum pname,
GLuint *params)
{
QueryVertexAttribBase(attrib, binding, currentValueData.UnsignedIntValues, pname, params);
QueryVertexAttribBase(attrib, binding, currentValueData.Values.UnsignedIntValues, pname,
params);
}
void QueryActiveUniformBlockiv(const Program *program,
......
......@@ -203,10 +203,10 @@ VertexStorageType ClassifyAttributeStorage(const gl::Context *context,
VertexDataManager::CurrentValueState::CurrentValueState(BufferFactoryD3D *factory)
: buffer(new StreamingVertexBufferInterface(factory)), offset(0)
{
data.FloatValues[0] = std::numeric_limits<float>::quiet_NaN();
data.FloatValues[1] = std::numeric_limits<float>::quiet_NaN();
data.FloatValues[2] = std::numeric_limits<float>::quiet_NaN();
data.FloatValues[3] = std::numeric_limits<float>::quiet_NaN();
data.Values.FloatValues[0] = std::numeric_limits<float>::quiet_NaN();
data.Values.FloatValues[1] = std::numeric_limits<float>::quiet_NaN();
data.Values.FloatValues[2] = std::numeric_limits<float>::quiet_NaN();
data.Values.FloatValues[3] = std::numeric_limits<float>::quiet_NaN();
data.Type = gl::VertexAttribType::Float;
}
......@@ -595,7 +595,8 @@ angle::Result VertexDataManager::storeCurrentValue(
ANGLE_TRY(buffer.reserveVertexSpace(context, attrib, binding, 1, 0));
const uint8_t *sourceData = reinterpret_cast<const uint8_t *>(currentValue.FloatValues);
const uint8_t *sourceData =
reinterpret_cast<const uint8_t *>(currentValue.Values.FloatValues);
unsigned int streamOffset;
ANGLE_TRY(buffer.storeDynamicAttribute(context, attrib, binding, currentValue.Type, 0, 1, 0,
&streamOffset, sourceData));
......
......@@ -945,15 +945,16 @@ void StateManagerGL::setAttributeCurrentData(size_t index,
{
case gl::VertexAttribType::Float:
mFunctions->vertexAttrib4fv(static_cast<GLuint>(index),
mVertexAttribCurrentValues[index].FloatValues);
mVertexAttribCurrentValues[index].Values.FloatValues);
break;
case gl::VertexAttribType::Int:
mFunctions->vertexAttribI4iv(static_cast<GLuint>(index),
mVertexAttribCurrentValues[index].IntValues);
mVertexAttribCurrentValues[index].Values.IntValues);
break;
case gl::VertexAttribType::UnsignedInt:
mFunctions->vertexAttribI4uiv(static_cast<GLuint>(index),
mVertexAttribCurrentValues[index].UnsignedIntValues);
mFunctions->vertexAttribI4uiv(
static_cast<GLuint>(index),
mVertexAttribCurrentValues[index].Values.UnsignedIntValues);
break;
default:
UNREACHABLE();
......
......@@ -59,7 +59,7 @@ constexpr VkColorComponentFlags kAllColorChannelsMask =
VK_COLOR_COMPONENT_A_BIT);
constexpr VkBufferUsageFlags kVertexBufferUsage = VK_BUFFER_USAGE_VERTEX_BUFFER_BIT;
constexpr size_t kDefaultValueSize = sizeof(float) * 4;
constexpr size_t kDefaultValueSize = sizeof(gl::VertexAttribCurrentValueData::Values);
constexpr size_t kDefaultBufferSize = kDefaultValueSize * 16;
} // anonymous namespace
......@@ -567,8 +567,7 @@ angle::Result ContextVk::drawRangeElements(const gl::Context *context,
gl::DrawElementsType type,
const void *indices)
{
ANGLE_VK_UNREACHABLE(this);
return angle::Result::Stop;
return drawElements(context, mode, count, type, indices);
}
VkDevice ContextVk::getDevice() const
......@@ -1362,10 +1361,7 @@ angle::Result ContextVk::updateDefaultAttribute(size_t attribIndex)
const gl::State &glState = mState;
const gl::VertexAttribCurrentValueData &defaultValue =
glState.getVertexAttribCurrentValues()[attribIndex];
ASSERT(defaultValue.Type == gl::VertexAttribType::Float);
memcpy(ptr, defaultValue.FloatValues, kDefaultValueSize);
memcpy(ptr, &defaultValue.Values, kDefaultValueSize);
ANGLE_TRY(defaultBuffer.flush(this));
......
......@@ -395,7 +395,28 @@ angle::Result VertexArrayVk::syncState(const gl::Context *context,
ANGLE_INLINE void VertexArrayVk::setDefaultPackedInput(ContextVk *contextVk, size_t attribIndex)
{
contextVk->onVertexAttributeChange(attribIndex, 0, 0, VK_FORMAT_R32G32B32A32_SFLOAT, 0);
const gl::State &glState = contextVk->getState();
const gl::VertexAttribCurrentValueData &defaultValue =
glState.getVertexAttribCurrentValues()[attribIndex];
switch (defaultValue.Type)
{
case gl::VertexAttribType::Float:
contextVk->onVertexAttributeChange(attribIndex, 0, 0, VK_FORMAT_R32G32B32A32_SFLOAT, 0);
break;
case gl::VertexAttribType::Int:
contextVk->onVertexAttributeChange(attribIndex, 0, 0, VK_FORMAT_R32G32B32A32_SINT, 0);
break;
case gl::VertexAttribType::UnsignedInt:
contextVk->onVertexAttributeChange(attribIndex, 0, 0, VK_FORMAT_R32G32B32A32_UINT, 0);
break;
default:
UNREACHABLE();
break;
}
}
angle::Result VertexArrayVk::syncDirtyAttrib(ContextVk *contextVk,
......
......@@ -638,11 +638,19 @@
3193 VULKAN : dEQP-GLES3.functional.vertex_arrays.single_attribute.first.int2_10_10_10* = SKIP
3193 VULKAN : dEQP-GLES3.functional.vertex_arrays.single_attribute.offset.int2_10_10_10* = SKIP
3193 VULKAN : dEQP-GLES3.functional.vertex_array_objects.all_attributes = SKIP
3193 VULKAN : dEQP-GLES3.functional.draw.* = SKIP
3193 VULKAN : dEQP-GLES3.functional.default_vertex_attrib.int.* = SKIP
3193 VULKAN : dEQP-GLES3.functional.default_vertex_attrib.ivec* = SKIP
3193 VULKAN : dEQP-GLES3.functional.default_vertex_attrib.uint.* = SKIP
3193 VULKAN : dEQP-GLES3.functional.default_vertex_attrib.uvec* = SKIP
3193 VULKAN : dEQP-GLES3.functional.draw.draw_arrays_instanced.line_loop.* = SKIP
3193 VULKAN : dEQP-GLES3.functional.draw.draw_elements_instanced.line_loop.* = SKIP
3193 VULKAN : dEQP-GLES3.functional.draw.random.* = SKIP
3193 VULKAN : dEQP-GLES3.functional.draw.draw_elements.indices.user_ptr.index_int = FAIL
3193 VULKAN : dEQP-GLES3.functional.draw.draw_elements.indices.unaligned_user_ptr.index_int = FAIL
3193 VULKAN : dEQP-GLES3.functional.draw.draw_elements_instanced.indices.user_ptr.index_int = FAIL
3193 VULKAN : dEQP-GLES3.functional.draw.draw_elements_instanced.indices.unaligned_user_ptr.index_int = FAIL
3193 VULKAN : dEQP-GLES3.functional.negative_api.vertex_array.draw_range_elements = FAIL
3193 VULKAN : dEQP-GLES3.functional.negative_api.vertex_array.draw_range_elements_incomplete_primitive = FAIL
// Polygon offset:
2950 VULKAN : dEQP-GLES3.functional.polygon_offset.float32_result_depth_clamp = FAIL
......@@ -687,9 +695,6 @@
// - ES3 Query Types:
2950 VULKAN : dEQP-GLES3.functional.negative_api.fragment.begin_query = SKIP
// - ContextVk::drawRangeElements:
2950 VULKAN : dEQP-GLES3.functional.negative_api.vertex_array.draw_range_element* = SKIP
// - TextureVk::setBaseLevel:
2950 VULKAN : dEQP-GLES3.functional.state_query.texture.texture_2d_texture_base_level_gettexparameter* = SKIP
2950 VULKAN : dEQP-GLES3.functional.state_query.texture.texture_3d_texture_base_level_gettexparameter* = 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