blob: 47882dcb17cf332442ff1ab338cfc155d129e9da [file] [log] [blame]
/*
* Copyright 2015, 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.
*
* THIS FILE WAS GENERATED BY apic. DO NOT EDIT.
*/
#ifndef GAPII_GLES_SPY_H
#define GAPII_GLES_SPY_H
#include "gles_imports.h"
#include "gles_types.h"
#include "spy_base.h"
#include <gapic/log.h>
#include <gapic/coder/memory.h>
#include <gapic/coder/atom.h>
#include <gapic/coder/gles.h>
#define __STDC_FORMAT_MACROS
#include <inttypes.h>
#include <memory>
#include <string>
using gapic::coder::atom::Observations;
namespace gapii {
class GlesSpy : public SpyBase {
public:
inline void init(std::shared_ptr<gapic::Encoder> encoder);
inline int eglInitialize(void* dpy, int* major, int* minor);
inline void* eglCreateContext(void* display, void* config, void* share_context,
int* attrib_list);
inline int eglMakeCurrent(void* display, void* draw, void* read, void* context);
inline int eglSwapBuffers(void* display, void* surface);
inline int eglQuerySurface(void* display, void* surface, int attribute, int* value);
inline void* glXCreateContext(void* dpy, void* vis, void* shareList, bool direct);
inline void* glXCreateNewContext(void* display, void* fbconfig, uint32_t type, void* shared,
bool direct);
inline int glXMakeContextCurrent(void* display, void* draw, void* read, void* ctx);
inline int glXMakeCurrent(void* display, void* drawable, void* ctx);
inline void glXSwapBuffers(void* display, void* drawable);
inline int glXQueryDrawable(void* display, void* draw, int attribute, int* value);
inline void* wglCreateContext(void* hdc);
inline void* wglCreateContextAttribsARB(void* hdc, void* hShareContext, int* attribList);
inline int wglMakeCurrent(void* hdc, void* hglrc);
inline void wglSwapBuffers(void* hdc);
inline int CGLCreateContext(void* pix, void* share, void** ctx);
inline int CGLSetCurrentContext(void* ctx);
inline int CGLGetSurface(void* ctx, void** cid, int32_t* wid, int32_t* sid);
inline int CGSGetSurfaceBounds(void* cid, int32_t wid, int32_t sid, double* bounds);
inline int CGLFlushDrawable(void* ctx);
inline void glEnableClientState(uint32_t type);
inline void glDisableClientState(uint32_t type);
inline void glGetProgramBinaryOES(uint32_t program, int32_t buffer_size, int32_t* bytes_written,
uint32_t* binary_format, void* binary);
inline void glProgramBinaryOES(uint32_t program, uint32_t binary_format, void* binary,
int32_t binary_size);
inline void glStartTilingQCOM(int32_t x, int32_t y, int32_t width, int32_t height,
uint32_t preserveMask);
inline void glEndTilingQCOM(uint32_t preserve_mask);
inline void glDiscardFramebufferEXT(uint32_t target, int32_t numAttachments,
uint32_t* attachments);
inline void glInsertEventMarkerEXT(int32_t length, char* marker);
inline void glPushGroupMarkerEXT(int32_t length, char* marker);
inline void glPopGroupMarkerEXT();
inline void glTexStorage1DEXT(uint32_t target, int32_t levels, uint32_t format, int32_t width);
inline void glTexStorage2DEXT(uint32_t target, int32_t levels, uint32_t format, int32_t width,
int32_t height);
inline void glTexStorage3DEXT(uint32_t target, int32_t levels, uint32_t format, int32_t width,
int32_t height, int32_t depth);
inline void glTextureStorage1DEXT(uint32_t texture, uint32_t target, int32_t levels,
uint32_t format, int32_t width);
inline void glTextureStorage2DEXT(uint32_t texture, uint32_t target, int32_t levels,
uint32_t format, int32_t width, int32_t height);
inline void glTextureStorage3DEXT(uint32_t texture, uint32_t target, int32_t levels,
uint32_t format, int32_t width, int32_t height,
int32_t depth);
inline void glGenVertexArraysOES(int32_t count, uint32_t* arrays);
inline void glBindVertexArrayOES(uint32_t array);
inline void glDeleteVertexArraysOES(int32_t count, uint32_t* arrays);
inline bool glIsVertexArrayOES(uint32_t array);
inline void glEGLImageTargetTexture2DOES(uint32_t target, void* image);
inline void glEGLImageTargetRenderbufferStorageOES(uint32_t target, void* image);
inline uint32_t glGetGraphicsResetStatusEXT();
inline void glBindAttribLocation(uint32_t program, int32_t location, char* name);
inline void glBlendFunc(uint32_t src_factor, uint32_t dst_factor);
inline void glBlendFuncSeparate(uint32_t src_factor_rgb, uint32_t dst_factor_rgb,
uint32_t src_factor_alpha, uint32_t dst_factor_alpha);
inline void glBlendEquation(uint32_t equation);
inline void glBlendEquationSeparate(uint32_t rgb, uint32_t alpha);
inline void glBlendColor(float red, float green, float blue, float alpha);
inline void glEnableVertexAttribArray(int32_t location);
inline void glDisableVertexAttribArray(int32_t location);
inline void glVertexAttribPointer(int32_t location, int32_t size, uint32_t type,
bool normalized, int32_t stride, void* data);
inline void glGetActiveAttrib(uint32_t program, int32_t location, int32_t buffer_size,
int32_t* buffer_bytes_written, int32_t* vector_count,
uint32_t* type, char* name);
inline void glGetActiveUniform(uint32_t program, int32_t location, int32_t buffer_size,
int32_t* buffer_bytes_written, int32_t* vector_count,
uint32_t* type, char* name);
inline uint32_t glGetError();
inline void glGetProgramiv(uint32_t program, uint32_t parameter, int32_t* value);
inline void glGetShaderiv(uint32_t shader, uint32_t parameter, int32_t* value);
inline int32_t glGetUniformLocation(uint32_t program, char* name);
inline int32_t glGetAttribLocation(uint32_t program, char* name);
inline void glPixelStorei(uint32_t parameter, int32_t value);
inline void glTexParameteri(uint32_t target, uint32_t parameter, int32_t value);
inline void glTexParameterf(uint32_t target, uint32_t parameter, float value);
inline void glGetTexParameteriv(uint32_t target, uint32_t parameter, int32_t* values);
inline void glGetTexParameterfv(uint32_t target, uint32_t parameter, float* values);
inline void glUniform1i(int32_t location, int32_t value);
inline void glUniform2i(int32_t location, int32_t value0, int32_t value1);
inline void glUniform3i(int32_t location, int32_t value0, int32_t value1, int32_t value2);
inline void glUniform4i(int32_t location, int32_t value0, int32_t value1, int32_t value2,
int32_t value3);
inline void glUniform1iv(int32_t location, int32_t count, int32_t* values);
inline void glUniform2iv(int32_t location, int32_t count, int32_t* values);
inline void glUniform3iv(int32_t location, int32_t count, int32_t* values);
inline void glUniform4iv(int32_t location, int32_t count, int32_t* values);
inline void glUniform1f(int32_t location, float value);
inline void glUniform2f(int32_t location, float value0, float value1);
inline void glUniform3f(int32_t location, float value0, float value1, float value2);
inline void glUniform4f(int32_t location, float value0, float value1, float value2,
float value3);
inline void glUniform1fv(int32_t location, int32_t count, float* values);
inline void glUniform2fv(int32_t location, int32_t count, float* values);
inline void glUniform3fv(int32_t location, int32_t count, float* values);
inline void glUniform4fv(int32_t location, int32_t count, float* values);
inline void glUniformMatrix2fv(int32_t location, int32_t count, bool transpose, float* values);
inline void glUniformMatrix3fv(int32_t location, int32_t count, bool transpose, float* values);
inline void glUniformMatrix4fv(int32_t location, int32_t count, bool transpose, float* values);
inline void glGetUniformfv(uint32_t program, int32_t location, float* values);
inline void glGetUniformiv(uint32_t program, int32_t location, int32_t* values);
inline void glVertexAttrib1f(int32_t location, float value0);
inline void glVertexAttrib2f(int32_t location, float value0, float value1);
inline void glVertexAttrib3f(int32_t location, float value0, float value1, float value2);
inline void glVertexAttrib4f(int32_t location, float value0, float value1, float value2,
float value3);
inline void glVertexAttrib1fv(int32_t location, float* value);
inline void glVertexAttrib2fv(int32_t location, float* value);
inline void glVertexAttrib3fv(int32_t location, float* value);
inline void glVertexAttrib4fv(int32_t location, float* value);
inline void glGetShaderPrecisionFormat(uint32_t shader_type, uint32_t precision_type,
int32_t* range, int32_t* precision);
inline void glDepthMask(bool enabled);
inline void glDepthFunc(uint32_t function);
inline void glDepthRangef(float near, float far);
inline void glColorMask(bool red, bool green, bool blue, bool alpha);
inline void glStencilMask(uint32_t mask);
inline void glStencilMaskSeparate(uint32_t face, uint32_t mask);
inline void glStencilFuncSeparate(uint32_t face, uint32_t function, int32_t reference_value,
int32_t mask);
inline void glStencilOpSeparate(uint32_t face, uint32_t stencil_fail,
uint32_t stencil_pass_depth_fail,
uint32_t stencil_pass_depth_pass);
inline void glFrontFace(uint32_t orientation);
inline void glViewport(int32_t x, int32_t y, int32_t width, int32_t height);
inline void glScissor(int32_t x, int32_t y, int32_t width, int32_t height);
inline void glActiveTexture(uint32_t unit);
inline void glGenTextures(int32_t count, uint32_t* textures);
inline void glDeleteTextures(int32_t count, uint32_t* textures);
inline bool glIsTexture(uint32_t texture);
inline void glBindTexture(uint32_t target, uint32_t texture);
inline void glTexImage2D(uint32_t target, int32_t level, uint32_t internal_format,
int32_t width, int32_t height, int32_t border, uint32_t format,
uint32_t type, void* data);
inline void glTexSubImage2D(uint32_t target, int32_t level, int32_t xoffset, int32_t yoffset,
int32_t width, int32_t height, uint32_t format, uint32_t type,
void* data);
inline void glCopyTexImage2D(uint32_t target, int32_t level, uint32_t format, int32_t x,
int32_t y, int32_t width, int32_t height, int32_t border);
inline void glCopyTexSubImage2D(uint32_t target, int32_t level, int32_t xoffset,
int32_t yoffset, int32_t x, int32_t y, int32_t width,
int32_t height);
inline void glCompressedTexImage2D(uint32_t target, int32_t level, uint32_t format,
int32_t width, int32_t height, int32_t border,
int32_t image_size, void* data);
inline void glCompressedTexSubImage2D(uint32_t target, int32_t level, int32_t xoffset,
int32_t yoffset, int32_t width, int32_t height,
uint32_t format, int32_t image_size, void* data);
inline void glGenerateMipmap(uint32_t target);
inline void glReadPixels(int32_t x, int32_t y, int32_t width, int32_t height, uint32_t format,
uint32_t type, void* data);
inline void glGenFramebuffers(int32_t count, uint32_t* framebuffers);
inline void glBindFramebuffer(uint32_t target, uint32_t framebuffer);
inline uint32_t glCheckFramebufferStatus(uint32_t target);
inline void glDeleteFramebuffers(int32_t count, uint32_t* framebuffers);
inline bool glIsFramebuffer(uint32_t framebuffer);
inline void glGenRenderbuffers(int32_t count, uint32_t* renderbuffers);
inline void glBindRenderbuffer(uint32_t target, uint32_t renderbuffer);
inline void glRenderbufferStorage(uint32_t target, uint32_t format, int32_t width,
int32_t height);
inline void glDeleteRenderbuffers(int32_t count, uint32_t* renderbuffers);
inline bool glIsRenderbuffer(uint32_t renderbuffer);
inline void glGetRenderbufferParameteriv(uint32_t target, uint32_t parameter, int32_t* values);
inline void glGenBuffers(int32_t count, uint32_t* buffers);
inline void glBindBuffer(uint32_t target, uint32_t buffer);
inline void glBufferData(uint32_t target, int32_t size, void* data, uint32_t usage);
inline void glBufferSubData(uint32_t target, int32_t offset, int32_t size, void* data);
inline void glDeleteBuffers(int32_t count, uint32_t* buffers);
inline bool glIsBuffer(uint32_t buffer);
inline void glGetBufferParameteriv(uint32_t target, uint32_t parameter, int32_t* value);
inline uint32_t glCreateShader(uint32_t type);
inline void glDeleteShader(uint32_t shader);
inline void glShaderSource(uint32_t shader, int32_t count, char** source, int32_t* length);
inline void glShaderBinary(int32_t count, uint32_t* shaders, uint32_t binary_format,
void* binary, int32_t binary_size);
inline void glGetShaderInfoLog(uint32_t shader, int32_t buffer_length,
int32_t* string_length_written, char* info);
inline void glGetShaderSource(uint32_t shader, int32_t buffer_length,
int32_t* string_length_written, char* source);
inline void glReleaseShaderCompiler();
inline void glCompileShader(uint32_t shader);
inline bool glIsShader(uint32_t shader);
inline uint32_t glCreateProgram();
inline void glDeleteProgram(uint32_t program);
inline void glAttachShader(uint32_t program, uint32_t shader);
inline void glDetachShader(uint32_t program, uint32_t shader);
inline void glGetAttachedShaders(uint32_t program, int32_t buffer_length,
int32_t* shaders_length_written, uint32_t* shaders);
inline void glLinkProgram(uint32_t program);
inline void glGetProgramInfoLog(uint32_t program, int32_t buffer_length,
int32_t* string_length_written, char* info);
inline void glUseProgram(uint32_t program);
inline bool glIsProgram(uint32_t program);
inline void glValidateProgram(uint32_t program);
inline void glClearColor(float r, float g, float b, float a);
inline void glClearDepthf(float depth);
inline void glClearStencil(int32_t stencil);
inline void glClear(uint32_t mask);
inline void glCullFace(uint32_t mode);
inline void glPolygonOffset(float scale_factor, float units);
inline void glLineWidth(float width);
inline void glSampleCoverage(float value, bool invert);
inline void glHint(uint32_t target, uint32_t mode);
inline void glFramebufferRenderbuffer(uint32_t framebuffer_target,
uint32_t framebuffer_attachment,
uint32_t renderbuffer_target, uint32_t renderbuffer);
inline void glFramebufferTexture2D(uint32_t framebuffer_target, uint32_t framebuffer_attachment,
uint32_t texture_target, uint32_t texture, int32_t level);
inline void glGetFramebufferAttachmentParameteriv(uint32_t framebuffer_target,
uint32_t attachment, uint32_t parameter,
int32_t* value);
inline void glDrawElements(uint32_t draw_mode, int32_t element_count, uint32_t indices_type,
void* indices);
inline void glDrawArrays(uint32_t draw_mode, int32_t first_index, int32_t index_count);
inline void glFlush();
inline void glFinish();
inline void glGetBooleanv(uint32_t param, bool* values);
inline void glGetFloatv(uint32_t param, float* values);
inline void glGetIntegerv(uint32_t param, int32_t* values);
inline char* glGetString(uint32_t param);
inline void glEnable(uint32_t capability);
inline void glDisable(uint32_t capability);
inline bool glIsEnabled(uint32_t capability);
inline uint64_t glFenceSync(uint32_t condition, uint32_t syncFlags);
inline void glDeleteSync(uint64_t sync);
inline void glWaitSync(uint64_t sync, uint32_t syncFlags, uint64_t timeout);
inline uint32_t glClientWaitSync(uint64_t sync, uint32_t syncFlags, uint64_t timeout);
inline void* glMapBufferRange(uint32_t target, int32_t offset, int32_t length, uint32_t access);
inline void glUnmapBuffer(uint32_t target);
inline void glInvalidateFramebuffer(uint32_t target, int32_t count, uint32_t* attachments);
inline void glRenderbufferStorageMultisample(uint32_t target, int32_t samples, uint32_t format,
int32_t width, int32_t height);
inline void glBlitFramebuffer(int32_t srcX0, int32_t srcY0, int32_t srcX1, int32_t srcY1,
int32_t dstX0, int32_t dstY0, int32_t dstX1, int32_t dstY1,
uint32_t mask, uint32_t filter);
inline void glGenQueries(int32_t count, uint32_t* queries);
inline void glBeginQuery(uint32_t target, uint32_t query);
inline void glEndQuery(uint32_t target);
inline void glDeleteQueries(int32_t count, uint32_t* queries);
inline bool glIsQuery(uint32_t query);
inline void glGetQueryiv(uint32_t target, uint32_t parameter, int32_t* value);
inline void glGetQueryObjectuiv(uint32_t query, uint32_t parameter, uint32_t* value);
inline void glGetActiveUniformBlockName(uint32_t program, uint32_t uniform_block_index,
int32_t buffer_size, int32_t* buffer_bytes_written,
char* name);
inline void glGetActiveUniformBlockiv(uint32_t program, uint32_t uniform_block_index,
uint32_t parameter_name, int32_t* parameters);
inline void glUniformBlockBinding(uint32_t program, uint32_t uniform_block_index,
uint32_t uniform_block_binding);
inline void glGetActiveUniformsiv(uint32_t program, uint32_t uniform_count,
uint32_t* uniform_indices, uint32_t parameter_name,
int32_t* parameters);
inline void glBindBufferBase(uint32_t target, uint32_t index, uint32_t buffer);
inline void glGenVertexArrays(int32_t count, uint32_t* arrays);
inline void glBindVertexArray(uint32_t array);
inline void glDeleteVertexArrays(uint32_t count, uint32_t* arrays);
inline void glGetQueryObjecti64v(uint32_t query, uint32_t parameter, int64_t* value);
inline void glGetQueryObjectui64v(uint32_t query, uint32_t parameter, uint64_t* value);
inline void glGenQueriesEXT(int32_t count, uint32_t* queries);
inline void glBeginQueryEXT(uint32_t target, uint32_t query);
inline void glEndQueryEXT(uint32_t target);
inline void glDeleteQueriesEXT(int32_t count, uint32_t* queries);
inline bool glIsQueryEXT(uint32_t query);
inline void glQueryCounterEXT(uint32_t query, uint32_t target);
inline void glGetQueryivEXT(uint32_t target, uint32_t parameter, int32_t* value);
inline void glGetQueryObjectivEXT(uint32_t query, uint32_t parameter, int32_t* value);
inline void glGetQueryObjectuivEXT(uint32_t query, uint32_t parameter, uint32_t* value);
inline void glGetQueryObjecti64vEXT(uint32_t query, uint32_t parameter, int64_t* value);
inline void glGetQueryObjectui64vEXT(uint32_t query, uint32_t parameter, uint64_t* value);
inline void architecture(uint32_t pointer_alignment, uint32_t pointer_size,
uint32_t integer_size, bool little_endian);
inline void replayCreateRenderer(uint32_t id);
inline void replayBindRenderer(uint32_t id);
inline void switchThread(uint64_t threadID);
inline void backbufferInfo(int32_t width, int32_t height, uint32_t color_fmt,
uint32_t depth_fmt, uint32_t stencil_fmt, bool resetViewportScissor,
bool preserveBuffersOnSwap);
inline void startTimer(uint8_t index);
inline uint64_t stopTimer(uint8_t index);
inline void flushPostBuffer();
protected:
GlesImports mImports;
// Globals
ContextID NextContextID;
ThreadID CurrentThread;
ThreadIDToContext__R Contexts;
EGLContextToContext__R EGLContexts;
GLXContextToContext__R GLXContexts;
HGLRCToContext__R WGLContexts;
CGLContextObjToContext__R CGLContexts;
#include "gles_state_externs.inl"
};
// Inline methods
inline void GlesSpy::init(std::shared_ptr<gapic::Encoder> encoder) {
SpyBase::init(encoder);
mImports.Resolve();
NextContextID = 0;
CurrentThread = 0;
Contexts = ThreadIDToContext__R();
EGLContexts = EGLContextToContext__R();
GLXContexts = GLXContextToContext__R();
WGLContexts = HGLRCToContext__R();
CGLContexts = CGLContextObjToContext__R();
}
inline int GlesSpy::eglInitialize(void* dpy, int* major, int* minor) {
GAPID_INFO("eglInitialize(%p, %p, %p)\n", dpy, major, minor);
int result = 0;
Observations observations;
do {
observe(observations.mReads);
result = mImports.eglInitialize(dpy, major, minor);
if (major != nullptr) {
write(slice(major, 0, 1), 0, slice(major, 0, 1)[0]);
}
if (major != nullptr) {
write(slice(minor, 0, 1), 0, slice(minor, 0, 1)[0]);
}
break;
} while (false);
observe(observations.mWrites);
gapic::coder::gles::EglInitialize coder(
observations, gapic::coder::gles::EGLDisplay(gapic::coder::memory::Pointer(
reinterpret_cast<uintptr_t>(dpy), 0)),
gapic::coder::gles::EGLint__P(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(major), 0)),
gapic::coder::gles::EGLint__P(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(minor), 0)),
result);
mEncoder->Object(&coder);
return result;
}
inline void* GlesSpy::eglCreateContext(void* display, void* config, void* share_context,
int* attrib_list) {
GAPID_INFO("eglCreateContext(%p, %p, %p, %p)\n", display, config, share_context, attrib_list);
void* result = nullptr;
Observations observations;
do {
observe(observations.mReads);
result = mImports.eglCreateContext(display, config, share_context, attrib_list);
EGLContext l_context = (EGLContext)(result);
ContextID l_identifier = this->NextContextID;
this->NextContextID = this->NextContextID + (ContextID)(1);
std::shared_ptr<Context> l_ctx = std::shared_ptr<Context>((new Context()));
l_ctx->mIdentifier = l_identifier;
l_ctx->mInstances.mBuffers[(BufferId)(0)] = std::shared_ptr<Buffer>((new Buffer()));
l_ctx->mInstances.mTextures[(TextureId)(0)] = std::shared_ptr<Texture>((new Texture()));
l_ctx->mInstances.mRenderbuffers[(RenderbufferId)(0)] =
std::shared_ptr<Renderbuffer>((new Renderbuffer()));
RenderbufferId l_color_id = (RenderbufferId)(4294967295);
RenderbufferId l_depth_id = (RenderbufferId)(4294967294);
RenderbufferId l_stencil_id = (RenderbufferId)(4294967293);
l_ctx->mInstances.mRenderbuffers[l_color_id] =
std::shared_ptr<Renderbuffer>((new Renderbuffer()));
l_ctx->mInstances.mRenderbuffers[l_depth_id] =
std::shared_ptr<Renderbuffer>((new Renderbuffer()));
l_ctx->mInstances.mRenderbuffers[l_stencil_id] =
std::shared_ptr<Renderbuffer>((new Renderbuffer()));
std::shared_ptr<Framebuffer> l_backbuffer =
std::shared_ptr<Framebuffer>((new Framebuffer()));
l_backbuffer->mAttachments[GLenum::GL_COLOR_ATTACHMENT0] =
FramebufferAttachmentInfo()
.SetObject((uint32_t)(l_color_id))
.SetType(GLenum::GL_RENDERBUFFER)
.SetCubeMapFace(GLenum::GL_TEXTURE_CUBE_MAP_POSITIVE_X);
l_backbuffer->mAttachments[GLenum::GL_DEPTH_ATTACHMENT] =
FramebufferAttachmentInfo()
.SetObject((uint32_t)(l_depth_id))
.SetType(GLenum::GL_RENDERBUFFER)
.SetCubeMapFace(GLenum::GL_TEXTURE_CUBE_MAP_POSITIVE_X);
l_backbuffer->mAttachments[GLenum::GL_STENCIL_ATTACHMENT] =
FramebufferAttachmentInfo()
.SetObject((uint32_t)(l_stencil_id))
.SetType(GLenum::GL_RENDERBUFFER)
.SetCubeMapFace(GLenum::GL_TEXTURE_CUBE_MAP_POSITIVE_X);
l_ctx->mInstances.mFramebuffers[(FramebufferId)(0)] = l_backbuffer;
l_ctx->mBoundFramebuffers[GLenum::GL_DRAW_FRAMEBUFFER] = (FramebufferId)(0);
l_ctx->mBoundFramebuffers[GLenum::GL_READ_FRAMEBUFFER] = (FramebufferId)(0);
l_ctx->mRasterizing.mStencilMask[GLenum::GL_FRONT] = 4294967295;
l_ctx->mRasterizing.mStencilMask[GLenum::GL_BACK] = 4294967295;
l_ctx->mPixelStorage[GLenum::GL_PACK_ALIGNMENT] = 4;
l_ctx->mPixelStorage[GLenum::GL_UNPACK_ALIGNMENT] = 4;
for (int32_t l_i = 0; l_i < 64; ++l_i) {
l_ctx->mVertexAttributeArrays[(AttributeLocation)(l_i)] =
std::shared_ptr<VertexAttributeArray>((new VertexAttributeArray()));
}
std::shared_ptr<Context> l_CreateContext_0_result = l_ctx;
this->EGLContexts[l_context] = l_CreateContext_0_result;
break;
} while (false);
observe(observations.mWrites);
gapic::coder::gles::EglCreateContext coder(
observations, gapic::coder::gles::EGLDisplay(gapic::coder::memory::Pointer(
reinterpret_cast<uintptr_t>(display), 0)),
gapic::coder::gles::EGLConfig(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(config), 0)),
gapic::coder::gles::EGLContext(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(share_context), 0)),
gapic::coder::gles::EGLint__P(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(attrib_list), 0)),
gapic::coder::gles::EGLContext(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(result), 0)));
mEncoder->Object(&coder);
return result;
}
inline int GlesSpy::eglMakeCurrent(void* display, void* draw, void* read, void* context) {
GAPID_INFO("eglMakeCurrent(%p, %p, %p, %p)\n", display, draw, read, context);
int result = 0;
Observations observations;
do {
std::shared_ptr<Context> l_SetContext_1_context = this->EGLContexts[context];
this->Contexts[this->CurrentThread] = l_SetContext_1_context;
observe(observations.mReads);
result = mImports.eglMakeCurrent(display, draw, read, context);
break;
} while (false);
observe(observations.mWrites);
gapic::coder::gles::EglMakeCurrent coder(
observations, gapic::coder::gles::EGLDisplay(gapic::coder::memory::Pointer(
reinterpret_cast<uintptr_t>(display), 0)),
gapic::coder::gles::EGLSurface(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(draw), 0)),
gapic::coder::gles::EGLSurface(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(read), 0)),
gapic::coder::gles::EGLContext(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(context), 0)),
result);
mEncoder->Object(&coder);
return result;
}
inline int GlesSpy::eglSwapBuffers(void* display, void* surface) {
GAPID_INFO("eglSwapBuffers(%p, %p)\n", display, surface);
int result = 0;
Observations observations;
do {
observe(observations.mReads);
result = mImports.eglSwapBuffers(display, surface);
break;
} while (false);
observe(observations.mWrites);
gapic::coder::gles::EglSwapBuffers coder(
observations, gapic::coder::gles::EGLDisplay(gapic::coder::memory::Pointer(
reinterpret_cast<uintptr_t>(display), 0)),
gapic::coder::gles::Void__P(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(surface), 0)),
result);
mEncoder->Object(&coder);
return result;
}
inline int GlesSpy::eglQuerySurface(void* display, void* surface, int attribute, int* value) {
GAPID_INFO("eglQuerySurface(%p, %p, %d, %p)\n", display, surface, attribute, value);
int result = 0;
Observations observations;
do {
observe(observations.mReads);
result = mImports.eglQuerySurface(display, surface, attribute, value);
write(slice(value, 0, 1), 0, slice(value, 0, 1)[0]);
break;
} while (false);
observe(observations.mWrites);
gapic::coder::gles::EglQuerySurface coder(
observations, gapic::coder::gles::EGLDisplay(gapic::coder::memory::Pointer(
reinterpret_cast<uintptr_t>(display), 0)),
gapic::coder::gles::EGLSurface(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(surface), 0)),
attribute, gapic::coder::gles::EGLint__P(gapic::coder::memory::Pointer(
reinterpret_cast<uintptr_t>(value), 0)),
result);
mEncoder->Object(&coder);
return result;
}
inline void* GlesSpy::glXCreateContext(void* dpy, void* vis, void* shareList, bool direct) {
GAPID_INFO("glXCreateContext(%p, %p, %p, %d)\n", dpy, vis, shareList, direct);
void* result = nullptr;
Observations observations;
do {
observe(observations.mReads);
result = mImports.glXCreateContext(dpy, vis, shareList, direct);
GLXContext l_context = (GLXContext)(result);
ContextID l_identifier = this->NextContextID;
this->NextContextID = this->NextContextID + (ContextID)(1);
std::shared_ptr<Context> l_ctx = std::shared_ptr<Context>((new Context()));
l_ctx->mIdentifier = l_identifier;
l_ctx->mInstances.mBuffers[(BufferId)(0)] = std::shared_ptr<Buffer>((new Buffer()));
l_ctx->mInstances.mTextures[(TextureId)(0)] = std::shared_ptr<Texture>((new Texture()));
l_ctx->mInstances.mRenderbuffers[(RenderbufferId)(0)] =
std::shared_ptr<Renderbuffer>((new Renderbuffer()));
RenderbufferId l_color_id = (RenderbufferId)(4294967295);
RenderbufferId l_depth_id = (RenderbufferId)(4294967294);
RenderbufferId l_stencil_id = (RenderbufferId)(4294967293);
l_ctx->mInstances.mRenderbuffers[l_color_id] =
std::shared_ptr<Renderbuffer>((new Renderbuffer()));
l_ctx->mInstances.mRenderbuffers[l_depth_id] =
std::shared_ptr<Renderbuffer>((new Renderbuffer()));
l_ctx->mInstances.mRenderbuffers[l_stencil_id] =
std::shared_ptr<Renderbuffer>((new Renderbuffer()));
std::shared_ptr<Framebuffer> l_backbuffer =
std::shared_ptr<Framebuffer>((new Framebuffer()));
l_backbuffer->mAttachments[GLenum::GL_COLOR_ATTACHMENT0] =
FramebufferAttachmentInfo()
.SetObject((uint32_t)(l_color_id))
.SetType(GLenum::GL_RENDERBUFFER)
.SetCubeMapFace(GLenum::GL_TEXTURE_CUBE_MAP_POSITIVE_X);
l_backbuffer->mAttachments[GLenum::GL_DEPTH_ATTACHMENT] =
FramebufferAttachmentInfo()
.SetObject((uint32_t)(l_depth_id))
.SetType(GLenum::GL_RENDERBUFFER)
.SetCubeMapFace(GLenum::GL_TEXTURE_CUBE_MAP_POSITIVE_X);
l_backbuffer->mAttachments[GLenum::GL_STENCIL_ATTACHMENT] =
FramebufferAttachmentInfo()
.SetObject((uint32_t)(l_stencil_id))
.SetType(GLenum::GL_RENDERBUFFER)
.SetCubeMapFace(GLenum::GL_TEXTURE_CUBE_MAP_POSITIVE_X);
l_ctx->mInstances.mFramebuffers[(FramebufferId)(0)] = l_backbuffer;
l_ctx->mBoundFramebuffers[GLenum::GL_DRAW_FRAMEBUFFER] = (FramebufferId)(0);
l_ctx->mBoundFramebuffers[GLenum::GL_READ_FRAMEBUFFER] = (FramebufferId)(0);
l_ctx->mRasterizing.mStencilMask[GLenum::GL_FRONT] = 4294967295;
l_ctx->mRasterizing.mStencilMask[GLenum::GL_BACK] = 4294967295;
l_ctx->mPixelStorage[GLenum::GL_PACK_ALIGNMENT] = 4;
l_ctx->mPixelStorage[GLenum::GL_UNPACK_ALIGNMENT] = 4;
for (int32_t l_i = 0; l_i < 64; ++l_i) {
l_ctx->mVertexAttributeArrays[(AttributeLocation)(l_i)] =
std::shared_ptr<VertexAttributeArray>((new VertexAttributeArray()));
}
std::shared_ptr<Context> l_CreateContext_2_result = l_ctx;
this->GLXContexts[l_context] = l_CreateContext_2_result;
break;
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlXCreateContext coder(
observations, gapic::coder::gles::Void__P(gapic::coder::memory::Pointer(
reinterpret_cast<uintptr_t>(dpy), 0)),
gapic::coder::gles::Void__P(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(vis), 0)),
gapic::coder::gles::GLXContext(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(shareList), 0)),
direct, gapic::coder::gles::GLXContext(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(result), 0)));
mEncoder->Object(&coder);
return result;
}
inline void* GlesSpy::glXCreateNewContext(void* display, void* fbconfig, uint32_t type,
void* shared, bool direct) {
GAPID_INFO("glXCreateNewContext(%p, %p, %" PRIu32 ", %p, %d)\n", display, fbconfig, type,
shared, direct);
void* result = nullptr;
Observations observations;
do {
observe(observations.mReads);
result = mImports.glXCreateNewContext(display, fbconfig, type, shared, direct);
GLXContext l_context = (GLXContext)(result);
ContextID l_identifier = this->NextContextID;
this->NextContextID = this->NextContextID + (ContextID)(1);
std::shared_ptr<Context> l_ctx = std::shared_ptr<Context>((new Context()));
l_ctx->mIdentifier = l_identifier;
l_ctx->mInstances.mBuffers[(BufferId)(0)] = std::shared_ptr<Buffer>((new Buffer()));
l_ctx->mInstances.mTextures[(TextureId)(0)] = std::shared_ptr<Texture>((new Texture()));
l_ctx->mInstances.mRenderbuffers[(RenderbufferId)(0)] =
std::shared_ptr<Renderbuffer>((new Renderbuffer()));
RenderbufferId l_color_id = (RenderbufferId)(4294967295);
RenderbufferId l_depth_id = (RenderbufferId)(4294967294);
RenderbufferId l_stencil_id = (RenderbufferId)(4294967293);
l_ctx->mInstances.mRenderbuffers[l_color_id] =
std::shared_ptr<Renderbuffer>((new Renderbuffer()));
l_ctx->mInstances.mRenderbuffers[l_depth_id] =
std::shared_ptr<Renderbuffer>((new Renderbuffer()));
l_ctx->mInstances.mRenderbuffers[l_stencil_id] =
std::shared_ptr<Renderbuffer>((new Renderbuffer()));
std::shared_ptr<Framebuffer> l_backbuffer =
std::shared_ptr<Framebuffer>((new Framebuffer()));
l_backbuffer->mAttachments[GLenum::GL_COLOR_ATTACHMENT0] =
FramebufferAttachmentInfo()
.SetObject((uint32_t)(l_color_id))
.SetType(GLenum::GL_RENDERBUFFER)
.SetCubeMapFace(GLenum::GL_TEXTURE_CUBE_MAP_POSITIVE_X);
l_backbuffer->mAttachments[GLenum::GL_DEPTH_ATTACHMENT] =
FramebufferAttachmentInfo()
.SetObject((uint32_t)(l_depth_id))
.SetType(GLenum::GL_RENDERBUFFER)
.SetCubeMapFace(GLenum::GL_TEXTURE_CUBE_MAP_POSITIVE_X);
l_backbuffer->mAttachments[GLenum::GL_STENCIL_ATTACHMENT] =
FramebufferAttachmentInfo()
.SetObject((uint32_t)(l_stencil_id))
.SetType(GLenum::GL_RENDERBUFFER)
.SetCubeMapFace(GLenum::GL_TEXTURE_CUBE_MAP_POSITIVE_X);
l_ctx->mInstances.mFramebuffers[(FramebufferId)(0)] = l_backbuffer;
l_ctx->mBoundFramebuffers[GLenum::GL_DRAW_FRAMEBUFFER] = (FramebufferId)(0);
l_ctx->mBoundFramebuffers[GLenum::GL_READ_FRAMEBUFFER] = (FramebufferId)(0);
l_ctx->mRasterizing.mStencilMask[GLenum::GL_FRONT] = 4294967295;
l_ctx->mRasterizing.mStencilMask[GLenum::GL_BACK] = 4294967295;
l_ctx->mPixelStorage[GLenum::GL_PACK_ALIGNMENT] = 4;
l_ctx->mPixelStorage[GLenum::GL_UNPACK_ALIGNMENT] = 4;
for (int32_t l_i = 0; l_i < 64; ++l_i) {
l_ctx->mVertexAttributeArrays[(AttributeLocation)(l_i)] =
std::shared_ptr<VertexAttributeArray>((new VertexAttributeArray()));
}
std::shared_ptr<Context> l_CreateContext_3_result = l_ctx;
this->GLXContexts[l_context] = l_CreateContext_3_result;
break;
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlXCreateNewContext coder(
observations, gapic::coder::gles::Void__P(gapic::coder::memory::Pointer(
reinterpret_cast<uintptr_t>(display), 0)),
gapic::coder::gles::Void__P(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(fbconfig), 0)),
type, gapic::coder::gles::GLXContext(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(shared), 0)),
direct, gapic::coder::gles::GLXContext(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(result), 0)));
mEncoder->Object(&coder);
return result;
}
inline int GlesSpy::glXMakeContextCurrent(void* display, void* draw, void* read, void* ctx) {
GAPID_INFO("glXMakeContextCurrent(%p, %p, %p, %p)\n", display, draw, read, ctx);
int result = 0;
Observations observations;
do {
std::shared_ptr<Context> l_SetContext_4_context = this->GLXContexts[ctx];
this->Contexts[this->CurrentThread] = l_SetContext_4_context;
observe(observations.mReads);
result = mImports.glXMakeContextCurrent(display, draw, read, ctx);
break;
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlXMakeContextCurrent coder(
observations, gapic::coder::gles::Void__P(gapic::coder::memory::Pointer(
reinterpret_cast<uintptr_t>(display), 0)),
gapic::coder::gles::GLXDrawable(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(draw), 0)),
gapic::coder::gles::GLXDrawable(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(read), 0)),
gapic::coder::gles::GLXContext(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(ctx), 0)),
result);
mEncoder->Object(&coder);
return result;
}
inline int GlesSpy::glXMakeCurrent(void* display, void* drawable, void* ctx) {
GAPID_INFO("glXMakeCurrent(%p, %p, %p)\n", display, drawable, ctx);
int result = 0;
Observations observations;
do {
std::shared_ptr<Context> l_SetContext_5_context = this->GLXContexts[ctx];
this->Contexts[this->CurrentThread] = l_SetContext_5_context;
observe(observations.mReads);
result = mImports.glXMakeCurrent(display, drawable, ctx);
break;
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlXMakeCurrent coder(
observations, gapic::coder::gles::Void__P(gapic::coder::memory::Pointer(
reinterpret_cast<uintptr_t>(display), 0)),
gapic::coder::gles::GLXDrawable(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(drawable), 0)),
gapic::coder::gles::GLXContext(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(ctx), 0)),
result);
mEncoder->Object(&coder);
return result;
}
inline void GlesSpy::glXSwapBuffers(void* display, void* drawable) {
GAPID_INFO("glXSwapBuffers(%p, %p)\n", display, drawable);
Observations observations;
do {
observe(observations.mReads);
mImports.glXSwapBuffers(display, drawable);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlXSwapBuffers coder(
observations, gapic::coder::gles::Void__P(gapic::coder::memory::Pointer(
reinterpret_cast<uintptr_t>(display), 0)),
gapic::coder::gles::GLXDrawable(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(drawable), 0)));
mEncoder->Object(&coder);
}
inline int GlesSpy::glXQueryDrawable(void* display, void* draw, int attribute, int* value) {
GAPID_INFO("glXQueryDrawable(%p, %p, %d, %p)\n", display, draw, attribute, value);
int result = 0;
Observations observations;
do {
observe(observations.mReads);
result = mImports.glXQueryDrawable(display, draw, attribute, value);
write(slice(value, 0, 1), 0, slice(value, 0, 1)[0]);
break;
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlXQueryDrawable coder(
observations, gapic::coder::gles::Void__P(gapic::coder::memory::Pointer(
reinterpret_cast<uintptr_t>(display), 0)),
gapic::coder::gles::GLXDrawable(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(draw), 0)),
attribute, gapic::coder::gles::Int__P(gapic::coder::memory::Pointer(
reinterpret_cast<uintptr_t>(value), 0)),
result);
mEncoder->Object(&coder);
return result;
}
inline void* GlesSpy::wglCreateContext(void* hdc) {
GAPID_INFO("wglCreateContext(%p)\n", hdc);
void* result = nullptr;
Observations observations;
do {
observe(observations.mReads);
result = mImports.wglCreateContext(hdc);
HGLRC l_context = (HGLRC)(result);
ContextID l_identifier = this->NextContextID;
this->NextContextID = this->NextContextID + (ContextID)(1);
std::shared_ptr<Context> l_ctx = std::shared_ptr<Context>((new Context()));
l_ctx->mIdentifier = l_identifier;
l_ctx->mInstances.mBuffers[(BufferId)(0)] = std::shared_ptr<Buffer>((new Buffer()));
l_ctx->mInstances.mTextures[(TextureId)(0)] = std::shared_ptr<Texture>((new Texture()));
l_ctx->mInstances.mRenderbuffers[(RenderbufferId)(0)] =
std::shared_ptr<Renderbuffer>((new Renderbuffer()));
RenderbufferId l_color_id = (RenderbufferId)(4294967295);
RenderbufferId l_depth_id = (RenderbufferId)(4294967294);
RenderbufferId l_stencil_id = (RenderbufferId)(4294967293);
l_ctx->mInstances.mRenderbuffers[l_color_id] =
std::shared_ptr<Renderbuffer>((new Renderbuffer()));
l_ctx->mInstances.mRenderbuffers[l_depth_id] =
std::shared_ptr<Renderbuffer>((new Renderbuffer()));
l_ctx->mInstances.mRenderbuffers[l_stencil_id] =
std::shared_ptr<Renderbuffer>((new Renderbuffer()));
std::shared_ptr<Framebuffer> l_backbuffer =
std::shared_ptr<Framebuffer>((new Framebuffer()));
l_backbuffer->mAttachments[GLenum::GL_COLOR_ATTACHMENT0] =
FramebufferAttachmentInfo()
.SetObject((uint32_t)(l_color_id))
.SetType(GLenum::GL_RENDERBUFFER)
.SetCubeMapFace(GLenum::GL_TEXTURE_CUBE_MAP_POSITIVE_X);
l_backbuffer->mAttachments[GLenum::GL_DEPTH_ATTACHMENT] =
FramebufferAttachmentInfo()
.SetObject((uint32_t)(l_depth_id))
.SetType(GLenum::GL_RENDERBUFFER)
.SetCubeMapFace(GLenum::GL_TEXTURE_CUBE_MAP_POSITIVE_X);
l_backbuffer->mAttachments[GLenum::GL_STENCIL_ATTACHMENT] =
FramebufferAttachmentInfo()
.SetObject((uint32_t)(l_stencil_id))
.SetType(GLenum::GL_RENDERBUFFER)
.SetCubeMapFace(GLenum::GL_TEXTURE_CUBE_MAP_POSITIVE_X);
l_ctx->mInstances.mFramebuffers[(FramebufferId)(0)] = l_backbuffer;
l_ctx->mBoundFramebuffers[GLenum::GL_DRAW_FRAMEBUFFER] = (FramebufferId)(0);
l_ctx->mBoundFramebuffers[GLenum::GL_READ_FRAMEBUFFER] = (FramebufferId)(0);
l_ctx->mRasterizing.mStencilMask[GLenum::GL_FRONT] = 4294967295;
l_ctx->mRasterizing.mStencilMask[GLenum::GL_BACK] = 4294967295;
l_ctx->mPixelStorage[GLenum::GL_PACK_ALIGNMENT] = 4;
l_ctx->mPixelStorage[GLenum::GL_UNPACK_ALIGNMENT] = 4;
for (int32_t l_i = 0; l_i < 64; ++l_i) {
l_ctx->mVertexAttributeArrays[(AttributeLocation)(l_i)] =
std::shared_ptr<VertexAttributeArray>((new VertexAttributeArray()));
}
std::shared_ptr<Context> l_CreateContext_6_result = l_ctx;
this->WGLContexts[l_context] = l_CreateContext_6_result;
break;
} while (false);
observe(observations.mWrites);
gapic::coder::gles::WglCreateContext coder(
observations, gapic::coder::gles::HDC(gapic::coder::memory::Pointer(
reinterpret_cast<uintptr_t>(hdc), 0)),
gapic::coder::gles::HGLRC(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(result), 0)));
mEncoder->Object(&coder);
return result;
}
inline void* GlesSpy::wglCreateContextAttribsARB(void* hdc, void* hShareContext, int* attribList) {
GAPID_INFO("wglCreateContextAttribsARB(%p, %p, %p)\n", hdc, hShareContext, attribList);
void* result = nullptr;
Observations observations;
do {
observe(observations.mReads);
result = mImports.wglCreateContextAttribsARB(hdc, hShareContext, attribList);
HGLRC l_context = (HGLRC)(result);
ContextID l_identifier = this->NextContextID;
this->NextContextID = this->NextContextID + (ContextID)(1);
std::shared_ptr<Context> l_ctx = std::shared_ptr<Context>((new Context()));
l_ctx->mIdentifier = l_identifier;
l_ctx->mInstances.mBuffers[(BufferId)(0)] = std::shared_ptr<Buffer>((new Buffer()));
l_ctx->mInstances.mTextures[(TextureId)(0)] = std::shared_ptr<Texture>((new Texture()));
l_ctx->mInstances.mRenderbuffers[(RenderbufferId)(0)] =
std::shared_ptr<Renderbuffer>((new Renderbuffer()));
RenderbufferId l_color_id = (RenderbufferId)(4294967295);
RenderbufferId l_depth_id = (RenderbufferId)(4294967294);
RenderbufferId l_stencil_id = (RenderbufferId)(4294967293);
l_ctx->mInstances.mRenderbuffers[l_color_id] =
std::shared_ptr<Renderbuffer>((new Renderbuffer()));
l_ctx->mInstances.mRenderbuffers[l_depth_id] =
std::shared_ptr<Renderbuffer>((new Renderbuffer()));
l_ctx->mInstances.mRenderbuffers[l_stencil_id] =
std::shared_ptr<Renderbuffer>((new Renderbuffer()));
std::shared_ptr<Framebuffer> l_backbuffer =
std::shared_ptr<Framebuffer>((new Framebuffer()));
l_backbuffer->mAttachments[GLenum::GL_COLOR_ATTACHMENT0] =
FramebufferAttachmentInfo()
.SetObject((uint32_t)(l_color_id))
.SetType(GLenum::GL_RENDERBUFFER)
.SetCubeMapFace(GLenum::GL_TEXTURE_CUBE_MAP_POSITIVE_X);
l_backbuffer->mAttachments[GLenum::GL_DEPTH_ATTACHMENT] =
FramebufferAttachmentInfo()
.SetObject((uint32_t)(l_depth_id))
.SetType(GLenum::GL_RENDERBUFFER)
.SetCubeMapFace(GLenum::GL_TEXTURE_CUBE_MAP_POSITIVE_X);
l_backbuffer->mAttachments[GLenum::GL_STENCIL_ATTACHMENT] =
FramebufferAttachmentInfo()
.SetObject((uint32_t)(l_stencil_id))
.SetType(GLenum::GL_RENDERBUFFER)
.SetCubeMapFace(GLenum::GL_TEXTURE_CUBE_MAP_POSITIVE_X);
l_ctx->mInstances.mFramebuffers[(FramebufferId)(0)] = l_backbuffer;
l_ctx->mBoundFramebuffers[GLenum::GL_DRAW_FRAMEBUFFER] = (FramebufferId)(0);
l_ctx->mBoundFramebuffers[GLenum::GL_READ_FRAMEBUFFER] = (FramebufferId)(0);
l_ctx->mRasterizing.mStencilMask[GLenum::GL_FRONT] = 4294967295;
l_ctx->mRasterizing.mStencilMask[GLenum::GL_BACK] = 4294967295;
l_ctx->mPixelStorage[GLenum::GL_PACK_ALIGNMENT] = 4;
l_ctx->mPixelStorage[GLenum::GL_UNPACK_ALIGNMENT] = 4;
for (int32_t l_i = 0; l_i < 64; ++l_i) {
l_ctx->mVertexAttributeArrays[(AttributeLocation)(l_i)] =
std::shared_ptr<VertexAttributeArray>((new VertexAttributeArray()));
}
std::shared_ptr<Context> l_CreateContext_7_result = l_ctx;
this->WGLContexts[l_context] = l_CreateContext_7_result;
break;
} while (false);
observe(observations.mWrites);
gapic::coder::gles::WglCreateContextAttribsARB coder(
observations, gapic::coder::gles::HDC(gapic::coder::memory::Pointer(
reinterpret_cast<uintptr_t>(hdc), 0)),
gapic::coder::gles::HGLRC(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(hShareContext), 0)),
gapic::coder::gles::Int__P(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(attribList), 0)),
gapic::coder::gles::HGLRC(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(result), 0)));
mEncoder->Object(&coder);
return result;
}
inline int GlesSpy::wglMakeCurrent(void* hdc, void* hglrc) {
GAPID_INFO("wglMakeCurrent(%p, %p)\n", hdc, hglrc);
int result = 0;
Observations observations;
do {
std::shared_ptr<Context> l_SetContext_8_context = this->WGLContexts[hglrc];
this->Contexts[this->CurrentThread] = l_SetContext_8_context;
observe(observations.mReads);
result = mImports.wglMakeCurrent(hdc, hglrc);
break;
} while (false);
observe(observations.mWrites);
gapic::coder::gles::WglMakeCurrent coder(
observations, gapic::coder::gles::HDC(gapic::coder::memory::Pointer(
reinterpret_cast<uintptr_t>(hdc), 0)),
gapic::coder::gles::HGLRC(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(hglrc), 0)),
result);
mEncoder->Object(&coder);
return result;
}
inline void GlesSpy::wglSwapBuffers(void* hdc) {
GAPID_INFO("wglSwapBuffers(%p)\n", hdc);
Observations observations;
do {
observe(observations.mReads);
mImports.wglSwapBuffers(hdc);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::WglSwapBuffers coder(observations,
gapic::coder::gles::HDC(gapic::coder::memory::Pointer(
reinterpret_cast<uintptr_t>(hdc), 0)));
mEncoder->Object(&coder);
}
inline int GlesSpy::CGLCreateContext(void* pix, void* share, void** ctx) {
GAPID_INFO("CGLCreateContext(%p, %p, %p)\n", pix, share, ctx);
int result = 0;
Observations observations;
do {
observe(observations.mReads);
result = mImports.CGLCreateContext(pix, share, ctx);
CGLContextObj l_context = (CGLContextObj)(slice(ctx, 0, 1)[0]);
ContextID l_identifier = this->NextContextID;
this->NextContextID = this->NextContextID + (ContextID)(1);
std::shared_ptr<Context> l_ctx = std::shared_ptr<Context>((new Context()));
l_ctx->mIdentifier = l_identifier;
l_ctx->mInstances.mBuffers[(BufferId)(0)] = std::shared_ptr<Buffer>((new Buffer()));
l_ctx->mInstances.mTextures[(TextureId)(0)] = std::shared_ptr<Texture>((new Texture()));
l_ctx->mInstances.mRenderbuffers[(RenderbufferId)(0)] =
std::shared_ptr<Renderbuffer>((new Renderbuffer()));
RenderbufferId l_color_id = (RenderbufferId)(4294967295);
RenderbufferId l_depth_id = (RenderbufferId)(4294967294);
RenderbufferId l_stencil_id = (RenderbufferId)(4294967293);
l_ctx->mInstances.mRenderbuffers[l_color_id] =
std::shared_ptr<Renderbuffer>((new Renderbuffer()));
l_ctx->mInstances.mRenderbuffers[l_depth_id] =
std::shared_ptr<Renderbuffer>((new Renderbuffer()));
l_ctx->mInstances.mRenderbuffers[l_stencil_id] =
std::shared_ptr<Renderbuffer>((new Renderbuffer()));
std::shared_ptr<Framebuffer> l_backbuffer =
std::shared_ptr<Framebuffer>((new Framebuffer()));
l_backbuffer->mAttachments[GLenum::GL_COLOR_ATTACHMENT0] =
FramebufferAttachmentInfo()
.SetObject((uint32_t)(l_color_id))
.SetType(GLenum::GL_RENDERBUFFER)
.SetCubeMapFace(GLenum::GL_TEXTURE_CUBE_MAP_POSITIVE_X);
l_backbuffer->mAttachments[GLenum::GL_DEPTH_ATTACHMENT] =
FramebufferAttachmentInfo()
.SetObject((uint32_t)(l_depth_id))
.SetType(GLenum::GL_RENDERBUFFER)
.SetCubeMapFace(GLenum::GL_TEXTURE_CUBE_MAP_POSITIVE_X);
l_backbuffer->mAttachments[GLenum::GL_STENCIL_ATTACHMENT] =
FramebufferAttachmentInfo()
.SetObject((uint32_t)(l_stencil_id))
.SetType(GLenum::GL_RENDERBUFFER)
.SetCubeMapFace(GLenum::GL_TEXTURE_CUBE_MAP_POSITIVE_X);
l_ctx->mInstances.mFramebuffers[(FramebufferId)(0)] = l_backbuffer;
l_ctx->mBoundFramebuffers[GLenum::GL_DRAW_FRAMEBUFFER] = (FramebufferId)(0);
l_ctx->mBoundFramebuffers[GLenum::GL_READ_FRAMEBUFFER] = (FramebufferId)(0);
l_ctx->mRasterizing.mStencilMask[GLenum::GL_FRONT] = 4294967295;
l_ctx->mRasterizing.mStencilMask[GLenum::GL_BACK] = 4294967295;
l_ctx->mPixelStorage[GLenum::GL_PACK_ALIGNMENT] = 4;
l_ctx->mPixelStorage[GLenum::GL_UNPACK_ALIGNMENT] = 4;
for (int32_t l_i = 0; l_i < 64; ++l_i) {
l_ctx->mVertexAttributeArrays[(AttributeLocation)(l_i)] =
std::shared_ptr<VertexAttributeArray>((new VertexAttributeArray()));
}
std::shared_ptr<Context> l_CreateContext_9_result = l_ctx;
this->CGLContexts[l_context] = l_CreateContext_9_result;
write(slice(ctx, 0, 1), 0, l_context);
break;
} while (false);
observe(observations.mWrites);
gapic::coder::gles::CGLCreateContext coder(
observations, gapic::coder::gles::CGLPixelFormatObj(gapic::coder::memory::Pointer(
reinterpret_cast<uintptr_t>(pix), 0)),
gapic::coder::gles::CGLContextObj(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(share), 0)),
gapic::coder::gles::CGLContextObj__P(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(ctx), 0)),
result);
mEncoder->Object(&coder);
return result;
}
inline int GlesSpy::CGLSetCurrentContext(void* ctx) {
GAPID_INFO("CGLSetCurrentContext(%p)\n", ctx);
int result = 0;
Observations observations;
do {
std::shared_ptr<Context> l_SetContext_10_context = this->CGLContexts[ctx];
this->Contexts[this->CurrentThread] = l_SetContext_10_context;
observe(observations.mReads);
result = mImports.CGLSetCurrentContext(ctx);
break;
} while (false);
observe(observations.mWrites);
gapic::coder::gles::CGLSetCurrentContext coder(
observations, gapic::coder::gles::CGLContextObj(gapic::coder::memory::Pointer(
reinterpret_cast<uintptr_t>(ctx), 0)),
result);
mEncoder->Object(&coder);
return result;
}
inline int GlesSpy::CGLGetSurface(void* ctx, void** cid, int32_t* wid, int32_t* sid) {
GAPID_INFO("CGLGetSurface(%p, %p, %p, %p)\n", ctx, cid, wid, sid);
int result = 0;
Observations observations;
do {
observe(observations.mReads);
result = mImports.CGLGetSurface(ctx, cid, wid, sid);
write(slice(cid, 0, 1), 0, slice(cid, 0, 1)[0]);
write(slice(wid, 0, 1), 0, slice(wid, 0, 1)[0]);
write(slice(sid, 0, 1), 0, slice(sid, 0, 1)[0]);
break;
} while (false);
observe(observations.mWrites);
gapic::coder::gles::CGLGetSurface coder(
observations, gapic::coder::gles::CGLContextObj(gapic::coder::memory::Pointer(
reinterpret_cast<uintptr_t>(ctx), 0)),
gapic::coder::gles::CGSConnectionID__P(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(cid), 0)),
gapic::coder::gles::CGSWindowID__P(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(wid), 0)),
gapic::coder::gles::CGSSurfaceID__P(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(sid), 0)),
result);
mEncoder->Object(&coder);
return result;
}
inline int GlesSpy::CGSGetSurfaceBounds(void* cid, int32_t wid, int32_t sid, double* bounds) {
GAPID_INFO("CGSGetSurfaceBounds(%p, %" PRId32 ", %" PRId32 ", %p)\n", cid, wid, sid, bounds);
int result = 0;
Observations observations;
do {
observe(observations.mReads);
result = mImports.CGSGetSurfaceBounds(cid, wid, sid, bounds);
write(slice(bounds, 0, 4));
break;
} while (false);
observe(observations.mWrites);
gapic::coder::gles::CGSGetSurfaceBounds coder(
observations, gapic::coder::gles::CGSConnectionID(gapic::coder::memory::Pointer(
reinterpret_cast<uintptr_t>(cid), 0)),
wid, sid, gapic::coder::gles::F64__P(gapic::coder::memory::Pointer(
reinterpret_cast<uintptr_t>(bounds), 0)),
result);
mEncoder->Object(&coder);
return result;
}
inline int GlesSpy::CGLFlushDrawable(void* ctx) {
GAPID_INFO("CGLFlushDrawable(%p)\n", ctx);
int result = 0;
Observations observations;
do {
observe(observations.mReads);
result = mImports.CGLFlushDrawable(ctx);
break;
} while (false);
observe(observations.mWrites);
gapic::coder::gles::CGLFlushDrawable coder(
observations, gapic::coder::gles::CGLContextObj(gapic::coder::memory::Pointer(
reinterpret_cast<uintptr_t>(ctx), 0)),
result);
mEncoder->Object(&coder);
return result;
}
inline void GlesSpy::glEnableClientState(uint32_t type) {
GAPID_INFO("glEnableClientState(%u)\n", type);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_11_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_11_result;
l_ctx->mCapabilities[type] = true;
observe(observations.mReads);
mImports.glEnableClientState(type);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlEnableClientState coder(observations, type);
mEncoder->Object(&coder);
}
inline void GlesSpy::glDisableClientState(uint32_t type) {
GAPID_INFO("glDisableClientState(%u)\n", type);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_12_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_12_result;
l_ctx->mCapabilities[type] = false;
observe(observations.mReads);
mImports.glDisableClientState(type);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlDisableClientState coder(observations, type);
mEncoder->Object(&coder);
}
inline void GlesSpy::glGetProgramBinaryOES(uint32_t program, int32_t buffer_size,
int32_t* bytes_written, uint32_t* binary_format,
void* binary) {
GAPID_INFO("glGetProgramBinaryOES(%" PRIu32 ", %" PRId32 ", %p, %p, %p)\n", program,
buffer_size, bytes_written, binary_format, binary);
Observations observations;
do {
observe(observations.mReads);
mImports.glGetProgramBinaryOES(program, buffer_size, bytes_written, binary_format, binary);
int32_t l_l = (int32_t)(slice(bytes_written, 0, 1)[0]);
write(slice(bytes_written, 0, 1), 0, l_l);
write(slice(binary_format, 0, 1), 0, slice(binary_format, 0, 1)[0]);
write(slice(binary, (uint64_t)(0), (uint64_t)(l_l)));
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlGetProgramBinaryOES coder(
observations, program, buffer_size,
gapic::coder::gles::S32__P(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(bytes_written), 0)),
gapic::coder::gles::U32__P(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(binary_format), 0)),
gapic::coder::gles::Void__P(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(binary), 0)));
mEncoder->Object(&coder);
}
inline void GlesSpy::glProgramBinaryOES(uint32_t program, uint32_t binary_format, void* binary,
int32_t binary_size) {
GAPID_INFO("glProgramBinaryOES(%" PRIu32 ", %" PRIu32 ", %p, %" PRId32 ")\n", program,
binary_format, binary, binary_size);
Observations observations;
do {
observe(observations.mReads);
mImports.glProgramBinaryOES(program, binary_format, binary, binary_size);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlProgramBinaryOES coder(
observations, program, binary_format,
gapic::coder::gles::Void__P(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(binary), 0)),
binary_size);
mEncoder->Object(&coder);
}
inline void GlesSpy::glStartTilingQCOM(int32_t x, int32_t y, int32_t width, int32_t height,
uint32_t preserveMask) {
GAPID_INFO("glStartTilingQCOM(%" PRId32 ", %" PRId32 ", %" PRId32 ", %" PRId32 ", %u)\n", x, y,
width, height, preserveMask);
Observations observations;
do {
observe(observations.mReads);
mImports.glStartTilingQCOM(x, y, width, height, preserveMask);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlStartTilingQCOM coder(observations, x, y, width, height, preserveMask);
mEncoder->Object(&coder);
}
inline void GlesSpy::glEndTilingQCOM(uint32_t preserve_mask) {
GAPID_INFO("glEndTilingQCOM(%u)\n", preserve_mask);
Observations observations;
do {
observe(observations.mReads);
mImports.glEndTilingQCOM(preserve_mask);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlEndTilingQCOM coder(observations, preserve_mask);
mEncoder->Object(&coder);
}
inline void GlesSpy::glDiscardFramebufferEXT(uint32_t target, int32_t numAttachments,
uint32_t* attachments) {
GAPID_INFO("glDiscardFramebufferEXT(%u, %" PRId32 ", %p)\n", target, numAttachments,
attachments);
Observations observations;
do {
observe(observations.mReads);
mImports.glDiscardFramebufferEXT(target, numAttachments, attachments);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlDiscardFramebufferEXT coder(
observations, target, numAttachments,
gapic::coder::gles::GLenum__P(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(attachments), 0)));
mEncoder->Object(&coder);
}
inline void GlesSpy::glInsertEventMarkerEXT(int32_t length, char* marker) {
GAPID_INFO("glInsertEventMarkerEXT(%" PRId32 ", %p)\n", length, marker);
Observations observations;
do {
if (length > 0) {
read(slice(marker, (uint64_t)(0), (uint64_t)(length)));
} else {
string(marker);
}
observe(observations.mReads);
mImports.glInsertEventMarkerEXT(length, marker);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlInsertEventMarkerEXT coder(
observations, length, gapic::coder::gles::Char__P(gapic::coder::memory::Pointer(
reinterpret_cast<uintptr_t>(marker), 0)));
mEncoder->Object(&coder);
}
inline void GlesSpy::glPushGroupMarkerEXT(int32_t length, char* marker) {
GAPID_INFO("glPushGroupMarkerEXT(%" PRId32 ", %p)\n", length, marker);
Observations observations;
do {
if (length > 0) {
read(slice(marker, (uint64_t)(0), (uint64_t)(length)));
} else {
string(marker);
}
observe(observations.mReads);
mImports.glPushGroupMarkerEXT(length, marker);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlPushGroupMarkerEXT coder(
observations, length, gapic::coder::gles::Char__P(gapic::coder::memory::Pointer(
reinterpret_cast<uintptr_t>(marker), 0)));
mEncoder->Object(&coder);
}
inline void GlesSpy::glPopGroupMarkerEXT() {
GAPID_INFO("glPopGroupMarkerEXT()\n");
Observations observations;
do {
observe(observations.mReads);
mImports.glPopGroupMarkerEXT();
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlPopGroupMarkerEXT coder(observations);
mEncoder->Object(&coder);
}
inline void GlesSpy::glTexStorage1DEXT(uint32_t target, int32_t levels, uint32_t format,
int32_t width) {
GAPID_INFO("glTexStorage1DEXT(%u, %" PRId32 ", %u, %" PRId32 ")\n", target, levels, format,
width);
Observations observations;
do {
observe(observations.mReads);
mImports.glTexStorage1DEXT(target, levels, format, width);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlTexStorage1DEXT coder(observations, target, levels, format, width);
mEncoder->Object(&coder);
}
inline void GlesSpy::glTexStorage2DEXT(uint32_t target, int32_t levels, uint32_t format,
int32_t width, int32_t height) {
GAPID_INFO("glTexStorage2DEXT(%u, %" PRId32 ", %u, %" PRId32 ", %" PRId32 ")\n", target, levels,
format, width, height);
Observations observations;
do {
observe(observations.mReads);
mImports.glTexStorage2DEXT(target, levels, format, width, height);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlTexStorage2DEXT coder(observations, target, levels, format, width,
height);
mEncoder->Object(&coder);
}
inline void GlesSpy::glTexStorage3DEXT(uint32_t target, int32_t levels, uint32_t format,
int32_t width, int32_t height, int32_t depth) {
GAPID_INFO("glTexStorage3DEXT(%u, %" PRId32 ", %u, %" PRId32 ", %" PRId32 ", %" PRId32 ")\n",
target, levels, format, width, height, depth);
Observations observations;
do {
observe(observations.mReads);
mImports.glTexStorage3DEXT(target, levels, format, width, height, depth);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlTexStorage3DEXT coder(observations, target, levels, format, width, height,
depth);
mEncoder->Object(&coder);
}
inline void GlesSpy::glTextureStorage1DEXT(uint32_t texture, uint32_t target, int32_t levels,
uint32_t format, int32_t width) {
GAPID_INFO("glTextureStorage1DEXT(%" PRIu32 ", %u, %" PRId32 ", %u, %" PRId32 ")\n", texture,
target, levels, format, width);
Observations observations;
do {
observe(observations.mReads);
mImports.glTextureStorage1DEXT(texture, target, levels, format, width);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlTextureStorage1DEXT coder(observations, texture, target, levels, format,
width);
mEncoder->Object(&coder);
}
inline void GlesSpy::glTextureStorage2DEXT(uint32_t texture, uint32_t target, int32_t levels,
uint32_t format, int32_t width, int32_t height) {
GAPID_INFO("glTextureStorage2DEXT(%" PRIu32 ", %u, %" PRId32 ", %u, %" PRId32 ", %" PRId32
")\n",
texture, target, levels, format, width, height);
Observations observations;
do {
observe(observations.mReads);
mImports.glTextureStorage2DEXT(texture, target, levels, format, width, height);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlTextureStorage2DEXT coder(observations, texture, target, levels, format,
width, height);
mEncoder->Object(&coder);
}
inline void GlesSpy::glTextureStorage3DEXT(uint32_t texture, uint32_t target, int32_t levels,
uint32_t format, int32_t width, int32_t height,
int32_t depth) {
GAPID_INFO("glTextureStorage3DEXT(%" PRIu32 ", %u, %" PRId32 ", %u, %" PRId32 ", %" PRId32
", %" PRId32 ")\n",
texture, target, levels, format, width, height, depth);
Observations observations;
do {
observe(observations.mReads);
mImports.glTextureStorage3DEXT(texture, target, levels, format, width, height, depth);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlTextureStorage3DEXT coder(observations, texture, target, levels, format,
width, height, depth);
mEncoder->Object(&coder);
}
inline void GlesSpy::glGenVertexArraysOES(int32_t count, uint32_t* arrays) {
GAPID_INFO("glGenVertexArraysOES(%" PRId32 ", %p)\n", count, arrays);
Observations observations;
do {
Slice<VertexArrayId> l_a = slice(arrays, (uint64_t)(0), (uint64_t)(count));
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_13_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_13_result;
observe(observations.mReads);
mImports.glGenVertexArraysOES(count, arrays);
for (int32_t l_i = 0; l_i < count; ++l_i) {
VertexArrayId l_id = (VertexArrayId)(
slice(arrays, (uint64_t)(0), (uint64_t)(count))[(uint64_t)(l_i)]);
l_ctx->mInstances.mVertexArrays[l_id] =
std::shared_ptr<VertexArray>((new VertexArray()));
write(l_a, (uint64_t)(l_i), l_id);
}
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlGenVertexArraysOES coder(
observations, count, gapic::coder::gles::VertexArrayId__P(gapic::coder::memory::Pointer(
reinterpret_cast<uintptr_t>(arrays), 0)));
mEncoder->Object(&coder);
}
inline void GlesSpy::glBindVertexArrayOES(uint32_t array) {
GAPID_INFO("glBindVertexArrayOES(%" PRIu32 ")\n", array);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_14_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_14_result;
if (!(l_ctx->mInstances.mVertexArrays.count(array) > 0)) {
l_ctx->mInstances.mVertexArrays[array] =
std::shared_ptr<VertexArray>((new VertexArray()));
}
l_ctx->mBoundVertexArray = array;
observe(observations.mReads);
mImports.glBindVertexArrayOES(array);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlBindVertexArrayOES coder(observations, array);
mEncoder->Object(&coder);
}
inline void GlesSpy::glDeleteVertexArraysOES(int32_t count, uint32_t* arrays) {
GAPID_INFO("glDeleteVertexArraysOES(%" PRId32 ", %p)\n", count, arrays);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_15_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_15_result;
Slice<VertexArrayId> l_a = slice(arrays, (uint64_t)(0), (uint64_t)(count));
for (int32_t l_i = 0; l_i < count; ++l_i) {
l_ctx->mInstances.mVertexArrays[read(l_a, (uint64_t)(l_i))] =
std::shared_ptr<VertexArray>();
}
observe(observations.mReads);
mImports.glDeleteVertexArraysOES(count, arrays);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlDeleteVertexArraysOES coder(
observations, count,
gapic::coder::gles::VertexArrayId__CP(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(arrays), 0)));
mEncoder->Object(&coder);
}
inline bool GlesSpy::glIsVertexArrayOES(uint32_t array) {
GAPID_INFO("glIsVertexArrayOES(%" PRIu32 ")\n", array);
bool result = false;
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_16_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_16_result;
observe(observations.mReads);
result = mImports.glIsVertexArrayOES(array);
break;
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlIsVertexArrayOES coder(observations, array, result);
mEncoder->Object(&coder);
return result;
}
inline void GlesSpy::glEGLImageTargetTexture2DOES(uint32_t target, void* image) {
GAPID_INFO("glEGLImageTargetTexture2DOES(%u, %p)\n", target, image);
Observations observations;
do {
observe(observations.mReads);
mImports.glEGLImageTargetTexture2DOES(target, image);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlEGLImageTargetTexture2DOES coder(
observations, target, gapic::coder::gles::ImageOES(gapic::coder::memory::Pointer(
reinterpret_cast<uintptr_t>(image), 0)));
mEncoder->Object(&coder);
}
inline void GlesSpy::glEGLImageTargetRenderbufferStorageOES(uint32_t target, void* image) {
GAPID_INFO("glEGLImageTargetRenderbufferStorageOES(%u, %p)\n", target, image);
Observations observations;
do {
observe(observations.mReads);
mImports.glEGLImageTargetRenderbufferStorageOES(target, image);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlEGLImageTargetRenderbufferStorageOES coder(
observations, target, gapic::coder::gles::TexturePointer(gapic::coder::memory::Pointer(
reinterpret_cast<uintptr_t>(image), 0)));
mEncoder->Object(&coder);
}
inline uint32_t GlesSpy::glGetGraphicsResetStatusEXT() {
GAPID_INFO("glGetGraphicsResetStatusEXT()\n");
uint32_t result = 0;
Observations observations;
do {
observe(observations.mReads);
result = mImports.glGetGraphicsResetStatusEXT();
break;
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlGetGraphicsResetStatusEXT coder(observations, result);
mEncoder->Object(&coder);
return result;
}
inline void GlesSpy::glBindAttribLocation(uint32_t program, int32_t location, char* name) {
GAPID_INFO("glBindAttribLocation(%" PRIu32 ", %" PRId32 ", %s)\n", program, location, name);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_17_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_17_result;
std::shared_ptr<Program> l_p = l_ctx->mInstances.mPrograms[program];
l_p->mAttributeBindings[name] = location;
observe(observations.mReads);
mImports.glBindAttribLocation(program, location, name);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlBindAttribLocation coder(observations, program, location, name);
mEncoder->Object(&coder);
}
inline void GlesSpy::glBlendFunc(uint32_t src_factor, uint32_t dst_factor) {
GAPID_INFO("glBlendFunc(%u, %u)\n", src_factor, dst_factor);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_18_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_18_result;
l_ctx->mBlending.mSrcRgbBlendFactor = src_factor;
l_ctx->mBlending.mSrcAlphaBlendFactor = src_factor;
l_ctx->mBlending.mDstRgbBlendFactor = dst_factor;
l_ctx->mBlending.mDstAlphaBlendFactor = dst_factor;
observe(observations.mReads);
mImports.glBlendFunc(src_factor, dst_factor);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlBlendFunc coder(observations, src_factor, dst_factor);
mEncoder->Object(&coder);
}
inline void GlesSpy::glBlendFuncSeparate(uint32_t src_factor_rgb, uint32_t dst_factor_rgb,
uint32_t src_factor_alpha, uint32_t dst_factor_alpha) {
GAPID_INFO("glBlendFuncSeparate(%u, %u, %u, %u)\n", src_factor_rgb, dst_factor_rgb,
src_factor_alpha, dst_factor_alpha);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_19_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_19_result;
l_ctx->mBlending.mSrcRgbBlendFactor = src_factor_rgb;
l_ctx->mBlending.mDstRgbBlendFactor = dst_factor_rgb;
l_ctx->mBlending.mSrcAlphaBlendFactor = src_factor_alpha;
l_ctx->mBlending.mDstAlphaBlendFactor = dst_factor_alpha;
observe(observations.mReads);
mImports.glBlendFuncSeparate(src_factor_rgb, dst_factor_rgb, src_factor_alpha,
dst_factor_alpha);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlBlendFuncSeparate coder(observations, src_factor_rgb, dst_factor_rgb,
src_factor_alpha, dst_factor_alpha);
mEncoder->Object(&coder);
}
inline void GlesSpy::glBlendEquation(uint32_t equation) {
GAPID_INFO("glBlendEquation(%u)\n", equation);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_20_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_20_result;
l_ctx->mBlending.mBlendEquationRgb = equation;
l_ctx->mBlending.mBlendEquationAlpha = equation;
observe(observations.mReads);
mImports.glBlendEquation(equation);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlBlendEquation coder(observations, equation);
mEncoder->Object(&coder);
}
inline void GlesSpy::glBlendEquationSeparate(uint32_t rgb, uint32_t alpha) {
GAPID_INFO("glBlendEquationSeparate(%u, %u)\n", rgb, alpha);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_21_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_21_result;
l_ctx->mBlending.mBlendEquationRgb = rgb;
l_ctx->mBlending.mBlendEquationAlpha = alpha;
observe(observations.mReads);
mImports.glBlendEquationSeparate(rgb, alpha);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlBlendEquationSeparate coder(observations, rgb, alpha);
mEncoder->Object(&coder);
}
inline void GlesSpy::glBlendColor(float red, float green, float blue, float alpha) {
GAPID_INFO("glBlendColor(%f, %f, %f, %f)\n", red, green, blue, alpha);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_22_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_22_result;
l_ctx->mBlending.mBlendColor =
Color().SetRed(red).SetGreen(green).SetBlue(blue).SetAlpha(alpha);
observe(observations.mReads);
mImports.glBlendColor(red, green, blue, alpha);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlBlendColor coder(observations, red, green, blue, alpha);
mEncoder->Object(&coder);
}
inline void GlesSpy::glEnableVertexAttribArray(int32_t location) {
GAPID_INFO("glEnableVertexAttribArray(%" PRId32 ")\n", location);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_23_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_23_result;
l_ctx->mVertexAttributeArrays[location]->mEnabled = true;
observe(observations.mReads);
mImports.glEnableVertexAttribArray(location);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlEnableVertexAttribArray coder(observations, location);
mEncoder->Object(&coder);
}
inline void GlesSpy::glDisableVertexAttribArray(int32_t location) {
GAPID_INFO("glDisableVertexAttribArray(%" PRId32 ")\n", location);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_24_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_24_result;
l_ctx->mVertexAttributeArrays[location]->mEnabled = false;
observe(observations.mReads);
mImports.glDisableVertexAttribArray(location);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlDisableVertexAttribArray coder(observations, location);
mEncoder->Object(&coder);
}
inline void GlesSpy::glVertexAttribPointer(int32_t location, int32_t size, uint32_t type,
bool normalized, int32_t stride, void* data) {
GAPID_INFO("glVertexAttribPointer(%" PRId32 ", %" PRId32 ", %u, %d, %" PRId32 ", %p)\n",
location, size, type, normalized, stride, data);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_25_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_25_result;
std::shared_ptr<VertexAttributeArray> l_a = l_ctx->mVertexAttributeArrays[location];
l_a->mSize = (uint32_t)(size);
l_a->mType = type;
l_a->mNormalized = normalized;
l_a->mStride = stride;
l_a->mPointer = data;
l_a->mBuffer = l_ctx->mBoundBuffers[GLenum::GL_ARRAY_BUFFER];
observe(observations.mReads);
mImports.glVertexAttribPointer(location, size, type, normalized, stride, data);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlVertexAttribPointer coder(
observations, location, size, type, normalized, stride,
gapic::coder::gles::VertexPointer(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(data), 0)));
mEncoder->Object(&coder);
}
inline void GlesSpy::glGetActiveAttrib(uint32_t program, int32_t location, int32_t buffer_size,
int32_t* buffer_bytes_written, int32_t* vector_count,
uint32_t* type, char* name) {
GAPID_INFO("glGetActiveAttrib(%" PRIu32 ", %" PRId32 ", %" PRId32 ", %p, %p, %p, %p)\n",
program, location, buffer_size, buffer_bytes_written, vector_count, type, name);
Observations observations;
do {
observe(observations.mReads);
mImports.glGetActiveAttrib(program, location, buffer_size, buffer_bytes_written,
vector_count, type, name);
if (buffer_bytes_written != nullptr) {
int32_t l_l = (int32_t)(slice(buffer_bytes_written, 0, 1)[0]);
write(slice(buffer_bytes_written, 0, 1), 0, l_l);
write(slice(name, (uint64_t)(0), (uint64_t)(l_l)));
} else {
write(slice(name, 0, 256));
}
write(slice(vector_count, 0, 1), 0, (int32_t)(slice(vector_count, 0, 1)[0]));
write(slice(type, 0, 1), 0, (uint32_t)(slice(type, 0, 1)[0]));
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlGetActiveAttrib coder(
observations, program, location, buffer_size,
gapic::coder::gles::S32__P(gapic::coder::memory::Pointer(
reinterpret_cast<uintptr_t>(buffer_bytes_written), 0)),
gapic::coder::gles::S32__P(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(vector_count), 0)),
gapic::coder::gles::GLenum__P(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(type), 0)),
gapic::coder::gles::Char__P(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(name), 0)));
mEncoder->Object(&coder);
}
inline void GlesSpy::glGetActiveUniform(uint32_t program, int32_t location, int32_t buffer_size,
int32_t* buffer_bytes_written, int32_t* vector_count,
uint32_t* type, char* name) {
GAPID_INFO("glGetActiveUniform(%" PRIu32 ", %" PRId32 ", %" PRId32 ", %p, %p, %p, %p)\n",
program, location, buffer_size, buffer_bytes_written, vector_count, type, name);
Observations observations;
do {
observe(observations.mReads);
mImports.glGetActiveUniform(program, location, buffer_size, buffer_bytes_written,
vector_count, type, name);
if (buffer_bytes_written != nullptr) {
int32_t l_l = (int32_t)(slice(buffer_bytes_written, 0, 1)[0]);
write(slice(buffer_bytes_written, 0, 1), 0, l_l);
write(slice(name, (uint64_t)(0), (uint64_t)(l_l)));
} else {
write(slice(name, 0, 256));
}
write(slice(vector_count, 0, 1), 0, (int32_t)(slice(vector_count, 0, 1)[0]));
write(slice(type, 0, 1), 0, (uint32_t)(slice(type, 0, 1)[0]));
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlGetActiveUniform coder(
observations, program, location, buffer_size,
gapic::coder::gles::S32__P(gapic::coder::memory::Pointer(
reinterpret_cast<uintptr_t>(buffer_bytes_written), 0)),
gapic::coder::gles::S32__P(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(vector_count), 0)),
gapic::coder::gles::GLenum__P(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(type), 0)),
gapic::coder::gles::Char__P(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(name), 0)));
mEncoder->Object(&coder);
}
inline uint32_t GlesSpy::glGetError() {
GAPID_INFO("glGetError()\n");
uint32_t result = 0;
Observations observations;
do {
observe(observations.mReads);
result = mImports.glGetError();
break;
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlGetError coder(observations, result);
mEncoder->Object(&coder);
return result;
}
inline void GlesSpy::glGetProgramiv(uint32_t program, uint32_t parameter, int32_t* value) {
GAPID_INFO("glGetProgramiv(%" PRIu32 ", %u, %p)\n", program, parameter, value);
Observations observations;
do {
observe(observations.mReads);
mImports.glGetProgramiv(program, parameter, value);
write(slice(value, 0, 1), 0, slice(value, 0, 1)[0]);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlGetProgramiv coder(
observations, program, parameter,
gapic::coder::gles::S32__P(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(value), 0)));
mEncoder->Object(&coder);
}
inline void GlesSpy::glGetShaderiv(uint32_t shader, uint32_t parameter, int32_t* value) {
GAPID_INFO("glGetShaderiv(%" PRIu32 ", %u, %p)\n", shader, parameter, value);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_26_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_26_result;
std::shared_ptr<Shader> l_s = l_ctx->mInstances.mShaders[shader];
observe(observations.mReads);
mImports.glGetShaderiv(shader, parameter, value);
write(slice(value, 0, 1), 0, /* clang-format off */
/* switch(parameter) */
/* case GLenum::GL_SHADER_TYPE: */(((parameter) == (GLenum::GL_SHADER_TYPE))) ? ((int32_t)(l_s->mType)) :
/* case GLenum::GL_DELETE_STATUS: */(((parameter) == (GLenum::GL_DELETE_STATUS))) ? (/* clang-format off */
/* switch(l_s->mDeletable) */
/* case true: */(((l_s->mDeletable) == (true))) ? (1) :
/* case false: */(((l_s->mDeletable) == (false))) ? (0) :
/* default: */ 0 /* clang-format on */)
:
/* case GLenum::GL_COMPILE_STATUS: */ (
((parameter) == (GLenum::GL_COMPILE_STATUS)))
? (/* clang-format off */
/* switch(l_s->mCompiled) */
/* case true: */(((l_s->mCompiled) == (true))) ? (1) :
/* case false: */(((l_s->mCompiled) == (false))) ? (0) :
/* default: */ 0 /* clang-format on */)
:
/* case GLenum::GL_INFO_LOG_LENGTH: */ (
((parameter) == (GLenum::GL_INFO_LOG_LENGTH)))
? (int32_t((l_s->mInfoLog.count())))
:
/* case GLenum::GL_SHADER_SOURCE_LENGTH: */ (
((parameter) ==
(GLenum::GL_SHADER_SOURCE_LENGTH)))
? (int32_t((l_s->mSource.size())))
:
/* default: */ 0 /* clang-format on */);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlGetShaderiv coder(
observations, shader, parameter,
gapic::coder::gles::S32__P(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(value), 0)));
mEncoder->Object(&coder);
}
inline int32_t GlesSpy::glGetUniformLocation(uint32_t program, char* name) {
GAPID_INFO("glGetUniformLocation(%" PRIu32 ", %s)\n", program, name);
int32_t result = 0;
Observations observations;
do {
observe(observations.mReads);
result = mImports.glGetUniformLocation(program, name);
break;
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlGetUniformLocation coder(observations, program, name, result);
mEncoder->Object(&coder);
return result;
}
inline int32_t GlesSpy::glGetAttribLocation(uint32_t program, char* name) {
GAPID_INFO("glGetAttribLocation(%" PRIu32 ", %s)\n", program, name);
int32_t result = 0;
Observations observations;
do {
observe(observations.mReads);
result = mImports.glGetAttribLocation(program, name);
break;
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlGetAttribLocation coder(observations, program, name, result);
mEncoder->Object(&coder);
return result;
}
inline void GlesSpy::glPixelStorei(uint32_t parameter, int32_t value) {
GAPID_INFO("glPixelStorei(%u, %" PRId32 ")\n", parameter, value);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_27_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_27_result;
l_ctx->mPixelStorage[parameter] = value;
observe(observations.mReads);
mImports.glPixelStorei(parameter, value);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlPixelStorei coder(observations, parameter, value);
mEncoder->Object(&coder);
}
inline void GlesSpy::glTexParameteri(uint32_t target, uint32_t parameter, int32_t value) {
GAPID_INFO("glTexParameteri(%u, %u, %" PRId32 ")\n", target, parameter, value);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_28_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_28_result;
TextureId l_id = l_ctx->mTextureUnits[l_ctx->mActiveTextureUnit][target];
std::shared_ptr<Texture> l_t = l_ctx->mInstances.mTextures[l_id];
switch (parameter) {
case GLenum::GL_TEXTURE_MAG_FILTER: {
l_t->mMagFilter = (uint32_t)(value);
break;
}
case GLenum::GL_TEXTURE_MIN_FILTER: {
l_t->mMinFilter = (uint32_t)(value);
break;
}
case GLenum::GL_TEXTURE_WRAP_S: {
l_t->mWrapS = (uint32_t)(value);
break;
}
case GLenum::GL_TEXTURE_WRAP_T: {
l_t->mWrapT = (uint32_t)(value);
break;
}
case GLenum::GL_TEXTURE_MAX_ANISOTROPY_EXT: {
l_t->mMaxAnisotropy = (float)(value);
break;
}
case GLenum::GL_TEXTURE_SWIZZLE_R: {
l_t->mSwizzleR = (uint32_t)(value);
break;
}
case GLenum::GL_TEXTURE_SWIZZLE_G: {
l_t->mSwizzleG = (uint32_t)(value);
break;
}
case GLenum::GL_TEXTURE_SWIZZLE_B: {
l_t->mSwizzleB = (uint32_t)(value);
break;
}
case GLenum::GL_TEXTURE_SWIZZLE_A: {
l_t->mSwizzleA = (uint32_t)(value);
break;
}
}
observe(observations.mReads);
mImports.glTexParameteri(target, parameter, value);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlTexParameteri coder(observations, target, parameter, value);
mEncoder->Object(&coder);
}
inline void GlesSpy::glTexParameterf(uint32_t target, uint32_t parameter, float value) {
GAPID_INFO("glTexParameterf(%u, %u, %f)\n", target, parameter, value);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_29_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_29_result;
TextureId l_id = l_ctx->mTextureUnits[l_ctx->mActiveTextureUnit][target];
std::shared_ptr<Texture> l_t = l_ctx->mInstances.mTextures[l_id];
switch (parameter) {
case GLenum::GL_TEXTURE_MAG_FILTER: {
l_t->mMagFilter = (uint32_t)(value);
break;
}
case GLenum::GL_TEXTURE_MIN_FILTER: {
l_t->mMinFilter = (uint32_t)(value);
break;
}
case GLenum::GL_TEXTURE_WRAP_S: {
l_t->mWrapS = (uint32_t)(value);
break;
}
case GLenum::GL_TEXTURE_WRAP_T: {
l_t->mWrapT = (uint32_t)(value);
break;
}
case GLenum::GL_TEXTURE_MAX_ANISOTROPY_EXT: {
l_t->mMaxAnisotropy = value;
break;
}
case GLenum::GL_TEXTURE_SWIZZLE_R: {
l_t->mSwizzleR = (uint32_t)(value);
break;
}
case GLenum::GL_TEXTURE_SWIZZLE_G: {
l_t->mSwizzleG = (uint32_t)(value);
break;
}
case GLenum::GL_TEXTURE_SWIZZLE_B: {
l_t->mSwizzleB = (uint32_t)(value);
break;
}
case GLenum::GL_TEXTURE_SWIZZLE_A: {
l_t->mSwizzleA = (uint32_t)(value);
break;
}
}
observe(observations.mReads);
mImports.glTexParameterf(target, parameter, value);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlTexParameterf coder(observations, target, parameter, value);
mEncoder->Object(&coder);
}
inline void GlesSpy::glGetTexParameteriv(uint32_t target, uint32_t parameter, int32_t* values) {
GAPID_INFO("glGetTexParameteriv(%u, %u, %p)\n", target, parameter, values);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_30_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_30_result;
TextureId l_id = l_ctx->mTextureUnits[l_ctx->mActiveTextureUnit][target];
std::shared_ptr<Texture> l_t = l_ctx->mInstances.mTextures[l_id];
observe(observations.mReads);
mImports.glGetTexParameteriv(target, parameter, values);
write(slice(values, 0, 1), 0, /* clang-format off */
/* switch(parameter) */
/* case GLenum::GL_TEXTURE_MAG_FILTER: */(((parameter) == (GLenum::GL_TEXTURE_MAG_FILTER))) ? ((int32_t)(l_t->mMagFilter)) :
/* case GLenum::GL_TEXTURE_MIN_FILTER: */(((parameter) == (GLenum::GL_TEXTURE_MIN_FILTER))) ? ((int32_t)(l_t->mMinFilter)) :
/* case GLenum::GL_TEXTURE_WRAP_S: */(((parameter) == (GLenum::GL_TEXTURE_WRAP_S))) ? ((int32_t)(l_t->mWrapS)) :
/* case GLenum::GL_TEXTURE_WRAP_T: */(((parameter) == (GLenum::GL_TEXTURE_WRAP_T))) ? ((int32_t)(l_t->mWrapT)) :
/* case GLenum::GL_TEXTURE_MAX_ANISOTROPY_EXT: */(((parameter) == (GLenum::GL_TEXTURE_MAX_ANISOTROPY_EXT))) ? ((int32_t)(l_t->mMaxAnisotropy)) :
/* case GLenum::GL_TEXTURE_SWIZZLE_R: */(((parameter) == (GLenum::GL_TEXTURE_SWIZZLE_R))) ? ((int32_t)(l_t->mSwizzleR)) :
/* case GLenum::GL_TEXTURE_SWIZZLE_G: */(((parameter) == (GLenum::GL_TEXTURE_SWIZZLE_G))) ? ((int32_t)(l_t->mSwizzleG)) :
/* case GLenum::GL_TEXTURE_SWIZZLE_B: */(((parameter) == (GLenum::GL_TEXTURE_SWIZZLE_B))) ? ((int32_t)(l_t->mSwizzleB)) :
/* case GLenum::GL_TEXTURE_SWIZZLE_A: */(((parameter) == (GLenum::GL_TEXTURE_SWIZZLE_A))) ? ((int32_t)(l_t->mSwizzleA)) :
/* default: */ 0 /* clang-format on */);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlGetTexParameteriv coder(
observations, target, parameter,
gapic::coder::gles::S32__P(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(values), 0)));
mEncoder->Object(&coder);
}
inline void GlesSpy::glGetTexParameterfv(uint32_t target, uint32_t parameter, float* values) {
GAPID_INFO("glGetTexParameterfv(%u, %u, %p)\n", target, parameter, values);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_31_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_31_result;
TextureId l_id = l_ctx->mTextureUnits[l_ctx->mActiveTextureUnit][target];
std::shared_ptr<Texture> l_t = l_ctx->mInstances.mTextures[l_id];
observe(observations.mReads);
mImports.glGetTexParameterfv(target, parameter, values);
write(slice(values, 0, 1), 0, /* clang-format off */
/* switch(parameter) */
/* case GLenum::GL_TEXTURE_MAG_FILTER: */(((parameter) == (GLenum::GL_TEXTURE_MAG_FILTER))) ? ((float)(l_t->mMagFilter)) :
/* case GLenum::GL_TEXTURE_MIN_FILTER: */(((parameter) == (GLenum::GL_TEXTURE_MIN_FILTER))) ? ((float)(l_t->mMinFilter)) :
/* case GLenum::GL_TEXTURE_WRAP_S: */(((parameter) == (GLenum::GL_TEXTURE_WRAP_S))) ? ((float)(l_t->mWrapS)) :
/* case GLenum::GL_TEXTURE_WRAP_T: */(((parameter) == (GLenum::GL_TEXTURE_WRAP_T))) ? ((float)(l_t->mWrapT)) :
/* case GLenum::GL_TEXTURE_MAX_ANISOTROPY_EXT: */(((parameter) == (GLenum::GL_TEXTURE_MAX_ANISOTROPY_EXT))) ? (l_t->mMaxAnisotropy) :
/* case GLenum::GL_TEXTURE_SWIZZLE_R: */(((parameter) == (GLenum::GL_TEXTURE_SWIZZLE_R))) ? ((float)(l_t->mSwizzleR)) :
/* case GLenum::GL_TEXTURE_SWIZZLE_G: */(((parameter) == (GLenum::GL_TEXTURE_SWIZZLE_G))) ? ((float)(l_t->mSwizzleG)) :
/* case GLenum::GL_TEXTURE_SWIZZLE_B: */(((parameter) == (GLenum::GL_TEXTURE_SWIZZLE_B))) ? ((float)(l_t->mSwizzleB)) :
/* case GLenum::GL_TEXTURE_SWIZZLE_A: */(((parameter) == (GLenum::GL_TEXTURE_SWIZZLE_A))) ? ((float)(l_t->mSwizzleA)) :
/* default: */ 0 /* clang-format on */);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlGetTexParameterfv coder(
observations, target, parameter,
gapic::coder::gles::F32__CP(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(values), 0)));
mEncoder->Object(&coder);
}
inline void GlesSpy::glUniform1i(int32_t location, int32_t value) {
GAPID_INFO("glUniform1i(%" PRId32 ", %" PRId32 ")\n", location, value);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_32_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_32_result;
Slice<int32_t> l_v = make<int32_t>(1);
observe(observations.mReads);
mImports.glUniform1i(location, value);
write(l_v, 0, value);
std::shared_ptr<Program> l_program = l_ctx->mInstances.mPrograms[l_ctx->mBoundProgram];
Uniform l_uniform = l_program->mUniforms[location];
l_uniform.mType = GLenum::GL_INT;
l_uniform.mValue = l_v.as<uint8_t>();
l_program->mUniforms[location] = l_uniform;
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlUniform1i coder(observations, location, value);
mEncoder->Object(&coder);
}
inline void GlesSpy::glUniform2i(int32_t location, int32_t value0, int32_t value1) {
GAPID_INFO("glUniform2i(%" PRId32 ", %" PRId32 ", %" PRId32 ")\n", location, value0, value1);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_33_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_33_result;
Slice<Vec2i> l_v = make<Vec2i>(1);
observe(observations.mReads);
mImports.glUniform2i(location, value0, value1);
write(l_v, 0, Vec2i{value0, value1});
std::shared_ptr<Program> l_program = l_ctx->mInstances.mPrograms[l_ctx->mBoundProgram];
Uniform l_uniform = l_program->mUniforms[location];
l_uniform.mType = GLenum::GL_INT_VEC2;
l_uniform.mValue = l_v.as<uint8_t>();
l_program->mUniforms[location] = l_uniform;
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlUniform2i coder(observations, location, value0, value1);
mEncoder->Object(&coder);
}
inline void GlesSpy::glUniform3i(int32_t location, int32_t value0, int32_t value1, int32_t value2) {
GAPID_INFO("glUniform3i(%" PRId32 ", %" PRId32 ", %" PRId32 ", %" PRId32 ")\n", location,
value0, value1, value2);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_34_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_34_result;
Slice<Vec3i> l_v = make<Vec3i>(1);
observe(observations.mReads);
mImports.glUniform3i(location, value0, value1, value2);
write(l_v, 0, Vec3i{value0, value1, value2});
std::shared_ptr<Program> l_program = l_ctx->mInstances.mPrograms[l_ctx->mBoundProgram];
Uniform l_uniform = l_program->mUniforms[location];
l_uniform.mType = GLenum::GL_INT_VEC3;
l_uniform.mValue = l_v.as<uint8_t>();
l_program->mUniforms[location] = l_uniform;
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlUniform3i coder(observations, location, value0, value1, value2);
mEncoder->Object(&coder);
}
inline void GlesSpy::glUniform4i(int32_t location, int32_t value0, int32_t value1, int32_t value2,
int32_t value3) {
GAPID_INFO("glUniform4i(%" PRId32 ", %" PRId32 ", %" PRId32 ", %" PRId32 ", %" PRId32 ")\n",
location, value0, value1, value2, value3);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_35_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_35_result;
Slice<Vec4i> l_v = make<Vec4i>(1);
observe(observations.mReads);
mImports.glUniform4i(location, value0, value1, value2, value3);
write(l_v, 0, Vec4i{value0, value1, value2, value3});
std::shared_ptr<Program> l_program = l_ctx->mInstances.mPrograms[l_ctx->mBoundProgram];
Uniform l_uniform = l_program->mUniforms[location];
l_uniform.mType = GLenum::GL_INT_VEC4;
l_uniform.mValue = l_v.as<uint8_t>();
l_program->mUniforms[location] = l_uniform;
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlUniform4i coder(observations, location, value0, value1, value2, value3);
mEncoder->Object(&coder);
}
inline void GlesSpy::glUniform1iv(int32_t location, int32_t count, int32_t* values) {
GAPID_INFO("glUniform1iv(%" PRId32 ", %" PRId32 ", %p)\n", location, count, values);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_36_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_36_result;
Slice<int32_t> l_v = slice(values, (uint64_t)(0), (uint64_t)(count));
std::shared_ptr<Program> l_program = l_ctx->mInstances.mPrograms[l_ctx->mBoundProgram];
Uniform l_uniform = l_program->mUniforms[location];
l_uniform.mType = GLenum::GL_INT;
l_uniform.mValue = clone(l_v.as<uint8_t>());
l_program->mUniforms[location] = l_uniform;
observe(observations.mReads);
mImports.glUniform1iv(location, count, values);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlUniform1iv coder(observations, location, count,
gapic::coder::gles::S32__P(gapic::coder::memory::Pointer(
reinterpret_cast<uintptr_t>(values), 0)));
mEncoder->Object(&coder);
}
inline void GlesSpy::glUniform2iv(int32_t location, int32_t count, int32_t* values) {
GAPID_INFO("glUniform2iv(%" PRId32 ", %" PRId32 ", %p)\n", location, count, values);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_37_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_37_result;
Slice<Vec2i> l_v = slice((Vec2i*)(values), (uint64_t)(0), (uint64_t)(count));
std::shared_ptr<Program> l_program = l_ctx->mInstances.mPrograms[l_ctx->mBoundProgram];
Uniform l_uniform = l_program->mUniforms[location];
l_uniform.mType = GLenum::GL_INT_VEC2;
l_uniform.mValue = clone(l_v.as<uint8_t>());
l_program->mUniforms[location] = l_uniform;
observe(observations.mReads);
mImports.glUniform2iv(location, count, values);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlUniform2iv coder(observations, location, count,
gapic::coder::gles::S32__P(gapic::coder::memory::Pointer(
reinterpret_cast<uintptr_t>(values), 0)));
mEncoder->Object(&coder);
}
inline void GlesSpy::glUniform3iv(int32_t location, int32_t count, int32_t* values) {
GAPID_INFO("glUniform3iv(%" PRId32 ", %" PRId32 ", %p)\n", location, count, values);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_38_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_38_result;
Slice<Vec3i> l_v = slice((Vec3i*)(values), (uint64_t)(0), (uint64_t)(count));
std::shared_ptr<Program> l_program = l_ctx->mInstances.mPrograms[l_ctx->mBoundProgram];
Uniform l_uniform = l_program->mUniforms[location];
l_uniform.mType = GLenum::GL_INT_VEC3;
l_uniform.mValue = clone(l_v.as<uint8_t>());
l_program->mUniforms[location] = l_uniform;
observe(observations.mReads);
mImports.glUniform3iv(location, count, values);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlUniform3iv coder(observations, location, count,
gapic::coder::gles::S32__P(gapic::coder::memory::Pointer(
reinterpret_cast<uintptr_t>(values), 0)));
mEncoder->Object(&coder);
}
inline void GlesSpy::glUniform4iv(int32_t location, int32_t count, int32_t* values) {
GAPID_INFO("glUniform4iv(%" PRId32 ", %" PRId32 ", %p)\n", location, count, values);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_39_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_39_result;
Slice<Vec4i> l_v = slice((Vec4i*)(values), (uint64_t)(0), (uint64_t)(count));
std::shared_ptr<Program> l_program = l_ctx->mInstances.mPrograms[l_ctx->mBoundProgram];
Uniform l_uniform = l_program->mUniforms[location];
l_uniform.mType = GLenum::GL_INT_VEC4;
l_uniform.mValue = clone(l_v.as<uint8_t>());
l_program->mUniforms[location] = l_uniform;
observe(observations.mReads);
mImports.glUniform4iv(location, count, values);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlUniform4iv coder(observations, location, count,
gapic::coder::gles::S32__P(gapic::coder::memory::Pointer(
reinterpret_cast<uintptr_t>(values), 0)));
mEncoder->Object(&coder);
}
inline void GlesSpy::glUniform1f(int32_t location, float value) {
GAPID_INFO("glUniform1f(%" PRId32 ", %f)\n", location, value);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_40_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_40_result;
Slice<float> l_v = make<float>(1);
observe(observations.mReads);
mImports.glUniform1f(location, value);
write(l_v, 0, value);
std::shared_ptr<Program> l_program = l_ctx->mInstances.mPrograms[l_ctx->mBoundProgram];
Uniform l_uniform = l_program->mUniforms[location];
l_uniform.mType = GLenum::GL_FLOAT;
l_uniform.mValue = l_v.as<uint8_t>();
l_program->mUniforms[location] = l_uniform;
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlUniform1f coder(observations, location, value);
mEncoder->Object(&coder);
}
inline void GlesSpy::glUniform2f(int32_t location, float value0, float value1) {
GAPID_INFO("glUniform2f(%" PRId32 ", %f, %f)\n", location, value0, value1);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_41_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_41_result;
Slice<Vec2f> l_v = make<Vec2f>(1);
observe(observations.mReads);
mImports.glUniform2f(location, value0, value1);
write(l_v, 0, Vec2f{value0, value1});
std::shared_ptr<Program> l_program = l_ctx->mInstances.mPrograms[l_ctx->mBoundProgram];
Uniform l_uniform = l_program->mUniforms[location];
l_uniform.mType = GLenum::GL_FLOAT_VEC2;
l_uniform.mValue = l_v.as<uint8_t>();
l_program->mUniforms[location] = l_uniform;
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlUniform2f coder(observations, location, value0, value1);
mEncoder->Object(&coder);
}
inline void GlesSpy::glUniform3f(int32_t location, float value0, float value1, float value2) {
GAPID_INFO("glUniform3f(%" PRId32 ", %f, %f, %f)\n", location, value0, value1, value2);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_42_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_42_result;
Slice<Vec3f> l_v = make<Vec3f>(1);
observe(observations.mReads);
mImports.glUniform3f(location, value0, value1, value2);
write(l_v, 0, Vec3f{value0, value1, value2});
std::shared_ptr<Program> l_program = l_ctx->mInstances.mPrograms[l_ctx->mBoundProgram];
Uniform l_uniform = l_program->mUniforms[location];
l_uniform.mType = GLenum::GL_FLOAT_VEC3;
l_uniform.mValue = l_v.as<uint8_t>();
l_program->mUniforms[location] = l_uniform;
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlUniform3f coder(observations, location, value0, value1, value2);
mEncoder->Object(&coder);
}
inline void GlesSpy::glUniform4f(int32_t location, float value0, float value1, float value2,
float value3) {
GAPID_INFO("glUniform4f(%" PRId32 ", %f, %f, %f, %f)\n", location, value0, value1, value2,
value3);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_43_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_43_result;
Slice<Vec4f> l_v = make<Vec4f>(1);
observe(observations.mReads);
mImports.glUniform4f(location, value0, value1, value2, value3);
write(l_v, 0, Vec4f{value0, value1, value2, value3});
std::shared_ptr<Program> l_program = l_ctx->mInstances.mPrograms[l_ctx->mBoundProgram];
Uniform l_uniform = l_program->mUniforms[location];
l_uniform.mType = GLenum::GL_FLOAT_VEC4;
l_uniform.mValue = l_v.as<uint8_t>();
l_program->mUniforms[location] = l_uniform;
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlUniform4f coder(observations, location, value0, value1, value2, value3);
mEncoder->Object(&coder);
}
inline void GlesSpy::glUniform1fv(int32_t location, int32_t count, float* values) {
GAPID_INFO("glUniform1fv(%" PRId32 ", %" PRId32 ", %p)\n", location, count, values);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_44_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_44_result;
Slice<float> l_v = slice(values, (uint64_t)(0), (uint64_t)(count));
std::shared_ptr<Program> l_program = l_ctx->mInstances.mPrograms[l_ctx->mBoundProgram];
Uniform l_uniform = l_program->mUniforms[location];
l_uniform.mType = GLenum::GL_FLOAT;
l_uniform.mValue = clone(l_v.as<uint8_t>());
l_program->mUniforms[location] = l_uniform;
observe(observations.mReads);
mImports.glUniform1fv(location, count, values);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlUniform1fv coder(
observations, location, count,
gapic::coder::gles::F32__CP(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(values), 0)));
mEncoder->Object(&coder);
}
inline void GlesSpy::glUniform2fv(int32_t location, int32_t count, float* values) {
GAPID_INFO("glUniform2fv(%" PRId32 ", %" PRId32 ", %p)\n", location, count, values);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_45_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_45_result;
Slice<Vec2f> l_v = slice((Vec2f*)(values), (uint64_t)(0), (uint64_t)(count));
std::shared_ptr<Program> l_program = l_ctx->mInstances.mPrograms[l_ctx->mBoundProgram];
Uniform l_uniform = l_program->mUniforms[location];
l_uniform.mType = GLenum::GL_FLOAT_VEC2;
l_uniform.mValue = clone(l_v.as<uint8_t>());
l_program->mUniforms[location] = l_uniform;
observe(observations.mReads);
mImports.glUniform2fv(location, count, values);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlUniform2fv coder(
observations, location, count,
gapic::coder::gles::F32__CP(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(values), 0)));
mEncoder->Object(&coder);
}
inline void GlesSpy::glUniform3fv(int32_t location, int32_t count, float* values) {
GAPID_INFO("glUniform3fv(%" PRId32 ", %" PRId32 ", %p)\n", location, count, values);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_46_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_46_result;
Slice<Vec3f> l_v = slice((Vec3f*)(values), (uint64_t)(0), (uint64_t)(count));
std::shared_ptr<Program> l_program = l_ctx->mInstances.mPrograms[l_ctx->mBoundProgram];
Uniform l_uniform = l_program->mUniforms[location];
l_uniform.mType = GLenum::GL_FLOAT_VEC3;
l_uniform.mValue = clone(l_v.as<uint8_t>());
l_program->mUniforms[location] = l_uniform;
observe(observations.mReads);
mImports.glUniform3fv(location, count, values);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlUniform3fv coder(
observations, location, count,
gapic::coder::gles::F32__CP(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(values), 0)));
mEncoder->Object(&coder);
}
inline void GlesSpy::glUniform4fv(int32_t location, int32_t count, float* values) {
GAPID_INFO("glUniform4fv(%" PRId32 ", %" PRId32 ", %p)\n", location, count, values);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_47_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_47_result;
Slice<Vec4f> l_v = slice((Vec4f*)(values), (uint64_t)(0), (uint64_t)(count));
std::shared_ptr<Program> l_program = l_ctx->mInstances.mPrograms[l_ctx->mBoundProgram];
Uniform l_uniform = l_program->mUniforms[location];
l_uniform.mType = GLenum::GL_FLOAT_VEC4;
l_uniform.mValue = clone(l_v.as<uint8_t>());
l_program->mUniforms[location] = l_uniform;
observe(observations.mReads);
mImports.glUniform4fv(location, count, values);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlUniform4fv coder(
observations, location, count,
gapic::coder::gles::F32__CP(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(values), 0)));
mEncoder->Object(&coder);
}
inline void GlesSpy::glUniformMatrix2fv(int32_t location, int32_t count, bool transpose,
float* values) {
GAPID_INFO("glUniformMatrix2fv(%" PRId32 ", %" PRId32 ", %d, %p)\n", location, count, transpose,
values);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_48_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_48_result;
Slice<Mat2f> l_v = slice((Mat2f*)(values), (uint64_t)(0), (uint64_t)(count));
std::shared_ptr<Program> l_program = l_ctx->mInstances.mPrograms[l_ctx->mBoundProgram];
Uniform l_uniform = l_program->mUniforms[location];
l_uniform.mType = GLenum::GL_FLOAT_MAT2;
l_uniform.mValue = clone(l_v.as<uint8_t>());
l_program->mUniforms[location] = l_uniform;
observe(observations.mReads);
mImports.glUniformMatrix2fv(location, count, transpose, values);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlUniformMatrix2fv coder(
observations, location, count, transpose,
gapic::coder::gles::F32__CP(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(values), 0)));
mEncoder->Object(&coder);
}
inline void GlesSpy::glUniformMatrix3fv(int32_t location, int32_t count, bool transpose,
float* values) {
GAPID_INFO("glUniformMatrix3fv(%" PRId32 ", %" PRId32 ", %d, %p)\n", location, count, transpose,
values);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_49_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_49_result;
Slice<Mat3f> l_v = slice((Mat3f*)(values), (uint64_t)(0), (uint64_t)(count));
std::shared_ptr<Program> l_program = l_ctx->mInstances.mPrograms[l_ctx->mBoundProgram];
Uniform l_uniform = l_program->mUniforms[location];
l_uniform.mType = GLenum::GL_FLOAT_MAT3;
l_uniform.mValue = clone(l_v.as<uint8_t>());
l_program->mUniforms[location] = l_uniform;
observe(observations.mReads);
mImports.glUniformMatrix3fv(location, count, transpose, values);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlUniformMatrix3fv coder(
observations, location, count, transpose,
gapic::coder::gles::F32__CP(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(values), 0)));
mEncoder->Object(&coder);
}
inline void GlesSpy::glUniformMatrix4fv(int32_t location, int32_t count, bool transpose,
float* values) {
GAPID_INFO("glUniformMatrix4fv(%" PRId32 ", %" PRId32 ", %d, %p)\n", location, count, transpose,
values);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_50_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_50_result;
Slice<Mat4f> l_v = slice((Mat4f*)(values), (uint64_t)(0), (uint64_t)(count));
std::shared_ptr<Program> l_program = l_ctx->mInstances.mPrograms[l_ctx->mBoundProgram];
Uniform l_uniform = l_program->mUniforms[location];
l_uniform.mValue = clone(l_v.as<uint8_t>());
l_program->mUniforms[location] = l_uniform;
observe(observations.mReads);
mImports.glUniformMatrix4fv(location, count, transpose, values);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlUniformMatrix4fv coder(
observations, location, count, transpose,
gapic::coder::gles::F32__CP(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(values), 0)));
mEncoder->Object(&coder);
}
inline void GlesSpy::glGetUniformfv(uint32_t program, int32_t location, float* values) {
GAPID_INFO("glGetUniformfv(%" PRIu32 ", %" PRId32 ", %p)\n", program, location, values);
Observations observations;
do {
observe(observations.mReads);
mImports.glGetUniformfv(program, location, values);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlGetUniformfv coder(
observations, program, location,
gapic::coder::gles::F32__CP(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(values), 0)));
mEncoder->Object(&coder);
}
inline void GlesSpy::glGetUniformiv(uint32_t program, int32_t location, int32_t* values) {
GAPID_INFO("glGetUniformiv(%" PRIu32 ", %" PRId32 ", %p)\n", program, location, values);
Observations observations;
do {
observe(observations.mReads);
mImports.glGetUniformiv(program, location, values);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlGetUniformiv coder(
observations, program, location,
gapic::coder::gles::S32__CP(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(values), 0)));
mEncoder->Object(&coder);
}
inline void GlesSpy::glVertexAttrib1f(int32_t location, float value0) {
GAPID_INFO("glVertexAttrib1f(%" PRId32 ", %f)\n", location, value0);
Observations observations;
do {
observe(observations.mReads);
mImports.glVertexAttrib1f(location, value0);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlVertexAttrib1f coder(observations, location, value0);
mEncoder->Object(&coder);
}
inline void GlesSpy::glVertexAttrib2f(int32_t location, float value0, float value1) {
GAPID_INFO("glVertexAttrib2f(%" PRId32 ", %f, %f)\n", location, value0, value1);
Observations observations;
do {
observe(observations.mReads);
mImports.glVertexAttrib2f(location, value0, value1);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlVertexAttrib2f coder(observations, location, value0, value1);
mEncoder->Object(&coder);
}
inline void GlesSpy::glVertexAttrib3f(int32_t location, float value0, float value1, float value2) {
GAPID_INFO("glVertexAttrib3f(%" PRId32 ", %f, %f, %f)\n", location, value0, value1, value2);
Observations observations;
do {
observe(observations.mReads);
mImports.glVertexAttrib3f(location, value0, value1, value2);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlVertexAttrib3f coder(observations, location, value0, value1, value2);
mEncoder->Object(&coder);
}
inline void GlesSpy::glVertexAttrib4f(int32_t location, float value0, float value1, float value2,
float value3) {
GAPID_INFO("glVertexAttrib4f(%" PRId32 ", %f, %f, %f, %f)\n", location, value0, value1, value2,
value3);
Observations observations;
do {
observe(observations.mReads);
mImports.glVertexAttrib4f(location, value0, value1, value2, value3);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlVertexAttrib4f coder(observations, location, value0, value1, value2,
value3);
mEncoder->Object(&coder);
}
inline void GlesSpy::glVertexAttrib1fv(int32_t location, float* value) {
GAPID_INFO("glVertexAttrib1fv(%" PRId32 ", %p)\n", location, value);
Observations observations;
do {
read(slice(value, 0, 1));
observe(observations.mReads);
mImports.glVertexAttrib1fv(location, value);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlVertexAttrib1fv coder(
observations, location, gapic::coder::gles::F32__CP(gapic::coder::memory::Pointer(
reinterpret_cast<uintptr_t>(value), 0)));
mEncoder->Object(&coder);
}
inline void GlesSpy::glVertexAttrib2fv(int32_t location, float* value) {
GAPID_INFO("glVertexAttrib2fv(%" PRId32 ", %p)\n", location, value);
Observations observations;
do {
read(slice(value, 0, 2));
observe(observations.mReads);
mImports.glVertexAttrib2fv(location, value);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlVertexAttrib2fv coder(
observations, location, gapic::coder::gles::F32__CP(gapic::coder::memory::Pointer(
reinterpret_cast<uintptr_t>(value), 0)));
mEncoder->Object(&coder);
}
inline void GlesSpy::glVertexAttrib3fv(int32_t location, float* value) {
GAPID_INFO("glVertexAttrib3fv(%" PRId32 ", %p)\n", location, value);
Observations observations;
do {
read(slice(value, 0, 3));
observe(observations.mReads);
mImports.glVertexAttrib3fv(location, value);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlVertexAttrib3fv coder(
observations, location, gapic::coder::gles::F32__CP(gapic::coder::memory::Pointer(
reinterpret_cast<uintptr_t>(value), 0)));
mEncoder->Object(&coder);
}
inline void GlesSpy::glVertexAttrib4fv(int32_t location, float* value) {
GAPID_INFO("glVertexAttrib4fv(%" PRId32 ", %p)\n", location, value);
Observations observations;
do {
read(slice(value, 0, 4));
observe(observations.mReads);
mImports.glVertexAttrib4fv(location, value);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlVertexAttrib4fv coder(
observations, location, gapic::coder::gles::F32__CP(gapic::coder::memory::Pointer(
reinterpret_cast<uintptr_t>(value), 0)));
mEncoder->Object(&coder);
}
inline void GlesSpy::glGetShaderPrecisionFormat(uint32_t shader_type, uint32_t precision_type,
int32_t* range, int32_t* precision) {
GAPID_INFO("glGetShaderPrecisionFormat(%u, %u, %p, %p)\n", shader_type, precision_type, range,
precision);
Observations observations;
do {
observe(observations.mReads);
mImports.glGetShaderPrecisionFormat(shader_type, precision_type, range, precision);
write(slice(range, 0, 2));
write(slice(precision, 0, 1), 0, slice(precision, 0, 1)[0]);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlGetShaderPrecisionFormat coder(
observations, shader_type, precision_type,
gapic::coder::gles::S32__P(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(range), 0)),
gapic::coder::gles::S32__P(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(precision), 0)));
mEncoder->Object(&coder);
}
inline void GlesSpy::glDepthMask(bool enabled) {
GAPID_INFO("glDepthMask(%d)\n", enabled);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_51_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_51_result;
l_ctx->mRasterizing.mDepthMask = enabled;
observe(observations.mReads);
mImports.glDepthMask(enabled);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlDepthMask coder(observations, enabled);
mEncoder->Object(&coder);
}
inline void GlesSpy::glDepthFunc(uint32_t function) {
GAPID_INFO("glDepthFunc(%u)\n", function);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_52_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_52_result;
l_ctx->mRasterizing.mDepthTestFunction = function;
observe(observations.mReads);
mImports.glDepthFunc(function);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlDepthFunc coder(observations, function);
mEncoder->Object(&coder);
}
inline void GlesSpy::glDepthRangef(float near, float far) {
GAPID_INFO("glDepthRangef(%f, %f)\n", near, far);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_53_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_53_result;
l_ctx->mRasterizing.mDepthNear = near;
l_ctx->mRasterizing.mDepthFar = far;
observe(observations.mReads);
mImports.glDepthRangef(near, far);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlDepthRangef coder(observations, near, far);
mEncoder->Object(&coder);
}
inline void GlesSpy::glColorMask(bool red, bool green, bool blue, bool alpha) {
GAPID_INFO("glColorMask(%d, %d, %d, %d)\n", red, green, blue, alpha);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_54_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_54_result;
l_ctx->mRasterizing.mColorMaskRed = red;
l_ctx->mRasterizing.mColorMaskGreen = green;
l_ctx->mRasterizing.mColorMaskBlue = blue;
l_ctx->mRasterizing.mColorMaskAlpha = alpha;
observe(observations.mReads);
mImports.glColorMask(red, green, blue, alpha);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlColorMask coder(observations, red, green, blue, alpha);
mEncoder->Object(&coder);
}
inline void GlesSpy::glStencilMask(uint32_t mask) {
GAPID_INFO("glStencilMask(%" PRIu32 ")\n", mask);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_55_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_55_result;
l_ctx->mRasterizing.mStencilMask[GLenum::GL_FRONT] = mask;
l_ctx->mRasterizing.mStencilMask[GLenum::GL_BACK] = mask;
observe(observations.mReads);
mImports.glStencilMask(mask);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlStencilMask coder(observations, mask);
mEncoder->Object(&coder);
}
inline void GlesSpy::glStencilMaskSeparate(uint32_t face, uint32_t mask) {
GAPID_INFO("glStencilMaskSeparate(%u, %" PRIu32 ")\n", face, mask);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_56_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_56_result;
switch (face) {
case GLenum::GL_FRONT: {
l_ctx->mRasterizing.mStencilMask[GLenum::GL_FRONT] = mask;
break;
}
case GLenum::GL_BACK: {
l_ctx->mRasterizing.mStencilMask[GLenum::GL_BACK] = mask;
break;
}
case GLenum::GL_FRONT_AND_BACK: {
l_ctx->mRasterizing.mStencilMask[GLenum::GL_FRONT] = mask;
l_ctx->mRasterizing.mStencilMask[GLenum::GL_BACK] = mask;
break;
}
}
observe(observations.mReads);
mImports.glStencilMaskSeparate(face, mask);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlStencilMaskSeparate coder(observations, face, mask);
mEncoder->Object(&coder);
}
inline void GlesSpy::glStencilFuncSeparate(uint32_t face, uint32_t function,
int32_t reference_value, int32_t mask) {
GAPID_INFO("glStencilFuncSeparate(%u, %u, %" PRId32 ", %" PRId32 ")\n", face, function,
reference_value, mask);
Observations observations;
do {
observe(observations.mReads);
mImports.glStencilFuncSeparate(face, function, reference_value, mask);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlStencilFuncSeparate coder(observations, face, function, reference_value,
mask);
mEncoder->Object(&coder);
}
inline void GlesSpy::glStencilOpSeparate(uint32_t face, uint32_t stencil_fail,
uint32_t stencil_pass_depth_fail,
uint32_t stencil_pass_depth_pass) {
GAPID_INFO("glStencilOpSeparate(%u, %u, %u, %u)\n", face, stencil_fail, stencil_pass_depth_fail,
stencil_pass_depth_pass);
Observations observations;
do {
observe(observations.mReads);
mImports.glStencilOpSeparate(face, stencil_fail, stencil_pass_depth_fail,
stencil_pass_depth_pass);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlStencilOpSeparate coder(observations, face, stencil_fail,
stencil_pass_depth_fail, stencil_pass_depth_pass);
mEncoder->Object(&coder);
}
inline void GlesSpy::glFrontFace(uint32_t orientation) {
GAPID_INFO("glFrontFace(%u)\n", orientation);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_57_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_57_result;
l_ctx->mRasterizing.mFrontFace = orientation;
observe(observations.mReads);
mImports.glFrontFace(orientation);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlFrontFace coder(observations, orientation);
mEncoder->Object(&coder);
}
inline void GlesSpy::glViewport(int32_t x, int32_t y, int32_t width, int32_t height) {
GAPID_INFO("glViewport(%" PRId32 ", %" PRId32 ", %" PRId32 ", %" PRId32 ")\n", x, y, width,
height);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_58_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_58_result;
l_ctx->mRasterizing.mViewport = Rect().SetX(x).SetY(y).SetWidth(width).SetHeight(height);
observe(observations.mReads);
mImports.glViewport(x, y, width, height);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlViewport coder(observations, x, y, width, height);
mEncoder->Object(&coder);
}
inline void GlesSpy::glScissor(int32_t x, int32_t y, int32_t width, int32_t height) {
GAPID_INFO("glScissor(%" PRId32 ", %" PRId32 ", %" PRId32 ", %" PRId32 ")\n", x, y, width,
height);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_59_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_59_result;
l_ctx->mRasterizing.mScissor = Rect().SetX(x).SetY(y).SetWidth(width).SetHeight(height);
observe(observations.mReads);
mImports.glScissor(x, y, width, height);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlScissor coder(observations, x, y, width, height);
mEncoder->Object(&coder);
}
inline void GlesSpy::glActiveTexture(uint32_t unit) {
GAPID_INFO("glActiveTexture(%u)\n", unit);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_60_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_60_result;
l_ctx->mActiveTextureUnit = unit;
if (!(l_ctx->mTextureUnits.count(unit) > 0)) {
l_ctx->mTextureUnits[unit] = l_ctx->mTextureUnits[unit];
}
observe(observations.mReads);
mImports.glActiveTexture(unit);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlActiveTexture coder(observations, unit);
mEncoder->Object(&coder);
}
inline void GlesSpy::glGenTextures(int32_t count, uint32_t* textures) {
GAPID_INFO("glGenTextures(%" PRId32 ", %p)\n", count, textures);
Observations observations;
do {
Slice<TextureId> l_t = slice(textures, (uint64_t)(0), (uint64_t)(count));
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_61_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_61_result;
observe(observations.mReads);
mImports.glGenTextures(count, textures);
for (int32_t l_i = 0; l_i < count; ++l_i) {
TextureId l_id =
(TextureId)(slice(textures, (uint64_t)(0), (uint64_t)(count))[(uint64_t)(l_i)]);
l_ctx->mInstances.mTextures[l_id] = std::shared_ptr<Texture>((new Texture()));
write(l_t, (uint64_t)(l_i), l_id);
}
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlGenTextures coder(
observations, count, gapic::coder::gles::TextureId__P(gapic::coder::memory::Pointer(
reinterpret_cast<uintptr_t>(textures), 0)));
mEncoder->Object(&coder);
}
inline void GlesSpy::glDeleteTextures(int32_t count, uint32_t* textures) {
GAPID_INFO("glDeleteTextures(%" PRId32 ", %p)\n", count, textures);
Observations observations;
do {
Slice<TextureId> l_t = slice(textures, (uint64_t)(0), (uint64_t)(count));
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_62_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_62_result;
for (int32_t l_i = 0; l_i < count; ++l_i) {
l_ctx->mInstances.mTextures[read(l_t, (uint64_t)(l_i))] = std::shared_ptr<Texture>();
}
observe(observations.mReads);
mImports.glDeleteTextures(count, textures);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlDeleteTextures coder(
observations, count, gapic::coder::gles::TextureId__CP(gapic::coder::memory::Pointer(
reinterpret_cast<uintptr_t>(textures), 0)));
mEncoder->Object(&coder);
}
inline bool GlesSpy::glIsTexture(uint32_t texture) {
GAPID_INFO("glIsTexture(%" PRIu32 ")\n", texture);
bool result = false;
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_63_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_63_result;
observe(observations.mReads);
result = mImports.glIsTexture(texture);
break;
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlIsTexture coder(observations, texture, result);
mEncoder->Object(&coder);
return result;
}
inline void GlesSpy::glBindTexture(uint32_t target, uint32_t texture) {
GAPID_INFO("glBindTexture(%u, %" PRIu32 ")\n", target, texture);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_64_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_64_result;
if (!(l_ctx->mInstances.mTextures.count(texture) > 0)) {
l_ctx->mInstances.mTextures[texture] = std::shared_ptr<Texture>((new Texture()));
}
l_ctx->mTextureUnits[l_ctx->mActiveTextureUnit][target] = texture;
observe(observations.mReads);
mImports.glBindTexture(target, texture);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlBindTexture coder(observations, target, texture);
mEncoder->Object(&coder);
}
inline void GlesSpy::glTexImage2D(uint32_t target, int32_t level, uint32_t internal_format,
int32_t width, int32_t height, int32_t border, uint32_t format,
uint32_t type, void* data) {
GAPID_INFO("glTexImage2D(%u, %" PRId32 ", %u, %" PRId32 ", %" PRId32 ", %" PRId32
", %u, %u, %p)\n",
target, level, internal_format, width, height, border, format, type, data);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_65_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_65_result;
switch (target) {
case GLenum::GL_TEXTURE_2D: {
TextureId l_id =
l_ctx->mTextureUnits[l_ctx->mActiveTextureUnit][GLenum::GL_TEXTURE_2D];
std::shared_ptr<Texture> l_t = l_ctx->mInstances.mTextures[l_id];
Image l_l = Image()
.SetWidth(width)
.SetHeight(height)
.SetSize(imageSize((uint32_t)(width), (uint32_t)(height),
format, type))
.SetFormat(format);
if (data != nullptr) {
if (l_ctx->mBoundBuffers[GLenum::GL_PIXEL_UNPACK_BUFFER] == (BufferId)(0)) {
l_l.mData = clone(
slice((uint8_t*)(data), (uint64_t)(0), (uint64_t)(l_l.mSize)));
}
} else {
l_l.mData = make<uint8_t>((uint64_t)(l_l.mSize));
}
l_t->mTexture2D[level] = l_l;
l_t->mKind = TextureKind::TEXTURE2D;
l_t->mFormat = format;
break;
}
case GLenum::GL_TEXTURE_CUBE_MAP_POSITIVE_X: // fall-through...
case GLenum::GL_TEXTURE_CUBE_MAP_POSITIVE_Y: // fall-through...
case GLenum::GL_TEXTURE_CUBE_MAP_POSITIVE_Z: // fall-through...
case GLenum::GL_TEXTURE_CUBE_MAP_NEGATIVE_X: // fall-through...
case GLenum::GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: // fall-through...
case GLenum::GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: {
TextureId l_id = l_ctx->mTextureUnits[l_ctx->mActiveTextureUnit]
[GLenum::GL_TEXTURE_CUBE_MAP];
std::shared_ptr<Texture> l_t = l_ctx->mInstances.mTextures[l_id];
Image l_l = Image()
.SetWidth(width)
.SetHeight(height)
.SetSize(imageSize((uint32_t)(width), (uint32_t)(height),
format, type))
.SetFormat(format);
if (data != nullptr) {
if (l_ctx->mBoundBuffers[GLenum::GL_PIXEL_UNPACK_BUFFER] == (BufferId)(0)) {
l_l.mData = clone(
slice((uint8_t*)(data), (uint64_t)(0), (uint64_t)(l_l.mSize)));
}
} else {
l_l.mData = make<uint8_t>((uint64_t)(l_l.mSize));
}
CubemapLevel l_cube = l_t->mCubemap[level];
l_cube.mFaces[target] = l_l;
l_t->mCubemap[level] = l_cube;
l_t->mKind = TextureKind::CUBEMAP;
l_t->mFormat = format;
break;
}
}
observe(observations.mReads);
mImports.glTexImage2D(target, level, internal_format, width, height, border, format, type,
data);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlTexImage2D coder(
observations, target, level, internal_format, width, height, border, format, type,
gapic::coder::gles::TexturePointer(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(data), 0)));
mEncoder->Object(&coder);
}
inline void GlesSpy::glTexSubImage2D(uint32_t target, int32_t level, int32_t xoffset,
int32_t yoffset, int32_t width, int32_t height,
uint32_t format, uint32_t type, void* data) {
GAPID_INFO("glTexSubImage2D(%u, %" PRId32 ", %" PRId32 ", %" PRId32 ", %" PRId32 ", %" PRId32
", %u, %u, %p)\n",
target, level, xoffset, yoffset, width, height, format, type, data);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_66_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_66_result;
switch (target) {
case GLenum::GL_TEXTURE_2D: {
TextureId l_id =
l_ctx->mTextureUnits[l_ctx->mActiveTextureUnit][GLenum::GL_TEXTURE_2D];
std::shared_ptr<Texture> l_t = l_ctx->mInstances.mTextures[l_id];
Image l_l = Image()
.SetWidth(width)
.SetHeight(height)
.SetSize(imageSize((uint32_t)(width), (uint32_t)(height),
format, type))
.SetFormat(format);
if (l_ctx->mBoundBuffers[GLenum::GL_PIXEL_UNPACK_BUFFER] == (BufferId)(0) &&
data != nullptr) {
l_l.mData =
clone(slice((uint8_t*)(data), (uint64_t)(0), (uint64_t)(l_l.mSize)));
}
l_t->mTexture2D[level] = l_l;
l_t->mKind = TextureKind::TEXTURE2D;
l_t->mFormat = format;
break;
}
case GLenum::GL_TEXTURE_CUBE_MAP_POSITIVE_X: // fall-through...
case GLenum::GL_TEXTURE_CUBE_MAP_POSITIVE_Y: // fall-through...
case GLenum::GL_TEXTURE_CUBE_MAP_POSITIVE_Z: // fall-through...
case GLenum::GL_TEXTURE_CUBE_MAP_NEGATIVE_X: // fall-through...
case GLenum::GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: // fall-through...
case GLenum::GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: {
TextureId l_id = l_ctx->mTextureUnits[l_ctx->mActiveTextureUnit]
[GLenum::GL_TEXTURE_CUBE_MAP];
std::shared_ptr<Texture> l_t = l_ctx->mInstances.mTextures[l_id];
Image l_l = Image()
.SetWidth(width)
.SetHeight(height)
.SetSize(imageSize((uint32_t)(width), (uint32_t)(height),
format, type))
.SetFormat(format);
if (l_ctx->mBoundBuffers[GLenum::GL_PIXEL_UNPACK_BUFFER] == (BufferId)(0) &&
data != nullptr) {
l_l.mData =
clone(slice((uint8_t*)(data), (uint64_t)(0), (uint64_t)(l_l.mSize)));
}
CubemapLevel l_cube = l_t->mCubemap[level];
l_cube.mFaces[target] = l_l;
l_t->mCubemap[level] = l_cube;
l_t->mKind = TextureKind::CUBEMAP;
l_t->mFormat = format;
break;
}
}
observe(observations.mReads);
mImports.glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type,
data);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlTexSubImage2D coder(
observations, target, level, xoffset, yoffset, width, height, format, type,
gapic::coder::gles::TexturePointer(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(data), 0)));
mEncoder->Object(&coder);
}
inline void GlesSpy::glCopyTexImage2D(uint32_t target, int32_t level, uint32_t format, int32_t x,
int32_t y, int32_t width, int32_t height, int32_t border) {
GAPID_INFO("glCopyTexImage2D(%u, %" PRId32 ", %u, %" PRId32 ", %" PRId32 ", %" PRId32
", %" PRId32 ", %" PRId32 ")\n",
target, level, format, x, y, width, height, border);
Observations observations;
do {
observe(observations.mReads);
mImports.glCopyTexImage2D(target, level, format, x, y, width, height, border);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlCopyTexImage2D coder(observations, target, level, format, x, y, width,
height, border);
mEncoder->Object(&coder);
}
inline void GlesSpy::glCopyTexSubImage2D(uint32_t target, int32_t level, int32_t xoffset,
int32_t yoffset, int32_t x, int32_t y, int32_t width,
int32_t height) {
GAPID_INFO("glCopyTexSubImage2D(%u, %" PRId32 ", %" PRId32 ", %" PRId32 ", %" PRId32
", %" PRId32 ", %" PRId32 ", %" PRId32 ")\n",
target, level, xoffset, yoffset, x, y, width, height);
Observations observations;
do {
observe(observations.mReads);
mImports.glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlCopyTexSubImage2D coder(observations, target, level, xoffset, yoffset, x,
y, width, height);
mEncoder->Object(&coder);
}
inline void GlesSpy::glCompressedTexImage2D(uint32_t target, int32_t level, uint32_t format,
int32_t width, int32_t height, int32_t border,
int32_t image_size, void* data) {
GAPID_INFO("glCompressedTexImage2D(%u, %" PRId32 ", %u, %" PRId32 ", %" PRId32 ", %" PRId32
", %" PRId32 ", %p)\n",
target, level, format, width, height, border, image_size, data);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_67_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_67_result;
switch (target) {
case GLenum::GL_TEXTURE_2D: {
TextureId l_id =
l_ctx->mTextureUnits[l_ctx->mActiveTextureUnit][GLenum::GL_TEXTURE_2D];
std::shared_ptr<Texture> l_t = l_ctx->mInstances.mTextures[l_id];
Image l_l = Image()
.SetWidth(width)
.SetHeight(height)
.SetSize((uint32_t)(image_size))
.SetFormat(format);
if (l_ctx->mBoundBuffers[GLenum::GL_PIXEL_UNPACK_BUFFER] == (BufferId)(0) &&
data != nullptr) {
l_l.mData =
clone(slice((uint8_t*)(data), (uint64_t)(0), (uint64_t)(l_l.mSize)));
}
l_t->mTexture2D[level] = l_l;
l_t->mKind = TextureKind::TEXTURE2D;
l_t->mFormat = format;
break;
}
case GLenum::GL_TEXTURE_CUBE_MAP_POSITIVE_X: // fall-through...
case GLenum::GL_TEXTURE_CUBE_MAP_POSITIVE_Y: // fall-through...
case GLenum::GL_TEXTURE_CUBE_MAP_POSITIVE_Z: // fall-through...
case GLenum::GL_TEXTURE_CUBE_MAP_NEGATIVE_X: // fall-through...
case GLenum::GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: // fall-through...
case GLenum::GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: {
TextureId l_id = l_ctx->mTextureUnits[l_ctx->mActiveTextureUnit]
[GLenum::GL_TEXTURE_CUBE_MAP];
std::shared_ptr<Texture> l_t = l_ctx->mInstances.mTextures[l_id];
Image l_l = Image()
.SetWidth(width)
.SetHeight(height)
.SetSize((uint32_t)(image_size))
.SetFormat(format);
if (l_ctx->mBoundBuffers[GLenum::GL_PIXEL_UNPACK_BUFFER] == (BufferId)(0) &&
data != nullptr) {
l_l.mData =
clone(slice((uint8_t*)(data), (uint64_t)(0), (uint64_t)(l_l.mSize)));
}
CubemapLevel l_cube = l_t->mCubemap[level];
l_cube.mFaces[target] = l_l;
l_t->mCubemap[level] = l_cube;
l_t->mKind = TextureKind::CUBEMAP;
l_t->mFormat = format;
break;
}
}
observe(observations.mReads);
mImports.glCompressedTexImage2D(target, level, format, width, height, border, image_size,
data);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlCompressedTexImage2D coder(
observations, target, level, format, width, height, border, image_size,
gapic::coder::gles::TexturePointer(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(data), 0)));
mEncoder->Object(&coder);
}
inline void GlesSpy::glCompressedTexSubImage2D(uint32_t target, int32_t level, int32_t xoffset,
int32_t yoffset, int32_t width, int32_t height,
uint32_t format, int32_t image_size, void* data) {
GAPID_INFO("glCompressedTexSubImage2D(%u, %" PRId32 ", %" PRId32 ", %" PRId32 ", %" PRId32
", %" PRId32 ", %u, %" PRId32 ", %p)\n",
target, level, xoffset, yoffset, width, height, format, image_size, data);
Observations observations;
do {
observe(observations.mReads);
mImports.glCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format,
image_size, data);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlCompressedTexSubImage2D coder(
observations, target, level, xoffset, yoffset, width, height, format, image_size,
gapic::coder::gles::TexturePointer(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(data), 0)));
mEncoder->Object(&coder);
}
inline void GlesSpy::glGenerateMipmap(uint32_t target) {
GAPID_INFO("glGenerateMipmap(%u)\n", target);
Observations observations;
do {
observe(observations.mReads);
mImports.glGenerateMipmap(target);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlGenerateMipmap coder(observations, target);
mEncoder->Object(&coder);
}
inline void GlesSpy::glReadPixels(int32_t x, int32_t y, int32_t width, int32_t height,
uint32_t format, uint32_t type, void* data) {
GAPID_INFO("glReadPixels(%" PRId32 ", %" PRId32 ", %" PRId32 ", %" PRId32 ", %u, %u, %p)\n", x,
y, width, height, format, type, data);
Observations observations;
do {
observe(observations.mReads);
mImports.glReadPixels(x, y, width, height, format, type, data);
write(slice(data, (uint64_t)(0),
(uint64_t)(imageSize((uint32_t)(width), (uint32_t)(height), format, type))));
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlReadPixels coder(
observations, x, y, width, height, format, type,
gapic::coder::gles::Void__P(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(data), 0)));
mEncoder->Object(&coder);
}
inline void GlesSpy::glGenFramebuffers(int32_t count, uint32_t* framebuffers) {
GAPID_INFO("glGenFramebuffers(%" PRId32 ", %p)\n", count, framebuffers);
Observations observations;
do {
Slice<FramebufferId> l_f = slice(framebuffers, (uint64_t)(0), (uint64_t)(count));
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_68_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_68_result;
observe(observations.mReads);
mImports.glGenFramebuffers(count, framebuffers);
for (int32_t l_i = 0; l_i < count; ++l_i) {
FramebufferId l_id = (FramebufferId)(
slice(framebuffers, (uint64_t)(0), (uint64_t)(count))[(uint64_t)(l_i)]);
l_ctx->mInstances.mFramebuffers[l_id] =
std::shared_ptr<Framebuffer>((new Framebuffer()));
write(l_f, (uint64_t)(l_i), l_id);
}
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlGenFramebuffers coder(
observations, count, gapic::coder::gles::FramebufferId__P(gapic::coder::memory::Pointer(
reinterpret_cast<uintptr_t>(framebuffers), 0)));
mEncoder->Object(&coder);
}
inline void GlesSpy::glBindFramebuffer(uint32_t target, uint32_t framebuffer) {
GAPID_INFO("glBindFramebuffer(%u, %" PRIu32 ")\n", target, framebuffer);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_69_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_69_result;
if (!(l_ctx->mInstances.mFramebuffers.count(framebuffer) > 0)) {
l_ctx->mInstances.mFramebuffers[framebuffer] =
std::shared_ptr<Framebuffer>((new Framebuffer()));
}
if (target == GLenum::GL_FRAMEBUFFER) {
l_ctx->mBoundFramebuffers[GLenum::GL_READ_FRAMEBUFFER] = framebuffer;
l_ctx->mBoundFramebuffers[GLenum::GL_DRAW_FRAMEBUFFER] = framebuffer;
} else {
l_ctx->mBoundFramebuffers[target] = framebuffer;
}
observe(observations.mReads);
mImports.glBindFramebuffer(target, framebuffer);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlBindFramebuffer coder(observations, target, framebuffer);
mEncoder->Object(&coder);
}
inline uint32_t GlesSpy::glCheckFramebufferStatus(uint32_t target) {
GAPID_INFO("glCheckFramebufferStatus(%u)\n", target);
uint32_t result = 0;
Observations observations;
do {
observe(observations.mReads);
result = mImports.glCheckFramebufferStatus(target);
break;
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlCheckFramebufferStatus coder(observations, target, result);
mEncoder->Object(&coder);
return result;
}
inline void GlesSpy::glDeleteFramebuffers(int32_t count, uint32_t* framebuffers) {
GAPID_INFO("glDeleteFramebuffers(%" PRId32 ", %p)\n", count, framebuffers);
Observations observations;
do {
Slice<FramebufferId> l_f = slice(framebuffers, (uint64_t)(0), (uint64_t)(count));
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_70_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_70_result;
for (int32_t l_i = 0; l_i < count; ++l_i) {
l_ctx->mInstances.mFramebuffers[read(l_f, (uint64_t)(l_i))] =
std::shared_ptr<Framebuffer>();
}
observe(observations.mReads);
mImports.glDeleteFramebuffers(count, framebuffers);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlDeleteFramebuffers coder(
observations, count,
gapic::coder::gles::FramebufferId__CP(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(framebuffers), 0)));
mEncoder->Object(&coder);
}
inline bool GlesSpy::glIsFramebuffer(uint32_t framebuffer) {
GAPID_INFO("glIsFramebuffer(%" PRIu32 ")\n", framebuffer);
bool result = false;
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_71_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_71_result;
observe(observations.mReads);
result = mImports.glIsFramebuffer(framebuffer);
break;
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlIsFramebuffer coder(observations, framebuffer, result);
mEncoder->Object(&coder);
return result;
}
inline void GlesSpy::glGenRenderbuffers(int32_t count, uint32_t* renderbuffers) {
GAPID_INFO("glGenRenderbuffers(%" PRId32 ", %p)\n", count, renderbuffers);
Observations observations;
do {
Slice<RenderbufferId> l_r = slice(renderbuffers, (uint64_t)(0), (uint64_t)(count));
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_72_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_72_result;
observe(observations.mReads);
mImports.glGenRenderbuffers(count, renderbuffers);
for (int32_t l_i = 0; l_i < count; ++l_i) {
RenderbufferId l_id = (RenderbufferId)(
slice(renderbuffers, (uint64_t)(0), (uint64_t)(count))[(uint64_t)(l_i)]);
l_ctx->mInstances.mRenderbuffers[l_id] =
std::shared_ptr<Renderbuffer>((new Renderbuffer()));
write(l_r, (uint64_t)(l_i), l_id);
}
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlGenRenderbuffers coder(
observations, count,
gapic::coder::gles::RenderbufferId__P(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(renderbuffers), 0)));
mEncoder->Object(&coder);
}
inline void GlesSpy::glBindRenderbuffer(uint32_t target, uint32_t renderbuffer) {
GAPID_INFO("glBindRenderbuffer(%u, %" PRIu32 ")\n", target, renderbuffer);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_73_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_73_result;
if (!(l_ctx->mInstances.mRenderbuffers.count(renderbuffer) > 0)) {
l_ctx->mInstances.mRenderbuffers[renderbuffer] =
std::shared_ptr<Renderbuffer>((new Renderbuffer()));
}
l_ctx->mBoundRenderbuffers[target] = renderbuffer;
observe(observations.mReads);
mImports.glBindRenderbuffer(target, renderbuffer);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlBindRenderbuffer coder(observations, target, renderbuffer);
mEncoder->Object(&coder);
}
inline void GlesSpy::glRenderbufferStorage(uint32_t target, uint32_t format, int32_t width,
int32_t height) {
GAPID_INFO("glRenderbufferStorage(%u, %u, %" PRId32 ", %" PRId32 ")\n", target, format, width,
height);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_74_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_74_result;
RenderbufferId l_id = l_ctx->mBoundRenderbuffers[target];
std::shared_ptr<Renderbuffer> l_rb = l_ctx->mInstances.mRenderbuffers[l_id];
l_rb->mFormat = format;
l_rb->mWidth = width;
l_rb->mHeight = height;
observe(observations.mReads);
mImports.glRenderbufferStorage(target, format, width, height);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlRenderbufferStorage coder(observations, target, format, width, height);
mEncoder->Object(&coder);
}
inline void GlesSpy::glDeleteRenderbuffers(int32_t count, uint32_t* renderbuffers) {
GAPID_INFO("glDeleteRenderbuffers(%" PRId32 ", %p)\n", count, renderbuffers);
Observations observations;
do {
Slice<RenderbufferId> l_r = slice(renderbuffers, (uint64_t)(0), (uint64_t)(count));
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_75_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_75_result;
for (int32_t l_i = 0; l_i < count; ++l_i) {
l_ctx->mInstances.mRenderbuffers[read(l_r, (uint64_t)(l_i))] =
std::shared_ptr<Renderbuffer>();
}
observe(observations.mReads);
mImports.glDeleteRenderbuffers(count, renderbuffers);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlDeleteRenderbuffers coder(
observations, count,
gapic::coder::gles::RenderbufferId__CP(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(renderbuffers), 0)));
mEncoder->Object(&coder);
}
inline bool GlesSpy::glIsRenderbuffer(uint32_t renderbuffer) {
GAPID_INFO("glIsRenderbuffer(%" PRIu32 ")\n", renderbuffer);
bool result = false;
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_76_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_76_result;
observe(observations.mReads);
result = mImports.glIsRenderbuffer(renderbuffer);
break;
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlIsRenderbuffer coder(observations, renderbuffer, result);
mEncoder->Object(&coder);
return result;
}
inline void GlesSpy::glGetRenderbufferParameteriv(uint32_t target, uint32_t parameter,
int32_t* values) {
GAPID_INFO("glGetRenderbufferParameteriv(%u, %u, %p)\n", target, parameter, values);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_77_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_77_result;
RenderbufferId l_id = l_ctx->mBoundRenderbuffers[target];
std::shared_ptr<Renderbuffer> l_rb = l_ctx->mInstances.mRenderbuffers[l_id];
observe(observations.mReads);
mImports.glGetRenderbufferParameteriv(target, parameter, values);
write(slice(values, 0, 1), 0, /* clang-format off */
/* switch(parameter) */
/* case GLenum::GL_RENDERBUFFER_WIDTH: */(((parameter) == (GLenum::GL_RENDERBUFFER_WIDTH))) ? (l_rb->mWidth) :
/* case GLenum::GL_RENDERBUFFER_HEIGHT: */(((parameter) == (GLenum::GL_RENDERBUFFER_HEIGHT))) ? (l_rb->mHeight) :
/* case GLenum::GL_RENDERBUFFER_INTERNAL_FORMAT: */(((parameter) == (GLenum::GL_RENDERBUFFER_INTERNAL_FORMAT))) ? ((int32_t)(l_rb->mFormat)) :
/* default: */ 0 /* clang-format on */);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlGetRenderbufferParameteriv coder(
observations, target, parameter,
gapic::coder::gles::S32__P(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(values), 0)));
mEncoder->Object(&coder);
}
inline void GlesSpy::glGenBuffers(int32_t count, uint32_t* buffers) {
GAPID_INFO("glGenBuffers(%" PRId32 ", %p)\n", count, buffers);
Observations observations;
do {
Slice<BufferId> l_b = slice(buffers, (uint64_t)(0), (uint64_t)(count));
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_78_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_78_result;
observe(observations.mReads);
mImports.glGenBuffers(count, buffers);
for (int32_t l_i = 0; l_i < count; ++l_i) {
BufferId l_id =
(BufferId)(slice(buffers, (uint64_t)(0), (uint64_t)(count))[(uint64_t)(l_i)]);
l_ctx->mInstances.mBuffers[l_id] = std::shared_ptr<Buffer>((new Buffer()));
write(l_b, (uint64_t)(l_i), l_id);
}
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlGenBuffers coder(
observations, count, gapic::coder::gles::BufferId__P(gapic::coder::memory::Pointer(
reinterpret_cast<uintptr_t>(buffers), 0)));
mEncoder->Object(&coder);
}
inline void GlesSpy::glBindBuffer(uint32_t target, uint32_t buffer) {
GAPID_INFO("glBindBuffer(%u, %" PRIu32 ")\n", target, buffer);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_79_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_79_result;
if (!(l_ctx->mInstances.mBuffers.count(buffer) > 0)) {
l_ctx->mInstances.mBuffers[buffer] = std::shared_ptr<Buffer>((new Buffer()));
}
l_ctx->mBoundBuffers[target] = buffer;
observe(observations.mReads);
mImports.glBindBuffer(target, buffer);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlBindBuffer coder(observations, target, buffer);
mEncoder->Object(&coder);
}
inline void GlesSpy::glBufferData(uint32_t target, int32_t size, void* data, uint32_t usage) {
GAPID_INFO("glBufferData(%u, %" PRId32 ", %p, %u)\n", target, size, data, usage);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_80_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_80_result;
BufferId l_id = l_ctx->mBoundBuffers[target];
std::shared_ptr<Buffer> l_b = l_ctx->mInstances.mBuffers[l_id];
l_b->mData = /* clang-format off */
/* switch(data != nullptr) */
/* case true: */(((data != nullptr) == (true))) ? (clone(slice((uint8_t*)(data), (uint64_t)(0), (uint64_t)(size)))) :
/* case false: */(((data != nullptr) == (false))) ? (make<uint8_t>((uint64_t)(size))) :
/* default: */ Slice<uint8_t>() /* clang-format on */;
l_b->mSize = size;
l_b->mUsage = usage;
observe(observations.mReads);
mImports.glBufferData(target, size, data, usage);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlBufferData coder(
observations, target, size,
gapic::coder::gles::BufferDataPointer(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(data), 0)),
usage);
mEncoder->Object(&coder);
}
inline void GlesSpy::glBufferSubData(uint32_t target, int32_t offset, int32_t size, void* data) {
GAPID_INFO("glBufferSubData(%u, %" PRId32 ", %" PRId32 ", %p)\n", target, offset, size, data);
Observations observations;
do {
read(slice(data, (uint64_t)(0), (uint64_t)(size)));
observe(observations.mReads);
mImports.glBufferSubData(target, offset, size, data);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlBufferSubData coder(
observations, target, offset, size,
gapic::coder::gles::BufferDataPointer(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(data), 0)));
mEncoder->Object(&coder);
}
inline void GlesSpy::glDeleteBuffers(int32_t count, uint32_t* buffers) {
GAPID_INFO("glDeleteBuffers(%" PRId32 ", %p)\n", count, buffers);
Observations observations;
do {
Slice<BufferId> l_b = slice(buffers, (uint64_t)(0), (uint64_t)(count));
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_81_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_81_result;
for (int32_t l_i = 0; l_i < count; ++l_i) {
l_ctx->mInstances.mBuffers[read(l_b, (uint64_t)(l_i))] = std::shared_ptr<Buffer>();
}
observe(observations.mReads);
mImports.glDeleteBuffers(count, buffers);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlDeleteBuffers coder(
observations, count, gapic::coder::gles::BufferId__CP(gapic::coder::memory::Pointer(
reinterpret_cast<uintptr_t>(buffers), 0)));
mEncoder->Object(&coder);
}
inline bool GlesSpy::glIsBuffer(uint32_t buffer) {
GAPID_INFO("glIsBuffer(%" PRIu32 ")\n", buffer);
bool result = false;
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_82_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_82_result;
observe(observations.mReads);
result = mImports.glIsBuffer(buffer);
break;
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlIsBuffer coder(observations, buffer, result);
mEncoder->Object(&coder);
return result;
}
inline void GlesSpy::glGetBufferParameteriv(uint32_t target, uint32_t parameter, int32_t* value) {
GAPID_INFO("glGetBufferParameteriv(%u, %u, %p)\n", target, parameter, value);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_83_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_83_result;
BufferId l_id = l_ctx->mBoundBuffers[target];
std::shared_ptr<Buffer> l_b = l_ctx->mInstances.mBuffers[l_id];
observe(observations.mReads);
mImports.glGetBufferParameteriv(target, parameter, value);
write(slice(value, 0, 1), 0, /* clang-format off */
/* switch(parameter) */
/* case GLenum::GL_BUFFER_SIZE: */(((parameter) == (GLenum::GL_BUFFER_SIZE))) ? (l_b->mSize) :
/* case GLenum::GL_BUFFER_USAGE: */(((parameter) == (GLenum::GL_BUFFER_USAGE))) ? ((int32_t)(l_b->mUsage)) :
/* default: */ 0 /* clang-format on */);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlGetBufferParameteriv coder(
observations, target, parameter,
gapic::coder::gles::S32__P(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(value), 0)));
mEncoder->Object(&coder);
}
inline uint32_t GlesSpy::glCreateShader(uint32_t type) {
GAPID_INFO("glCreateShader(%u)\n", type);
uint32_t result = 0;
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_84_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_84_result;
observe(observations.mReads);
result = mImports.glCreateShader(type);
ShaderId l_id = (ShaderId)(result);
l_ctx->mInstances.mShaders[l_id] = std::shared_ptr<Shader>((new Shader()));
std::shared_ptr<Shader> l_s = l_ctx->mInstances.mShaders[l_id];
l_s->mType = type;
break;
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlCreateShader coder(observations, type, result);
mEncoder->Object(&coder);
return result;
}
inline void GlesSpy::glDeleteShader(uint32_t shader) {
GAPID_INFO("glDeleteShader(%" PRIu32 ")\n", shader);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_85_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_85_result;
std::shared_ptr<Shader> l_s = l_ctx->mInstances.mShaders[shader];
l_s->mDeletable = true;
l_ctx->mInstances.mShaders[shader] = std::shared_ptr<Shader>();
observe(observations.mReads);
mImports.glDeleteShader(shader);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlDeleteShader coder(observations, shader);
mEncoder->Object(&coder);
}
inline void GlesSpy::glShaderSource(uint32_t shader, int32_t count, char** source,
int32_t* length) {
GAPID_INFO("glShaderSource(%" PRIu32 ", %" PRId32 ", %p, %p)\n", shader, count, source, length);
Observations observations;
do {
Slice<char*> l_sources = slice(source, (uint64_t)(0), (uint64_t)(count));
Slice<int32_t> l_lengths = slice(length, (uint64_t)(0), (uint64_t)(count));
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_86_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_86_result;
std::shared_ptr<Shader> l_s = l_ctx->mInstances.mShaders[shader];
for (int32_t l_i = 0; l_i < count; ++l_i) {
std::string l_str = /* clang-format off */
/* switch(length == nullptr || read(l_lengths, (uint64_t)(l_i)) < 0) */
/* case true: */(((length == nullptr || read(l_lengths, (uint64_t)(l_i)) < 0) == (true))) ? (string(read(l_sources, (uint64_t)(l_i)))) :
/* case false: */(((length == nullptr || read(l_lengths, (uint64_t)(l_i)) < 0) == (false))) ? (string(slice(read(l_sources, (uint64_t)(l_i)), (uint64_t)(0), (uint64_t)(read(l_lengths, (uint64_t)(l_i)))))) :
/* default: */ "" /* clang-format on */;
l_s->mSource += l_str;
}
observe(observations.mReads);
mImports.glShaderSource(shader, count, source, length);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlShaderSource coder(
observations, shader, count,
gapic::coder::gles::Char__CP__CP(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(source), 0)),
gapic::coder::gles::S32__CP(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(length), 0)));
mEncoder->Object(&coder);
}
inline void GlesSpy::glShaderBinary(int32_t count, uint32_t* shaders, uint32_t binary_format,
void* binary, int32_t binary_size) {
GAPID_INFO("glShaderBinary(%" PRId32 ", %p, %" PRIu32 ", %p, %" PRId32 ")\n", count, shaders,
binary_format, binary, binary_size);
Observations observations;
do {
for (int32_t l_i = 0; l_i < count; ++l_i) {
}
observe(observations.mReads);
mImports.glShaderBinary(count, shaders, binary_format, binary, binary_size);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlShaderBinary coder(
observations, count, gapic::coder::gles::ShaderId__CP(gapic::coder::memory::Pointer(
reinterpret_cast<uintptr_t>(shaders), 0)),
binary_format, gapic::coder::gles::Void__CP(gapic::coder::memory::Pointer(
reinterpret_cast<uintptr_t>(binary), 0)),
binary_size);
mEncoder->Object(&coder);
}
inline void GlesSpy::glGetShaderInfoLog(uint32_t shader, int32_t buffer_length,
int32_t* string_length_written, char* info) {
GAPID_INFO("glGetShaderInfoLog(%" PRIu32 ", %" PRId32 ", %p, %p)\n", shader, buffer_length,
string_length_written, info);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_87_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_87_result;
std::shared_ptr<Shader> l_s = l_ctx->mInstances.mShaders[shader];
int32_t l_min_88_a = buffer_length;
int32_t l_min_88_b = int32_t((l_s->mInfoLog.count()));
int32_t l_min_88_result = /* clang-format off */
/* switch(l_min_88_a < l_min_88_b) */
/* case true: */(((l_min_88_a < l_min_88_b) == (true))) ? (l_min_88_a) :
/* case false: */(((l_min_88_a < l_min_88_b) == (false))) ? (l_min_88_b) :
/* default: */ 0 /* clang-format on */;
int32_t l_l = l_min_88_result;
Slice<char> copy__dst__ = copy(slice(info, (uint64_t)(0), (uint64_t)(l_l)),
slice(l_s->mInfoLog, (uint64_t)(0), (uint64_t)(l_l)));
observe(observations.mReads);
mImports.glGetShaderInfoLog(shader, buffer_length, string_length_written, info);
write(copy__dst__);
write(slice(string_length_written, 0, 1), 0, l_l);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlGetShaderInfoLog coder(
observations, shader, buffer_length,
gapic::coder::gles::S32__P(gapic::coder::memory::Pointer(
reinterpret_cast<uintptr_t>(string_length_written), 0)),
gapic::coder::gles::Char__P(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(info), 0)));
mEncoder->Object(&coder);
}
inline void GlesSpy::glGetShaderSource(uint32_t shader, int32_t buffer_length,
int32_t* string_length_written, char* source) {
GAPID_INFO("glGetShaderSource(%" PRIu32 ", %" PRId32 ", %p, %p)\n", shader, buffer_length,
string_length_written, source);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_89_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_89_result;
std::shared_ptr<Shader> l_s = l_ctx->mInstances.mShaders[shader];
int32_t l_min_90_a = buffer_length;
int32_t l_min_90_b = int32_t((l_s->mSource.size()));
int32_t l_min_90_result = /* clang-format off */
/* switch(l_min_90_a < l_min_90_b) */
/* case true: */(((l_min_90_a < l_min_90_b) == (true))) ? (l_min_90_a) :
/* case false: */(((l_min_90_a < l_min_90_b) == (false))) ? (l_min_90_b) :
/* default: */ 0 /* clang-format on */;
int32_t l_l = l_min_90_result;
Slice<char> copy__dst__ = copy(slice(source, (uint64_t)(0), (uint64_t)(l_l)),
slice(slice(l_s->mSource), (uint64_t)(0), (uint64_t)(l_l)));
observe(observations.mReads);
mImports.glGetShaderSource(shader, buffer_length, string_length_written, source);
write(copy__dst__);
write(slice(string_length_written, 0, 1), 0, l_l);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlGetShaderSource coder(
observations, shader, buffer_length,
gapic::coder::gles::S32__P(gapic::coder::memory::Pointer(
reinterpret_cast<uintptr_t>(string_length_written), 0)),
gapic::coder::gles::Char__P(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(source), 0)));
mEncoder->Object(&coder);
}
inline void GlesSpy::glReleaseShaderCompiler() {
GAPID_INFO("glReleaseShaderCompiler()\n");
Observations observations;
do {
observe(observations.mReads);
mImports.glReleaseShaderCompiler();
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlReleaseShaderCompiler coder(observations);
mEncoder->Object(&coder);
}
inline void GlesSpy::glCompileShader(uint32_t shader) {
GAPID_INFO("glCompileShader(%" PRIu32 ")\n", shader);
Observations observations;
do {
observe(observations.mReads);
mImports.glCompileShader(shader);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlCompileShader coder(observations, shader);
mEncoder->Object(&coder);
}
inline bool GlesSpy::glIsShader(uint32_t shader) {
GAPID_INFO("glIsShader(%" PRIu32 ")\n", shader);
bool result = false;
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_91_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_91_result;
observe(observations.mReads);
result = mImports.glIsShader(shader);
break;
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlIsShader coder(observations, shader, result);
mEncoder->Object(&coder);
return result;
}
inline uint32_t GlesSpy::glCreateProgram() {
GAPID_INFO("glCreateProgram()\n");
uint32_t result = 0;
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_92_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_92_result;
observe(observations.mReads);
result = mImports.glCreateProgram();
ProgramId l_id = (ProgramId)(result);
l_ctx->mInstances.mPrograms[l_id] = std::shared_ptr<Program>((new Program()));
break;
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlCreateProgram coder(observations, result);
mEncoder->Object(&coder);
return result;
}
inline void GlesSpy::glDeleteProgram(uint32_t program) {
GAPID_INFO("glDeleteProgram(%" PRIu32 ")\n", program);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_93_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_93_result;
l_ctx->mInstances.mPrograms[program] = std::shared_ptr<Program>();
observe(observations.mReads);
mImports.glDeleteProgram(program);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlDeleteProgram coder(observations, program);
mEncoder->Object(&coder);
}
inline void GlesSpy::glAttachShader(uint32_t program, uint32_t shader) {
GAPID_INFO("glAttachShader(%" PRIu32 ", %" PRIu32 ")\n", program, shader);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_94_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_94_result;
std::shared_ptr<Program> l_p = l_ctx->mInstances.mPrograms[program];
std::shared_ptr<Shader> l_s = l_ctx->mInstances.mShaders[shader];
l_p->mShaders[l_s->mType] = shader;
observe(observations.mReads);
mImports.glAttachShader(program, shader);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlAttachShader coder(observations, program, shader);
mEncoder->Object(&coder);
}
inline void GlesSpy::glDetachShader(uint32_t program, uint32_t shader) {
GAPID_INFO("glDetachShader(%" PRIu32 ", %" PRIu32 ")\n", program, shader);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_95_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_95_result;
std::shared_ptr<Program> l_p = l_ctx->mInstances.mPrograms[program];
std::shared_ptr<Shader> l_s = l_ctx->mInstances.mShaders[shader];
l_p->mShaders[l_s->mType] = 0;
observe(observations.mReads);
mImports.glDetachShader(program, shader);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlDetachShader coder(observations, program, shader);
mEncoder->Object(&coder);
}
inline void GlesSpy::glGetAttachedShaders(uint32_t program, int32_t buffer_length,
int32_t* shaders_length_written, uint32_t* shaders) {
GAPID_INFO("glGetAttachedShaders(%" PRIu32 ", %" PRId32 ", %p, %p)\n", program, buffer_length,
shaders_length_written, shaders);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_96_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_96_result;
std::shared_ptr<Program> l_p = l_ctx->mInstances.mPrograms[program];
int32_t l_min_97_a = buffer_length;
int32_t l_min_97_b = int32_t((l_p->mShaders.size()));
int32_t l_min_97_result = /* clang-format off */
/* switch(l_min_97_a < l_min_97_b) */
/* case true: */(((l_min_97_a < l_min_97_b) == (true))) ? (l_min_97_a) :
/* case false: */(((l_min_97_a < l_min_97_b) == (false))) ? (l_min_97_b) :
/* default: */ 0 /* clang-format on */;
int32_t l_l = l_min_97_result;
observe(observations.mReads);
mImports.glGetAttachedShaders(program, buffer_length, shaders_length_written, shaders);
write(slice(shaders_length_written, 0, 1), 0, l_l);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlGetAttachedShaders coder(
observations, program, buffer_length,
gapic::coder::gles::S32__P(gapic::coder::memory::Pointer(
reinterpret_cast<uintptr_t>(shaders_length_written), 0)),
gapic::coder::gles::ShaderId__P(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(shaders), 0)));
mEncoder->Object(&coder);
}
inline void GlesSpy::glLinkProgram(uint32_t program) {
GAPID_INFO("glLinkProgram(%" PRIu32 ")\n", program);
Observations observations;
do {
observe(observations.mReads);
mImports.glLinkProgram(program);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlLinkProgram coder(observations, program);
mEncoder->Object(&coder);
}
inline void GlesSpy::glGetProgramInfoLog(uint32_t program, int32_t buffer_length,
int32_t* string_length_written, char* info) {
GAPID_INFO("glGetProgramInfoLog(%" PRIu32 ", %" PRId32 ", %p, %p)\n", program, buffer_length,
string_length_written, info);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_98_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_98_result;
std::shared_ptr<Program> l_p = l_ctx->mInstances.mPrograms[program];
int32_t l_min_99_a = buffer_length;
int32_t l_min_99_b = int32_t((l_p->mInfoLog.count()));
int32_t l_min_99_result = /* clang-format off */
/* switch(l_min_99_a < l_min_99_b) */
/* case true: */(((l_min_99_a < l_min_99_b) == (true))) ? (l_min_99_a) :
/* case false: */(((l_min_99_a < l_min_99_b) == (false))) ? (l_min_99_b) :
/* default: */ 0 /* clang-format on */;
int32_t l_l = l_min_99_result;
Slice<char> copy__dst__ = copy(slice(info, (uint64_t)(0), (uint64_t)(l_l)),
slice(l_p->mInfoLog, (uint64_t)(0), (uint64_t)(l_l)));
observe(observations.mReads);
mImports.glGetProgramInfoLog(program, buffer_length, string_length_written, info);
write(copy__dst__);
write(slice(string_length_written, 0, 1), 0, l_l);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlGetProgramInfoLog coder(
observations, program, buffer_length,
gapic::coder::gles::S32__P(gapic::coder::memory::Pointer(
reinterpret_cast<uintptr_t>(string_length_written), 0)),
gapic::coder::gles::Char__P(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(info), 0)));
mEncoder->Object(&coder);
}
inline void GlesSpy::glUseProgram(uint32_t program) {
GAPID_INFO("glUseProgram(%" PRIu32 ")\n", program);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_100_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_100_result;
l_ctx->mBoundProgram = program;
observe(observations.mReads);
mImports.glUseProgram(program);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlUseProgram coder(observations, program);
mEncoder->Object(&coder);
}
inline bool GlesSpy::glIsProgram(uint32_t program) {
GAPID_INFO("glIsProgram(%" PRIu32 ")\n", program);
bool result = false;
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_101_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_101_result;
observe(observations.mReads);
result = mImports.glIsProgram(program);
break;
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlIsProgram coder(observations, program, result);
mEncoder->Object(&coder);
return result;
}
inline void GlesSpy::glValidateProgram(uint32_t program) {
GAPID_INFO("glValidateProgram(%" PRIu32 ")\n", program);
Observations observations;
do {
observe(observations.mReads);
mImports.glValidateProgram(program);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlValidateProgram coder(observations, program);
mEncoder->Object(&coder);
}
inline void GlesSpy::glClearColor(float r, float g, float b, float a) {
GAPID_INFO("glClearColor(%f, %f, %f, %f)\n", r, g, b, a);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_102_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_102_result;
l_ctx->mClearing.mClearColor = Color().SetRed(r).SetGreen(g).SetBlue(b).SetAlpha(a);
observe(observations.mReads);
mImports.glClearColor(r, g, b, a);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlClearColor coder(observations, r, g, b, a);
mEncoder->Object(&coder);
}
inline void GlesSpy::glClearDepthf(float depth) {
GAPID_INFO("glClearDepthf(%f)\n", depth);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_103_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_103_result;
l_ctx->mClearing.mClearDepth = depth;
observe(observations.mReads);
mImports.glClearDepthf(depth);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlClearDepthf coder(observations, depth);
mEncoder->Object(&coder);
}
inline void GlesSpy::glClearStencil(int32_t stencil) {
GAPID_INFO("glClearStencil(%" PRId32 ")\n", stencil);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_104_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_104_result;
l_ctx->mClearing.mClearStencil = stencil;
observe(observations.mReads);
mImports.glClearStencil(stencil);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlClearStencil coder(observations, stencil);
mEncoder->Object(&coder);
}
inline void GlesSpy::glClear(uint32_t mask) {
GAPID_INFO("glClear(%u)\n", mask);
Observations observations;
do {
if ((mask & GLbitfield::GL_COLOR_BUFFER_BIT) != 0) {
}
observe(observations.mReads);
mImports.glClear(mask);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlClear coder(observations, mask);
mEncoder->Object(&coder);
}
inline void GlesSpy::glCullFace(uint32_t mode) {
GAPID_INFO("glCullFace(%u)\n", mode);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_105_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_105_result;
l_ctx->mRasterizing.mCullFace = mode;
observe(observations.mReads);
mImports.glCullFace(mode);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlCullFace coder(observations, mode);
mEncoder->Object(&coder);
}
inline void GlesSpy::glPolygonOffset(float scale_factor, float units) {
GAPID_INFO("glPolygonOffset(%f, %f)\n", scale_factor, units);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_106_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_106_result;
l_ctx->mRasterizing.mPolygonOffsetUnits = units;
l_ctx->mRasterizing.mPolygonOffsetFactor = scale_factor;
observe(observations.mReads);
mImports.glPolygonOffset(scale_factor, units);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlPolygonOffset coder(observations, scale_factor, units);
mEncoder->Object(&coder);
}
inline void GlesSpy::glLineWidth(float width) {
GAPID_INFO("glLineWidth(%f)\n", width);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_107_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_107_result;
l_ctx->mRasterizing.mLineWidth = width;
observe(observations.mReads);
mImports.glLineWidth(width);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlLineWidth coder(observations, width);
mEncoder->Object(&coder);
}
inline void GlesSpy::glSampleCoverage(float value, bool invert) {
GAPID_INFO("glSampleCoverage(%f, %d)\n", value, invert);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_108_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_108_result;
l_ctx->mRasterizing.mSampleCoverageValue = value;
l_ctx->mRasterizing.mSampleCoverageInvert = invert;
observe(observations.mReads);
mImports.glSampleCoverage(value, invert);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlSampleCoverage coder(observations, value, invert);
mEncoder->Object(&coder);
}
inline void GlesSpy::glHint(uint32_t target, uint32_t mode) {
GAPID_INFO("glHint(%u, %u)\n", target, mode);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_109_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_109_result;
l_ctx->mGenerateMipmapHint = mode;
observe(observations.mReads);
mImports.glHint(target, mode);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlHint coder(observations, target, mode);
mEncoder->Object(&coder);
}
inline void GlesSpy::glFramebufferRenderbuffer(uint32_t framebuffer_target,
uint32_t framebuffer_attachment,
uint32_t renderbuffer_target,
uint32_t renderbuffer) {
GAPID_INFO("glFramebufferRenderbuffer(%u, %u, %u, %" PRIu32 ")\n", framebuffer_target,
framebuffer_attachment, renderbuffer_target, renderbuffer);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_110_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_110_result;
uint32_t l_target = /* clang-format off */
/* switch(framebuffer_target) */
/* case GLenum::GL_FRAMEBUFFER: */(((framebuffer_target) == (GLenum::GL_FRAMEBUFFER))) ? (GLenum::GL_DRAW_FRAMEBUFFER) :
/* case GLenum::GL_DRAW_FRAMEBUFFER: */(((framebuffer_target) == (GLenum::GL_DRAW_FRAMEBUFFER))) ? (GLenum::GL_DRAW_FRAMEBUFFER) :
/* case GLenum::GL_READ_FRAMEBUFFER: */(((framebuffer_target) == (GLenum::GL_READ_FRAMEBUFFER))) ? (GLenum::GL_READ_FRAMEBUFFER) :
/* default: */ 0 /* clang-format on */;
FramebufferId l_framebufferId = l_ctx->mBoundFramebuffers[l_target];
std::shared_ptr<Framebuffer> l_framebuffer =
l_ctx->mInstances.mFramebuffers[l_framebufferId];
FramebufferAttachmentInfo l_attachment =
l_framebuffer->mAttachments[framebuffer_attachment];
if (renderbuffer == (RenderbufferId)(0)) {
l_attachment.mType = GLenum::GL_NONE;
} else {
l_attachment.mType = GLenum::GL_RENDERBUFFER;
}
l_attachment.mObject = (uint32_t)(renderbuffer);
l_attachment.mTextureLevel = 0;
l_attachment.mCubeMapFace = GLenum::GL_TEXTURE_CUBE_MAP_POSITIVE_X;
l_framebuffer->mAttachments[framebuffer_attachment] = l_attachment;
observe(observations.mReads);
mImports.glFramebufferRenderbuffer(framebuffer_target, framebuffer_attachment,
renderbuffer_target, renderbuffer);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlFramebufferRenderbuffer coder(observations, framebuffer_target,
framebuffer_attachment, renderbuffer_target,
renderbuffer);
mEncoder->Object(&coder);
}
inline void GlesSpy::glFramebufferTexture2D(uint32_t framebuffer_target,
uint32_t framebuffer_attachment,
uint32_t texture_target, uint32_t texture,
int32_t level) {
GAPID_INFO("glFramebufferTexture2D(%u, %u, %u, %" PRIu32 ", %" PRId32 ")\n", framebuffer_target,
framebuffer_attachment, texture_target, texture, level);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_111_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_111_result;
uint32_t l_target = /* clang-format off */
/* switch(framebuffer_target) */
/* case GLenum::GL_FRAMEBUFFER: */(((framebuffer_target) == (GLenum::GL_FRAMEBUFFER))) ? (GLenum::GL_DRAW_FRAMEBUFFER) :
/* case GLenum::GL_DRAW_FRAMEBUFFER: */(((framebuffer_target) == (GLenum::GL_DRAW_FRAMEBUFFER))) ? (GLenum::GL_DRAW_FRAMEBUFFER) :
/* case GLenum::GL_READ_FRAMEBUFFER: */(((framebuffer_target) == (GLenum::GL_READ_FRAMEBUFFER))) ? (GLenum::GL_READ_FRAMEBUFFER) :
/* default: */ 0 /* clang-format on */;
FramebufferId l_framebufferId = l_ctx->mBoundFramebuffers[l_target];
std::shared_ptr<Framebuffer> l_framebuffer =
l_ctx->mInstances.mFramebuffers[l_framebufferId];
FramebufferAttachmentInfo l_attachment =
l_framebuffer->mAttachments[framebuffer_attachment];
if (texture == (TextureId)(0)) {
l_attachment.mType = GLenum::GL_NONE;
l_attachment.mObject = 0;
l_attachment.mTextureLevel = 0;
l_attachment.mCubeMapFace = GLenum::GL_TEXTURE_CUBE_MAP_POSITIVE_X;
} else {
l_attachment.mType = GLenum::GL_TEXTURE;
l_attachment.mObject = (uint32_t)(texture);
l_attachment.mTextureLevel = level;
l_attachment.mCubeMapFace = /* clang-format off */
/* switch(texture_target) */
/* case GLenum::GL_TEXTURE_2D: */(((texture_target) == (GLenum::GL_TEXTURE_2D))) ? (GLenum::GL_TEXTURE_CUBE_MAP_POSITIVE_X) :
/* case GLenum::GL_TEXTURE_CUBE_MAP_POSITIVE_X: */(((texture_target) == (GLenum::GL_TEXTURE_CUBE_MAP_POSITIVE_X))) ? (GLenum::GL_TEXTURE_CUBE_MAP_POSITIVE_X) :
/* case GLenum::GL_TEXTURE_CUBE_MAP_POSITIVE_Y: */(((texture_target) == (GLenum::GL_TEXTURE_CUBE_MAP_POSITIVE_Y))) ? (GLenum::GL_TEXTURE_CUBE_MAP_POSITIVE_Y) :
/* case GLenum::GL_TEXTURE_CUBE_MAP_POSITIVE_Z: */(((texture_target) == (GLenum::GL_TEXTURE_CUBE_MAP_POSITIVE_Z))) ? (GLenum::GL_TEXTURE_CUBE_MAP_POSITIVE_Z) :
/* case GLenum::GL_TEXTURE_CUBE_MAP_NEGATIVE_X: */(((texture_target) == (GLenum::GL_TEXTURE_CUBE_MAP_NEGATIVE_X))) ? (GLenum::GL_TEXTURE_CUBE_MAP_NEGATIVE_X) :
/* case GLenum::GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: */(((texture_target) == (GLenum::GL_TEXTURE_CUBE_MAP_NEGATIVE_Y))) ? (GLenum::GL_TEXTURE_CUBE_MAP_NEGATIVE_Y) :
/* case GLenum::GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: */(((texture_target) == (GLenum::GL_TEXTURE_CUBE_MAP_NEGATIVE_Z))) ? (GLenum::GL_TEXTURE_CUBE_MAP_NEGATIVE_Z) :
/* default: */ 0 /* clang-format on */;
}
l_framebuffer->mAttachments[framebuffer_attachment] = l_attachment;
observe(observations.mReads);
mImports.glFramebufferTexture2D(framebuffer_target, framebuffer_attachment, texture_target,
texture, level);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlFramebufferTexture2D coder(observations, framebuffer_target,
framebuffer_attachment, texture_target,
texture, level);
mEncoder->Object(&coder);
}
inline void GlesSpy::glGetFramebufferAttachmentParameteriv(uint32_t framebuffer_target,
uint32_t attachment, uint32_t parameter,
int32_t* value) {
GAPID_INFO("glGetFramebufferAttachmentParameteriv(%u, %u, %u, %p)\n", framebuffer_target,
attachment, parameter, value);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_112_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_112_result;
uint32_t l_target = /* clang-format off */
/* switch(framebuffer_target) */
/* case GLenum::GL_FRAMEBUFFER: */(((framebuffer_target) == (GLenum::GL_FRAMEBUFFER))) ? (GLenum::GL_DRAW_FRAMEBUFFER) :
/* case GLenum::GL_DRAW_FRAMEBUFFER: */(((framebuffer_target) == (GLenum::GL_DRAW_FRAMEBUFFER))) ? (GLenum::GL_DRAW_FRAMEBUFFER) :
/* case GLenum::GL_READ_FRAMEBUFFER: */(((framebuffer_target) == (GLenum::GL_READ_FRAMEBUFFER))) ? (GLenum::GL_READ_FRAMEBUFFER) :
/* default: */ 0 /* clang-format on */;
FramebufferId l_framebufferId = l_ctx->mBoundFramebuffers[l_target];
std::shared_ptr<Framebuffer> l_framebuffer =
l_ctx->mInstances.mFramebuffers[l_framebufferId];
FramebufferAttachmentInfo l_a = l_framebuffer->mAttachments[attachment];
observe(observations.mReads);
mImports.glGetFramebufferAttachmentParameteriv(framebuffer_target, attachment, parameter,
value);
write(slice(value, 0, 1), 0, /* clang-format off */
/* switch(parameter) */
/* case GLenum::GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: */(((parameter) == (GLenum::GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE))) ? ((int32_t)(l_a.mType)) :
/* case GLenum::GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: */(((parameter) == (GLenum::GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME))) ? ((int32_t)(l_a.mObject)) :
/* case GLenum::GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: */(((parameter) == (GLenum::GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL))) ? (l_a.mTextureLevel) :
/* case GLenum::GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: */(((parameter) == (GLenum::GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE))) ? ((int32_t)(l_a.mCubeMapFace)) :
/* default: */ 0 /* clang-format on */);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlGetFramebufferAttachmentParameteriv coder(
observations, framebuffer_target, attachment, parameter,
gapic::coder::gles::S32__P(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(value), 0)));
mEncoder->Object(&coder);
}
inline void GlesSpy::glDrawElements(uint32_t draw_mode, int32_t element_count,
uint32_t indices_type, void* indices) {
GAPID_INFO("glDrawElements(%u, %" PRId32 ", %u, %p)\n", draw_mode, element_count, indices_type,
indices);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_113_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_113_result;
uint32_t l_count = (uint32_t)(element_count);
BufferId l_id = l_ctx->mBoundBuffers[GLenum::GL_ELEMENT_ARRAY_BUFFER];
if (l_id != (BufferId)(0)) {
Slice<uint8_t> l_index_data = l_ctx->mInstances.mBuffers[l_id]->mData;
uint32_t l_offset = (uint32_t)((uint64_t)(indices));
uint32_t l_first = minIndex(l_index_data.begin(), indices_type, l_offset, l_count);
uint32_t l_last = maxIndex(l_index_data.begin(), indices_type, l_offset, l_count);
std::shared_ptr<Context> l_ReadVertexArrays_114_ctx = l_ctx;
uint32_t l_ReadVertexArrays_114_first_index = l_first;
uint32_t l_ReadVertexArrays_114_last_index = l_last;
for (int32_t l_i = 0;
l_i < int32_t((l_ReadVertexArrays_114_ctx->mVertexAttributeArrays.size()));
++l_i) {
std::shared_ptr<VertexAttributeArray> l_arr =
l_ReadVertexArrays_114_ctx
->mVertexAttributeArrays[(AttributeLocation)(l_i)];
if (l_arr->mEnabled && l_arr->mBuffer == (BufferId)(0)) {
uint32_t l_vertexAttribTypeSize_115_t = l_arr->mType;
uint32_t l_vertexAttribTypeSize_115_result = /* clang-format off */
/* switch(l_vertexAttribTypeSize_115_t) */
/* case GLenum::GL_BYTE: */(((l_vertexAttribTypeSize_115_t) == (GLenum::GL_BYTE))) ? (1) :
/* case GLenum::GL_UNSIGNED_BYTE: */(((l_vertexAttribTypeSize_115_t) == (GLenum::GL_UNSIGNED_BYTE))) ? (1) :
/* case GLenum::GL_SHORT: */(((l_vertexAttribTypeSize_115_t) == (GLenum::GL_SHORT))) ? (2) :
/* case GLenum::GL_UNSIGNED_SHORT: */(((l_vertexAttribTypeSize_115_t) == (GLenum::GL_UNSIGNED_SHORT))) ? (2) :
/* case GLenum::GL_FIXED: */(((l_vertexAttribTypeSize_115_t) == (GLenum::GL_FIXED))) ? (4) :
/* case GLenum::GL_FLOAT: */(((l_vertexAttribTypeSize_115_t) == (GLenum::GL_FLOAT))) ? (4) :
/* case GLenum::GL_HALF_FLOAT_ARB: */(((l_vertexAttribTypeSize_115_t) == (GLenum::GL_HALF_FLOAT_ARB))) ? (2) :
/* case GLenum::GL_HALF_FLOAT_OES: */(((l_vertexAttribTypeSize_115_t) == (GLenum::GL_HALF_FLOAT_OES))) ? (2) :
/* default: */ 0 /* clang-format on */;
uint32_t l_elsize = l_vertexAttribTypeSize_115_result * l_arr->mSize;
uint32_t l_elstride = /* clang-format off */
/* switch(l_arr->mStride == 0) */
/* case true: */(((l_arr->mStride == 0) == (true))) ? (l_elsize) :
/* case false: */(((l_arr->mStride == 0) == (false))) ? ((uint32_t)(l_arr->mStride)) :
/* default: */ 0 /* clang-format on */;
for (uint32_t l_v = l_ReadVertexArrays_114_first_index;
l_v < l_ReadVertexArrays_114_last_index + 1; ++l_v) {
uint32_t l_offset = l_elstride * l_v;
read(slice(l_arr->mPointer, (uint64_t)(l_offset),
(uint64_t)(l_offset + l_elsize)));
}
}
}
} else {
uint8_t* l_index_data = (uint8_t*)(indices);
uint32_t l_first = minIndex(l_index_data, indices_type, 0, l_count);
uint32_t l_last = maxIndex(l_index_data, indices_type, 0, l_count);
std::shared_ptr<Context> l_ReadVertexArrays_116_ctx = l_ctx;
uint32_t l_ReadVertexArrays_116_first_index = l_first;
uint32_t l_ReadVertexArrays_116_last_index = l_last;
for (int32_t l_i = 0;
l_i < int32_t((l_ReadVertexArrays_116_ctx->mVertexAttributeArrays.size()));
++l_i) {
std::shared_ptr<VertexAttributeArray> l_arr =
l_ReadVertexArrays_116_ctx
->mVertexAttributeArrays[(AttributeLocation)(l_i)];
if (l_arr->mEnabled && l_arr->mBuffer == (BufferId)(0)) {
uint32_t l_vertexAttribTypeSize_117_t = l_arr->mType;
uint32_t l_vertexAttribTypeSize_117_result = /* clang-format off */
/* switch(l_vertexAttribTypeSize_117_t) */
/* case GLenum::GL_BYTE: */(((l_vertexAttribTypeSize_117_t) == (GLenum::GL_BYTE))) ? (1) :
/* case GLenum::GL_UNSIGNED_BYTE: */(((l_vertexAttribTypeSize_117_t) == (GLenum::GL_UNSIGNED_BYTE))) ? (1) :
/* case GLenum::GL_SHORT: */(((l_vertexAttribTypeSize_117_t) == (GLenum::GL_SHORT))) ? (2) :
/* case GLenum::GL_UNSIGNED_SHORT: */(((l_vertexAttribTypeSize_117_t) == (GLenum::GL_UNSIGNED_SHORT))) ? (2) :
/* case GLenum::GL_FIXED: */(((l_vertexAttribTypeSize_117_t) == (GLenum::GL_FIXED))) ? (4) :
/* case GLenum::GL_FLOAT: */(((l_vertexAttribTypeSize_117_t) == (GLenum::GL_FLOAT))) ? (4) :
/* case GLenum::GL_HALF_FLOAT_ARB: */(((l_vertexAttribTypeSize_117_t) == (GLenum::GL_HALF_FLOAT_ARB))) ? (2) :
/* case GLenum::GL_HALF_FLOAT_OES: */(((l_vertexAttribTypeSize_117_t) == (GLenum::GL_HALF_FLOAT_OES))) ? (2) :
/* default: */ 0 /* clang-format on */;
uint32_t l_elsize = l_vertexAttribTypeSize_117_result * l_arr->mSize;
uint32_t l_elstride = /* clang-format off */
/* switch(l_arr->mStride == 0) */
/* case true: */(((l_arr->mStride == 0) == (true))) ? (l_elsize) :
/* case false: */(((l_arr->mStride == 0) == (false))) ? ((uint32_t)(l_arr->mStride)) :
/* default: */ 0 /* clang-format on */;
for (uint32_t l_v = l_ReadVertexArrays_116_first_index;
l_v < l_ReadVertexArrays_116_last_index + 1; ++l_v) {
uint32_t l_offset = l_elstride * l_v;
read(slice(l_arr->mPointer, (uint64_t)(l_offset),
(uint64_t)(l_offset + l_elsize)));
}
}
}
uint32_t l_IndexSize_118_indices_type = indices_type;
uint32_t l_IndexSize_118_result = /* clang-format off */
/* switch(l_IndexSize_118_indices_type) */
/* case GLenum::GL_UNSIGNED_BYTE: */(((l_IndexSize_118_indices_type) == (GLenum::GL_UNSIGNED_BYTE))) ? (1) :
/* case GLenum::GL_UNSIGNED_SHORT: */(((l_IndexSize_118_indices_type) == (GLenum::GL_UNSIGNED_SHORT))) ? (2) :
/* case GLenum::GL_UNSIGNED_INT: */(((l_IndexSize_118_indices_type) == (GLenum::GL_UNSIGNED_INT))) ? (4) :
/* default: */ 0 /* clang-format on */;
read(slice(l_index_data, (uint64_t)(0),
(uint64_t)((uint32_t)(element_count)*l_IndexSize_118_result)));
}
observe(observations.mReads);
mImports.glDrawElements(draw_mode, element_count, indices_type, indices);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlDrawElements coder(
observations, draw_mode, element_count, indices_type,
gapic::coder::gles::IndicesPointer(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(indices), 0)));
mEncoder->Object(&coder);
}
inline void GlesSpy::glDrawArrays(uint32_t draw_mode, int32_t first_index, int32_t index_count) {
GAPID_INFO("glDrawArrays(%u, %" PRId32 ", %" PRId32 ")\n", draw_mode, first_index, index_count);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_119_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_119_result;
int32_t l_last_index = first_index + index_count - 1;
std::shared_ptr<Context> l_ReadVertexArrays_120_ctx = l_ctx;
uint32_t l_ReadVertexArrays_120_first_index = (uint32_t)(first_index);
uint32_t l_ReadVertexArrays_120_last_index = (uint32_t)(l_last_index);
for (int32_t l_i = 0;
l_i < int32_t((l_ReadVertexArrays_120_ctx->mVertexAttributeArrays.size())); ++l_i) {
std::shared_ptr<VertexAttributeArray> l_arr =
l_ReadVertexArrays_120_ctx->mVertexAttributeArrays[(AttributeLocation)(l_i)];
if (l_arr->mEnabled && l_arr->mBuffer == (BufferId)(0)) {
uint32_t l_vertexAttribTypeSize_121_t = l_arr->mType;
uint32_t l_vertexAttribTypeSize_121_result = /* clang-format off */
/* switch(l_vertexAttribTypeSize_121_t) */
/* case GLenum::GL_BYTE: */(((l_vertexAttribTypeSize_121_t) == (GLenum::GL_BYTE))) ? (1) :
/* case GLenum::GL_UNSIGNED_BYTE: */(((l_vertexAttribTypeSize_121_t) == (GLenum::GL_UNSIGNED_BYTE))) ? (1) :
/* case GLenum::GL_SHORT: */(((l_vertexAttribTypeSize_121_t) == (GLenum::GL_SHORT))) ? (2) :
/* case GLenum::GL_UNSIGNED_SHORT: */(((l_vertexAttribTypeSize_121_t) == (GLenum::GL_UNSIGNED_SHORT))) ? (2) :
/* case GLenum::GL_FIXED: */(((l_vertexAttribTypeSize_121_t) == (GLenum::GL_FIXED))) ? (4) :
/* case GLenum::GL_FLOAT: */(((l_vertexAttribTypeSize_121_t) == (GLenum::GL_FLOAT))) ? (4) :
/* case GLenum::GL_HALF_FLOAT_ARB: */(((l_vertexAttribTypeSize_121_t) == (GLenum::GL_HALF_FLOAT_ARB))) ? (2) :
/* case GLenum::GL_HALF_FLOAT_OES: */(((l_vertexAttribTypeSize_121_t) == (GLenum::GL_HALF_FLOAT_OES))) ? (2) :
/* default: */ 0 /* clang-format on */;
uint32_t l_elsize = l_vertexAttribTypeSize_121_result * l_arr->mSize;
uint32_t l_elstride = /* clang-format off */
/* switch(l_arr->mStride == 0) */
/* case true: */(((l_arr->mStride == 0) == (true))) ? (l_elsize) :
/* case false: */(((l_arr->mStride == 0) == (false))) ? ((uint32_t)(l_arr->mStride)) :
/* default: */ 0 /* clang-format on */;
for (uint32_t l_v = l_ReadVertexArrays_120_first_index;
l_v < l_ReadVertexArrays_120_last_index + 1; ++l_v) {
uint32_t l_offset = l_elstride * l_v;
read(slice(l_arr->mPointer, (uint64_t)(l_offset),
(uint64_t)(l_offset + l_elsize)));
}
}
}
observe(observations.mReads);
mImports.glDrawArrays(draw_mode, first_index, index_count);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlDrawArrays coder(observations, draw_mode, first_index, index_count);
mEncoder->Object(&coder);
}
inline void GlesSpy::glFlush() {
GAPID_INFO("glFlush()\n");
Observations observations;
do {
observe(observations.mReads);
mImports.glFlush();
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlFlush coder(observations);
mEncoder->Object(&coder);
}
inline void GlesSpy::glFinish() {
GAPID_INFO("glFinish()\n");
Observations observations;
do {
observe(observations.mReads);
mImports.glFinish();
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlFinish coder(observations);
mEncoder->Object(&coder);
}
inline void GlesSpy::glGetBooleanv(uint32_t param, bool* values) {
GAPID_INFO("glGetBooleanv(%u, %p)\n", param, values);
Observations observations;
do {
Slice<bool> l_v = slice(values, (uint64_t)(0), (uint64_t)(stateVariableSize(param)));
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_122_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_122_result;
observe(observations.mReads);
mImports.glGetBooleanv(param, values);
switch (param) {
case GLenum::GL_BLEND: {
write(l_v, 0, l_ctx->mCapabilities[GLenum::GL_BLEND]);
break;
}
case GLenum::GL_CULL_FACE: {
write(l_v, 0, l_ctx->mCapabilities[GLenum::GL_CULL_FACE]);
break;
}
case GLenum::GL_DEPTH_TEST: {
write(l_v, 0, l_ctx->mCapabilities[GLenum::GL_DEPTH_TEST]);
break;
}
case GLenum::GL_DITHER: {
write(l_v, 0, l_ctx->mCapabilities[GLenum::GL_DITHER]);
break;
}
case GLenum::GL_POLYGON_OFFSET_FILL: {
write(l_v, 0, l_ctx->mCapabilities[GLenum::GL_POLYGON_OFFSET_FILL]);
break;
}
case GLenum::GL_SAMPLE_ALPHA_TO_COVERAGE: {
write(l_v, 0, l_ctx->mCapabilities[GLenum::GL_SAMPLE_ALPHA_TO_COVERAGE]);
break;
}
case GLenum::GL_SAMPLE_COVERAGE: {
write(l_v, 0, l_ctx->mCapabilities[GLenum::GL_SAMPLE_COVERAGE]);
break;
}
case GLenum::GL_SCISSOR_TEST: {
write(l_v, 0, l_ctx->mCapabilities[GLenum::GL_SCISSOR_TEST]);
break;
}
case GLenum::GL_STENCIL_TEST: {
write(l_v, 0, l_ctx->mCapabilities[GLenum::GL_STENCIL_TEST]);
break;
}
case GLenum::GL_DEPTH_WRITEMASK: {
write(l_v, 0, l_ctx->mRasterizing.mDepthMask);
break;
}
case GLenum::GL_COLOR_WRITEMASK: {
write(l_v, 0, l_ctx->mRasterizing.mColorMaskRed);
write(l_v, 1, l_ctx->mRasterizing.mColorMaskGreen);
write(l_v, 2, l_ctx->mRasterizing.mColorMaskBlue);
write(l_v, 3, l_ctx->mRasterizing.mColorMaskAlpha);
break;
}
case GLenum::GL_SAMPLE_COVERAGE_INVERT: {
write(l_v, 0, l_ctx->mRasterizing.mSampleCoverageInvert);
break;
}
case GLenum::GL_SHADER_COMPILER: {
write(l_v, 0,
slice(values, (uint64_t)(0), (uint64_t)(stateVariableSize(param)))[0]);
break;
}
case GLenum::GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: {
write(l_v, 0,
slice(values, (uint64_t)(0), (uint64_t)(stateVariableSize(param)))[0]);
break;
}
}
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlGetBooleanv coder(
observations, param, gapic::coder::gles::Bool__P(gapic::coder::memory::Pointer(
reinterpret_cast<uintptr_t>(values), 0)));
mEncoder->Object(&coder);
}
inline void GlesSpy::glGetFloatv(uint32_t param, float* values) {
GAPID_INFO("glGetFloatv(%u, %p)\n", param, values);
Observations observations;
do {
Slice<float> l_v = slice(values, (uint64_t)(0), (uint64_t)(stateVariableSize(param)));
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_123_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_123_result;
observe(observations.mReads);
mImports.glGetFloatv(param, values);
switch (param) {
case GLenum::GL_DEPTH_RANGE: {
write(l_v, 0, l_ctx->mRasterizing.mDepthNear);
write(l_v, 1, l_ctx->mRasterizing.mDepthFar);
break;
}
case GLenum::GL_LINE_WIDTH: {
write(l_v, 0, l_ctx->mRasterizing.mLineWidth);
break;
}
case GLenum::GL_POLYGON_OFFSET_FACTOR: {
write(l_v, 0, l_ctx->mRasterizing.mPolygonOffsetFactor);
break;
}
case GLenum::GL_POLYGON_OFFSET_UNITS: {
write(l_v, 0, l_ctx->mRasterizing.mPolygonOffsetUnits);
break;
}
case GLenum::GL_SAMPLE_COVERAGE_VALUE: {
write(l_v, 0, l_ctx->mRasterizing.mSampleCoverageValue);
break;
}
case GLenum::GL_COLOR_CLEAR_VALUE: {
write(l_v, 0, l_ctx->mClearing.mClearColor.mRed);
write(l_v, 1, l_ctx->mClearing.mClearColor.mGreen);
write(l_v, 2, l_ctx->mClearing.mClearColor.mBlue);
write(l_v, 3, l_ctx->mClearing.mClearColor.mAlpha);
break;
}
case GLenum::GL_DEPTH_CLEAR_VALUE: {
write(l_v, 0, l_ctx->mClearing.mClearDepth);
break;
}
case GLenum::GL_ALIASED_LINE_WIDTH_RANGE: {
write(l_v, 0,
slice(values, (uint64_t)(0), (uint64_t)(stateVariableSize(param)))[0]);
write(l_v, 1,
slice(values, (uint64_t)(0), (uint64_t)(stateVariableSize(param)))[1]);
break;
}
case GLenum::GL_ALIASED_POINT_SIZE_RANGE: {
write(l_v, 0,
slice(values, (uint64_t)(0), (uint64_t)(stateVariableSize(param)))[0]);
write(l_v, 1,
slice(values, (uint64_t)(0), (uint64_t)(stateVariableSize(param)))[1]);
break;
}
case GLenum::GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: {
write(l_v, 0,
slice(values, (uint64_t)(0), (uint64_t)(stateVariableSize(param)))[0]);
break;
}
}
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlGetFloatv coder(observations, param,
gapic::coder::gles::F32__P(gapic::coder::memory::Pointer(
reinterpret_cast<uintptr_t>(values), 0)));
mEncoder->Object(&coder);
}
inline void GlesSpy::glGetIntegerv(uint32_t param, int32_t* values) {
GAPID_INFO("glGetIntegerv(%u, %p)\n", param, values);
Observations observations;
do {
Slice<int32_t> l_v = slice(values, (uint64_t)(0), (uint64_t)(stateVariableSize(param)));
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_124_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_124_result;
observe(observations.mReads);
mImports.glGetIntegerv(param, values);
switch (param) {
case GLenum::GL_ACTIVE_TEXTURE: {
write(l_v, 0, (int32_t)(l_ctx->mActiveTextureUnit));
break;
}
case GLenum::GL_ARRAY_BUFFER_BINDING: {
write(l_v, 0, (int32_t)(l_ctx->mBoundBuffers[GLenum::GL_ARRAY_BUFFER]));
break;
}
case GLenum::GL_ELEMENT_ARRAY_BUFFER_BINDING: {
write(l_v, 0, (int32_t)(l_ctx->mBoundBuffers[GLenum::GL_ELEMENT_ARRAY_BUFFER]));
break;
}
case GLenum::GL_BLEND_SRC_ALPHA: {
write(l_v, 0, (int32_t)(l_ctx->mBlending.mSrcAlphaBlendFactor));
break;
}
case GLenum::GL_BLEND_SRC_RGB: {
write(l_v, 0, (int32_t)(l_ctx->mBlending.mSrcRgbBlendFactor));
break;
}
case GLenum::GL_BLEND_DST_ALPHA: {
write(l_v, 0, (int32_t)(l_ctx->mBlending.mDstAlphaBlendFactor));
break;
}
case GLenum::GL_BLEND_DST_RGB: {
write(l_v, 0, (int32_t)(l_ctx->mBlending.mDstRgbBlendFactor));
break;
}
case GLenum::GL_BLEND_EQUATION_RGB: {
write(l_v, 0, (int32_t)(l_ctx->mBlending.mBlendEquationRgb));
break;
}
case GLenum::GL_BLEND_EQUATION_ALPHA: {
write(l_v, 0, (int32_t)(l_ctx->mBlending.mBlendEquationAlpha));
break;
}
case GLenum::GL_BLEND_COLOR: {
write(l_v, 0, (int32_t)(l_ctx->mBlending.mBlendColor.mRed));
write(l_v, 1, (int32_t)(l_ctx->mBlending.mBlendColor.mGreen));
write(l_v, 2, (int32_t)(l_ctx->mBlending.mBlendColor.mBlue));
write(l_v, 3, (int32_t)(l_ctx->mBlending.mBlendColor.mAlpha));
break;
}
case GLenum::GL_DEPTH_FUNC: {
write(l_v, 0, (int32_t)(l_ctx->mRasterizing.mDepthTestFunction));
break;
}
case GLenum::GL_DEPTH_CLEAR_VALUE: {
write(l_v, 0, (int32_t)(l_ctx->mClearing.mClearDepth));
break;
}
case GLenum::GL_STENCIL_WRITEMASK: {
write(l_v, 0, (int32_t)(l_ctx->mRasterizing.mStencilMask[GLenum::GL_FRONT]));
break;
}
case GLenum::GL_STENCIL_BACK_WRITEMASK: {
write(l_v, 0, (int32_t)(l_ctx->mRasterizing.mStencilMask[GLenum::GL_BACK]));
break;
}
case GLenum::GL_VIEWPORT: {
write(l_v, 0, l_ctx->mRasterizing.mViewport.mX);
write(l_v, 1, l_ctx->mRasterizing.mViewport.mY);
write(l_v, 2, l_ctx->mRasterizing.mViewport.mWidth);
write(l_v, 3, l_ctx->mRasterizing.mViewport.mHeight);
break;
}
case GLenum::GL_SCISSOR_BOX: {
write(l_v, 0, l_ctx->mRasterizing.mScissor.mX);
write(l_v, 1, l_ctx->mRasterizing.mScissor.mY);
write(l_v, 2, l_ctx->mRasterizing.mScissor.mWidth);
write(l_v, 3, l_ctx->mRasterizing.mScissor.mHeight);
break;
}
case GLenum::GL_FRONT_FACE: {
write(l_v, 0, (int32_t)(l_ctx->mRasterizing.mFrontFace));
break;
}
case GLenum::GL_CULL_FACE_MODE: {
write(l_v, 0, (int32_t)(l_ctx->mRasterizing.mCullFace));
break;
}
case GLenum::GL_STENCIL_CLEAR_VALUE: {
write(l_v, 0, l_ctx->mClearing.mClearStencil);
break;
}
case GLenum::GL_FRAMEBUFFER_BINDING: {
write(l_v, 0, (int32_t)(l_ctx->mBoundFramebuffers[GLenum::GL_FRAMEBUFFER]));
break;
}
case GLenum::GL_READ_FRAMEBUFFER_BINDING: {
write(l_v, 0, (int32_t)(l_ctx->mBoundFramebuffers[GLenum::GL_READ_FRAMEBUFFER]));
break;
}
case GLenum::GL_RENDERBUFFER_BINDING: {
write(l_v, 0, (int32_t)(l_ctx->mBoundRenderbuffers[GLenum::GL_RENDERBUFFER]));
break;
}
case GLenum::GL_CURRENT_PROGRAM: {
write(l_v, 0, (int32_t)(l_ctx->mBoundProgram));
break;
}
case GLenum::GL_TEXTURE_BINDING_2D: {
write(l_v, 0, (int32_t)(l_ctx->mTextureUnits[l_ctx->mActiveTextureUnit]
[GLenum::GL_TEXTURE_2D]));
break;
}
case GLenum::GL_TEXTURE_BINDING_CUBE_MAP: {
write(l_v, 0, (int32_t)(l_ctx->mTextureUnits[l_ctx->mActiveTextureUnit]
[GLenum::GL_TEXTURE_CUBE_MAP]));
break;
}
case GLenum::GL_GENERATE_MIPMAP_HINT: {
write(l_v, 0, (int32_t)(l_ctx->mGenerateMipmapHint));
break;
}
case GLenum::GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS: {
auto l_result =
slice(values, (uint64_t)(0), (uint64_t)(stateVariableSize(param)))[0];
write(l_v, 0, l_result);
break;
}
case GLenum::GL_MAX_CUBE_MAP_TEXTURE_SIZE: {
auto l_result =
slice(values, (uint64_t)(0), (uint64_t)(stateVariableSize(param)))[0];
write(l_v, 0, l_result);
break;
}
case GLenum::GL_MAX_FRAGMENT_UNIFORM_VECTORS: {
auto l_result =
slice(values, (uint64_t)(0), (uint64_t)(stateVariableSize(param)))[0];
write(l_v, 0, l_result);
break;
}
case GLenum::GL_MAX_RENDERBUFFER_SIZE: {
auto l_result =
slice(values, (uint64_t)(0), (uint64_t)(stateVariableSize(param)))[0];
write(l_v, 0, l_result);
break;
}
case GLenum::GL_MAX_TEXTURE_IMAGE_UNITS: {
auto l_result =
slice(values, (uint64_t)(0), (uint64_t)(stateVariableSize(param)))[0];
write(l_v, 0, l_result);
break;
}
case GLenum::GL_MAX_TEXTURE_SIZE: {
auto l_result =
slice(values, (uint64_t)(0), (uint64_t)(stateVariableSize(param)))[0];
write(l_v, 0, l_result);
break;
}
case GLenum::GL_MAX_VARYING_VECTORS: {
auto l_result =
slice(values, (uint64_t)(0), (uint64_t)(stateVariableSize(param)))[0];
write(l_v, 0, l_result);
break;
}
case GLenum::GL_MAX_VERTEX_ATTRIBS: {
auto l_result =
slice(values, (uint64_t)(0), (uint64_t)(stateVariableSize(param)))[0];
write(l_v, 0, l_result);
break;
}
case GLenum::GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS: {
write(l_v, 0,
slice(values, (uint64_t)(0), (uint64_t)(stateVariableSize(param)))[0]);
break;
}
case GLenum::GL_MAX_VERTEX_UNIFORM_VECTORS: {
auto l_result =
slice(values, (uint64_t)(0), (uint64_t)(stateVariableSize(param)))[0];
write(l_v, 0, l_result);
break;
}
case GLenum::GL_MAX_VIEWPORT_DIMS: {
auto l_max_width =
slice(values, (uint64_t)(0), (uint64_t)(stateVariableSize(param)))[0];
auto l_max_height =
slice(values, (uint64_t)(0), (uint64_t)(stateVariableSize(param)))[1];
write(l_v, 0, l_max_width);
write(l_v, 1, l_max_height);
break;
}
case GLenum::GL_NUM_COMPRESSED_TEXTURE_FORMATS: {
auto l_result =
slice(values, (uint64_t)(0), (uint64_t)(stateVariableSize(param)))[0];
write(l_v, 0, l_result);
break;
}
case GLenum::GL_NUM_SHADER_BINARY_FORMATS: {
auto l_result =
slice(values, (uint64_t)(0), (uint64_t)(stateVariableSize(param)))[0];
write(l_v, 0, l_result);
break;
}
case GLenum::GL_PACK_ALIGNMENT: {
write(l_v, 0, l_ctx->mPixelStorage[GLenum::GL_PACK_ALIGNMENT]);
break;
}
case GLenum::GL_UNPACK_ALIGNMENT: {
write(l_v, 0, l_ctx->mPixelStorage[GLenum::GL_UNPACK_ALIGNMENT]);
break;
}
case GLenum::GL_ALPHA_BITS: {
write(l_v, 0,
slice(values, (uint64_t)(0), (uint64_t)(stateVariableSize(param)))[0]);
break;
}
case GLenum::GL_BLUE_BITS: {
write(l_v, 0,
slice(values, (uint64_t)(0), (uint64_t)(stateVariableSize(param)))[0]);
break;
}
case GLenum::GL_GREEN_BITS: {
write(l_v, 0,
slice(values, (uint64_t)(0), (uint64_t)(stateVariableSize(param)))[0]);
break;
}
case GLenum::GL_RED_BITS: {
write(l_v, 0,
slice(values, (uint64_t)(0), (uint64_t)(stateVariableSize(param)))[0]);
break;
}
case GLenum::GL_DEPTH_BITS: {
write(l_v, 0,
slice(values, (uint64_t)(0), (uint64_t)(stateVariableSize(param)))[0]);
break;
}
case GLenum::GL_SAMPLE_BUFFERS: {
write(l_v, 0,
slice(values, (uint64_t)(0), (uint64_t)(stateVariableSize(param)))[0]);
break;
}
case GLenum::GL_SAMPLES: {
write(l_v, 0,
slice(values, (uint64_t)(0), (uint64_t)(stateVariableSize(param)))[0]);
break;
}
case GLenum::GL_STENCIL_BITS: {
write(l_v, 0,
slice(values, (uint64_t)(0), (uint64_t)(stateVariableSize(param)))[0]);
break;
}
case GLenum::GL_SUBPIXEL_BITS: {
auto l_result =
slice(values, (uint64_t)(0), (uint64_t)(stateVariableSize(param)))[0];
write(l_v, 0, l_result);
break;
}
case GLenum::GL_IMPLEMENTATION_COLOR_READ_FORMAT: {
write(l_v, 0,
slice(values, (uint64_t)(0), (uint64_t)(stateVariableSize(param)))[0]);
break;
}
case GLenum::GL_IMPLEMENTATION_COLOR_READ_TYPE: {
write(l_v, 0,
slice(values, (uint64_t)(0), (uint64_t)(stateVariableSize(param)))[0]);
break;
}
case GLenum::GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: {
write(l_v, 0,
slice(values, (uint64_t)(0), (uint64_t)(stateVariableSize(param)))[0]);
break;
}
case GLenum::GL_GPU_DISJOINT_EXT: {
write(l_v, 0,
slice(values, (uint64_t)(0), (uint64_t)(stateVariableSize(param)))[0]);
break;
}
}
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlGetIntegerv coder(
observations, param, gapic::coder::gles::S32__P(gapic::coder::memory::Pointer(
reinterpret_cast<uintptr_t>(values), 0)));
mEncoder->Object(&coder);
}
inline char* GlesSpy::glGetString(uint32_t param) {
GAPID_INFO("glGetString(%u)\n", param);
char* result = nullptr;
Observations observations;
do {
observe(observations.mReads);
result = mImports.glGetString(param);
break;
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlGetString coder(
observations, param, gapic::coder::gles::Char__CP(gapic::coder::memory::Pointer(
reinterpret_cast<uintptr_t>(result), 0)));
mEncoder->Object(&coder);
return result;
}
inline void GlesSpy::glEnable(uint32_t capability) {
GAPID_INFO("glEnable(%u)\n", capability);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_125_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_125_result;
l_ctx->mCapabilities[capability] = true;
observe(observations.mReads);
mImports.glEnable(capability);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlEnable coder(observations, capability);
mEncoder->Object(&coder);
}
inline void GlesSpy::glDisable(uint32_t capability) {
GAPID_INFO("glDisable(%u)\n", capability);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_126_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_126_result;
l_ctx->mCapabilities[capability] = false;
observe(observations.mReads);
mImports.glDisable(capability);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlDisable coder(observations, capability);
mEncoder->Object(&coder);
}
inline bool GlesSpy::glIsEnabled(uint32_t capability) {
GAPID_INFO("glIsEnabled(%u)\n", capability);
bool result = false;
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_127_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_127_result;
observe(observations.mReads);
result = mImports.glIsEnabled(capability);
break;
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlIsEnabled coder(observations, capability, result);
mEncoder->Object(&coder);
return result;
}
inline uint64_t GlesSpy::glFenceSync(uint32_t condition, uint32_t syncFlags) {
GAPID_INFO("glFenceSync(%u, %u)\n", condition, syncFlags);
uint64_t result = 0;
Observations observations;
do {
observe(observations.mReads);
result = mImports.glFenceSync(condition, syncFlags);
break;
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlFenceSync coder(observations, condition, syncFlags, result);
mEncoder->Object(&coder);
return result;
}
inline void GlesSpy::glDeleteSync(uint64_t sync) {
GAPID_INFO("glDeleteSync(%" PRIu64 ")\n", sync);
Observations observations;
do {
observe(observations.mReads);
mImports.glDeleteSync(sync);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlDeleteSync coder(observations, sync);
mEncoder->Object(&coder);
}
inline void GlesSpy::glWaitSync(uint64_t sync, uint32_t syncFlags, uint64_t timeout) {
GAPID_INFO("glWaitSync(%" PRIu64 ", %u, %" PRIu64 ")\n", sync, syncFlags, timeout);
Observations observations;
do {
observe(observations.mReads);
mImports.glWaitSync(sync, syncFlags, timeout);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlWaitSync coder(observations, sync, syncFlags, timeout);
mEncoder->Object(&coder);
}
inline uint32_t GlesSpy::glClientWaitSync(uint64_t sync, uint32_t syncFlags, uint64_t timeout) {
GAPID_INFO("glClientWaitSync(%" PRIu64 ", %u, %" PRIu64 ")\n", sync, syncFlags, timeout);
uint32_t result = 0;
Observations observations;
do {
observe(observations.mReads);
result = mImports.glClientWaitSync(sync, syncFlags, timeout);
break;
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlClientWaitSync coder(observations, sync, syncFlags, timeout, result);
mEncoder->Object(&coder);
return result;
}
inline void* GlesSpy::glMapBufferRange(uint32_t target, int32_t offset, int32_t length,
uint32_t access) {
GAPID_INFO("glMapBufferRange(%u, %" PRId32 ", %" PRId32 ", %u)\n", target, offset, length,
access);
void* result = nullptr;
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_128_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_128_result;
std::shared_ptr<Buffer> l_b = l_ctx->mInstances.mBuffers[l_ctx->mBoundBuffers[target]];
observe(observations.mReads);
result = mImports.glMapBufferRange(target, offset, length, access);
uint8_t* l_ptr = (uint8_t*)(result);
l_b->mMappingAccess = access;
l_b->mMappingData = slice(l_ptr, (uint64_t)(0), (uint64_t)(length));
if ((access & GLbitfield::GL_MAP_READ_BIT) != 0) {
Slice<uint8_t> l_src =
slice(l_b->mData, (uint64_t)(offset), (uint64_t)(offset + length));
Slice<uint8_t> l_dst = l_b->mMappingData;
write(l_dst);
}
break;
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlMapBufferRange coder(
observations, target, offset, length, access,
gapic::coder::gles::Void__P(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(result), 0)));
mEncoder->Object(&coder);
return result;
}
inline void GlesSpy::glUnmapBuffer(uint32_t target) {
GAPID_INFO("glUnmapBuffer(%u)\n", target);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_129_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_129_result;
std::shared_ptr<Buffer> l_b = l_ctx->mInstances.mBuffers[l_ctx->mBoundBuffers[target]];
Slice<uint8_t> copy__dst__ =
copy(slice(l_b->mData, (uint64_t)(l_b->mMappingOffset),
(uint64_t)(l_b->mMappingOffset + int32_t((l_b->mMappingData.count())))),
l_b->mMappingData);
observe(observations.mReads);
mImports.glUnmapBuffer(target);
write(copy__dst__);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlUnmapBuffer coder(observations, target);
mEncoder->Object(&coder);
}
inline void GlesSpy::glInvalidateFramebuffer(uint32_t target, int32_t count,
uint32_t* attachments) {
GAPID_INFO("glInvalidateFramebuffer(%u, %" PRId32 ", %p)\n", target, count, attachments);
Observations observations;
do {
observe(observations.mReads);
mImports.glInvalidateFramebuffer(target, count, attachments);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlInvalidateFramebuffer coder(
observations, target, count,
gapic::coder::gles::GLenum__CP(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(attachments), 0)));
mEncoder->Object(&coder);
}
inline void GlesSpy::glRenderbufferStorageMultisample(uint32_t target, int32_t samples,
uint32_t format, int32_t width,
int32_t height) {
GAPID_INFO("glRenderbufferStorageMultisample(%u, %" PRId32 ", %u, %" PRId32 ", %" PRId32 ")\n",
target, samples, format, width, height);
Observations observations;
do {
observe(observations.mReads);
mImports.glRenderbufferStorageMultisample(target, samples, format, width, height);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlRenderbufferStorageMultisample coder(observations, target, samples,
format, width, height);
mEncoder->Object(&coder);
}
inline void GlesSpy::glBlitFramebuffer(int32_t srcX0, int32_t srcY0, int32_t srcX1, int32_t srcY1,
int32_t dstX0, int32_t dstY0, int32_t dstX1, int32_t dstY1,
uint32_t mask, uint32_t filter) {
GAPID_INFO("glBlitFramebuffer(%" PRId32 ", %" PRId32 ", %" PRId32 ", %" PRId32 ", %" PRId32
", %" PRId32 ", %" PRId32 ", %" PRId32 ", %u, %u)\n",
srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
Observations observations;
do {
observe(observations.mReads);
mImports.glBlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask,
filter);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlBlitFramebuffer coder(observations, srcX0, srcY0, srcX1, srcY1, dstX0,
dstY0, dstX1, dstY1, mask, filter);
mEncoder->Object(&coder);
}
inline void GlesSpy::glGenQueries(int32_t count, uint32_t* queries) {
GAPID_INFO("glGenQueries(%" PRId32 ", %p)\n", count, queries);
Observations observations;
do {
Slice<QueryId> l_q = slice(queries, (uint64_t)(0), (uint64_t)(count));
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_130_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_130_result;
observe(observations.mReads);
mImports.glGenQueries(count, queries);
for (int32_t l_i = 0; l_i < count; ++l_i) {
QueryId l_id =
(QueryId)(slice(queries, (uint64_t)(0), (uint64_t)(count))[(uint64_t)(l_i)]);
l_ctx->mInstances.mQueries[l_id] = std::shared_ptr<Query>((new Query()));
write(l_q, (uint64_t)(l_i), l_id);
}
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlGenQueries coder(
observations, count, gapic::coder::gles::QueryId__P(gapic::coder::memory::Pointer(
reinterpret_cast<uintptr_t>(queries), 0)));
mEncoder->Object(&coder);
}
inline void GlesSpy::glBeginQuery(uint32_t target, uint32_t query) {
GAPID_INFO("glBeginQuery(%u, %" PRIu32 ")\n", target, query);
Observations observations;
do {
observe(observations.mReads);
mImports.glBeginQuery(target, query);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlBeginQuery coder(observations, target, query);
mEncoder->Object(&coder);
}
inline void GlesSpy::glEndQuery(uint32_t target) {
GAPID_INFO("glEndQuery(%u)\n", target);
Observations observations;
do {
observe(observations.mReads);
mImports.glEndQuery(target);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlEndQuery coder(observations, target);
mEncoder->Object(&coder);
}
inline void GlesSpy::glDeleteQueries(int32_t count, uint32_t* queries) {
GAPID_INFO("glDeleteQueries(%" PRId32 ", %p)\n", count, queries);
Observations observations;
do {
Slice<QueryId> l_q = slice(queries, (uint64_t)(0), (uint64_t)(count));
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_131_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_131_result;
for (int32_t l_i = 0; l_i < count; ++l_i) {
l_ctx->mInstances.mQueries[read(l_q, (uint64_t)(l_i))] = std::shared_ptr<Query>();
}
observe(observations.mReads);
mImports.glDeleteQueries(count, queries);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlDeleteQueries coder(
observations, count, gapic::coder::gles::QueryId__CP(gapic::coder::memory::Pointer(
reinterpret_cast<uintptr_t>(queries), 0)));
mEncoder->Object(&coder);
}
inline bool GlesSpy::glIsQuery(uint32_t query) {
GAPID_INFO("glIsQuery(%" PRIu32 ")\n", query);
bool result = false;
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_132_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_132_result;
observe(observations.mReads);
result = mImports.glIsQuery(query);
break;
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlIsQuery coder(observations, query, result);
mEncoder->Object(&coder);
return result;
}
inline void GlesSpy::glGetQueryiv(uint32_t target, uint32_t parameter, int32_t* value) {
GAPID_INFO("glGetQueryiv(%u, %u, %p)\n", target, parameter, value);
Observations observations;
do {
observe(observations.mReads);
mImports.glGetQueryiv(target, parameter, value);
write(slice(value, 0, 1), 0, slice(value, 0, 1)[0]);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlGetQueryiv coder(observations, target, parameter,
gapic::coder::gles::S32__P(gapic::coder::memory::Pointer(
reinterpret_cast<uintptr_t>(value), 0)));
mEncoder->Object(&coder);
}
inline void GlesSpy::glGetQueryObjectuiv(uint32_t query, uint32_t parameter, uint32_t* value) {
GAPID_INFO("glGetQueryObjectuiv(%" PRIu32 ", %u, %p)\n", query, parameter, value);
Observations observations;
do {
observe(observations.mReads);
mImports.glGetQueryObjectuiv(query, parameter, value);
write(slice(value, 0, 1), 0, slice(value, 0, 1)[0]);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlGetQueryObjectuiv coder(
observations, query, parameter,
gapic::coder::gles::U32__P(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(value), 0)));
mEncoder->Object(&coder);
}
inline void GlesSpy::glGetActiveUniformBlockName(uint32_t program, uint32_t uniform_block_index,
int32_t buffer_size, int32_t* buffer_bytes_written,
char* name) {
GAPID_INFO("glGetActiveUniformBlockName(%" PRIu32 ", %" PRIu32 ", %" PRId32 ", %p, %p)\n",
program, uniform_block_index, buffer_size, buffer_bytes_written, name);
Observations observations;
do {
observe(observations.mReads);
mImports.glGetActiveUniformBlockName(program, uniform_block_index, buffer_size,
buffer_bytes_written, name);
int32_t l_l = (int32_t)(slice(buffer_bytes_written, 0, 1)[0]);
write(slice(buffer_bytes_written, 0, 1), 0, l_l);
write(slice(name, (uint64_t)(0), (uint64_t)(l_l)));
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlGetActiveUniformBlockName coder(
observations, program, uniform_block_index, buffer_size,
gapic::coder::gles::S32__P(gapic::coder::memory::Pointer(
reinterpret_cast<uintptr_t>(buffer_bytes_written), 0)),
gapic::coder::gles::Char__P(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(name), 0)));
mEncoder->Object(&coder);
}
inline void GlesSpy::glGetActiveUniformBlockiv(uint32_t program, uint32_t uniform_block_index,
uint32_t parameter_name, int32_t* parameters) {
GAPID_INFO("glGetActiveUniformBlockiv(%" PRIu32 ", %" PRIu32 ", %u, %p)\n", program,
uniform_block_index, parameter_name, parameters);
Observations observations;
do {
observe(observations.mReads);
mImports.glGetActiveUniformBlockiv(program, uniform_block_index, parameter_name,
parameters);
write(slice(parameters, 0, 1), 0, slice(parameters, 0, 1)[0]);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlGetActiveUniformBlockiv coder(
observations, program, uniform_block_index, parameter_name,
gapic::coder::gles::S32__P(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(parameters), 0)));
mEncoder->Object(&coder);
}
inline void GlesSpy::glUniformBlockBinding(uint32_t program, uint32_t uniform_block_index,
uint32_t uniform_block_binding) {
GAPID_INFO("glUniformBlockBinding(%" PRIu32 ", %" PRIu32 ", %" PRIu32 ")\n", program,
uniform_block_index, uniform_block_binding);
Observations observations;
do {
observe(observations.mReads);
mImports.glUniformBlockBinding(program, uniform_block_index, uniform_block_binding);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlUniformBlockBinding coder(observations, program, uniform_block_index,
uniform_block_binding);
mEncoder->Object(&coder);
}
inline void GlesSpy::glGetActiveUniformsiv(uint32_t program, uint32_t uniform_count,
uint32_t* uniform_indices, uint32_t parameter_name,
int32_t* parameters) {
GAPID_INFO("glGetActiveUniformsiv(%" PRIu32 ", %" PRIu32 ", %p, %u, %p)\n", program,
uniform_count, uniform_indices, parameter_name, parameters);
Observations observations;
do {
read(slice(uniform_indices, (uint64_t)(0), (uint64_t)(uniform_count)));
observe(observations.mReads);
mImports.glGetActiveUniformsiv(program, uniform_count, uniform_indices, parameter_name,
parameters);
write(slice(parameters, (uint64_t)(0), (uint64_t)(uniform_count)));
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlGetActiveUniformsiv coder(
observations, program, uniform_count,
gapic::coder::gles::U32__P(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(uniform_indices), 0)),
parameter_name, gapic::coder::gles::S32__P(gapic::coder::memory::Pointer(
reinterpret_cast<uintptr_t>(parameters), 0)));
mEncoder->Object(&coder);
}
inline void GlesSpy::glBindBufferBase(uint32_t target, uint32_t index, uint32_t buffer) {
GAPID_INFO("glBindBufferBase(%u, %" PRIu32 ", %" PRIu32 ")\n", target, index, buffer);
Observations observations;
do {
observe(observations.mReads);
mImports.glBindBufferBase(target, index, buffer);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlBindBufferBase coder(observations, target, index, buffer);
mEncoder->Object(&coder);
}
inline void GlesSpy::glGenVertexArrays(int32_t count, uint32_t* arrays) {
GAPID_INFO("glGenVertexArrays(%" PRId32 ", %p)\n", count, arrays);
Observations observations;
do {
Slice<VertexArrayId> l_a = slice(arrays, (uint64_t)(0), (uint64_t)(count));
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_133_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_133_result;
observe(observations.mReads);
mImports.glGenVertexArrays(count, arrays);
for (int32_t l_i = 0; l_i < count; ++l_i) {
VertexArrayId l_id = (VertexArrayId)(
slice(arrays, (uint64_t)(0), (uint64_t)(count))[(uint64_t)(l_i)]);
l_ctx->mInstances.mVertexArrays[l_id] =
std::shared_ptr<VertexArray>((new VertexArray()));
write(l_a, (uint64_t)(l_i), l_id);
}
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlGenVertexArrays coder(
observations, count, gapic::coder::gles::VertexArrayId__P(gapic::coder::memory::Pointer(
reinterpret_cast<uintptr_t>(arrays), 0)));
mEncoder->Object(&coder);
}
inline void GlesSpy::glBindVertexArray(uint32_t array) {
GAPID_INFO("glBindVertexArray(%" PRIu32 ")\n", array);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_134_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_134_result;
if (!(l_ctx->mInstances.mVertexArrays.count(array) > 0)) {
l_ctx->mInstances.mVertexArrays[array] =
std::shared_ptr<VertexArray>((new VertexArray()));
}
l_ctx->mBoundVertexArray = array;
observe(observations.mReads);
mImports.glBindVertexArray(array);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlBindVertexArray coder(observations, array);
mEncoder->Object(&coder);
}
inline void GlesSpy::glDeleteVertexArrays(uint32_t count, uint32_t* arrays) {
GAPID_INFO("glDeleteVertexArrays(%" PRIu32 ", %p)\n", count, arrays);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_135_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_135_result;
Slice<VertexArrayId> l_a = slice(arrays, (uint64_t)(0), (uint64_t)(count));
for (uint32_t l_i = 0; l_i < count; ++l_i) {
l_ctx->mInstances.mVertexArrays[read(l_a, (uint64_t)(l_i))] =
std::shared_ptr<VertexArray>();
}
observe(observations.mReads);
mImports.glDeleteVertexArrays(count, arrays);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlDeleteVertexArrays coder(
observations, count,
gapic::coder::gles::VertexArrayId__CP(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(arrays), 0)));
mEncoder->Object(&coder);
}
inline void GlesSpy::glGetQueryObjecti64v(uint32_t query, uint32_t parameter, int64_t* value) {
GAPID_INFO("glGetQueryObjecti64v(%" PRIu32 ", %u, %p)\n", query, parameter, value);
Observations observations;
do {
observe(observations.mReads);
mImports.glGetQueryObjecti64v(query, parameter, value);
write(slice(value, 0, 1), 0, slice(value, 0, 1)[0]);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlGetQueryObjecti64v coder(
observations, query, parameter,
gapic::coder::gles::S64__P(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(value), 0)));
mEncoder->Object(&coder);
}
inline void GlesSpy::glGetQueryObjectui64v(uint32_t query, uint32_t parameter, uint64_t* value) {
GAPID_INFO("glGetQueryObjectui64v(%" PRIu32 ", %u, %p)\n", query, parameter, value);
Observations observations;
do {
observe(observations.mReads);
mImports.glGetQueryObjectui64v(query, parameter, value);
write(slice(value, 0, 1), 0, slice(value, 0, 1)[0]);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlGetQueryObjectui64v coder(
observations, query, parameter,
gapic::coder::gles::U64__P(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(value), 0)));
mEncoder->Object(&coder);
}
inline void GlesSpy::glGenQueriesEXT(int32_t count, uint32_t* queries) {
GAPID_INFO("glGenQueriesEXT(%" PRId32 ", %p)\n", count, queries);
Observations observations;
do {
Slice<QueryId> l_q = slice(queries, (uint64_t)(0), (uint64_t)(count));
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_136_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_136_result;
observe(observations.mReads);
mImports.glGenQueriesEXT(count, queries);
for (int32_t l_i = 0; l_i < count; ++l_i) {
QueryId l_id =
(QueryId)(slice(queries, (uint64_t)(0), (uint64_t)(count))[(uint64_t)(l_i)]);
l_ctx->mInstances.mQueries[l_id] = std::shared_ptr<Query>((new Query()));
write(l_q, (uint64_t)(l_i), l_id);
}
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlGenQueriesEXT coder(
observations, count, gapic::coder::gles::QueryId__P(gapic::coder::memory::Pointer(
reinterpret_cast<uintptr_t>(queries), 0)));
mEncoder->Object(&coder);
}
inline void GlesSpy::glBeginQueryEXT(uint32_t target, uint32_t query) {
GAPID_INFO("glBeginQueryEXT(%u, %" PRIu32 ")\n", target, query);
Observations observations;
do {
observe(observations.mReads);
mImports.glBeginQueryEXT(target, query);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlBeginQueryEXT coder(observations, target, query);
mEncoder->Object(&coder);
}
inline void GlesSpy::glEndQueryEXT(uint32_t target) {
GAPID_INFO("glEndQueryEXT(%u)\n", target);
Observations observations;
do {
observe(observations.mReads);
mImports.glEndQueryEXT(target);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlEndQueryEXT coder(observations, target);
mEncoder->Object(&coder);
}
inline void GlesSpy::glDeleteQueriesEXT(int32_t count, uint32_t* queries) {
GAPID_INFO("glDeleteQueriesEXT(%" PRId32 ", %p)\n", count, queries);
Observations observations;
do {
Slice<QueryId> l_q = slice(queries, (uint64_t)(0), (uint64_t)(count));
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_137_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_137_result;
for (int32_t l_i = 0; l_i < count; ++l_i) {
l_ctx->mInstances.mQueries[read(l_q, (uint64_t)(l_i))] = std::shared_ptr<Query>();
}
observe(observations.mReads);
mImports.glDeleteQueriesEXT(count, queries);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlDeleteQueriesEXT coder(
observations, count, gapic::coder::gles::QueryId__CP(gapic::coder::memory::Pointer(
reinterpret_cast<uintptr_t>(queries), 0)));
mEncoder->Object(&coder);
}
inline bool GlesSpy::glIsQueryEXT(uint32_t query) {
GAPID_INFO("glIsQueryEXT(%" PRIu32 ")\n", query);
bool result = false;
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_138_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_138_result;
observe(observations.mReads);
result = mImports.glIsQueryEXT(query);
break;
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlIsQueryEXT coder(observations, query, result);
mEncoder->Object(&coder);
return result;
}
inline void GlesSpy::glQueryCounterEXT(uint32_t query, uint32_t target) {
GAPID_INFO("glQueryCounterEXT(%" PRIu32 ", %u)\n", query, target);
Observations observations;
do {
observe(observations.mReads);
mImports.glQueryCounterEXT(query, target);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlQueryCounterEXT coder(observations, query, target);
mEncoder->Object(&coder);
}
inline void GlesSpy::glGetQueryivEXT(uint32_t target, uint32_t parameter, int32_t* value) {
GAPID_INFO("glGetQueryivEXT(%u, %u, %p)\n", target, parameter, value);
Observations observations;
do {
observe(observations.mReads);
mImports.glGetQueryivEXT(target, parameter, value);
write(slice(value, 0, 1), 0, slice(value, 0, 1)[0]);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlGetQueryivEXT coder(
observations, target, parameter,
gapic::coder::gles::S32__P(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(value), 0)));
mEncoder->Object(&coder);
}
inline void GlesSpy::glGetQueryObjectivEXT(uint32_t query, uint32_t parameter, int32_t* value) {
GAPID_INFO("glGetQueryObjectivEXT(%" PRIu32 ", %u, %p)\n", query, parameter, value);
Observations observations;
do {
observe(observations.mReads);
mImports.glGetQueryObjectivEXT(query, parameter, value);
write(slice(value, 0, 1), 0, slice(value, 0, 1)[0]);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlGetQueryObjectivEXT coder(
observations, query, parameter,
gapic::coder::gles::S32__P(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(value), 0)));
mEncoder->Object(&coder);
}
inline void GlesSpy::glGetQueryObjectuivEXT(uint32_t query, uint32_t parameter, uint32_t* value) {
GAPID_INFO("glGetQueryObjectuivEXT(%" PRIu32 ", %u, %p)\n", query, parameter, value);
Observations observations;
do {
observe(observations.mReads);
mImports.glGetQueryObjectuivEXT(query, parameter, value);
write(slice(value, 0, 1), 0, slice(value, 0, 1)[0]);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlGetQueryObjectuivEXT coder(
observations, query, parameter,
gapic::coder::gles::U32__P(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(value), 0)));
mEncoder->Object(&coder);
}
inline void GlesSpy::glGetQueryObjecti64vEXT(uint32_t query, uint32_t parameter, int64_t* value) {
GAPID_INFO("glGetQueryObjecti64vEXT(%" PRIu32 ", %u, %p)\n", query, parameter, value);
Observations observations;
do {
observe(observations.mReads);
mImports.glGetQueryObjecti64vEXT(query, parameter, value);
write(slice(value, 0, 1), 0, slice(value, 0, 1)[0]);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlGetQueryObjecti64vEXT coder(
observations, query, parameter,
gapic::coder::gles::S64__P(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(value), 0)));
mEncoder->Object(&coder);
}
inline void GlesSpy::glGetQueryObjectui64vEXT(uint32_t query, uint32_t parameter, uint64_t* value) {
GAPID_INFO("glGetQueryObjectui64vEXT(%" PRIu32 ", %u, %p)\n", query, parameter, value);
Observations observations;
do {
observe(observations.mReads);
mImports.glGetQueryObjectui64vEXT(query, parameter, value);
write(slice(value, 0, 1), 0, slice(value, 0, 1)[0]);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::GlGetQueryObjectui64vEXT coder(
observations, query, parameter,
gapic::coder::gles::U64__P(
gapic::coder::memory::Pointer(reinterpret_cast<uintptr_t>(value), 0)));
mEncoder->Object(&coder);
}
inline void GlesSpy::architecture(uint32_t pointer_alignment, uint32_t pointer_size,
uint32_t integer_size, bool little_endian) {
GAPID_INFO("architecture(%" PRIu32 ", %" PRIu32 ", %" PRIu32 ", %d)\n", pointer_alignment,
pointer_size, integer_size, little_endian);
Observations observations;
do {
observe(observations.mReads);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::Architecture coder(observations, pointer_alignment, pointer_size,
integer_size, little_endian);
mEncoder->Object(&coder);
}
inline void GlesSpy::replayCreateRenderer(uint32_t id) {
GAPID_INFO("replayCreateRenderer(%" PRIu32 ")\n", id);
Observations observations;
do {
observe(observations.mReads);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::ReplayCreateRenderer coder(observations, id);
mEncoder->Object(&coder);
}
inline void GlesSpy::replayBindRenderer(uint32_t id) {
GAPID_INFO("replayBindRenderer(%" PRIu32 ")\n", id);
Observations observations;
do {
observe(observations.mReads);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::ReplayBindRenderer coder(observations, id);
mEncoder->Object(&coder);
}
inline void GlesSpy::switchThread(uint64_t threadID) {
GAPID_INFO("switchThread(%" PRIu64 ")\n", threadID);
Observations observations;
do {
this->CurrentThread = threadID;
observe(observations.mReads);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::SwitchThread coder(observations, threadID);
mEncoder->Object(&coder);
}
inline void GlesSpy::backbufferInfo(int32_t width, int32_t height, uint32_t color_fmt,
uint32_t depth_fmt, uint32_t stencil_fmt,
bool resetViewportScissor, bool preserveBuffersOnSwap) {
GAPID_INFO("backbufferInfo(%" PRId32 ", %" PRId32 ", %u, %u, %u, %d, %d)\n", width, height,
color_fmt, depth_fmt, stencil_fmt, resetViewportScissor, preserveBuffersOnSwap);
Observations observations;
do {
std::shared_ptr<Context> l_context = this->Contexts[this->CurrentThread];
std::shared_ptr<Context> l_GetContext_139_result = l_context;
std::shared_ptr<Context> l_ctx = l_GetContext_139_result;
l_ctx->mPreserveBuffersOnSwap = preserveBuffersOnSwap;
std::shared_ptr<Framebuffer> l_backbuffer =
l_ctx->mInstances.mFramebuffers[(FramebufferId)(0)];
RenderbufferId l_color_id =
(RenderbufferId)(l_backbuffer->mAttachments[GLenum::GL_COLOR_ATTACHMENT0].mObject);
std::shared_ptr<Renderbuffer> l_color_buffer = l_ctx->mInstances.mRenderbuffers[l_color_id];
RenderbufferId l_depth_id =
(RenderbufferId)(l_backbuffer->mAttachments[GLenum::GL_DEPTH_ATTACHMENT].mObject);
std::shared_ptr<Renderbuffer> l_depth_buffer = l_ctx->mInstances.mRenderbuffers[l_depth_id];
RenderbufferId l_stencil_id =
(RenderbufferId)(l_backbuffer->mAttachments[GLenum::GL_STENCIL_ATTACHMENT].mObject);
std::shared_ptr<Renderbuffer> l_stencil_buffer =
l_ctx->mInstances.mRenderbuffers[l_stencil_id];
l_color_buffer->mWidth = width;
l_color_buffer->mHeight = height;
l_color_buffer->mFormat = color_fmt;
l_depth_buffer->mWidth = width;
l_depth_buffer->mHeight = height;
l_depth_buffer->mFormat = depth_fmt;
l_stencil_buffer->mWidth = width;
l_stencil_buffer->mHeight = height;
l_stencil_buffer->mFormat = stencil_fmt;
if (resetViewportScissor) {
l_ctx->mRasterizing.mScissor.mWidth = width;
l_ctx->mRasterizing.mScissor.mHeight = height;
l_ctx->mRasterizing.mViewport.mWidth = width;
l_ctx->mRasterizing.mViewport.mHeight = height;
}
observe(observations.mReads);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::BackbufferInfo coder(observations, width, height, color_fmt, depth_fmt,
stencil_fmt, resetViewportScissor,
preserveBuffersOnSwap);
mEncoder->Object(&coder);
}
inline void GlesSpy::startTimer(uint8_t index) {
GAPID_INFO("startTimer(%" PRIu8 ")\n", index);
Observations observations;
do {
observe(observations.mReads);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::StartTimer coder(observations, index);
mEncoder->Object(&coder);
}
inline uint64_t GlesSpy::stopTimer(uint8_t index) {
GAPID_INFO("stopTimer(%" PRIu8 ")\n", index);
uint64_t result = 0;
Observations observations;
do {
observe(observations.mReads);
break;
} while (false);
observe(observations.mWrites);
gapic::coder::gles::StopTimer coder(observations, index, result);
mEncoder->Object(&coder);
return result;
}
inline void GlesSpy::flushPostBuffer() {
GAPID_INFO("flushPostBuffer()\n");
Observations observations;
do {
observe(observations.mReads);
} while (false);
observe(observations.mWrites);
gapic::coder::gles::FlushPostBuffer coder(observations);
mEncoder->Object(&coder);
}
} // namespace gapii
#endif // GAPII_GLES_SPY_H