Commit 6941a556 by Geoff Lang

Rename Workarounds to WorkaroundsD3D.

It is not referenced outside of the d3d classes. BUG=angleproject:884 Change-Id: Ibeec034b1b78b569bea2f1c77d6a686b58b8e010 Reviewed-on: https://chromium-review.googlesource.com/288582Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Tested-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent c64d993d
......@@ -20,7 +20,6 @@
#include "libANGLE/renderer/FramebufferImpl.h"
#include "libANGLE/renderer/ImplFactory.h"
#include "libANGLE/renderer/RenderbufferImpl.h"
#include "libANGLE/renderer/Workarounds.h"
namespace gl
{
......
......@@ -23,7 +23,6 @@ namespace rx
class ImplFactory;
class FramebufferImpl;
class RenderbufferImpl;
struct Workarounds;
}
namespace egl
......
......@@ -14,10 +14,7 @@
namespace rx
{
Renderer::Renderer()
: mCapsInitialized(false),
mWorkaroundsInitialized(false)
Renderer::Renderer() : mCapsInitialized(false)
{
}
......@@ -62,15 +59,4 @@ const gl::Limitations &Renderer::getRendererLimitations() const
return mLimitations;
}
const Workarounds &Renderer::getWorkarounds() const
{
if (!mWorkaroundsInitialized)
{
mWorkarounds = generateWorkarounds();
mWorkaroundsInitialized = true;
}
return mWorkarounds;
}
}
......@@ -16,7 +16,6 @@
#include "libANGLE/Uniform.h"
#include "libANGLE/angletypes.h"
#include "libANGLE/renderer/ImplFactory.h"
#include "libANGLE/renderer/Workarounds.h"
#include "common/mathutil.h"
#include <stdint.h>
......@@ -40,7 +39,7 @@ namespace rx
{
struct TranslatedIndexData;
struct SourceIndexData;
struct Workarounds;
struct WorkaroundsD3D;
class DisplayImpl;
class Renderer : public ImplFactory
......@@ -78,23 +77,18 @@ class Renderer : public ImplFactory
const gl::TextureCapsMap &getRendererTextureCaps() const;
const gl::Extensions &getRendererExtensions() const;
const gl::Limitations &getRendererLimitations() const;
const Workarounds &getWorkarounds() const;
private:
void ensureCapsInitialized() const;
virtual void generateCaps(gl::Caps *outCaps, gl::TextureCapsMap* outTextureCaps,
gl::Extensions *outExtensions,
gl::Limitations *outLimitations) const = 0;
virtual Workarounds generateWorkarounds() const = 0;
mutable bool mCapsInitialized;
mutable gl::Caps mCaps;
mutable gl::TextureCapsMap mTextureCaps;
mutable gl::Extensions mExtensions;
mutable gl::Limitations mLimitations;
mutable bool mWorkaroundsInitialized;
mutable Workarounds mWorkarounds;
};
}
......
......@@ -337,7 +337,8 @@ GLenum FramebufferD3D::checkStatus() const
return GL_FRAMEBUFFER_COMPLETE;
}
const gl::AttachmentList &FramebufferD3D::getColorAttachmentsForRender(const Workarounds &workarounds) const
const gl::AttachmentList &FramebufferD3D::getColorAttachmentsForRender(
const WorkaroundsD3D &workarounds) const
{
if (!mInvalidateColorAttachmentCache)
{
......
......@@ -27,6 +27,7 @@ typedef std::vector<const FramebufferAttachment *> AttachmentList;
namespace rx
{
class RenderTargetD3D;
struct WorkaroundsD3D;
struct ClearParameters
{
......@@ -80,7 +81,7 @@ class FramebufferD3D : public FramebufferImpl
GLenum checkStatus() const override;
const gl::AttachmentList &getColorAttachmentsForRender(const Workarounds &workarounds) const;
const gl::AttachmentList &getColorAttachmentsForRender(const WorkaroundsD3D &workarounds) const;
protected:
// Cache variable
......
......@@ -2003,11 +2003,11 @@ void ProgramD3D::reset()
mTransformFeedbackBufferMode = GL_NONE;
mVertexHLSL.clear();
mVertexWorkarounds.reset();
mVertexWorkarounds = D3DCompilerWorkarounds();
mShaderVersion = 100;
mPixelHLSL.clear();
mPixelWorkarounds.reset();
mPixelWorkarounds = D3DCompilerWorkarounds();
mUsesFragDepth = false;
mPixelShaderKey.clear();
mUsesPointSize = false;
......
......@@ -17,8 +17,8 @@
#include "libANGLE/Constants.h"
#include "libANGLE/formatutils.h"
#include "libANGLE/renderer/ProgramImpl.h"
#include "libANGLE/renderer/Workarounds.h"
#include "libANGLE/renderer/d3d/DynamicHLSL.h"
#include "libANGLE/renderer/d3d/WorkaroundsD3D.h"
namespace gl
{
......
......@@ -41,7 +41,8 @@ RendererD3D::RendererD3D(egl::Display *display)
: mDisplay(display),
mDeviceLost(false),
mAnnotator(nullptr),
mScratchMemoryBufferResetCounter(0)
mScratchMemoryBufferResetCounter(0),
mWorkaroundsInitialized(false)
{
}
......
......@@ -16,6 +16,7 @@
#include "libANGLE/renderer/Renderer.h"
#include "libANGLE/renderer/d3d/VertexDataManager.h"
#include "libANGLE/renderer/d3d/formatutilsD3D.h"
#include "libANGLE/renderer/d3d/WorkaroundsD3D.h"
#include "libANGLE/renderer/d3d/d3d11/NativeWindow.h"
//FIXME(jmadill): std::array is currently prohibited by Chromium style guide
......@@ -152,6 +153,8 @@ class RendererD3D : public Renderer, public BufferFactoryD3D
virtual int getMajorShaderModel() const = 0;
const WorkaroundsD3D &getWorkarounds() const;
// Pixel operations
virtual gl::Error copyImage2D(const gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
const gl::Offset &destOffset, TextureStorage *storage, GLint level) = 0;
......@@ -251,9 +254,14 @@ class RendererD3D : public Renderer, public BufferFactoryD3D
gl::DebugAnnotator *getAnnotator();
virtual WorkaroundsD3D generateWorkarounds() const = 0;
gl::TextureMap mIncompleteTextures;
MemoryBuffer mScratchMemoryBuffer;
unsigned int mScratchMemoryBufferResetCounter;
mutable bool mWorkaroundsInitialized;
mutable WorkaroundsD3D mWorkarounds;
};
struct dx_VertexConstants
......
......@@ -9,8 +9,8 @@
#ifndef LIBANGLE_RENDERER_D3D_SHADERD3D_H_
#define LIBANGLE_RENDERER_D3D_SHADERD3D_H_
#include "libANGLE/renderer/d3d/WorkaroundsD3D.h"
#include "libANGLE/renderer/ShaderImpl.h"
#include "libANGLE/renderer/Workarounds.h"
#include "libANGLE/Shader.h"
#include <map>
......
//
// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
// Copyright (c) 2015 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.
//
// angletypes.h: Workarounds for driver bugs and other issues.
// WorkaroundsD3D.h: Workarounds for D3D driver bugs and other issues.
#ifndef LIBANGLE_RENDERER_WORKAROUNDS_H_
#define LIBANGLE_RENDERER_WORKAROUNDS_H_
#ifndef LIBANGLE_RENDERER_D3D_WORKAROUNDSD3D_H_
#define LIBANGLE_RENDERER_D3D_WORKAROUNDSD3D_H_
// TODO(jmadill,zmo,geofflang): make a workarounds library that can operate
// independent of ANGLE's renderer. Workarounds should also be accessible
......@@ -15,20 +15,11 @@
namespace rx
{
struct D3DCompilerWorkarounds : angle::NonCopyable
struct D3DCompilerWorkarounds
{
D3DCompilerWorkarounds()
: skipOptimization(false),
useMaxOptimization(false),
enableIEEEStrictness(false)
{}
void reset()
: skipOptimization(false), useMaxOptimization(false), enableIEEEStrictness(false)
{
skipOptimization = false;
useMaxOptimization = false;
enableIEEEStrictness = false;
}
bool skipOptimization;
......@@ -38,14 +29,15 @@ struct D3DCompilerWorkarounds : angle::NonCopyable
bool enableIEEEStrictness;
};
struct Workarounds
struct WorkaroundsD3D
{
Workarounds()
WorkaroundsD3D()
: mrtPerfWorkaround(false),
setDataFasterThanImageUpload(false),
zeroMaxLodWorkaround(false),
useInstancedPointSpriteEmulation(false)
{}
{
}
// On some systems, having extra rendertargets than necessary slows down the shader.
// We can fix this by optimizing those out of the shader. At the same time, we can
......@@ -55,20 +47,20 @@ struct Workarounds
bool setDataFasterThanImageUpload;
// Some renderers can't disable mipmaps on a mipmapped texture (i.e. solely sample from level zero, and ignore the other levels).
// D3D11 Feature Level 10+ does this by setting MaxLOD to 0.0f in the Sampler state. D3D9 sets D3DSAMP_MIPFILTER to D3DTEXF_NONE.
// There is no equivalent to this in D3D11 Feature Level 9_3.
// This causes problems when (for example) an application creates a mipmapped texture2D, but sets GL_TEXTURE_MIN_FILTER to GL_NEAREST (i.e disables mipmaps).
// To work around this, D3D11 FL9_3 has to create two copies of the texture. The textures' level zeros are identical, but only one texture has mips.
// Some renderers can't disable mipmaps on a mipmapped texture (i.e. solely sample from level
// zero, and ignore the other levels). D3D11 Feature Level 10+ does this by setting MaxLOD to
// 0.0f in the Sampler state. D3D9 sets D3DSAMP_MIPFILTER to D3DTEXF_NONE. There is no
// equivalent to this in D3D11 Feature Level 9_3. This causes problems when (for example) an
// application creates a mipmapped texture2D, but sets GL_TEXTURE_MIN_FILTER to GL_NEAREST
// (i.e disables mipmaps). To work around this, D3D11 FL9_3 has to create two copies of the
// texture. The textures' level zeros are identical, but only one texture has mips.
bool zeroMaxLodWorkaround;
// Some renderers do not support Geometry Shaders so the Geometry Shader-based
// PointSprite emulation will not work.
// To work around this, D3D11 FL9_3 has to use a different pointsprite
// Some renderers do not support Geometry Shaders so the Geometry Shader-based PointSprite
// emulation will not work. To work around this, D3D11 FL9_3 has to use a different pointsprite
// emulation that is implemented using instanced quads.
bool useInstancedPointSpriteEmulation;
};
}
#endif // LIBANGLE_RENDERER_WORKAROUNDS_H_
#endif // LIBANGLE_RENDERER_D3D_WORKAROUNDSD3D_H_
......@@ -2594,6 +2594,17 @@ std::string Renderer11::getShaderModelSuffix() const
}
}
const WorkaroundsD3D &RendererD3D::getWorkarounds() const
{
if (!mWorkaroundsInitialized)
{
mWorkarounds = generateWorkarounds();
mWorkaroundsInitialized = true;
}
return mWorkarounds;
}
gl::Error Renderer11::copyImage2D(const gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
const gl::Offset &destOffset, TextureStorage *storage, GLint level)
{
......@@ -3792,7 +3803,7 @@ void Renderer11::generateCaps(gl::Caps *outCaps, gl::TextureCapsMap *outTextureC
outExtensions, outLimitations);
}
Workarounds Renderer11::generateWorkarounds() const
WorkaroundsD3D Renderer11::generateWorkarounds() const
{
return d3d11::GenerateWorkarounds(mRenderer11DeviceCaps.featureLevel);
}
......
......@@ -281,7 +281,7 @@ class Renderer11 : public RendererD3D
gl::Extensions *outExtensions,
gl::Limitations *outLimitations) const override;
Workarounds generateWorkarounds() const override;
WorkaroundsD3D generateWorkarounds() const override;
gl::Error drawLineLoop(GLsizei count, GLenum type, const GLvoid *indices, int minIndex, gl::Buffer *elementArrayBuffer);
gl::Error drawTriangleFan(GLsizei count, GLenum type, const GLvoid *indices, int minIndex, gl::Buffer *elementArrayBuffer, int instances);
......
......@@ -15,7 +15,7 @@
#include "libANGLE/Framebuffer.h"
#include "libANGLE/Program.h"
#include "libANGLE/formatutils.h"
#include "libANGLE/renderer/Workarounds.h"
#include "libANGLE/renderer/d3d/WorkaroundsD3D.h"
#include "libANGLE/renderer/d3d/FramebufferD3D.h"
#include "libANGLE/renderer/d3d/d3d11/Renderer11.h"
#include "libANGLE/renderer/d3d/d3d11/RenderTarget11.h"
......@@ -1251,9 +1251,9 @@ HRESULT SetDebugName(ID3D11DeviceChild *resource, const char *name)
#endif
}
Workarounds GenerateWorkarounds(D3D_FEATURE_LEVEL featureLevel)
WorkaroundsD3D GenerateWorkarounds(D3D_FEATURE_LEVEL featureLevel)
{
Workarounds workarounds;
WorkaroundsD3D workarounds;
workarounds.mrtPerfWorkaround = true;
workarounds.setDataFasterThanImageUpload = true;
workarounds.zeroMaxLodWorkaround = (featureLevel <= D3D_FEATURE_LEVEL_9_3);
......
......@@ -25,7 +25,7 @@ class FramebufferAttachment;
namespace rx
{
class RenderTarget11;
struct Workarounds;
struct WorkaroundsD3D;
struct Renderer11DeviceCaps;
namespace gl_d3d11
......@@ -335,8 +335,7 @@ void SetBufferData(ID3D11DeviceContext *context, ID3D11Buffer *constantBuffer, c
}
}
Workarounds GenerateWorkarounds(D3D_FEATURE_LEVEL featureLevel);
WorkaroundsD3D GenerateWorkarounds(D3D_FEATURE_LEVEL featureLevel);
}
}
......
......@@ -2951,7 +2951,7 @@ void Renderer9::generateCaps(gl::Caps *outCaps, gl::TextureCapsMap *outTextureCa
outTextureCaps, outExtensions);
}
Workarounds Renderer9::generateWorkarounds() const
WorkaroundsD3D Renderer9::generateWorkarounds() const
{
return d3d9::GenerateWorkarounds();
}
......
......@@ -245,7 +245,7 @@ class Renderer9 : public RendererD3D
gl::Extensions *outExtensions,
gl::Limitations *outLimitations) const override;
Workarounds generateWorkarounds() const override;
WorkaroundsD3D generateWorkarounds() const override;
void release();
......
......@@ -8,16 +8,17 @@
// specific to the D3D9 renderer.
#include "libANGLE/renderer/d3d/d3d9/renderer9_utils.h"
#include "libANGLE/renderer/d3d/d3d9/formatutils9.h"
#include "libANGLE/renderer/d3d/FramebufferD3D.h"
#include "libANGLE/renderer/Workarounds.h"
#include "libANGLE/formatutils.h"
#include "libANGLE/Framebuffer.h"
#include "libANGLE/renderer/d3d/d3d9/RenderTarget9.h"
#include "common/mathutil.h"
#include "common/debug.h"
#include "libANGLE/formatutils.h"
#include "libANGLE/Framebuffer.h"
#include "libANGLE/renderer/d3d/d3d9/formatutils9.h"
#include "libANGLE/renderer/d3d/d3d9/RenderTarget9.h"
#include "libANGLE/renderer/d3d/FramebufferD3D.h"
#include "libANGLE/renderer/d3d/WorkaroundsD3D.h"
#include "third_party/systeminfo/SystemInfo.h"
namespace rx
......@@ -590,9 +591,9 @@ void MakeValidSize(bool isImage, D3DFORMAT format, GLsizei *requestWidth, GLsize
*levelOffset = upsampleCount;
}
Workarounds GenerateWorkarounds()
WorkaroundsD3D GenerateWorkarounds()
{
Workarounds workarounds;
WorkaroundsD3D workarounds;
workarounds.mrtPerfWorkaround = true;
workarounds.setDataFasterThanImageUpload = false;
workarounds.useInstancedPointSpriteEmulation = false;
......
......@@ -22,7 +22,7 @@ class FramebufferAttachment;
namespace rx
{
class RenderTarget9;
struct Workarounds;
struct WorkaroundsD3D;
namespace gl_d3d9
{
......@@ -77,8 +77,7 @@ inline bool isDeviceLostError(HRESULT errorCode)
}
}
Workarounds GenerateWorkarounds();
WorkaroundsD3D GenerateWorkarounds();
}
}
......
......@@ -323,10 +323,4 @@ void RendererGL::generateCaps(gl::Caps *outCaps, gl::TextureCapsMap* outTextureC
nativegl_gl::GenerateCaps(mFunctions, outCaps, outTextureCaps, outExtensions, &mMaxSupportedESVersion);
}
Workarounds RendererGL::generateWorkarounds() const
{
Workarounds workarounds;
return workarounds;
}
}
......@@ -83,8 +83,6 @@ class RendererGL : public Renderer
gl::Extensions *outExtensions,
gl::Limitations *outLimitations) const override;
Workarounds generateWorkarounds() const override;
mutable gl::Version mMaxSupportedESVersion;
const FunctionsGL *mFunctions;
......
......@@ -148,7 +148,6 @@
'libANGLE/renderer/TextureImpl.h',
'libANGLE/renderer/TransformFeedbackImpl.h',
'libANGLE/renderer/VertexArrayImpl.h',
'libANGLE/renderer/Workarounds.h',
'libANGLE/validationEGL.cpp',
'libANGLE/validationEGL.h',
'libANGLE/validationES.cpp',
......@@ -218,6 +217,7 @@
'libANGLE/renderer/d3d/VertexBuffer.h',
'libANGLE/renderer/d3d/VertexDataManager.cpp',
'libANGLE/renderer/d3d/VertexDataManager.h',
'libANGLE/renderer/d3d/WorkaroundsD3D.h',
],
'libangle_d3d9_sources':
[
......
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