blob: c5035ee7b3c63f24556da2b8b15038ee203dfad1 [file] [log] [blame]
/*
* Copyright (C) 2016 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.
*/
#ifndef GAPII_CONNECTION_HEADER_H
#define GAPII_CONNECTION_HEADER_H
#include <stdint.h>
namespace gapic {
class StreamReader;
} // namespace gapic
namespace gapii {
// ConnectionHeader is the first packet of data sent from the tool controlling
// the capture to the interceptor.
// All fields are encoded little-endian with no compression, regardless of
// architecture.
class ConnectionHeader {
public:
ConnectionHeader();
// Fakes no support for PCS, forcing the app to share shader source.
static const uint32_t FLAG_DISABLE_PRECOMPILED_SHADERS = 0x00000001;
// Driver errors are queried after each call and stored as extras.
static const uint32_t FLAG_RECORD_ERROR_STATE = 0x10000000;
// read reads the ConnectionHeader from the provided stream, returning true
// on success or false on error.
bool read(gapic::StreamReader* reader);
uint8_t mMagic[4]; // 's', 'p', 'y', '0'
uint32_t mVersion; // 2 or 3
uint32_t mObserveFrameFrequency; // non-zero == enabled. Version: 2+
uint32_t mObserveDrawFrequency; // non-zero == enabled. Version: 2+
uint32_t mFlags; // Combination of FLAG_XX bits. Version: 3+
};
} // namespace gapii
#endif // GAPII_CONNECTION_HEADER_H