X-Git-Url: https://gerrit.akraino.org/r/gitweb?a=blobdiff_plain;f=src%2Ftype3_AndroidCloud%2Fanbox-master%2Fexternal%2Fandroid-emugl%2Fshared%2FOpenglCodecCommon%2FGLDecoderContextData.h;fp=src%2Ftype3_AndroidCloud%2Fanbox-master%2Fexternal%2Fandroid-emugl%2Fshared%2FOpenglCodecCommon%2FGLDecoderContextData.h;h=3a6ee178aeed94bdb19f201c598ff8e8b4c978bb;hb=e26c1ec581be598521517829adba8c8dd23a768f;hp=0000000000000000000000000000000000000000;hpb=6699c1aea74eeb0eb400e6299079f0c7576f716f;p=iec.git diff --git a/src/type3_AndroidCloud/anbox-master/external/android-emugl/shared/OpenglCodecCommon/GLDecoderContextData.h b/src/type3_AndroidCloud/anbox-master/external/android-emugl/shared/OpenglCodecCommon/GLDecoderContextData.h new file mode 100644 index 0000000..3a6ee17 --- /dev/null +++ b/src/type3_AndroidCloud/anbox-master/external/android-emugl/shared/OpenglCodecCommon/GLDecoderContextData.h @@ -0,0 +1,82 @@ +/* +* Copyright (C) 2011 The Android Open Source Project +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +#pragma once + +#include +#include + +#include +#include + +// Convenient class used to hold the common context data shared +// by both the GLESv1 and GLESv2 decoders. This corresponds to +// vertex attribute buffers. +class GLDecoderContextData { +public: + // List of supported vertex attribute indices, as they appear in + // a glVertexAttribPointer() call. + typedef enum { + VERTEX_LOCATION = 0, + NORMAL_LOCATION = 1, + COLOR_LOCATION = 2, + POINTSIZE_LOCATION = 3, + TEXCOORD0_LOCATION = 4, + TEXCOORD1_LOCATION = 5, + TEXCOORD2_LOCATION = 6, + TEXCOORD3_LOCATION = 7, + TEXCOORD4_LOCATION = 8, + TEXCOORD5_LOCATION = 9, + TEXCOORD6_LOCATION = 10, + TEXCOORD7_LOCATION = 11, + MATRIXINDEX_LOCATION = 12, + WEIGHT_LOCATION = 13, + LAST_LOCATION = 14 + } PointerDataLocation; + + // Default constructor. + GLDecoderContextData(int numLocations = kMaxVertexAttributes) + : mPointerData(), + mNumLocations(static_cast(numLocations)) { + mPointerData.resize(mNumLocations); + } + + // Store |len| bytes from |data| into the buffer associated with + // vertex attribute index |loc|. + void storePointerData(unsigned int loc, void *data, size_t len) { + if (loc < mNumLocations) { + std::string& ptrData = mPointerData[loc]; + ptrData.assign(reinterpret_cast(data), len); + } else { + // User error, don't do anything here + } + } + + // Return pointer to data associated with vertex attribute index |loc| + void* pointerData(unsigned int loc) const { + if (loc < mNumLocations) { + return const_cast(mPointerData[loc].c_str()); + } else { + // User error. Return nullptr. + return nullptr; + } + } + +private: + static const int kMaxVertexAttributes = 64; + + std::vector mPointerData; + unsigned mNumLocations = 0; +};