Edit

kc3-lang/angle/src/libANGLE/validationES2.h

Branch :

  • Show log

    Commit

  • Author : Jamie Madill
    Date : 2018-11-27 16:32:45
    Hash : e0472f3d
    Message : Slight refactor to ErrorStrings.h. Allows for better readability. Also sort the error strings by ID. Bug: angleproject:2957 Change-Id: Ib3900a4c90507ac84496fd5ff916417eb768667b Reviewed-on: https://chromium-review.googlesource.com/c/1337461 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>

  • src/libANGLE/validationES2.h
  • //
    // 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;
    }
    }  // namespace gl
    
    #endif  // LIBANGLE_VALIDATION_ES2_H_