blob: febfdaa0eec4c35cefee1daab511fd7db473d97f [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 Langff5b2d52016-09-07 11:32:23 -040021class Framebuffer;
22class Program;
Geoff Lang740d9022016-10-07 11:20:52 -040023class Renderbuffer;
Geoff Langc1984ed2016-10-07 12:41:00 -040024class Sampler;
Geoff Langd7d0ed32016-10-07 11:33:51 -040025class Shader;
Geoff Langc1984ed2016-10-07 12:41:00 -040026class Texture;
Geoff Lang0a9661f2016-10-20 10:59:20 -070027struct TextureCaps;
Geoff Lang6899b872016-10-14 11:30:13 -040028struct UniformBlock;
Geoff Lang0b031062016-10-13 14:30:04 -040029struct VertexAttribute;
Jiawei-Shao2597fb62016-12-09 16:38:02 +080030struct VertexBinding;
Geoff Lang0b031062016-10-13 14:30:04 -040031struct VertexAttribCurrentValueData;
Geoff Langff5b2d52016-09-07 11:32:23 -040032
33void QueryFramebufferAttachmentParameteriv(const Framebuffer *framebuffer,
34 GLenum attachment,
35 GLenum pname,
36 GLint *params);
37void QueryBufferParameteriv(const Buffer *buffer, GLenum pname, GLint *params);
Geoff Langebebe1c2016-10-14 12:01:31 -040038void QueryBufferParameteri64v(const Buffer *buffer, GLenum pname, GLint64 *params);
Geoff Lang496c02d2016-10-20 11:38:11 -070039void QueryBufferPointerv(const Buffer *buffer, GLenum pname, void **params);
Geoff Langff5b2d52016-09-07 11:32:23 -040040void QueryProgramiv(const Program *program, GLenum pname, GLint *params);
Jamie Madill4e0e6f82017-02-17 11:06:03 -050041void QueryRenderbufferiv(const Context *context,
42 const Renderbuffer *renderbuffer,
43 GLenum pname,
44 GLint *params);
Geoff Langd7d0ed32016-10-07 11:33:51 -040045void QueryShaderiv(const Shader *shader, GLenum pname, GLint *params);
He Yunchao11b038b2016-11-22 21:24:04 +080046void QueryTexLevelParameterfv(const Texture *texture,
47 GLenum target,
48 GLint level,
49 GLenum pname,
50 GLfloat *params);
51void QueryTexLevelParameteriv(const Texture *texture,
52 GLenum target,
53 GLint level,
54 GLenum pname,
55 GLint *params);
Geoff Langc1984ed2016-10-07 12:41:00 -040056void QueryTexParameterfv(const Texture *texture, GLenum pname, GLfloat *params);
57void QueryTexParameteriv(const Texture *texture, GLenum pname, GLint *params);
58void QuerySamplerParameterfv(const Sampler *sampler, GLenum pname, GLfloat *params);
59void QuerySamplerParameteriv(const Sampler *sampler, GLenum pname, GLint *params);
Jiawei-Shao2597fb62016-12-09 16:38:02 +080060
61// Warning: you should ensure binding really matches attrib.bindingIndex before using the following
62// functions.
Geoff Lang0b031062016-10-13 14:30:04 -040063void QueryVertexAttribfv(const VertexAttribute &attrib,
Jiawei-Shao2597fb62016-12-09 16:38:02 +080064 const VertexBinding &binding,
Geoff Lang0b031062016-10-13 14:30:04 -040065 const VertexAttribCurrentValueData &currentValueData,
66 GLenum pname,
67 GLfloat *params);
Jiawei-Shao2597fb62016-12-09 16:38:02 +080068
Geoff Lang0b031062016-10-13 14:30:04 -040069void QueryVertexAttribiv(const VertexAttribute &attrib,
Jiawei-Shao2597fb62016-12-09 16:38:02 +080070 const VertexBinding &binding,
Geoff Lang0b031062016-10-13 14:30:04 -040071 const VertexAttribCurrentValueData &currentValueData,
72 GLenum pname,
73 GLint *params);
Jiawei-Shao2597fb62016-12-09 16:38:02 +080074
Geoff Lang0b031062016-10-13 14:30:04 -040075void QueryVertexAttribPointerv(const VertexAttribute &attrib, GLenum pname, GLvoid **pointer);
Jiawei-Shao2597fb62016-12-09 16:38:02 +080076
Geoff Lang0b031062016-10-13 14:30:04 -040077void QueryVertexAttribIiv(const VertexAttribute &attrib,
Jiawei-Shao2597fb62016-12-09 16:38:02 +080078 const VertexBinding &binding,
Geoff Lang0b031062016-10-13 14:30:04 -040079 const VertexAttribCurrentValueData &currentValueData,
80 GLenum pname,
81 GLint *params);
Jiawei-Shao2597fb62016-12-09 16:38:02 +080082
Geoff Lang0b031062016-10-13 14:30:04 -040083void QueryVertexAttribIuiv(const VertexAttribute &attrib,
Jiawei-Shao2597fb62016-12-09 16:38:02 +080084 const VertexBinding &binding,
Geoff Lang0b031062016-10-13 14:30:04 -040085 const VertexAttribCurrentValueData &currentValueData,
86 GLenum pname,
87 GLuint *params);
Geoff Langc1984ed2016-10-07 12:41:00 -040088
Geoff Lang6899b872016-10-14 11:30:13 -040089void QueryActiveUniformBlockiv(const Program *program,
90 GLuint uniformBlockIndex,
91 GLenum pname,
92 GLint *params);
93
Geoff Lang0a9661f2016-10-20 10:59:20 -070094void QueryInternalFormativ(const TextureCaps &format, GLenum pname, GLsizei bufSize, GLint *params);
JiangYizhoue18e6392017-02-20 10:32:23 +080095
JiangYizhouf7bbc8a2016-11-16 09:57:22 +080096void QueryFramebufferParameteriv(const Framebuffer *framebuffer, GLenum pname, GLint *params);
Geoff Lang0a9661f2016-10-20 10:59:20 -070097
Geoff Langc1984ed2016-10-07 12:41:00 -040098void SetTexParameterf(Texture *texture, GLenum pname, GLfloat param);
99void SetTexParameterfv(Texture *texture, GLenum pname, const GLfloat *params);
100void SetTexParameteri(Texture *texture, GLenum pname, GLint param);
101void SetTexParameteriv(Texture *texture, GLenum pname, const GLint *params);
102
103void SetSamplerParameterf(Sampler *sampler, GLenum pname, GLfloat param);
104void SetSamplerParameterfv(Sampler *sampler, GLenum pname, const GLfloat *params);
105void SetSamplerParameteri(Sampler *sampler, GLenum pname, GLint param);
106void SetSamplerParameteriv(Sampler *sampler, GLenum pname, const GLint *params);
JiangYizhoue18e6392017-02-20 10:32:23 +0800107
JiangYizhouf7bbc8a2016-11-16 09:57:22 +0800108void SetFramebufferParameteri(Framebuffer *framebuffer, GLenum pname, GLint param);
Geoff Lang65603eb2017-01-12 16:48:03 -0500109
Yunchao He61afff12017-03-14 15:34:03 +0800110void SetProgramParameteri(Program *program, GLenum pname, GLint value);
111
jchen1015015f72017-03-16 13:54:21 +0800112GLuint QueryProgramResourceIndex(const Program *program,
113 GLenum programInterface,
114 const GLchar *name);
115
Geoff Lang65603eb2017-01-12 16:48:03 -0500116} // namespace gl
117
118namespace egl
119{
120struct Config;
121
122void QueryConfigAttrib(const Config *config, EGLint attribute, EGLint *value);
123
124} // namespace egl
Geoff Langff5b2d52016-09-07 11:32:23 -0400125
126#endif // LIBANGLE_QUERYUTILS_H_