blob: e47776cbb28e6255d3fbd60fa909f7197fac7ef1 [file] [log] [blame]
Geoff Langff5b2d52016-09-07 11:32:23 -04001//
2// Copyright (c) 2016 The ANGLE Project Authors. All rights reserved.
3// Use of this source code is governed by a BSD-style license that can be
4// found in the LICENSE file.
5//
6
7// queryutils.h: Utilities for querying values from GL objects
8
9#ifndef LIBANGLE_QUERYUTILS_H_
10#define LIBANGLE_QUERYUTILS_H_
11
12#include "angle_gl.h"
13#include "common/angleutils.h"
14
Geoff Lang65603eb2017-01-12 16:48:03 -050015#include <EGL/egl.h>
16
Geoff Langff5b2d52016-09-07 11:32:23 -040017namespace gl
18{
19class Buffer;
Jamie Madill4e0e6f82017-02-17 11:06:03 -050020class Context;
Geoff Lang38f2cfb2017-04-11 15:23:08 -040021class Error;
Jamie Madill70b5bb02017-08-28 13:32:37 -040022class Sync;
Geoff Langff5b2d52016-09-07 11:32:23 -040023class Framebuffer;
24class Program;
Geoff Lang740d9022016-10-07 11:20:52 -040025class Renderbuffer;
Geoff Langc1984ed2016-10-07 12:41:00 -040026class Sampler;
Geoff Langd7d0ed32016-10-07 11:33:51 -040027class Shader;
Geoff Langc1984ed2016-10-07 12:41:00 -040028class Texture;
Geoff Lang0a9661f2016-10-20 10:59:20 -070029struct TextureCaps;
Geoff Lang6899b872016-10-14 11:30:13 -040030struct UniformBlock;
Geoff Lang0b031062016-10-13 14:30:04 -040031struct VertexAttribute;
Martin Radevdd5f27e2017-06-07 10:17:09 +030032class VertexBinding;
Geoff Lang0b031062016-10-13 14:30:04 -040033struct VertexAttribCurrentValueData;
Geoff Langff5b2d52016-09-07 11:32:23 -040034
35void QueryFramebufferAttachmentParameteriv(const Framebuffer *framebuffer,
36 GLenum attachment,
37 GLenum pname,
38 GLint *params);
39void QueryBufferParameteriv(const Buffer *buffer, GLenum pname, GLint *params);
Geoff Langebebe1c2016-10-14 12:01:31 -040040void QueryBufferParameteri64v(const Buffer *buffer, GLenum pname, GLint64 *params);
Geoff Lang496c02d2016-10-20 11:38:11 -070041void QueryBufferPointerv(const Buffer *buffer, GLenum pname, void **params);
Jamie Madillffe00c02017-06-27 16:26:55 -040042void QueryProgramiv(const Context *context, const Program *program, GLenum pname, GLint *params);
Jamie Madill4e0e6f82017-02-17 11:06:03 -050043void QueryRenderbufferiv(const Context *context,
44 const Renderbuffer *renderbuffer,
45 GLenum pname,
46 GLint *params);
Jamie Madillbd044ed2017-06-05 12:59:21 -040047void QueryShaderiv(const Context *context, Shader *shader, GLenum pname, GLint *params);
He Yunchao11b038b2016-11-22 21:24:04 +080048void QueryTexLevelParameterfv(const Texture *texture,
49 GLenum target,
50 GLint level,
51 GLenum pname,
52 GLfloat *params);
53void QueryTexLevelParameteriv(const Texture *texture,
54 GLenum target,
55 GLint level,
56 GLenum pname,
57 GLint *params);
Geoff Langc1984ed2016-10-07 12:41:00 -040058void QueryTexParameterfv(const Texture *texture, GLenum pname, GLfloat *params);
59void QueryTexParameteriv(const Texture *texture, GLenum pname, GLint *params);
60void QuerySamplerParameterfv(const Sampler *sampler, GLenum pname, GLfloat *params);
61void QuerySamplerParameteriv(const Sampler *sampler, GLenum pname, GLint *params);
Jiawei-Shao2597fb62016-12-09 16:38:02 +080062
63// Warning: you should ensure binding really matches attrib.bindingIndex before using the following
64// functions.
Geoff Lang0b031062016-10-13 14:30:04 -040065void QueryVertexAttribfv(const VertexAttribute &attrib,
Jiawei-Shao2597fb62016-12-09 16:38:02 +080066 const VertexBinding &binding,
Geoff Lang0b031062016-10-13 14:30:04 -040067 const VertexAttribCurrentValueData &currentValueData,
68 GLenum pname,
69 GLfloat *params);
Jiawei-Shao2597fb62016-12-09 16:38:02 +080070
Geoff Lang0b031062016-10-13 14:30:04 -040071void QueryVertexAttribiv(const VertexAttribute &attrib,
Jiawei-Shao2597fb62016-12-09 16:38:02 +080072 const VertexBinding &binding,
Geoff Lang0b031062016-10-13 14:30:04 -040073 const VertexAttribCurrentValueData &currentValueData,
74 GLenum pname,
75 GLint *params);
Jiawei-Shao2597fb62016-12-09 16:38:02 +080076
Jamie Madill876429b2017-04-20 15:46:24 -040077void QueryVertexAttribPointerv(const VertexAttribute &attrib, GLenum pname, void **pointer);
Jiawei-Shao2597fb62016-12-09 16:38:02 +080078
Geoff Lang0b031062016-10-13 14:30:04 -040079void QueryVertexAttribIiv(const VertexAttribute &attrib,
Jiawei-Shao2597fb62016-12-09 16:38:02 +080080 const VertexBinding &binding,
Geoff Lang0b031062016-10-13 14:30:04 -040081 const VertexAttribCurrentValueData &currentValueData,
82 GLenum pname,
83 GLint *params);
Jiawei-Shao2597fb62016-12-09 16:38:02 +080084
Geoff Lang0b031062016-10-13 14:30:04 -040085void QueryVertexAttribIuiv(const VertexAttribute &attrib,
Jiawei-Shao2597fb62016-12-09 16:38:02 +080086 const VertexBinding &binding,
Geoff Lang0b031062016-10-13 14:30:04 -040087 const VertexAttribCurrentValueData &currentValueData,
88 GLenum pname,
89 GLuint *params);
Geoff Langc1984ed2016-10-07 12:41:00 -040090
Geoff Lang6899b872016-10-14 11:30:13 -040091void QueryActiveUniformBlockiv(const Program *program,
92 GLuint uniformBlockIndex,
93 GLenum pname,
94 GLint *params);
95
Geoff Lang0a9661f2016-10-20 10:59:20 -070096void QueryInternalFormativ(const TextureCaps &format, GLenum pname, GLsizei bufSize, GLint *params);
JiangYizhoue18e6392017-02-20 10:32:23 +080097
JiangYizhouf7bbc8a2016-11-16 09:57:22 +080098void QueryFramebufferParameteriv(const Framebuffer *framebuffer, GLenum pname, GLint *params);
Geoff Lang0a9661f2016-10-20 10:59:20 -070099
Jamie Madill70b5bb02017-08-28 13:32:37 -0400100Error QuerySynciv(const Sync *sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
Geoff Lang38f2cfb2017-04-11 15:23:08 -0400101
Jamie Madill4928b7c2017-06-20 12:57:39 -0400102void SetTexParameterf(Context *context, Texture *texture, GLenum pname, GLfloat param);
103void SetTexParameterfv(Context *context, Texture *texture, GLenum pname, const GLfloat *params);
104void SetTexParameteri(Context *context, Texture *texture, GLenum pname, GLint param);
105void SetTexParameteriv(Context *context, Texture *texture, GLenum pname, const GLint *params);
Geoff Langc1984ed2016-10-07 12:41:00 -0400106
107void SetSamplerParameterf(Sampler *sampler, GLenum pname, GLfloat param);
108void SetSamplerParameterfv(Sampler *sampler, GLenum pname, const GLfloat *params);
109void SetSamplerParameteri(Sampler *sampler, GLenum pname, GLint param);
110void SetSamplerParameteriv(Sampler *sampler, GLenum pname, const GLint *params);
JiangYizhoue18e6392017-02-20 10:32:23 +0800111
JiangYizhouf7bbc8a2016-11-16 09:57:22 +0800112void SetFramebufferParameteri(Framebuffer *framebuffer, GLenum pname, GLint param);
Geoff Lang65603eb2017-01-12 16:48:03 -0500113
Yunchao He61afff12017-03-14 15:34:03 +0800114void SetProgramParameteri(Program *program, GLenum pname, GLint value);
115
jchen1015015f72017-03-16 13:54:21 +0800116GLuint QueryProgramResourceIndex(const Program *program,
117 GLenum programInterface,
118 const GLchar *name);
119
jchen10fd7c3b52017-03-21 15:36:03 +0800120void QueryProgramResourceName(const Program *program,
121 GLenum programInterface,
122 GLuint index,
123 GLsizei bufSize,
124 GLsizei *length,
125 GLchar *name);
126
jchen10191381f2017-04-11 13:59:04 +0800127GLint QueryProgramResourceLocation(const Program *program,
128 GLenum programInterface,
129 const GLchar *name);
jchen10880683b2017-04-12 16:21:55 +0800130void QueryProgramResourceiv(const Program *program,
131 GLenum programInterface,
132 GLuint index,
133 GLsizei propCount,
134 const GLenum *props,
135 GLsizei bufSize,
136 GLsizei *length,
137 GLint *params);
jchen10191381f2017-04-11 13:59:04 +0800138
Geoff Lang65603eb2017-01-12 16:48:03 -0500139} // namespace gl
140
141namespace egl
142{
143struct Config;
Geoff Lang31ecbd72017-07-26 13:01:27 -0400144class Surface;
Geoff Lang65603eb2017-01-12 16:48:03 -0500145
146void QueryConfigAttrib(const Config *config, EGLint attribute, EGLint *value);
147
Geoff Lang31ecbd72017-07-26 13:01:27 -0400148void QuerySurfaceAttrib(const Surface *surface, EGLint attribute, EGLint *value);
149void SetSurfaceAttrib(Surface *surface, EGLint attribute, EGLint value);
150
Geoff Lang65603eb2017-01-12 16:48:03 -0500151} // namespace egl
Geoff Langff5b2d52016-09-07 11:32:23 -0400152
153#endif // LIBANGLE_QUERYUTILS_H_