Hash :
f5c88e7e
        
        Author :
  
        
        Date :
2018-12-08T09:56:38
        
      
Refactor and inline DrawElements validation. This moves ValidateDrawBase into a common inline function. It also moves some checks in ValidateDrawElementsCommon into ValidateDrawElementsBase. "Base" is called from DrawElementsIndirect while "Common" is only called from non-indirect entry points. But this improves conformance because the missing checks in "Base" apply to DrawIndirect as well. In a follow-up patch many checks in "Base" will be cached into a single value. Much like what we did for ValidateDrawBase. Also inlines ValidateDrawElements which just calls through to "Common". Bug: angleproject:2966 Change-Id: Ibe0c5db25f403dd52a50dc73373ebb50cedad003 Reviewed-on: https://chromium-review.googlesource.com/c/1357147 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
//
// Copyright 2018 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// validationES2.h:
//  Inlined validation functions for OpenGL ES 2.0 entry points.
#ifndef LIBANGLE_VALIDATION_ES2_H_
#define LIBANGLE_VALIDATION_ES2_H_
#include "libANGLE/ErrorStrings.h"
#include "libANGLE/validationES.h"
#include "libANGLE/validationES2_autogen.h"
namespace gl
{
ANGLE_INLINE bool ValidateDrawArrays(Context *context,
                                     PrimitiveMode mode,
                                     GLint first,
                                     GLsizei count)
{
    return ValidateDrawArraysCommon(context, mode, first, count, 1);
}
ANGLE_INLINE bool ValidateUniform2f(Context *context, GLint location, GLfloat x, GLfloat y)
{
    return ValidateUniform(context, GL_FLOAT_VEC2, location, 1);
}
ANGLE_INLINE bool ValidateBindBuffer(Context *context, BufferBinding target, GLuint buffer)
{
    if (!context->isValidBufferBinding(target))
    {
        context->validationError(GL_INVALID_ENUM, err::kInvalidBufferTypes);
        return false;
    }
    if (!context->getGLState().isBindGeneratesResourceEnabled() &&
        !context->isBufferGenerated(buffer))
    {
        context->validationError(GL_INVALID_OPERATION, err::kObjectNotGenerated);
        return false;
    }
    return true;
}
ANGLE_INLINE bool ValidateDrawElements(Context *context,
                                       PrimitiveMode mode,
                                       GLsizei count,
                                       DrawElementsType type,
                                       const void *indices)
{
    return ValidateDrawElementsCommon(context, mode, count, type, indices, 1);
}
}  // namespace gl
#endif  // LIBANGLE_VALIDATION_ES2_H_