Commit e8f47137 by Geoff Lang

Work around depth texture sampling differences in GL versions.

ES3 requires that only the red channel has data when sampling from depth textures while desktop GL treats them as luminance textures. Set the swizzle state of the texture to sample 0 from the blue and green channels in TextureGL. Passes 75 new tests in dEQP-GLES3.functional.texture.format and dEQP-GLES3.functional.texture.specification. BUG=angleproject:884 Change-Id: I863472961dcbbf8af864f5e1d85a4aea41f47bda Reviewed-on: https://chromium-review.googlesource.com/298481Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org> Tested-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 4a693565
...@@ -20,14 +20,32 @@ class FunctionsGL; ...@@ -20,14 +20,32 @@ class FunctionsGL;
class StateManagerGL; class StateManagerGL;
struct WorkaroundsGL; struct WorkaroundsGL;
struct LUMAWorkaround struct LUMAWorkaroundGL
{ {
bool enabled; bool enabled;
GLenum sourceFormat;
GLenum workaroundFormat; GLenum workaroundFormat;
LUMAWorkaround(); LUMAWorkaroundGL();
LUMAWorkaround(bool enabled, GLenum sourceFormat, GLenum workaroundFormat); LUMAWorkaroundGL(bool enabled, GLenum workaroundFormat);
};
// Structure containing information about format and workarounds for each mip level of the
// TextureGL.
struct LevelInfoGL
{
// Format of the data used in this mip level.
GLenum sourceFormat;
// If this mip level requires sampler-state re-writing so that only a red channel is exposed.
bool depthStencilWorkaround;
// Information about luminance alpha texture workarounds in the core profile.
LUMAWorkaroundGL lumaWorkaround;
LevelInfoGL();
LevelInfoGL(GLenum sourceFormat,
bool depthStencilWorkaround,
const LUMAWorkaroundGL &lumaWorkaround);
}; };
class TextureGL : public TextureImpl class TextureGL : public TextureImpl
...@@ -83,7 +101,7 @@ class TextureGL : public TextureImpl ...@@ -83,7 +101,7 @@ class TextureGL : public TextureImpl
StateManagerGL *mStateManager; StateManagerGL *mStateManager;
BlitGL *mBlitter; BlitGL *mBlitter;
std::vector<LUMAWorkaround> mLUMAWorkaroundLevels; std::vector<LevelInfoGL> mLevelInfo;
mutable gl::SamplerState mAppliedSamplerState; mutable gl::SamplerState mAppliedSamplerState;
GLuint mTextureID; GLuint mTextureID;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment