Add end2end test for all vertex formats

BUG=dawn:41

Change-Id: I37bde37843522a8d7c8b3bea1cb24c0971efd8e2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/6340
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Shaobo Yan <shaobo.yan@intel.com>
This commit is contained in:
Yan, Shaobo
2019-04-26 15:25:18 +00:00
committed by Commit Bot service account
parent a32e3bd014
commit 9286adcb0f
5 changed files with 877 additions and 4 deletions

View File

@@ -105,6 +105,30 @@ namespace dawn_native { namespace opengl {
}
}
bool VertexFormatIsInt(dawn::VertexFormat format) {
switch (format) {
case dawn::VertexFormat::UChar2:
case dawn::VertexFormat::UChar4:
case dawn::VertexFormat::Char2:
case dawn::VertexFormat::Char4:
case dawn::VertexFormat::UShort2:
case dawn::VertexFormat::UShort4:
case dawn::VertexFormat::Short2:
case dawn::VertexFormat::Short4:
case dawn::VertexFormat::UInt:
case dawn::VertexFormat::UInt2:
case dawn::VertexFormat::UInt3:
case dawn::VertexFormat::UInt4:
case dawn::VertexFormat::Int:
case dawn::VertexFormat::Int2:
case dawn::VertexFormat::Int3:
case dawn::VertexFormat::Int4:
return true;
default:
return false;
}
}
GLint GetStencilMaskFromStencilFormat(dawn::TextureFormat depthStencilFormat) {
switch (depthStencilFormat) {
case dawn::TextureFormat::D32FloatS8Uint:
@@ -242,10 +266,16 @@ namespace dawn_native { namespace opengl {
GLboolean normalized = VertexFormatIsNormalized(attribute.format);
glBindBuffer(GL_ARRAY_BUFFER, buffer);
glVertexAttribPointer(
location, components, formatType, normalized, input.stride,
reinterpret_cast<void*>(
static_cast<intptr_t>(offset + attribute.offset)));
if (VertexFormatIsInt(attribute.format)) {
glVertexAttribIPointer(location, components, formatType, input.stride,
reinterpret_cast<void*>(static_cast<intptr_t>(
offset + attribute.offset)));
} else {
glVertexAttribPointer(
location, components, formatType, normalized, input.stride,
reinterpret_cast<void*>(
static_cast<intptr_t>(offset + attribute.offset)));
}
}
}