blob: c4f2ff84f3b36ea7a768d642d6fea48905bc84fb [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;
22class FenceSync;
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
Geoff Lang82483b92017-04-11 15:33:00 -0400100Error QuerySynciv(const FenceSync *sync,
101 GLenum pname,
102 GLsizei bufSize,
103 GLsizei *length,
104 GLint *values);
Geoff Lang38f2cfb2017-04-11 15:23:08 -0400105
Jamie Madill4928b7c2017-06-20 12:57:39 -0400106void SetTexParameterf(Context *context, Texture *texture, GLenum pname, GLfloat param);
107void SetTexParameterfv(Context *context, Texture *texture, GLenum pname, const GLfloat *params);
108void SetTexParameteri(Context *context, Texture *texture, GLenum pname, GLint param);
109void SetTexParameteriv(Context *context, Texture *texture, GLenum pname, const GLint *params);
Geoff Langc1984ed2016-10-07 12:41:00 -0400110
111void SetSamplerParameterf(Sampler *sampler, GLenum pname, GLfloat param);
112void SetSamplerParameterfv(Sampler *sampler, GLenum pname, const GLfloat *params);
113void SetSamplerParameteri(Sampler *sampler, GLenum pname, GLint param);
114void SetSamplerParameteriv(Sampler *sampler, GLenum pname, const GLint *params);
JiangYizhoue18e6392017-02-20 10:32:23 +0800115
JiangYizhouf7bbc8a2016-11-16 09:57:22 +0800116void SetFramebufferParameteri(Framebuffer *framebuffer, GLenum pname, GLint param);
Geoff Lang65603eb2017-01-12 16:48:03 -0500117
Yunchao He61afff12017-03-14 15:34:03 +0800118void SetProgramParameteri(Program *program, GLenum pname, GLint value);
119
jchen1015015f72017-03-16 13:54:21 +0800120GLuint QueryProgramResourceIndex(const Program *program,
121 GLenum programInterface,
122 const GLchar *name);
123
jchen10fd7c3b52017-03-21 15:36:03 +0800124void QueryProgramResourceName(const Program *program,
125 GLenum programInterface,
126 GLuint index,
127 GLsizei bufSize,
128 GLsizei *length,
129 GLchar *name);
130
jchen10191381f2017-04-11 13:59:04 +0800131GLint QueryProgramResourceLocation(const Program *program,
132 GLenum programInterface,
133 const GLchar *name);
134
Geoff Lang65603eb2017-01-12 16:48:03 -0500135} // namespace gl
136
137namespace egl
138{
139struct Config;
Geoff Lang31ecbd72017-07-26 13:01:27 -0400140class Surface;
Geoff Lang65603eb2017-01-12 16:48:03 -0500141
142void QueryConfigAttrib(const Config *config, EGLint attribute, EGLint *value);
143
Geoff Lang31ecbd72017-07-26 13:01:27 -0400144void QuerySurfaceAttrib(const Surface *surface, EGLint attribute, EGLint *value);
145void SetSurfaceAttrib(Surface *surface, EGLint attribute, EGLint value);
146
Geoff Lang65603eb2017-01-12 16:48:03 -0500147} // namespace egl
Geoff Langff5b2d52016-09-07 11:32:23 -0400148
149#endif // LIBANGLE_QUERYUTILS_H_