Commit 467c15f9 by Jiawei Shao Committed by Commit Bot

Use ShaderMap in ProgramD3D - Part II

This patch refactors ProgramD3D by storing all shader information into ShaderMap to simplify the code structure. This patch also fixes a bug on getting the number of maximum uniform blocks. BUG=angleproject:2169 Change-Id: I5b9fbfd70a18f8731ce19efed0df88037d495389 Reviewed-on: https://chromium-review.googlesource.com/1024749 Commit-Queue: Jiawei Shao <jiawei.shao@intel.com> Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org>
parent 7267aa65
......@@ -286,6 +286,7 @@ class ProgramState final : angle::NonCopyable
const std::string &getLabel();
Shader *getAttachedShader(ShaderType shaderType) const;
const gl::ShaderMap<Shader *> &getAttachedShaders() const { return mAttachedShaders; }
const std::vector<std::string> &getTransformFeedbackVaryingNames() const
{
return mTransformFeedbackVaryingNames;
......
......@@ -454,10 +454,11 @@ void DynamicHLSL::generateShaderLinkHLSL(const gl::Context *context,
const ProgramD3DMetadata &programMetadata,
const VaryingPacking &varyingPacking,
const BuiltinVaryingsD3D &builtinsD3D,
std::string *pixelHLSL,
std::string *vertexHLSL) const
gl::ShaderMap<std::string> *shaderHLSL) const
{
ASSERT(pixelHLSL->empty() && vertexHLSL->empty());
ASSERT(shaderHLSL);
ASSERT((*shaderHLSL)[gl::ShaderType::Vertex].empty() &&
(*shaderHLSL)[gl::ShaderType::Fragment].empty());
const auto &data = context->getContextState();
gl::Shader *vertexShaderGL = programData.getAttachedShader(ShaderType::Vertex);
......@@ -844,8 +845,8 @@ void DynamicHLSL::generateShaderLinkHLSL(const gl::Context *context,
<< " return generateOutput();\n"
<< "}\n";
*vertexHLSL = vertexStream.str();
*pixelHLSL = pixelStream.str();
(*shaderHLSL)[gl::ShaderType::Vertex] = vertexStream.str();
(*shaderHLSL)[gl::ShaderType::Fragment] = pixelStream.str();
}
std::string DynamicHLSL::generateComputeShaderLinkHLSL(const gl::Context *context,
......
......@@ -139,8 +139,7 @@ class DynamicHLSL : angle::NonCopyable
const ProgramD3DMetadata &programMetadata,
const gl::VaryingPacking &varyingPacking,
const BuiltinVaryingsD3D &builtinsD3D,
std::string *pixelHLSL,
std::string *vertexHLSL) const;
gl::ShaderMap<std::string> *shaderHLSL) const;
std::string generateComputeShaderLinkHLSL(const gl::Context *context,
const gl::ProgramState &programData) const;
......
......@@ -480,11 +480,9 @@ class ProgramD3D : public ProgramImpl
std::vector<std::unique_ptr<ShaderExecutableD3D>> mGeometryExecutables;
std::unique_ptr<ShaderExecutableD3D> mComputeExecutable;
std::string mVertexHLSL;
angle::CompilerWorkaroundsD3D mVertexWorkarounds;
gl::ShaderMap<std::string> mShaderHLSL;
gl::ShaderMap<angle::CompilerWorkaroundsD3D> mShaderWorkarounds;
std::string mPixelHLSL;
angle::CompilerWorkaroundsD3D mPixelWorkarounds;
bool mUsesFragDepth;
bool mHasANGLEMultiviewEnabled;
bool mUsesViewID;
......@@ -500,12 +498,8 @@ class ProgramD3D : public ProgramImpl
gl::ShaderMap<std::unique_ptr<UniformStorageD3D>> mShaderUniformStorages;
std::vector<Sampler> mSamplersPS;
std::vector<Sampler> mSamplersVS;
std::vector<Sampler> mSamplersCS;
GLuint mUsedVertexSamplerRange;
GLuint mUsedPixelSamplerRange;
GLuint mUsedComputeSamplerRange;
gl::ShaderMap<std::vector<Sampler>> mShaderSamplers;
gl::ShaderMap<GLuint> mUsedShaderSamplerRanges;
bool mDirtySamplerMapping;
std::vector<Image> mImagesCS;
......
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