blob: cbac855ff3bcad0ef2fc9132f8524b72300ab117 [file] [log] [blame]
Mathias Agopian3f844832013-08-07 21:24:32 -07001/*
2 * Copyright 2013 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include <GLES2/gl2.h>
Mathias Agopian49457ac2013-08-14 18:20:17 -070018#include "Texture.h"
Mathias Agopian3f844832013-08-07 21:24:32 -070019
20#ifndef SF_RENDER_ENGINE_DESCRIPTION_H_
21#define SF_RENDER_ENGINE_DESCRIPTION_H_
22
23namespace android {
24
25class Program;
26
27/*
28 * This holds the state of the rendering engine. This class is used
29 * to generate a corresponding GLSL program and set the appropriate
30 * uniform.
31 *
32 * Program and ProgramCache are friends and access the state directly
33 */
34class Description {
35 friend class Program;
36 friend class ProgramCache;
37
Mathias Agopian3f844832013-08-07 21:24:32 -070038 // whether textures are premultiplied
39 bool mPremultipliedAlpha;
40 // whether this layer is marked as opaque
41 bool mOpaque;
Mathias Agopian3f844832013-08-07 21:24:32 -070042
Mathias Agopian49457ac2013-08-14 18:20:17 -070043 // Texture this layer uses
44 Texture mTexture;
45 bool mTextureEnabled;
46
chaviw13fdc492017-06-27 12:40:18 -070047 // color used when texturing is disabled or when setting alpha.
48 half4 mColor;
Mathias Agopian3f844832013-08-07 21:24:32 -070049 // projection matrix
Mathias Agopiana8c386f2013-08-26 20:42:07 -070050 mat4 mProjectionMatrix;
Mathias Agopian3f844832013-08-07 21:24:32 -070051
Mathias Agopianff2ed702013-09-01 21:36:12 -070052 bool mColorMatrixEnabled;
53 mat4 mColorMatrix;
54
Romain Guy88d37dd2017-05-26 17:57:05 -070055 bool mIsWideGamut;
56
Mathias Agopian3f844832013-08-07 21:24:32 -070057public:
58 Description();
59 ~Description();
60
Mathias Agopian3f844832013-08-07 21:24:32 -070061 void setPremultipliedAlpha(bool premultipliedAlpha);
62 void setOpaque(bool opaque);
Mathias Agopian49457ac2013-08-14 18:20:17 -070063 void setTexture(const Texture& texture);
Mathias Agopian3f844832013-08-07 21:24:32 -070064 void disableTexture();
chaviw13fdc492017-06-27 12:40:18 -070065 void setColor(const half4& color);
Mathias Agopiana8c386f2013-08-26 20:42:07 -070066 void setProjectionMatrix(const mat4& mtx);
Mathias Agopianff2ed702013-09-01 21:36:12 -070067 void setColorMatrix(const mat4& mtx);
Dan Stozaf0087992014-10-20 15:46:09 -070068 const mat4& getColorMatrix() const;
Romain Guy88d37dd2017-05-26 17:57:05 -070069 void setWideGamut(bool wideGamut);
Mathias Agopian3f844832013-08-07 21:24:32 -070070};
71
72} /* namespace android */
73
74#endif /* SF_RENDER_ENGINE_DESCRIPTION_H_ */