зеркало из https://github.com/AvaloniaUI/angle.git
Revert "GLES1: Entry points for lighting and materials"
This reverts commit 4a09c1a245
.
Reason for revert: Seems to break the build
Original change's description:
> GLES1: Entry points for lighting and materials
>
> - glLight*/glMaterial and their queries
> - Use new packed enums in these entry points, except for lightmodel
> which stays GLenum to be consistent with other generic glGet's
> - State.cpp: New glGet* queries related to light model and
> light/normal rescale enablement
> - GLES1State.cpp: Functions to get/set lighting/material state
> - Validation for lighting/materials
>
> + Add a few convenience methods to random_utils for sampling
> non-negative floats and a sampler for random booleans
>
> BUG=angleproject:2306
>
> Change-Id: If7ba0c0a0dc75f88fbaa986b904f1ea96ee6512e
> Reviewed-on: https://chromium-review.googlesource.com/1065502
> Commit-Queue: Lingfeng Yang <lfy@google.com>
> Reviewed-by: Geoff Lang <geofflang@chromium.org>
TBR=geofflang@chromium.org,jmadill@chromium.org,cwallez@chromium.org,lfy@google.com
Change-Id: Ifabd708ded87c7484ad6d466508e2c2d6ea2557c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: angleproject:2306
Reviewed-on: https://chromium-review.googlesource.com/1071828
Reviewed-by: Lingfeng Yang <lfy@google.com>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
This commit is contained in:
Родитель
4a09c1a245
Коммит
668e507f99
|
@ -136,18 +136,6 @@
|
|||
"glGetBufferPointervRobustANGLE": {
|
||||
"target": "BufferBinding"
|
||||
},
|
||||
"glGetLightfv": {
|
||||
"pname" : "LightParameter"
|
||||
},
|
||||
"glGetLightxv": {
|
||||
"pname" : "LightParameter"
|
||||
},
|
||||
"glGetMaterialfv": {
|
||||
"pname" : "MaterialParameter"
|
||||
},
|
||||
"glGetMaterialxv": {
|
||||
"pname" : "MaterialParameter"
|
||||
},
|
||||
"glGetQueryiv": {
|
||||
"target": "QueryType"
|
||||
},
|
||||
|
@ -190,18 +178,6 @@
|
|||
"glGetTexParameterxv": {
|
||||
"target": "TextureType"
|
||||
},
|
||||
"glLightf" : {
|
||||
"pname" : "LightParameter"
|
||||
},
|
||||
"glLightfv" : {
|
||||
"pname" : "LightParameter"
|
||||
},
|
||||
"glLightx" : {
|
||||
"pname" : "LightParameter"
|
||||
},
|
||||
"glLightxv" : {
|
||||
"pname" : "LightParameter"
|
||||
},
|
||||
"glMapBuffer": {
|
||||
"target": "BufferBinding"
|
||||
},
|
||||
|
@ -214,18 +190,6 @@
|
|||
"glMapBufferRangeEXT": {
|
||||
"target": "BufferBinding"
|
||||
},
|
||||
"glMaterialf": {
|
||||
"pname": "MaterialParameter"
|
||||
},
|
||||
"glMaterialfv": {
|
||||
"pname": "MaterialParameter"
|
||||
},
|
||||
"glMaterialx": {
|
||||
"pname": "MaterialParameter"
|
||||
},
|
||||
"glMaterialxv": {
|
||||
"pname": "MaterialParameter"
|
||||
},
|
||||
"glMatrixMode": {
|
||||
"mode": "MatrixType"
|
||||
},
|
||||
|
|
|
@ -21,15 +21,6 @@ struct Color
|
|||
const T *data() const { return &red; }
|
||||
T *ptr() { return &red; }
|
||||
|
||||
static Color fromData(const T *data) { return Color(data[0], data[1], data[2], data[3]); }
|
||||
void writeData(T *data) const
|
||||
{
|
||||
data[0] = red;
|
||||
data[1] = green;
|
||||
data[2] = blue;
|
||||
data[3] = alpha;
|
||||
}
|
||||
|
||||
T red;
|
||||
T green;
|
||||
T blue;
|
||||
|
|
|
@ -1682,9 +1682,6 @@ void Context::getIntegervImpl(GLenum pname, GLint *params)
|
|||
case GL_MAX_TEXTURE_STACK_DEPTH:
|
||||
*params = mCaps.maxTextureMatrixStackDepth;
|
||||
break;
|
||||
case GL_MAX_LIGHTS:
|
||||
*params = mCaps.maxLights;
|
||||
break;
|
||||
// GLES1 emulation: Vertex attribute queries
|
||||
case GL_VERTEX_ARRAY_BUFFER_BINDING:
|
||||
case GL_NORMAL_ARRAY_BUFFER_BINDING:
|
||||
|
@ -7061,7 +7058,6 @@ bool Context::getQueryParameterInfo(GLenum pname, GLenum *type, unsigned int *nu
|
|||
case GL_MAX_MODELVIEW_STACK_DEPTH:
|
||||
case GL_MAX_PROJECTION_STACK_DEPTH:
|
||||
case GL_MAX_TEXTURE_STACK_DEPTH:
|
||||
case GL_MAX_LIGHTS:
|
||||
case GL_VERTEX_ARRAY_STRIDE:
|
||||
case GL_NORMAL_ARRAY_STRIDE:
|
||||
case GL_COLOR_ARRAY_STRIDE:
|
||||
|
@ -7089,7 +7085,6 @@ bool Context::getQueryParameterInfo(GLenum pname, GLenum *type, unsigned int *nu
|
|||
return true;
|
||||
case GL_CURRENT_COLOR:
|
||||
case GL_CURRENT_TEXTURE_COORDS:
|
||||
case GL_LIGHT_MODEL_AMBIENT:
|
||||
*type = GL_FLOAT;
|
||||
*numParams = 4;
|
||||
return true;
|
||||
|
@ -7103,10 +7098,6 @@ bool Context::getQueryParameterInfo(GLenum pname, GLenum *type, unsigned int *nu
|
|||
*type = GL_FLOAT;
|
||||
*numParams = 16;
|
||||
return true;
|
||||
case GL_LIGHT_MODEL_TWO_SIDE:
|
||||
*type = GL_BOOL;
|
||||
*numParams = 1;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#include "common/utilities.h"
|
||||
|
||||
#include "libANGLE/GLES1Renderer.h"
|
||||
#include "libANGLE/queryutils.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
|
@ -158,36 +157,24 @@ void Context::getFixedv(GLenum pname, GLfixed *params)
|
|||
UNIMPLEMENTED();
|
||||
}
|
||||
|
||||
void Context::getLightfv(GLenum light, LightParameter pname, GLfloat *params)
|
||||
void Context::getLightfv(GLenum light, GLenum pname, GLfloat *params)
|
||||
{
|
||||
GetLightParameters(&mGLState.gles1(), light, pname, params);
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
|
||||
void Context::getLightxv(GLenum light, LightParameter pname, GLfixed *params)
|
||||
void Context::getLightxv(GLenum light, GLenum pname, GLfixed *params)
|
||||
{
|
||||
GLfloat paramsf[4];
|
||||
getLightfv(light, pname, paramsf);
|
||||
|
||||
for (unsigned int i = 0; i < GetLightParameterCount(pname); i++)
|
||||
{
|
||||
params[i] = FloatToFixed(paramsf[i]);
|
||||
}
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
|
||||
void Context::getMaterialfv(GLenum face, MaterialParameter pname, GLfloat *params)
|
||||
void Context::getMaterialfv(GLenum face, GLenum pname, GLfloat *params)
|
||||
{
|
||||
GetMaterialParameters(&mGLState.gles1(), face, pname, params);
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
|
||||
void Context::getMaterialxv(GLenum face, MaterialParameter pname, GLfixed *params)
|
||||
void Context::getMaterialxv(GLenum face, GLenum pname, GLfixed *params)
|
||||
{
|
||||
GLfloat paramsf[4];
|
||||
getMaterialfv(face, pname, paramsf);
|
||||
|
||||
for (unsigned int i = 0; i < GetMaterialParameterCount(pname); i++)
|
||||
{
|
||||
params[i] = FloatToFixed(paramsf[i]);
|
||||
}
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
|
||||
void Context::getTexEnvfv(GLenum env, GLenum pname, GLfloat *params)
|
||||
|
@ -212,56 +199,42 @@ void Context::getTexParameterxv(TextureType target, GLenum pname, GLfixed *param
|
|||
|
||||
void Context::lightModelf(GLenum pname, GLfloat param)
|
||||
{
|
||||
SetLightModelParameters(&mGLState.gles1(), pname, ¶m);
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
|
||||
void Context::lightModelfv(GLenum pname, const GLfloat *params)
|
||||
{
|
||||
SetLightModelParameters(&mGLState.gles1(), pname, params);
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
|
||||
void Context::lightModelx(GLenum pname, GLfixed param)
|
||||
{
|
||||
lightModelf(pname, FixedToFloat(param));
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
|
||||
void Context::lightModelxv(GLenum pname, const GLfixed *param)
|
||||
{
|
||||
GLfloat paramsf[4];
|
||||
|
||||
for (unsigned int i = 0; i < GetLightModelParameterCount(pname); i++)
|
||||
{
|
||||
paramsf[i] = FixedToFloat(param[i]);
|
||||
}
|
||||
|
||||
lightModelfv(pname, paramsf);
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
|
||||
void Context::lightf(GLenum light, LightParameter pname, GLfloat param)
|
||||
void Context::lightf(GLenum light, GLenum pname, GLfloat param)
|
||||
{
|
||||
SetLightParameters(&mGLState.gles1(), light, pname, ¶m);
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
|
||||
void Context::lightfv(GLenum light, LightParameter pname, const GLfloat *params)
|
||||
void Context::lightfv(GLenum light, GLenum pname, const GLfloat *params)
|
||||
{
|
||||
SetLightParameters(&mGLState.gles1(), light, pname, params);
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
|
||||
void Context::lightx(GLenum light, LightParameter pname, GLfixed param)
|
||||
void Context::lightx(GLenum light, GLenum pname, GLfixed param)
|
||||
{
|
||||
lightf(light, pname, FixedToFloat(param));
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
|
||||
void Context::lightxv(GLenum light, LightParameter pname, const GLfixed *params)
|
||||
void Context::lightxv(GLenum light, GLenum pname, const GLfixed *params)
|
||||
{
|
||||
GLfloat paramsf[4];
|
||||
|
||||
for (unsigned int i = 0; i < GetLightParameterCount(pname); i++)
|
||||
{
|
||||
paramsf[i] = FixedToFloat(params[i]);
|
||||
}
|
||||
|
||||
lightfv(light, pname, paramsf);
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
|
||||
void Context::lineWidthx(GLfixed width)
|
||||
|
@ -289,31 +262,24 @@ void Context::logicOp(GLenum opcode)
|
|||
UNIMPLEMENTED();
|
||||
}
|
||||
|
||||
void Context::materialf(GLenum face, MaterialParameter pname, GLfloat param)
|
||||
void Context::materialf(GLenum face, GLenum pname, GLfloat param)
|
||||
{
|
||||
SetMaterialParameters(&mGLState.gles1(), face, pname, ¶m);
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
|
||||
void Context::materialfv(GLenum face, MaterialParameter pname, const GLfloat *params)
|
||||
void Context::materialfv(GLenum face, GLenum pname, const GLfloat *params)
|
||||
{
|
||||
SetMaterialParameters(&mGLState.gles1(), face, pname, params);
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
|
||||
void Context::materialx(GLenum face, MaterialParameter pname, GLfixed param)
|
||||
void Context::materialx(GLenum face, GLenum pname, GLfixed param)
|
||||
{
|
||||
materialf(face, pname, FixedToFloat(param));
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
|
||||
void Context::materialxv(GLenum face, MaterialParameter pname, const GLfixed *param)
|
||||
void Context::materialxv(GLenum face, GLenum pname, const GLfixed *param)
|
||||
{
|
||||
GLfloat paramsf[4];
|
||||
|
||||
for (unsigned int i = 0; i < GetMaterialParameterCount(pname); i++)
|
||||
{
|
||||
paramsf[i] = FixedToFloat(param[i]);
|
||||
}
|
||||
|
||||
materialfv(face, pname, paramsf);
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
|
||||
void Context::matrixMode(MatrixType mode)
|
||||
|
|
|
@ -34,10 +34,10 @@
|
|||
void getClipPlanef(GLenum plane, GLfloat *equation); \
|
||||
void getClipPlanex(GLenum plane, GLfixed *equation); \
|
||||
void getFixedv(GLenum pname, GLfixed *params); \
|
||||
void getLightfv(GLenum light, LightParameter pnamePacked, GLfloat *params); \
|
||||
void getLightxv(GLenum light, LightParameter pnamePacked, GLfixed *params); \
|
||||
void getMaterialfv(GLenum face, MaterialParameter pnamePacked, GLfloat *params); \
|
||||
void getMaterialxv(GLenum face, MaterialParameter pnamePacked, GLfixed *params); \
|
||||
void getLightfv(GLenum light, GLenum pname, GLfloat *params); \
|
||||
void getLightxv(GLenum light, GLenum pname, GLfixed *params); \
|
||||
void getMaterialfv(GLenum face, GLenum pname, GLfloat *params); \
|
||||
void getMaterialxv(GLenum face, GLenum pname, GLfixed *params); \
|
||||
void getTexEnvfv(GLenum target, GLenum pname, GLfloat *params); \
|
||||
void getTexEnviv(GLenum target, GLenum pname, GLint *params); \
|
||||
void getTexEnvxv(GLenum target, GLenum pname, GLfixed *params); \
|
||||
|
@ -46,19 +46,19 @@
|
|||
void lightModelfv(GLenum pname, const GLfloat *params); \
|
||||
void lightModelx(GLenum pname, GLfixed param); \
|
||||
void lightModelxv(GLenum pname, const GLfixed *param); \
|
||||
void lightf(GLenum light, LightParameter pnamePacked, GLfloat param); \
|
||||
void lightfv(GLenum light, LightParameter pnamePacked, const GLfloat *params); \
|
||||
void lightx(GLenum light, LightParameter pnamePacked, GLfixed param); \
|
||||
void lightxv(GLenum light, LightParameter pnamePacked, const GLfixed *params); \
|
||||
void lightf(GLenum light, GLenum pname, GLfloat param); \
|
||||
void lightfv(GLenum light, GLenum pname, const GLfloat *params); \
|
||||
void lightx(GLenum light, GLenum pname, GLfixed param); \
|
||||
void lightxv(GLenum light, GLenum pname, const GLfixed *params); \
|
||||
void lineWidthx(GLfixed width); \
|
||||
void loadIdentity(); \
|
||||
void loadMatrixf(const GLfloat *m); \
|
||||
void loadMatrixx(const GLfixed *m); \
|
||||
void logicOp(GLenum opcode); \
|
||||
void materialf(GLenum face, MaterialParameter pnamePacked, GLfloat param); \
|
||||
void materialfv(GLenum face, MaterialParameter pnamePacked, const GLfloat *params); \
|
||||
void materialx(GLenum face, MaterialParameter pnamePacked, GLfixed param); \
|
||||
void materialxv(GLenum face, MaterialParameter pnamePacked, const GLfixed *param); \
|
||||
void materialf(GLenum face, GLenum pname, GLfloat param); \
|
||||
void materialfv(GLenum face, GLenum pname, const GLfloat *params); \
|
||||
void materialx(GLenum face, GLenum pname, GLfixed param); \
|
||||
void materialxv(GLenum face, GLenum pname, const GLfixed *param); \
|
||||
void matrixMode(MatrixType modePacked); \
|
||||
void multMatrixf(const GLfloat *m); \
|
||||
void multMatrixx(const GLfixed *m); \
|
||||
|
|
|
@ -94,11 +94,6 @@ ERRMSG(InvalidFramebufferLayer,
|
|||
ERRMSG(InvalidImageUnit,
|
||||
"Image unit cannot be greater than or equal to the value of MAX_IMAGE_UNITS.");
|
||||
ERRMSG(InvalidInternalFormat, "Invalid internal format.");
|
||||
ERRMSG(InvalidLight, "Invalid light.");
|
||||
ERRMSG(InvalidLightModelParameter, "Invalid light model parameter.");
|
||||
ERRMSG(InvalidLightParameter, "Invalid light parameter.");
|
||||
ERRMSG(InvalidMaterialFace, "Invalid material face.");
|
||||
ERRMSG(InvalidMaterialParameter, "Invalid material parameter.");
|
||||
ERRMSG(InvalidMatrixMode, "Invalid matrix mode.");
|
||||
ERRMSG(InvalidMemoryBarrierBit, "Invalid memory barrier bit.");
|
||||
ERRMSG(InvalidMipLevel, "Level of detail outside of range.");
|
||||
|
@ -144,8 +139,6 @@ ERRMSG(InvalidVertexPointerType, "Invalid type for built-in vertex attribute.");
|
|||
ERRMSG(InvalidWidth, "Invalid width.");
|
||||
ERRMSG(InvalidWrapModeTexture, "Invalid wrap mode for texture type.");
|
||||
ERRMSG(LevelNotZero, "Texture level must be zero.");
|
||||
ERRMSG(LightParameterOutOfRange, "Light parameter out of range.");
|
||||
ERRMSG(MaterialParameterOutOfRange, "Material parameter out of range.");
|
||||
ERRMSG(MatrixStackOverflow, "Current matrix stack is full.");
|
||||
ERRMSG(MatrixStackUnderflow, "Current matrix stack has only a single matrix.");
|
||||
ERRMSG(MismatchedByteCountType, "Buffer size does not align with data type.");
|
||||
|
|
|
@ -240,11 +240,6 @@ GLES1State::MatrixStack &GLES1State::currentMatrixStack()
|
|||
}
|
||||
}
|
||||
|
||||
const angle::Mat4 &GLES1State::getModelviewMatrix() const
|
||||
{
|
||||
return mModelviewMatrices.back();
|
||||
}
|
||||
|
||||
const GLES1State::MatrixStack &GLES1State::currentMatrixStack() const
|
||||
{
|
||||
switch (mMatrixMode)
|
||||
|
@ -328,39 +323,4 @@ bool GLES1State::isTextureTargetEnabled(unsigned int unit, const TextureType typ
|
|||
return mTexUnitEnables[unit].test(type);
|
||||
}
|
||||
|
||||
LightModelParameters &GLES1State::lightModelParameters()
|
||||
{
|
||||
return mLightModel;
|
||||
}
|
||||
|
||||
const LightModelParameters &GLES1State::lightModelParameters() const
|
||||
{
|
||||
return mLightModel;
|
||||
}
|
||||
|
||||
LightParameters &GLES1State::lightParameters(unsigned int light)
|
||||
{
|
||||
return mLights[light];
|
||||
}
|
||||
|
||||
const LightParameters &GLES1State::lightParameters(unsigned int light) const
|
||||
{
|
||||
return mLights[light];
|
||||
}
|
||||
|
||||
MaterialParameters &GLES1State::materialParameters()
|
||||
{
|
||||
return mMaterial;
|
||||
}
|
||||
|
||||
const MaterialParameters &GLES1State::materialParameters() const
|
||||
{
|
||||
return mMaterial;
|
||||
}
|
||||
|
||||
bool GLES1State::isColorMaterialEnabled() const
|
||||
{
|
||||
return mColorMaterialEnabled;
|
||||
}
|
||||
|
||||
} // namespace gl
|
||||
|
|
|
@ -149,8 +149,6 @@ class GLES1State final : angle::NonCopyable
|
|||
MatrixStack ¤tMatrixStack();
|
||||
const MatrixStack ¤tMatrixStack() const;
|
||||
|
||||
const angle::Mat4 &getModelviewMatrix() const;
|
||||
|
||||
void loadMatrix(const angle::Mat4 &m);
|
||||
void multMatrix(const angle::Mat4 &m);
|
||||
|
||||
|
@ -159,16 +157,6 @@ class GLES1State final : angle::NonCopyable
|
|||
bool isTexCoordArrayEnabled(unsigned int unit) const;
|
||||
bool isTextureTargetEnabled(unsigned int unit, const TextureType type) const;
|
||||
|
||||
LightModelParameters &lightModelParameters();
|
||||
const LightModelParameters &lightModelParameters() const;
|
||||
|
||||
LightParameters &lightParameters(unsigned int light);
|
||||
const LightParameters &lightParameters(unsigned int light) const;
|
||||
|
||||
MaterialParameters &materialParameters();
|
||||
const MaterialParameters &materialParameters() const;
|
||||
bool isColorMaterialEnabled() const;
|
||||
|
||||
private:
|
||||
friend class State;
|
||||
friend class GLES1Renderer;
|
||||
|
|
|
@ -786,28 +786,7 @@ void State::setEnableFeature(GLenum feature, bool enabled)
|
|||
case GL_TEXTURE_CUBE_MAP:
|
||||
mGLES1State.mTexUnitEnables[mActiveSampler].set(TextureType::CubeMap, enabled);
|
||||
break;
|
||||
case GL_LIGHTING:
|
||||
mGLES1State.mLightingEnabled = enabled;
|
||||
break;
|
||||
case GL_LIGHT0:
|
||||
case GL_LIGHT1:
|
||||
case GL_LIGHT2:
|
||||
case GL_LIGHT3:
|
||||
case GL_LIGHT4:
|
||||
case GL_LIGHT5:
|
||||
case GL_LIGHT6:
|
||||
case GL_LIGHT7:
|
||||
mGLES1State.mLights[feature - GL_LIGHT0].enabled = enabled;
|
||||
break;
|
||||
case GL_NORMALIZE:
|
||||
mGLES1State.mNormalizeEnabled = enabled;
|
||||
break;
|
||||
case GL_RESCALE_NORMAL:
|
||||
mGLES1State.mRescaleNormalEnabled = enabled;
|
||||
break;
|
||||
case GL_COLOR_MATERIAL:
|
||||
mGLES1State.mColorMaterialEnabled = enabled;
|
||||
break;
|
||||
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
@ -877,23 +856,6 @@ bool State::getEnableFeature(GLenum feature) const
|
|||
return mGLES1State.mTexUnitEnables[mActiveSampler].test(TextureType::_2D);
|
||||
case GL_TEXTURE_CUBE_MAP:
|
||||
return mGLES1State.mTexUnitEnables[mActiveSampler].test(TextureType::CubeMap);
|
||||
case GL_LIGHTING:
|
||||
return mGLES1State.mLightingEnabled;
|
||||
case GL_LIGHT0:
|
||||
case GL_LIGHT1:
|
||||
case GL_LIGHT2:
|
||||
case GL_LIGHT3:
|
||||
case GL_LIGHT4:
|
||||
case GL_LIGHT5:
|
||||
case GL_LIGHT6:
|
||||
case GL_LIGHT7:
|
||||
return mGLES1State.mLights[feature - GL_LIGHT0].enabled;
|
||||
case GL_NORMALIZE:
|
||||
return mGLES1State.mNormalizeEnabled;
|
||||
case GL_RESCALE_NORMAL:
|
||||
return mGLES1State.mRescaleNormalEnabled;
|
||||
case GL_COLOR_MATERIAL:
|
||||
return mGLES1State.mColorMaterialEnabled;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
return false;
|
||||
|
@ -1937,9 +1899,7 @@ void State::getBooleanv(GLenum pname, GLboolean *params)
|
|||
case GL_PROGRAM_CACHE_ENABLED_ANGLE:
|
||||
*params = mProgramBinaryCacheEnabled ? GL_TRUE : GL_FALSE;
|
||||
break;
|
||||
case GL_LIGHT_MODEL_TWO_SIDE:
|
||||
*params = IsLightModelTwoSided(&mGLES1State);
|
||||
break;
|
||||
|
||||
default:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
|
@ -2033,9 +1993,6 @@ void State::getFloatv(GLenum pname, GLfloat *params)
|
|||
memcpy(params, mGLES1State.mTextureMatrices[mActiveSampler].back().data(),
|
||||
16 * sizeof(GLfloat));
|
||||
break;
|
||||
case GL_LIGHT_MODEL_AMBIENT:
|
||||
GetLightModelParameters(&mGLES1State, pname, params);
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
#include "libANGLE/Context.h"
|
||||
#include "libANGLE/Fence.h"
|
||||
#include "libANGLE/Framebuffer.h"
|
||||
#include "libANGLE/GLES1State.h"
|
||||
#include "libANGLE/Program.h"
|
||||
#include "libANGLE/Renderbuffer.h"
|
||||
#include "libANGLE/Sampler.h"
|
||||
|
@ -1747,282 +1746,6 @@ ClientVertexArrayType ParamToVertexArrayType(GLenum param)
|
|||
}
|
||||
}
|
||||
|
||||
void SetLightModelParameters(GLES1State *state, GLenum pname, const GLfloat *params)
|
||||
{
|
||||
LightModelParameters &lightModel = state->lightModelParameters();
|
||||
|
||||
switch (pname)
|
||||
{
|
||||
case GL_LIGHT_MODEL_AMBIENT:
|
||||
lightModel.color = ColorF::fromData(params);
|
||||
break;
|
||||
case GL_LIGHT_MODEL_TWO_SIDE:
|
||||
lightModel.twoSided = *params == 1.0f ? true : false;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void GetLightModelParameters(const GLES1State *state, GLenum pname, GLfloat *params)
|
||||
{
|
||||
const LightModelParameters &lightModel = state->lightModelParameters();
|
||||
|
||||
switch (pname)
|
||||
{
|
||||
case GL_LIGHT_MODEL_TWO_SIDE:
|
||||
*params = lightModel.twoSided ? 1.0f : 0.0f;
|
||||
break;
|
||||
case GL_LIGHT_MODEL_AMBIENT:
|
||||
lightModel.color.writeData(params);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool IsLightModelTwoSided(const GLES1State *state)
|
||||
{
|
||||
return state->lightModelParameters().twoSided;
|
||||
}
|
||||
|
||||
void SetLightParameters(GLES1State *state,
|
||||
GLenum light,
|
||||
LightParameter pname,
|
||||
const GLfloat *params)
|
||||
{
|
||||
uint32_t lightIndex = light - GL_LIGHT0;
|
||||
|
||||
LightParameters &lightParams = state->lightParameters(lightIndex);
|
||||
|
||||
switch (pname)
|
||||
{
|
||||
case LightParameter::Ambient:
|
||||
lightParams.ambient = ColorF::fromData(params);
|
||||
break;
|
||||
case LightParameter::Diffuse:
|
||||
lightParams.diffuse = ColorF::fromData(params);
|
||||
break;
|
||||
case LightParameter::Specular:
|
||||
lightParams.specular = ColorF::fromData(params);
|
||||
break;
|
||||
case LightParameter::Position:
|
||||
{
|
||||
angle::Mat4 mv = state->getModelviewMatrix();
|
||||
angle::Vector4 transformedPos =
|
||||
mv.product(angle::Vector4(params[0], params[1], params[2], params[3]));
|
||||
lightParams.position[0] = transformedPos[0];
|
||||
lightParams.position[1] = transformedPos[1];
|
||||
lightParams.position[2] = transformedPos[2];
|
||||
lightParams.position[3] = transformedPos[3];
|
||||
}
|
||||
break;
|
||||
case LightParameter::SpotDirection:
|
||||
{
|
||||
angle::Mat4 mv = state->getModelviewMatrix();
|
||||
angle::Vector4 transformedPos =
|
||||
mv.product(angle::Vector4(params[0], params[1], params[2], 0.0f));
|
||||
lightParams.direction[0] = transformedPos[0];
|
||||
lightParams.direction[1] = transformedPos[1];
|
||||
lightParams.direction[2] = transformedPos[2];
|
||||
}
|
||||
break;
|
||||
case LightParameter::SpotExponent:
|
||||
lightParams.spotlightExponent = *params;
|
||||
break;
|
||||
case LightParameter::SpotCutoff:
|
||||
lightParams.spotlightCutoffAngle = *params;
|
||||
break;
|
||||
case LightParameter::ConstantAttenuation:
|
||||
lightParams.attenuationConst = *params;
|
||||
break;
|
||||
case LightParameter::LinearAttenuation:
|
||||
lightParams.attenuationLinear = *params;
|
||||
break;
|
||||
case LightParameter::QuadraticAttenuation:
|
||||
lightParams.attenuationQuadratic = *params;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void GetLightParameters(const GLES1State *state,
|
||||
GLenum light,
|
||||
LightParameter pname,
|
||||
GLfloat *params)
|
||||
{
|
||||
uint32_t lightIndex = light - GL_LIGHT0;
|
||||
const LightParameters &lightParams = state->lightParameters(lightIndex);
|
||||
|
||||
switch (pname)
|
||||
{
|
||||
case LightParameter::Ambient:
|
||||
lightParams.ambient.writeData(params);
|
||||
break;
|
||||
case LightParameter::Diffuse:
|
||||
lightParams.diffuse.writeData(params);
|
||||
break;
|
||||
case LightParameter::Specular:
|
||||
lightParams.specular.writeData(params);
|
||||
break;
|
||||
case LightParameter::Position:
|
||||
memcpy(params, lightParams.position.data(), 4 * sizeof(GLfloat));
|
||||
break;
|
||||
case LightParameter::SpotDirection:
|
||||
memcpy(params, lightParams.direction.data(), 3 * sizeof(GLfloat));
|
||||
break;
|
||||
case LightParameter::SpotExponent:
|
||||
*params = lightParams.spotlightExponent;
|
||||
break;
|
||||
case LightParameter::SpotCutoff:
|
||||
*params = lightParams.spotlightCutoffAngle;
|
||||
break;
|
||||
case LightParameter::ConstantAttenuation:
|
||||
*params = lightParams.attenuationConst;
|
||||
break;
|
||||
case LightParameter::LinearAttenuation:
|
||||
*params = lightParams.attenuationLinear;
|
||||
break;
|
||||
case LightParameter::QuadraticAttenuation:
|
||||
*params = lightParams.attenuationQuadratic;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void SetMaterialParameters(GLES1State *state,
|
||||
GLenum face,
|
||||
MaterialParameter pname,
|
||||
const GLfloat *params)
|
||||
{
|
||||
MaterialParameters &material = state->materialParameters();
|
||||
switch (pname)
|
||||
{
|
||||
case MaterialParameter::Ambient:
|
||||
material.ambient = ColorF::fromData(params);
|
||||
break;
|
||||
case MaterialParameter::Diffuse:
|
||||
material.diffuse = ColorF::fromData(params);
|
||||
break;
|
||||
case MaterialParameter::AmbientAndDiffuse:
|
||||
material.ambient = ColorF::fromData(params);
|
||||
material.diffuse = ColorF::fromData(params);
|
||||
break;
|
||||
case MaterialParameter::Specular:
|
||||
material.specular = ColorF::fromData(params);
|
||||
break;
|
||||
case MaterialParameter::Emission:
|
||||
material.emissive = ColorF::fromData(params);
|
||||
break;
|
||||
case MaterialParameter::Shininess:
|
||||
material.specularExponent = *params;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void GetMaterialParameters(const GLES1State *state,
|
||||
GLenum face,
|
||||
MaterialParameter pname,
|
||||
GLfloat *params)
|
||||
{
|
||||
const ColorF ¤tColor = state->getCurrentColor();
|
||||
const MaterialParameters &material = state->materialParameters();
|
||||
const bool colorMaterialEnabled = state->isColorMaterialEnabled();
|
||||
|
||||
switch (pname)
|
||||
{
|
||||
case MaterialParameter::Ambient:
|
||||
if (colorMaterialEnabled)
|
||||
{
|
||||
currentColor.writeData(params);
|
||||
}
|
||||
else
|
||||
{
|
||||
material.ambient.writeData(params);
|
||||
}
|
||||
break;
|
||||
case MaterialParameter::Diffuse:
|
||||
if (colorMaterialEnabled)
|
||||
{
|
||||
currentColor.writeData(params);
|
||||
}
|
||||
else
|
||||
{
|
||||
material.diffuse.writeData(params);
|
||||
}
|
||||
break;
|
||||
case MaterialParameter::Specular:
|
||||
material.specular.writeData(params);
|
||||
break;
|
||||
case MaterialParameter::Emission:
|
||||
material.emissive.writeData(params);
|
||||
break;
|
||||
case MaterialParameter::Shininess:
|
||||
*params = material.specularExponent;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int GetLightModelParameterCount(GLenum pname)
|
||||
{
|
||||
switch (pname)
|
||||
{
|
||||
case GL_LIGHT_MODEL_AMBIENT:
|
||||
return 4;
|
||||
case GL_LIGHT_MODEL_TWO_SIDE:
|
||||
return 1;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int GetLightParameterCount(LightParameter pname)
|
||||
{
|
||||
switch (pname)
|
||||
{
|
||||
case LightParameter::Ambient:
|
||||
case LightParameter::Diffuse:
|
||||
case LightParameter::Specular:
|
||||
case LightParameter::Position:
|
||||
return 4;
|
||||
case LightParameter::SpotDirection:
|
||||
return 3;
|
||||
case LightParameter::SpotExponent:
|
||||
case LightParameter::SpotCutoff:
|
||||
case LightParameter::ConstantAttenuation:
|
||||
case LightParameter::LinearAttenuation:
|
||||
case LightParameter::QuadraticAttenuation:
|
||||
return 1;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int GetMaterialParameterCount(MaterialParameter pname)
|
||||
{
|
||||
switch (pname)
|
||||
{
|
||||
case MaterialParameter::Ambient:
|
||||
case MaterialParameter::Diffuse:
|
||||
case MaterialParameter::Specular:
|
||||
case MaterialParameter::Emission:
|
||||
return 4;
|
||||
case MaterialParameter::Shininess:
|
||||
return 1;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace gl
|
||||
|
||||
namespace egl
|
||||
|
|
|
@ -22,7 +22,6 @@ class Context;
|
|||
class Error;
|
||||
class Sync;
|
||||
class Framebuffer;
|
||||
class GLES1State;
|
||||
class Program;
|
||||
class Renderbuffer;
|
||||
class Sampler;
|
||||
|
@ -145,36 +144,9 @@ void QueryProgramInterfaceiv(const Program *program,
|
|||
GLenum programInterface,
|
||||
GLenum pname,
|
||||
GLint *params);
|
||||
// GLES1 emulation
|
||||
|
||||
ClientVertexArrayType ParamToVertexArrayType(GLenum param);
|
||||
|
||||
void SetLightParameters(GLES1State *state,
|
||||
GLenum light,
|
||||
LightParameter pname,
|
||||
const GLfloat *params);
|
||||
void GetLightParameters(const GLES1State *state,
|
||||
GLenum light,
|
||||
LightParameter pname,
|
||||
GLfloat *params);
|
||||
|
||||
void SetLightModelParameters(GLES1State *state, GLenum pname, const GLfloat *params);
|
||||
void GetLightModelParameters(const GLES1State *state, GLenum pname, GLfloat *params);
|
||||
bool IsLightModelTwoSided(const GLES1State *state);
|
||||
|
||||
void SetMaterialParameters(GLES1State *state,
|
||||
GLenum face,
|
||||
MaterialParameter pname,
|
||||
const GLfloat *params);
|
||||
void GetMaterialParameters(const GLES1State *state,
|
||||
GLenum face,
|
||||
MaterialParameter pname,
|
||||
GLfloat *params);
|
||||
|
||||
unsigned int GetLightModelParameterCount(GLenum pname);
|
||||
unsigned int GetLightParameterCount(LightParameter pname);
|
||||
unsigned int GetMaterialParameterCount(MaterialParameter pname);
|
||||
|
||||
} // namespace gl
|
||||
|
||||
namespace egl
|
||||
|
|
|
@ -11,8 +11,6 @@
|
|||
#include "common/debug.h"
|
||||
#include "libANGLE/Context.h"
|
||||
#include "libANGLE/ErrorStrings.h"
|
||||
#include "libANGLE/GLES1State.h"
|
||||
#include "libANGLE/queryutils.h"
|
||||
#include "libANGLE/validationES.h"
|
||||
|
||||
#define ANGLE_VALIDATE_IS_GLES1(context) \
|
||||
|
@ -149,173 +147,6 @@ bool ValidateBuiltinVertexAttributeCommon(Context *context,
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ValidateLightCaps(Context *context, GLenum light)
|
||||
{
|
||||
if (light < GL_LIGHT0 || light >= GL_LIGHT0 + context->getCaps().maxLights)
|
||||
{
|
||||
ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidLight);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ValidateLightCommon(Context *context,
|
||||
GLenum light,
|
||||
LightParameter pname,
|
||||
const GLfloat *params)
|
||||
{
|
||||
|
||||
ANGLE_VALIDATE_IS_GLES1(context);
|
||||
|
||||
if (!ValidateLightCaps(context, light))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (pname)
|
||||
{
|
||||
case LightParameter::Ambient:
|
||||
case LightParameter::Diffuse:
|
||||
case LightParameter::Specular:
|
||||
case LightParameter::Position:
|
||||
case LightParameter::SpotDirection:
|
||||
return true;
|
||||
case LightParameter::SpotExponent:
|
||||
if (params[0] < 0.0f || params[0] > 128.0f)
|
||||
{
|
||||
ANGLE_VALIDATION_ERR(context, InvalidValue(), LightParameterOutOfRange);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
case LightParameter::SpotCutoff:
|
||||
if (params[0] == 180.0f)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (params[0] < 0.0f || params[0] > 90.0f)
|
||||
{
|
||||
ANGLE_VALIDATION_ERR(context, InvalidValue(), LightParameterOutOfRange);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
case LightParameter::ConstantAttenuation:
|
||||
case LightParameter::LinearAttenuation:
|
||||
case LightParameter::QuadraticAttenuation:
|
||||
if (params[0] < 0.0f)
|
||||
{
|
||||
ANGLE_VALIDATION_ERR(context, InvalidValue(), LightParameterOutOfRange);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
default:
|
||||
ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidLightParameter);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool ValidateLightSingleComponent(Context *context,
|
||||
GLenum light,
|
||||
LightParameter pname,
|
||||
GLfloat param)
|
||||
{
|
||||
if (!ValidateLightCommon(context, light, pname, ¶m))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (GetLightParameterCount(pname) > 1)
|
||||
{
|
||||
ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidLightParameter);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ValidateMaterialCommon(Context *context,
|
||||
GLenum face,
|
||||
MaterialParameter pname,
|
||||
const GLfloat *params)
|
||||
{
|
||||
ANGLE_VALIDATE_IS_GLES1(context);
|
||||
|
||||
if (face != GL_FRONT_AND_BACK)
|
||||
{
|
||||
ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidMaterialFace);
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (pname)
|
||||
{
|
||||
case MaterialParameter::Ambient:
|
||||
case MaterialParameter::Diffuse:
|
||||
case MaterialParameter::Specular:
|
||||
case MaterialParameter::Emission:
|
||||
return true;
|
||||
case MaterialParameter::Shininess:
|
||||
if (params[0] < 0.0f || params[0] > 128.0f)
|
||||
{
|
||||
ANGLE_VALIDATION_ERR(context, InvalidValue(), MaterialParameterOutOfRange);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
default:
|
||||
ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidMaterialParameter);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool ValidateMaterialSingleComponent(Context *context,
|
||||
GLenum face,
|
||||
MaterialParameter pname,
|
||||
GLfloat param)
|
||||
{
|
||||
if (!ValidateMaterialCommon(context, face, pname, ¶m))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (GetMaterialParameterCount(pname) > 1)
|
||||
{
|
||||
ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidMaterialParameter);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ValidateLightModelCommon(Context *context, GLenum pname)
|
||||
{
|
||||
ANGLE_VALIDATE_IS_GLES1(context);
|
||||
switch (pname)
|
||||
{
|
||||
case GL_LIGHT_MODEL_AMBIENT:
|
||||
case GL_LIGHT_MODEL_TWO_SIDE:
|
||||
return true;
|
||||
default:
|
||||
ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidLightModelParameter);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool ValidateLightModelSingleComponent(Context *context, GLenum pname)
|
||||
{
|
||||
if (!ValidateLightModelCommon(context, pname))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (pname)
|
||||
{
|
||||
case GL_LIGHT_MODEL_TWO_SIDE:
|
||||
return true;
|
||||
default:
|
||||
ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidLightModelParameter);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace gl
|
||||
|
||||
namespace gl
|
||||
|
@ -493,28 +324,28 @@ bool ValidateGetFixedv(Context *context, GLenum pname, GLfixed *params)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ValidateGetLightfv(Context *context, GLenum light, LightParameter pname, GLfloat *params)
|
||||
bool ValidateGetLightfv(Context *context, GLenum light, GLenum pname, GLfloat *params)
|
||||
{
|
||||
GLfloat dummyParams[4] = {0.0f, 0.0f, 0.0f, 0.0f};
|
||||
return ValidateLightCommon(context, light, pname, dummyParams);
|
||||
UNIMPLEMENTED();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ValidateGetLightxv(Context *context, GLenum light, LightParameter pname, GLfixed *params)
|
||||
bool ValidateGetLightxv(Context *context, GLenum light, GLenum pname, GLfixed *params)
|
||||
{
|
||||
GLfloat dummyParams[4] = {0.0f, 0.0f, 0.0f, 0.0f};
|
||||
return ValidateLightCommon(context, light, pname, dummyParams);
|
||||
UNIMPLEMENTED();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ValidateGetMaterialfv(Context *context, GLenum face, MaterialParameter pname, GLfloat *params)
|
||||
bool ValidateGetMaterialfv(Context *context, GLenum face, GLenum pname, GLfloat *params)
|
||||
{
|
||||
GLfloat dummyParams[4] = {0.0f, 0.0f, 0.0f, 0.0f};
|
||||
return ValidateMaterialCommon(context, face, pname, dummyParams);
|
||||
UNIMPLEMENTED();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ValidateGetMaterialxv(Context *context, GLenum face, MaterialParameter pname, GLfixed *params)
|
||||
bool ValidateGetMaterialxv(Context *context, GLenum face, GLenum pname, GLfixed *params)
|
||||
{
|
||||
GLfloat dummyParams[4] = {0.0f, 0.0f, 0.0f, 0.0f};
|
||||
return ValidateMaterialCommon(context, face, pname, dummyParams);
|
||||
UNIMPLEMENTED();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ValidateGetPointerv(Context *context, GLenum pname, void **params)
|
||||
|
@ -560,48 +391,50 @@ bool ValidateGetTexParameterxv(Context *context, TextureType target, GLenum pnam
|
|||
|
||||
bool ValidateLightModelf(Context *context, GLenum pname, GLfloat param)
|
||||
{
|
||||
return ValidateLightModelSingleComponent(context, pname);
|
||||
UNIMPLEMENTED();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ValidateLightModelfv(Context *context, GLenum pname, const GLfloat *params)
|
||||
{
|
||||
return ValidateLightModelCommon(context, pname);
|
||||
UNIMPLEMENTED();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ValidateLightModelx(Context *context, GLenum pname, GLfixed param)
|
||||
{
|
||||
return ValidateLightModelSingleComponent(context, pname);
|
||||
UNIMPLEMENTED();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ValidateLightModelxv(Context *context, GLenum pname, const GLfixed *param)
|
||||
{
|
||||
return ValidateLightModelCommon(context, pname);
|
||||
UNIMPLEMENTED();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ValidateLightf(Context *context, GLenum light, LightParameter pname, GLfloat param)
|
||||
bool ValidateLightf(Context *context, GLenum light, GLenum pname, GLfloat param)
|
||||
{
|
||||
return ValidateLightSingleComponent(context, light, pname, param);
|
||||
UNIMPLEMENTED();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ValidateLightfv(Context *context, GLenum light, LightParameter pname, const GLfloat *params)
|
||||
bool ValidateLightfv(Context *context, GLenum light, GLenum pname, const GLfloat *params)
|
||||
{
|
||||
return ValidateLightCommon(context, light, pname, params);
|
||||
UNIMPLEMENTED();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ValidateLightx(Context *context, GLenum light, LightParameter pname, GLfixed param)
|
||||
bool ValidateLightx(Context *context, GLenum light, GLenum pname, GLfixed param)
|
||||
{
|
||||
return ValidateLightSingleComponent(context, light, pname, FixedToFloat(param));
|
||||
UNIMPLEMENTED();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ValidateLightxv(Context *context, GLenum light, LightParameter pname, const GLfixed *params)
|
||||
bool ValidateLightxv(Context *context, GLenum light, GLenum pname, const GLfixed *params)
|
||||
{
|
||||
GLfloat paramsf[4];
|
||||
for (unsigned int i = 0; i < GetLightParameterCount(pname); i++)
|
||||
{
|
||||
paramsf[i] = FixedToFloat(params[i]);
|
||||
}
|
||||
|
||||
return ValidateLightCommon(context, light, pname, paramsf);
|
||||
UNIMPLEMENTED();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ValidateLineWidthx(Context *context, GLfixed width)
|
||||
|
@ -634,37 +467,28 @@ bool ValidateLogicOp(Context *context, GLenum opcode)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ValidateMaterialf(Context *context, GLenum face, MaterialParameter pname, GLfloat param)
|
||||
bool ValidateMaterialf(Context *context, GLenum face, GLenum pname, GLfloat param)
|
||||
{
|
||||
return ValidateMaterialSingleComponent(context, face, pname, param);
|
||||
UNIMPLEMENTED();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ValidateMaterialfv(Context *context,
|
||||
GLenum face,
|
||||
MaterialParameter pname,
|
||||
const GLfloat *params)
|
||||
bool ValidateMaterialfv(Context *context, GLenum face, GLenum pname, const GLfloat *params)
|
||||
{
|
||||
return ValidateMaterialCommon(context, face, pname, params);
|
||||
UNIMPLEMENTED();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ValidateMaterialx(Context *context, GLenum face, MaterialParameter pname, GLfixed param)
|
||||
bool ValidateMaterialx(Context *context, GLenum face, GLenum pname, GLfixed param)
|
||||
{
|
||||
return ValidateMaterialSingleComponent(context, face, pname, FixedToFloat(param));
|
||||
UNIMPLEMENTED();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ValidateMaterialxv(Context *context,
|
||||
GLenum face,
|
||||
MaterialParameter pname,
|
||||
const GLfixed *params)
|
||||
bool ValidateMaterialxv(Context *context, GLenum face, GLenum pname, const GLfixed *param)
|
||||
{
|
||||
GLfloat paramsf[4];
|
||||
|
||||
for (unsigned int i = 0; i < GetMaterialParameterCount(pname); i++)
|
||||
{
|
||||
paramsf[i] = FixedToFloat(params[i]);
|
||||
}
|
||||
|
||||
return ValidateMaterialCommon(context, face, pname, paramsf);
|
||||
UNIMPLEMENTED();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ValidateMatrixMode(Context *context, MatrixType mode)
|
||||
|
|
|
@ -59,10 +59,10 @@ bool ValidateGetBufferParameteriv(Context *context, GLenum target, GLenum pname,
|
|||
bool ValidateGetClipPlanef(Context *context, GLenum plane, GLfloat *equation);
|
||||
bool ValidateGetClipPlanex(Context *context, GLenum plane, GLfixed *equation);
|
||||
bool ValidateGetFixedv(Context *context, GLenum pname, GLfixed *params);
|
||||
bool ValidateGetLightfv(Context *context, GLenum light, LightParameter pname, GLfloat *params);
|
||||
bool ValidateGetLightxv(Context *context, GLenum light, LightParameter pname, GLfixed *params);
|
||||
bool ValidateGetMaterialfv(Context *context, GLenum face, MaterialParameter pname, GLfloat *params);
|
||||
bool ValidateGetMaterialxv(Context *context, GLenum face, MaterialParameter pname, GLfixed *params);
|
||||
bool ValidateGetLightfv(Context *context, GLenum light, GLenum pname, GLfloat *params);
|
||||
bool ValidateGetLightxv(Context *context, GLenum light, GLenum pname, GLfixed *params);
|
||||
bool ValidateGetMaterialfv(Context *context, GLenum face, GLenum pname, GLfloat *params);
|
||||
bool ValidateGetMaterialxv(Context *context, GLenum face, GLenum pname, GLfixed *params);
|
||||
bool ValidateGetPointerv(Context *context, GLenum pname, void **params);
|
||||
bool ValidateGetTexEnvfv(Context *context, GLenum target, GLenum pname, GLfloat *params);
|
||||
bool ValidateGetTexEnviv(Context *context, GLenum target, GLenum pname, GLint *params);
|
||||
|
@ -72,25 +72,19 @@ bool ValidateLightModelf(Context *context, GLenum pname, GLfloat param);
|
|||
bool ValidateLightModelfv(Context *context, GLenum pname, const GLfloat *params);
|
||||
bool ValidateLightModelx(Context *context, GLenum pname, GLfixed param);
|
||||
bool ValidateLightModelxv(Context *context, GLenum pname, const GLfixed *param);
|
||||
bool ValidateLightf(Context *context, GLenum light, LightParameter pname, GLfloat param);
|
||||
bool ValidateLightfv(Context *context, GLenum light, LightParameter pname, const GLfloat *params);
|
||||
bool ValidateLightx(Context *context, GLenum light, LightParameter pname, GLfixed param);
|
||||
bool ValidateLightxv(Context *context, GLenum light, LightParameter pname, const GLfixed *params);
|
||||
bool ValidateLightf(Context *context, GLenum light, GLenum pname, GLfloat param);
|
||||
bool ValidateLightfv(Context *context, GLenum light, GLenum pname, const GLfloat *params);
|
||||
bool ValidateLightx(Context *context, GLenum light, GLenum pname, GLfixed param);
|
||||
bool ValidateLightxv(Context *context, GLenum light, GLenum pname, const GLfixed *params);
|
||||
bool ValidateLineWidthx(Context *context, GLfixed width);
|
||||
bool ValidateLoadIdentity(Context *context);
|
||||
bool ValidateLoadMatrixf(Context *context, const GLfloat *m);
|
||||
bool ValidateLoadMatrixx(Context *context, const GLfixed *m);
|
||||
bool ValidateLogicOp(Context *context, GLenum opcode);
|
||||
bool ValidateMaterialf(Context *context, GLenum face, MaterialParameter pname, GLfloat param);
|
||||
bool ValidateMaterialfv(Context *context,
|
||||
GLenum face,
|
||||
MaterialParameter pname,
|
||||
const GLfloat *params);
|
||||
bool ValidateMaterialx(Context *context, GLenum face, MaterialParameter pname, GLfixed param);
|
||||
bool ValidateMaterialxv(Context *context,
|
||||
GLenum face,
|
||||
MaterialParameter pname,
|
||||
const GLfixed *param);
|
||||
bool ValidateMaterialf(Context *context, GLenum face, GLenum pname, GLfloat param);
|
||||
bool ValidateMaterialfv(Context *context, GLenum face, GLenum pname, const GLfloat *params);
|
||||
bool ValidateMaterialx(Context *context, GLenum face, GLenum pname, GLfixed param);
|
||||
bool ValidateMaterialxv(Context *context, GLenum face, GLenum pname, const GLfixed *param);
|
||||
bool ValidateMatrixMode(Context *context, MatrixType mode);
|
||||
bool ValidateMultMatrixf(Context *context, const GLfloat *m);
|
||||
bool ValidateMultMatrixx(Context *context, const GLfixed *m);
|
||||
|
|
|
@ -799,18 +799,6 @@ bool ValidCap(const Context *context, GLenum cap, bool queryOnly)
|
|||
case GL_COLOR_ARRAY:
|
||||
case GL_TEXTURE_COORD_ARRAY:
|
||||
case GL_TEXTURE_2D:
|
||||
case GL_LIGHTING:
|
||||
case GL_LIGHT0:
|
||||
case GL_LIGHT1:
|
||||
case GL_LIGHT2:
|
||||
case GL_LIGHT3:
|
||||
case GL_LIGHT4:
|
||||
case GL_LIGHT5:
|
||||
case GL_LIGHT6:
|
||||
case GL_LIGHT7:
|
||||
case GL_NORMALIZE:
|
||||
case GL_RESCALE_NORMAL:
|
||||
case GL_COLOR_MATERIAL:
|
||||
return context->getClientVersion() < Version(2, 0);
|
||||
case GL_POINT_SIZE_ARRAY_OES:
|
||||
return context->getClientVersion() < Version(2, 0) &&
|
||||
|
|
|
@ -408,12 +408,11 @@ void GL_APIENTRY GetLightfv(GLenum light, GLenum pname, GLfloat *params)
|
|||
Context *context = GetValidGlobalContext();
|
||||
if (context)
|
||||
{
|
||||
LightParameter pnamePacked = FromGLenum<LightParameter>(pname);
|
||||
context->gatherParams<EntryPoint::GetLightfv>(light, pnamePacked, params);
|
||||
context->gatherParams<EntryPoint::GetLightfv>(light, pname, params);
|
||||
|
||||
if (context->skipValidation() || ValidateGetLightfv(context, light, pnamePacked, params))
|
||||
if (context->skipValidation() || ValidateGetLightfv(context, light, pname, params))
|
||||
{
|
||||
context->getLightfv(light, pnamePacked, params);
|
||||
context->getLightfv(light, pname, params);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -426,12 +425,11 @@ void GL_APIENTRY GetLightxv(GLenum light, GLenum pname, GLfixed *params)
|
|||
Context *context = GetValidGlobalContext();
|
||||
if (context)
|
||||
{
|
||||
LightParameter pnamePacked = FromGLenum<LightParameter>(pname);
|
||||
context->gatherParams<EntryPoint::GetLightxv>(light, pnamePacked, params);
|
||||
context->gatherParams<EntryPoint::GetLightxv>(light, pname, params);
|
||||
|
||||
if (context->skipValidation() || ValidateGetLightxv(context, light, pnamePacked, params))
|
||||
if (context->skipValidation() || ValidateGetLightxv(context, light, pname, params))
|
||||
{
|
||||
context->getLightxv(light, pnamePacked, params);
|
||||
context->getLightxv(light, pname, params);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -444,12 +442,11 @@ void GL_APIENTRY GetMaterialfv(GLenum face, GLenum pname, GLfloat *params)
|
|||
Context *context = GetValidGlobalContext();
|
||||
if (context)
|
||||
{
|
||||
MaterialParameter pnamePacked = FromGLenum<MaterialParameter>(pname);
|
||||
context->gatherParams<EntryPoint::GetMaterialfv>(face, pnamePacked, params);
|
||||
context->gatherParams<EntryPoint::GetMaterialfv>(face, pname, params);
|
||||
|
||||
if (context->skipValidation() || ValidateGetMaterialfv(context, face, pnamePacked, params))
|
||||
if (context->skipValidation() || ValidateGetMaterialfv(context, face, pname, params))
|
||||
{
|
||||
context->getMaterialfv(face, pnamePacked, params);
|
||||
context->getMaterialfv(face, pname, params);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -462,12 +459,11 @@ void GL_APIENTRY GetMaterialxv(GLenum face, GLenum pname, GLfixed *params)
|
|||
Context *context = GetValidGlobalContext();
|
||||
if (context)
|
||||
{
|
||||
MaterialParameter pnamePacked = FromGLenum<MaterialParameter>(pname);
|
||||
context->gatherParams<EntryPoint::GetMaterialxv>(face, pnamePacked, params);
|
||||
context->gatherParams<EntryPoint::GetMaterialxv>(face, pname, params);
|
||||
|
||||
if (context->skipValidation() || ValidateGetMaterialxv(context, face, pnamePacked, params))
|
||||
if (context->skipValidation() || ValidateGetMaterialxv(context, face, pname, params))
|
||||
{
|
||||
context->getMaterialxv(face, pnamePacked, params);
|
||||
context->getMaterialxv(face, pname, params);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -629,12 +625,11 @@ void GL_APIENTRY Lightf(GLenum light, GLenum pname, GLfloat param)
|
|||
Context *context = GetValidGlobalContext();
|
||||
if (context)
|
||||
{
|
||||
LightParameter pnamePacked = FromGLenum<LightParameter>(pname);
|
||||
context->gatherParams<EntryPoint::Lightf>(light, pnamePacked, param);
|
||||
context->gatherParams<EntryPoint::Lightf>(light, pname, param);
|
||||
|
||||
if (context->skipValidation() || ValidateLightf(context, light, pnamePacked, param))
|
||||
if (context->skipValidation() || ValidateLightf(context, light, pname, param))
|
||||
{
|
||||
context->lightf(light, pnamePacked, param);
|
||||
context->lightf(light, pname, param);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -647,12 +642,11 @@ void GL_APIENTRY Lightfv(GLenum light, GLenum pname, const GLfloat *params)
|
|||
Context *context = GetValidGlobalContext();
|
||||
if (context)
|
||||
{
|
||||
LightParameter pnamePacked = FromGLenum<LightParameter>(pname);
|
||||
context->gatherParams<EntryPoint::Lightfv>(light, pnamePacked, params);
|
||||
context->gatherParams<EntryPoint::Lightfv>(light, pname, params);
|
||||
|
||||
if (context->skipValidation() || ValidateLightfv(context, light, pnamePacked, params))
|
||||
if (context->skipValidation() || ValidateLightfv(context, light, pname, params))
|
||||
{
|
||||
context->lightfv(light, pnamePacked, params);
|
||||
context->lightfv(light, pname, params);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -664,12 +658,11 @@ void GL_APIENTRY Lightx(GLenum light, GLenum pname, GLfixed param)
|
|||
Context *context = GetValidGlobalContext();
|
||||
if (context)
|
||||
{
|
||||
LightParameter pnamePacked = FromGLenum<LightParameter>(pname);
|
||||
context->gatherParams<EntryPoint::Lightx>(light, pnamePacked, param);
|
||||
context->gatherParams<EntryPoint::Lightx>(light, pname, param);
|
||||
|
||||
if (context->skipValidation() || ValidateLightx(context, light, pnamePacked, param))
|
||||
if (context->skipValidation() || ValidateLightx(context, light, pname, param))
|
||||
{
|
||||
context->lightx(light, pnamePacked, param);
|
||||
context->lightx(light, pname, param);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -682,12 +675,11 @@ void GL_APIENTRY Lightxv(GLenum light, GLenum pname, const GLfixed *params)
|
|||
Context *context = GetValidGlobalContext();
|
||||
if (context)
|
||||
{
|
||||
LightParameter pnamePacked = FromGLenum<LightParameter>(pname);
|
||||
context->gatherParams<EntryPoint::Lightxv>(light, pnamePacked, params);
|
||||
context->gatherParams<EntryPoint::Lightxv>(light, pname, params);
|
||||
|
||||
if (context->skipValidation() || ValidateLightxv(context, light, pnamePacked, params))
|
||||
if (context->skipValidation() || ValidateLightxv(context, light, pname, params))
|
||||
{
|
||||
context->lightxv(light, pnamePacked, params);
|
||||
context->lightxv(light, pname, params);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -779,12 +771,11 @@ void GL_APIENTRY Materialf(GLenum face, GLenum pname, GLfloat param)
|
|||
Context *context = GetValidGlobalContext();
|
||||
if (context)
|
||||
{
|
||||
MaterialParameter pnamePacked = FromGLenum<MaterialParameter>(pname);
|
||||
context->gatherParams<EntryPoint::Materialf>(face, pnamePacked, param);
|
||||
context->gatherParams<EntryPoint::Materialf>(face, pname, param);
|
||||
|
||||
if (context->skipValidation() || ValidateMaterialf(context, face, pnamePacked, param))
|
||||
if (context->skipValidation() || ValidateMaterialf(context, face, pname, param))
|
||||
{
|
||||
context->materialf(face, pnamePacked, param);
|
||||
context->materialf(face, pname, param);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -797,12 +788,11 @@ void GL_APIENTRY Materialfv(GLenum face, GLenum pname, const GLfloat *params)
|
|||
Context *context = GetValidGlobalContext();
|
||||
if (context)
|
||||
{
|
||||
MaterialParameter pnamePacked = FromGLenum<MaterialParameter>(pname);
|
||||
context->gatherParams<EntryPoint::Materialfv>(face, pnamePacked, params);
|
||||
context->gatherParams<EntryPoint::Materialfv>(face, pname, params);
|
||||
|
||||
if (context->skipValidation() || ValidateMaterialfv(context, face, pnamePacked, params))
|
||||
if (context->skipValidation() || ValidateMaterialfv(context, face, pname, params))
|
||||
{
|
||||
context->materialfv(face, pnamePacked, params);
|
||||
context->materialfv(face, pname, params);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -814,12 +804,11 @@ void GL_APIENTRY Materialx(GLenum face, GLenum pname, GLfixed param)
|
|||
Context *context = GetValidGlobalContext();
|
||||
if (context)
|
||||
{
|
||||
MaterialParameter pnamePacked = FromGLenum<MaterialParameter>(pname);
|
||||
context->gatherParams<EntryPoint::Materialx>(face, pnamePacked, param);
|
||||
context->gatherParams<EntryPoint::Materialx>(face, pname, param);
|
||||
|
||||
if (context->skipValidation() || ValidateMaterialx(context, face, pnamePacked, param))
|
||||
if (context->skipValidation() || ValidateMaterialx(context, face, pname, param))
|
||||
{
|
||||
context->materialx(face, pnamePacked, param);
|
||||
context->materialx(face, pname, param);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -832,12 +821,11 @@ void GL_APIENTRY Materialxv(GLenum face, GLenum pname, const GLfixed *param)
|
|||
Context *context = GetValidGlobalContext();
|
||||
if (context)
|
||||
{
|
||||
MaterialParameter pnamePacked = FromGLenum<MaterialParameter>(pname);
|
||||
context->gatherParams<EntryPoint::Materialxv>(face, pnamePacked, param);
|
||||
context->gatherParams<EntryPoint::Materialxv>(face, pname, param);
|
||||
|
||||
if (context->skipValidation() || ValidateMaterialxv(context, face, pnamePacked, param))
|
||||
if (context->skipValidation() || ValidateMaterialxv(context, face, pname, param))
|
||||
{
|
||||
context->materialxv(face, pnamePacked, param);
|
||||
context->materialxv(face, pname, param);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,13 +55,11 @@
|
|||
'<(angle_path)/src/tests/gl_tests/gles1/CurrentColorTest.cpp',
|
||||
'<(angle_path)/src/tests/gl_tests/gles1/CurrentNormalTest.cpp',
|
||||
'<(angle_path)/src/tests/gl_tests/gles1/CurrentTextureCoordsTest.cpp',
|
||||
'<(angle_path)/src/tests/gl_tests/gles1/MaterialsTest.cpp',
|
||||
'<(angle_path)/src/tests/gl_tests/gles1/MatrixBuiltinsTest.cpp',
|
||||
'<(angle_path)/src/tests/gl_tests/gles1/MatrixLoadTest.cpp',
|
||||
'<(angle_path)/src/tests/gl_tests/gles1/MatrixModeTest.cpp',
|
||||
'<(angle_path)/src/tests/gl_tests/gles1/MatrixMultTest.cpp',
|
||||
'<(angle_path)/src/tests/gl_tests/gles1/MatrixStackTest.cpp',
|
||||
'<(angle_path)/src/tests/gl_tests/gles1/LightsTest.cpp',
|
||||
'<(angle_path)/src/tests/gl_tests/gles1/TextureTargetEnableTest.cpp',
|
||||
'<(angle_path)/src/tests/gl_tests/gles1/VertexPointerTest.cpp',
|
||||
'<(angle_path)/src/tests/gl_tests/GLSLTest.cpp',
|
||||
|
|
|
@ -1,315 +0,0 @@
|
|||
//
|
||||
// Copyright 2018 The ANGLE Project Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
|
||||
// LightsTest.cpp: Tests basic usage of glLight*.
|
||||
|
||||
#include "test_utils/ANGLETest.h"
|
||||
#include "test_utils/gl_raii.h"
|
||||
|
||||
#include "common/matrix_utils.h"
|
||||
#include "common/vector_utils.h"
|
||||
#include "random_utils.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
using namespace angle;
|
||||
|
||||
class LightsTest : public ANGLETest
|
||||
{
|
||||
protected:
|
||||
LightsTest()
|
||||
{
|
||||
setWindowWidth(32);
|
||||
setWindowHeight(32);
|
||||
setConfigRedBits(8);
|
||||
setConfigGreenBits(8);
|
||||
setConfigBlueBits(8);
|
||||
setConfigAlphaBits(8);
|
||||
setConfigDepthBits(24);
|
||||
}
|
||||
};
|
||||
|
||||
// Check that the initial lighting parameters state is correct,
|
||||
// including spec minimum for light count.
|
||||
TEST_P(LightsTest, InitialState)
|
||||
{
|
||||
const GLColor32F kAmbientInitial(0.2f, 0.2f, 0.2f, 1.0f);
|
||||
GLboolean kLightModelTwoSideInitial = GL_FALSE;
|
||||
|
||||
GLColor32F lightModelAmbient;
|
||||
GLboolean lightModelTwoSide;
|
||||
|
||||
glGetFloatv(GL_LIGHT_MODEL_AMBIENT, &lightModelAmbient.R);
|
||||
EXPECT_GL_NO_ERROR();
|
||||
EXPECT_EQ(kAmbientInitial, lightModelAmbient);
|
||||
|
||||
glGetBooleanv(GL_LIGHT_MODEL_TWO_SIDE, &lightModelTwoSide);
|
||||
EXPECT_GL_NO_ERROR();
|
||||
EXPECT_EQ(kLightModelTwoSideInitial, lightModelTwoSide);
|
||||
|
||||
EXPECT_GL_FALSE(glIsEnabled(GL_LIGHTING));
|
||||
EXPECT_GL_NO_ERROR();
|
||||
EXPECT_GL_FALSE(glIsEnabled(GL_NORMALIZE));
|
||||
EXPECT_GL_NO_ERROR();
|
||||
EXPECT_GL_FALSE(glIsEnabled(GL_RESCALE_NORMAL));
|
||||
EXPECT_GL_NO_ERROR();
|
||||
EXPECT_GL_FALSE(glIsEnabled(GL_COLOR_MATERIAL));
|
||||
EXPECT_GL_NO_ERROR();
|
||||
|
||||
GLint maxLights = 0;
|
||||
glGetIntegerv(GL_MAX_LIGHTS, &maxLights);
|
||||
EXPECT_GL_NO_ERROR();
|
||||
EXPECT_GE(8, maxLights);
|
||||
|
||||
const GLColor32F kLightnAmbient(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
const GLColor32F kLightnDiffuse(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
const GLColor32F kLightnSpecular(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
const GLColor32F kLight0Diffuse(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
const GLColor32F kLight0Specular(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
const angle::Vector4 kLightnPosition(0.0f, 0.0f, 1.0f, 0.0f);
|
||||
const angle::Vector3 kLightnDirection(0.0f, 0.0f, -1.0f);
|
||||
const GLfloat kLightnSpotlightExponent = 0.0f;
|
||||
const GLfloat kLightnSpotlightCutoffAngle = 180.0f;
|
||||
const GLfloat kLightnAttenuationConst = 1.0f;
|
||||
const GLfloat kLightnAttenuationLinear = 0.0f;
|
||||
const GLfloat kLightnAttenuationQuadratic = 0.0f;
|
||||
|
||||
for (int i = 0; i < maxLights; i++)
|
||||
{
|
||||
EXPECT_GL_FALSE(glIsEnabled(GL_LIGHT0 + i));
|
||||
EXPECT_GL_NO_ERROR();
|
||||
|
||||
GLColor32F actualColor;
|
||||
angle::Vector4 actualPosition;
|
||||
angle::Vector3 actualDirection;
|
||||
GLfloat actualFloatValue;
|
||||
|
||||
glGetLightfv(GL_LIGHT0 + i, GL_AMBIENT, &actualColor.R);
|
||||
EXPECT_GL_NO_ERROR();
|
||||
EXPECT_EQ(kLightnAmbient, actualColor);
|
||||
|
||||
glGetLightfv(GL_LIGHT0 + i, GL_DIFFUSE, &actualColor.R);
|
||||
EXPECT_GL_NO_ERROR();
|
||||
EXPECT_EQ(i == 0 ? kLight0Diffuse : kLightnDiffuse, actualColor);
|
||||
|
||||
glGetLightfv(GL_LIGHT0 + i, GL_SPECULAR, &actualColor.R);
|
||||
EXPECT_GL_NO_ERROR();
|
||||
EXPECT_EQ(i == 0 ? kLight0Specular : kLightnSpecular, actualColor);
|
||||
|
||||
glGetLightfv(GL_LIGHT0 + i, GL_POSITION, actualPosition.data());
|
||||
EXPECT_GL_NO_ERROR();
|
||||
EXPECT_EQ(kLightnPosition, actualPosition);
|
||||
|
||||
glGetLightfv(GL_LIGHT0 + i, GL_SPOT_DIRECTION, actualDirection.data());
|
||||
EXPECT_GL_NO_ERROR();
|
||||
EXPECT_EQ(kLightnDirection, actualDirection);
|
||||
|
||||
glGetLightfv(GL_LIGHT0 + i, GL_SPOT_EXPONENT, &actualFloatValue);
|
||||
EXPECT_GL_NO_ERROR();
|
||||
EXPECT_EQ(kLightnSpotlightExponent, actualFloatValue);
|
||||
|
||||
glGetLightfv(GL_LIGHT0 + i, GL_SPOT_CUTOFF, &actualFloatValue);
|
||||
EXPECT_GL_NO_ERROR();
|
||||
EXPECT_EQ(kLightnSpotlightCutoffAngle, actualFloatValue);
|
||||
|
||||
glGetLightfv(GL_LIGHT0 + i, GL_CONSTANT_ATTENUATION, &actualFloatValue);
|
||||
EXPECT_GL_NO_ERROR();
|
||||
EXPECT_EQ(kLightnAttenuationConst, actualFloatValue);
|
||||
|
||||
glGetLightfv(GL_LIGHT0 + i, GL_LINEAR_ATTENUATION, &actualFloatValue);
|
||||
EXPECT_GL_NO_ERROR();
|
||||
EXPECT_EQ(kLightnAttenuationLinear, actualFloatValue);
|
||||
|
||||
glGetLightfv(GL_LIGHT0 + i, GL_QUADRATIC_ATTENUATION, &actualFloatValue);
|
||||
EXPECT_GL_NO_ERROR();
|
||||
EXPECT_EQ(kLightnAttenuationQuadratic, actualFloatValue);
|
||||
}
|
||||
}
|
||||
|
||||
// Negative test for invalid parameter names.
|
||||
TEST_P(LightsTest, NegativeInvalidEnum)
|
||||
{
|
||||
GLint maxLights = 0;
|
||||
glGetIntegerv(GL_MAX_LIGHTS, &maxLights);
|
||||
|
||||
glIsEnabled(GL_LIGHT0 + maxLights);
|
||||
EXPECT_GL_ERROR(GL_INVALID_ENUM);
|
||||
|
||||
glLightfv(GL_LIGHT0 + maxLights, GL_AMBIENT, nullptr);
|
||||
EXPECT_GL_ERROR(GL_INVALID_ENUM);
|
||||
|
||||
glLightModelfv(GL_LIGHT0, nullptr);
|
||||
EXPECT_GL_ERROR(GL_INVALID_ENUM);
|
||||
|
||||
glLightModelf(GL_LIGHT0, 0.0f);
|
||||
EXPECT_GL_ERROR(GL_INVALID_ENUM);
|
||||
|
||||
for (int i = 0; i < maxLights; i++)
|
||||
{
|
||||
glLightf(GL_LIGHT0 + i, GL_TEXTURE_2D, 0.0f);
|
||||
EXPECT_GL_ERROR(GL_INVALID_ENUM);
|
||||
|
||||
glLightfv(GL_LIGHT0 + i, GL_TEXTURE_2D, nullptr);
|
||||
EXPECT_GL_ERROR(GL_INVALID_ENUM);
|
||||
}
|
||||
}
|
||||
|
||||
// Negative test for invalid parameter values.
|
||||
TEST_P(LightsTest, NegativeInvalidValue)
|
||||
{
|
||||
GLint maxLights = 0;
|
||||
glGetIntegerv(GL_MAX_LIGHTS, &maxLights);
|
||||
|
||||
std::vector<GLenum> attenuationParams = {
|
||||
GL_CONSTANT_ATTENUATION, GL_LINEAR_ATTENUATION, GL_QUADRATIC_ATTENUATION,
|
||||
};
|
||||
|
||||
for (int i = 0; i < maxLights; i++)
|
||||
{
|
||||
glLightf(GL_LIGHT0 + i, GL_SPOT_EXPONENT, -1.0f);
|
||||
EXPECT_GL_ERROR(GL_INVALID_VALUE);
|
||||
GLfloat previousVal = -1.0f;
|
||||
glGetLightfv(GL_LIGHT0 + i, GL_SPOT_EXPONENT, &previousVal);
|
||||
EXPECT_NE(-1.0f, previousVal);
|
||||
|
||||
glLightf(GL_LIGHT0 + i, GL_SPOT_EXPONENT, 128.1f);
|
||||
EXPECT_GL_ERROR(GL_INVALID_VALUE);
|
||||
previousVal = 128.1f;
|
||||
glGetLightfv(GL_LIGHT0 + i, GL_SPOT_EXPONENT, &previousVal);
|
||||
EXPECT_NE(128.1f, previousVal);
|
||||
|
||||
glLightf(GL_LIGHT0 + i, GL_SPOT_CUTOFF, -1.0f);
|
||||
EXPECT_GL_ERROR(GL_INVALID_VALUE);
|
||||
previousVal = -1.0f;
|
||||
glGetLightfv(GL_LIGHT0 + i, GL_SPOT_CUTOFF, &previousVal);
|
||||
EXPECT_NE(-1.0f, previousVal);
|
||||
|
||||
glLightf(GL_LIGHT0 + i, GL_SPOT_CUTOFF, 90.1f);
|
||||
EXPECT_GL_ERROR(GL_INVALID_VALUE);
|
||||
previousVal = 90.1f;
|
||||
glGetLightfv(GL_LIGHT0 + i, GL_SPOT_CUTOFF, &previousVal);
|
||||
EXPECT_NE(90.1f, previousVal);
|
||||
|
||||
for (GLenum pname : attenuationParams)
|
||||
{
|
||||
glLightf(GL_LIGHT0 + i, pname, -1.0f);
|
||||
EXPECT_GL_ERROR(GL_INVALID_VALUE);
|
||||
previousVal = -1.0f;
|
||||
glGetLightfv(GL_LIGHT0 + i, pname, &previousVal);
|
||||
EXPECT_NE(-1.0f, previousVal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Test to see if we can set and retrieve the light parameters.
|
||||
TEST_P(LightsTest, Set)
|
||||
{
|
||||
angle::RNG rng(0);
|
||||
|
||||
GLint maxLights = 0;
|
||||
glGetIntegerv(GL_MAX_LIGHTS, &maxLights);
|
||||
|
||||
constexpr int kNumTrials = 100;
|
||||
|
||||
GLColor32F actualColor;
|
||||
angle::Vector4 actualPosition;
|
||||
angle::Vector3 actualDirection;
|
||||
GLfloat actualFloatValue;
|
||||
GLboolean actualBooleanValue;
|
||||
|
||||
for (int k = 0; k < kNumTrials; ++k)
|
||||
{
|
||||
const GLColor32F lightModelAmbient(rng.randomFloat(), rng.randomFloat(), rng.randomFloat(),
|
||||
rng.randomFloat());
|
||||
const GLfloat lightModelTwoSide = rng.randomBool() ? 1.0f : 0.0f;
|
||||
|
||||
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, &lightModelAmbient.R);
|
||||
EXPECT_GL_NO_ERROR();
|
||||
glGetFloatv(GL_LIGHT_MODEL_AMBIENT, &actualColor.R);
|
||||
EXPECT_EQ(lightModelAmbient, actualColor);
|
||||
|
||||
glLightModelf(GL_LIGHT_MODEL_TWO_SIDE, lightModelTwoSide);
|
||||
EXPECT_GL_NO_ERROR();
|
||||
glGetFloatv(GL_LIGHT_MODEL_TWO_SIDE, &actualFloatValue);
|
||||
EXPECT_EQ(lightModelTwoSide, actualFloatValue);
|
||||
glGetBooleanv(GL_LIGHT_MODEL_TWO_SIDE, &actualBooleanValue);
|
||||
EXPECT_EQ(lightModelTwoSide == 1.0f ? GL_TRUE : GL_FALSE, actualBooleanValue);
|
||||
|
||||
for (int i = 0; i < maxLights; i++)
|
||||
{
|
||||
|
||||
const GLColor32F ambient(rng.randomFloat(), rng.randomFloat(), rng.randomFloat(),
|
||||
rng.randomFloat());
|
||||
const GLColor32F diffuse(rng.randomFloat(), rng.randomFloat(), rng.randomFloat(),
|
||||
rng.randomFloat());
|
||||
const GLColor32F specular(rng.randomFloat(), rng.randomFloat(), rng.randomFloat(),
|
||||
rng.randomFloat());
|
||||
const angle::Vector4 position(rng.randomFloat(), rng.randomFloat(), rng.randomFloat(),
|
||||
rng.randomFloat());
|
||||
const angle::Vector3 direction(rng.randomFloat(), rng.randomFloat(), rng.randomFloat());
|
||||
const GLfloat spotlightExponent = rng.randomFloatBetween(0.0f, 128.0f);
|
||||
const GLfloat spotlightCutoffAngle =
|
||||
rng.randomBool() ? rng.randomFloatBetween(0.0f, 90.0f) : 180.0f;
|
||||
const GLfloat attenuationConst = rng.randomFloatNonnegative();
|
||||
const GLfloat attenuationLinear = rng.randomFloatNonnegative();
|
||||
const GLfloat attenuationQuadratic = rng.randomFloatNonnegative();
|
||||
|
||||
glLightfv(GL_LIGHT0 + i, GL_AMBIENT, &ambient.R);
|
||||
EXPECT_GL_NO_ERROR();
|
||||
glGetLightfv(GL_LIGHT0 + i, GL_AMBIENT, &actualColor.R);
|
||||
EXPECT_EQ(ambient, actualColor);
|
||||
|
||||
glLightfv(GL_LIGHT0 + i, GL_DIFFUSE, &diffuse.R);
|
||||
EXPECT_GL_NO_ERROR();
|
||||
glGetLightfv(GL_LIGHT0 + i, GL_DIFFUSE, &actualColor.R);
|
||||
EXPECT_EQ(diffuse, actualColor);
|
||||
|
||||
glLightfv(GL_LIGHT0 + i, GL_SPECULAR, &specular.R);
|
||||
EXPECT_GL_NO_ERROR();
|
||||
glGetLightfv(GL_LIGHT0 + i, GL_SPECULAR, &actualColor.R);
|
||||
EXPECT_EQ(specular, actualColor);
|
||||
|
||||
glLightfv(GL_LIGHT0 + i, GL_POSITION, position.data());
|
||||
EXPECT_GL_NO_ERROR();
|
||||
glGetLightfv(GL_LIGHT0 + i, GL_POSITION, actualPosition.data());
|
||||
EXPECT_EQ(position, actualPosition);
|
||||
|
||||
glLightfv(GL_LIGHT0 + i, GL_SPOT_DIRECTION, direction.data());
|
||||
EXPECT_GL_NO_ERROR();
|
||||
glGetLightfv(GL_LIGHT0 + i, GL_SPOT_DIRECTION, actualDirection.data());
|
||||
EXPECT_EQ(direction, actualDirection);
|
||||
|
||||
glLightfv(GL_LIGHT0 + i, GL_SPOT_EXPONENT, &spotlightExponent);
|
||||
EXPECT_GL_NO_ERROR();
|
||||
glGetLightfv(GL_LIGHT0 + i, GL_SPOT_EXPONENT, &actualFloatValue);
|
||||
EXPECT_EQ(spotlightExponent, actualFloatValue);
|
||||
|
||||
glLightfv(GL_LIGHT0 + i, GL_SPOT_CUTOFF, &spotlightCutoffAngle);
|
||||
EXPECT_GL_NO_ERROR();
|
||||
glGetLightfv(GL_LIGHT0 + i, GL_SPOT_CUTOFF, &actualFloatValue);
|
||||
EXPECT_EQ(spotlightCutoffAngle, actualFloatValue);
|
||||
|
||||
glLightfv(GL_LIGHT0 + i, GL_CONSTANT_ATTENUATION, &attenuationConst);
|
||||
EXPECT_GL_NO_ERROR();
|
||||
glGetLightfv(GL_LIGHT0 + i, GL_CONSTANT_ATTENUATION, &actualFloatValue);
|
||||
EXPECT_EQ(attenuationConst, actualFloatValue);
|
||||
|
||||
glLightfv(GL_LIGHT0 + i, GL_LINEAR_ATTENUATION, &attenuationLinear);
|
||||
EXPECT_GL_NO_ERROR();
|
||||
glGetLightfv(GL_LIGHT0 + i, GL_LINEAR_ATTENUATION, &actualFloatValue);
|
||||
EXPECT_EQ(attenuationLinear, actualFloatValue);
|
||||
|
||||
glLightfv(GL_LIGHT0 + i, GL_LINEAR_ATTENUATION, &attenuationQuadratic);
|
||||
EXPECT_GL_NO_ERROR();
|
||||
glGetLightfv(GL_LIGHT0 + i, GL_LINEAR_ATTENUATION, &actualFloatValue);
|
||||
EXPECT_EQ(attenuationQuadratic, actualFloatValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ANGLE_INSTANTIATE_TEST(LightsTest, ES1_D3D11(), ES1_OPENGL(), ES1_OPENGLES());
|
|
@ -1,116 +0,0 @@
|
|||
//
|
||||
// Copyright 2018 The ANGLE Project Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
|
||||
// MaterialsTest.cpp: Tests basic usage of glMaterial*.
|
||||
|
||||
#include "test_utils/ANGLETest.h"
|
||||
#include "test_utils/gl_raii.h"
|
||||
|
||||
#include "random_utils.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
using namespace angle;
|
||||
|
||||
class MaterialsTest : public ANGLETest
|
||||
{
|
||||
protected:
|
||||
MaterialsTest()
|
||||
{
|
||||
setWindowWidth(32);
|
||||
setWindowHeight(32);
|
||||
setConfigRedBits(8);
|
||||
setConfigGreenBits(8);
|
||||
setConfigBlueBits(8);
|
||||
setConfigAlphaBits(8);
|
||||
setConfigDepthBits(24);
|
||||
}
|
||||
};
|
||||
|
||||
// Check that the initial material state is correct.
|
||||
TEST_P(MaterialsTest, InitialState)
|
||||
{
|
||||
const GLColor32F kAmbientInitial(0.2f, 0.2f, 0.2f, 1.0f);
|
||||
const GLColor32F kDiffuseInitial(0.8f, 0.8f, 0.8f, 1.0f);
|
||||
const GLColor32F kSpecularInitial(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
const GLColor32F kEmissiveInitial(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
const float kShininessInitial = 0.0f;
|
||||
|
||||
GLColor32F actualColor;
|
||||
float actualShininess;
|
||||
|
||||
std::vector<GLenum> pnames = {
|
||||
GL_AMBIENT, GL_DIFFUSE, GL_SPECULAR, GL_EMISSION,
|
||||
};
|
||||
|
||||
std::vector<GLColor32F> colors = {
|
||||
kAmbientInitial, kDiffuseInitial, kSpecularInitial, kEmissiveInitial,
|
||||
};
|
||||
|
||||
for (size_t i = 0; i < pnames.size(); i++)
|
||||
{
|
||||
glGetMaterialfv(GL_FRONT_AND_BACK, pnames[i], &actualColor.R);
|
||||
EXPECT_GL_NO_ERROR();
|
||||
EXPECT_EQ(colors[i], actualColor);
|
||||
}
|
||||
|
||||
glGetMaterialfv(GL_FRONT_AND_BACK, GL_SHININESS, &actualShininess);
|
||||
EXPECT_GL_NO_ERROR();
|
||||
EXPECT_EQ(kShininessInitial, actualShininess);
|
||||
}
|
||||
|
||||
// Check for invalid parameter names.
|
||||
TEST_P(MaterialsTest, InvalidParameter)
|
||||
{
|
||||
glGetMaterialfv(GL_FRONT_AND_BACK, 0, nullptr);
|
||||
EXPECT_GL_ERROR(GL_INVALID_ENUM);
|
||||
|
||||
glGetMaterialfv(GL_FRONT, GL_AMBIENT, nullptr);
|
||||
EXPECT_GL_ERROR(GL_INVALID_ENUM);
|
||||
|
||||
glGetMaterialfv(GL_BACK, GL_AMBIENT, nullptr);
|
||||
EXPECT_GL_ERROR(GL_INVALID_ENUM);
|
||||
}
|
||||
|
||||
// Check that material parameters can be set.
|
||||
TEST_P(MaterialsTest, SetParameters)
|
||||
{
|
||||
const GLColor32F kAmbientTestValue(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
const GLColor32F kDiffuseTestValue(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
const GLColor32F kSpecularTestValue(0.5f, 0.5f, 0.5f, 0.5f);
|
||||
const GLColor32F kEmissiveTestValue(0.4f, 0.4f, 0.4f, 0.4f);
|
||||
const float kShininessTestValue = 1.0f;
|
||||
|
||||
std::vector<GLenum> pnames = {
|
||||
GL_AMBIENT, GL_DIFFUSE, GL_SPECULAR, GL_EMISSION,
|
||||
};
|
||||
|
||||
std::vector<GLColor32F> colors = {
|
||||
kAmbientTestValue, kDiffuseTestValue, kSpecularTestValue, kEmissiveTestValue,
|
||||
};
|
||||
|
||||
GLColor32F actualColor;
|
||||
float actualShininess;
|
||||
|
||||
for (size_t i = 0; i < pnames.size(); i++)
|
||||
{
|
||||
glMaterialfv(GL_FRONT_AND_BACK, pnames[i], &colors[i].R);
|
||||
EXPECT_GL_NO_ERROR();
|
||||
glGetMaterialfv(GL_FRONT_AND_BACK, pnames[i], &actualColor.R);
|
||||
EXPECT_GL_NO_ERROR();
|
||||
EXPECT_EQ(colors[i], actualColor);
|
||||
}
|
||||
|
||||
glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, kShininessTestValue);
|
||||
EXPECT_GL_NO_ERROR();
|
||||
glGetMaterialfv(GL_FRONT_AND_BACK, GL_SHININESS, &actualShininess);
|
||||
EXPECT_GL_NO_ERROR();
|
||||
EXPECT_EQ(kShininessTestValue, actualShininess);
|
||||
}
|
||||
|
||||
ANGLE_INSTANTIATE_TEST(MaterialsTest, ES1_D3D11(), ES1_OPENGL(), ES1_OPENGLES());
|
|
@ -37,12 +37,6 @@ void RNG::reseed(unsigned int newSeed)
|
|||
mGenerator.seed(newSeed);
|
||||
}
|
||||
|
||||
bool RNG::randomBool(float probTrue)
|
||||
{
|
||||
std::bernoulli_distribution dist(probTrue);
|
||||
return dist(mGenerator);
|
||||
}
|
||||
|
||||
int RNG::randomInt()
|
||||
{
|
||||
std::uniform_int_distribution<int> intDistribution;
|
||||
|
@ -73,13 +67,6 @@ float RNG::randomFloatBetween(float min, float max)
|
|||
return floatDistribution(mGenerator);
|
||||
}
|
||||
|
||||
float RNG::randomFloatNonnegative()
|
||||
{
|
||||
std::uniform_real_distribution<float> floatDistribution(0.0f,
|
||||
std::numeric_limits<float>::max());
|
||||
return floatDistribution(mGenerator);
|
||||
}
|
||||
|
||||
float RNG::randomNegativeOneToOne()
|
||||
{
|
||||
return randomFloatBetween(-1.0f, 1.0f);
|
||||
|
|
|
@ -29,13 +29,11 @@ class ANGLE_EXPORT RNG
|
|||
|
||||
void reseed(unsigned int newSeed);
|
||||
|
||||
bool randomBool(float probTrue = 0.5f);
|
||||
int randomInt();
|
||||
int randomIntBetween(int min, int max);
|
||||
unsigned int randomUInt();
|
||||
float randomFloat();
|
||||
float randomFloatBetween(float min, float max);
|
||||
float randomFloatNonnegative();
|
||||
float randomNegativeOneToOne();
|
||||
|
||||
private:
|
||||
|
@ -59,4 +57,4 @@ inline void FillVectorWithRandomUBytes(std::vector<uint8_t> *data)
|
|||
|
||||
} // namespace angle
|
||||
|
||||
#endif // UTIL_RANDOM_UTILS_H
|
||||
#endif // UTIL_RANDOM_UTILS_H
|
||||
|
|
Загрузка…
Ссылка в новой задаче