Commit 31c8c56a by Jamie Madill

Make ProgramImpl::compileProgramExecutables D3D-only.

Finally we can isolate this method into the D3D-only code, and remove the interface from ProgramImpl. BUG=angleproject:1123 Change-Id: I253b15d44d4cf8bbb5dbeaa78bbcc431a5267bf7 Reviewed-on: https://chromium-review.googlesource.com/293765Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Tested-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 18fdcbcf
......@@ -311,22 +311,11 @@ Error Program::link(const gl::Data &data)
return Error(GL_NO_ERROR);
}
int registers;
rx::LinkResult result =
mProgram->link(data, mInfoLog, mData.mAttachedFragmentShader, mData.mAttachedVertexShader,
&registers, &mOutputVariables);
if (result.error.isError() || !result.linkSuccess)
{
return result.error;
}
rx::LinkResult result = mProgram->link(data, mInfoLog, mData.mAttachedFragmentShader,
mData.mAttachedVertexShader, &mOutputVariables);
// TODO: The concept of "executables" is D3D only, and as such this belongs in ProgramD3D. It must be called,
// however, last in this function, so it can't simply be moved to ProgramD3D::link without further shuffling.
result = mProgram->compileProgramExecutables(mInfoLog, registers);
if (result.error.isError() || !result.linkSuccess)
{
mInfoLog << "Failed to create D3D shaders.";
unlink(false);
return result.error;
}
......
......@@ -47,7 +47,6 @@ class ProgramImpl : angle::NonCopyable
gl::InfoLog &infoLog,
gl::Shader *fragmentShader,
gl::Shader *vertexShader,
int *registers,
std::map<int, gl::VariableLocation> *outputVariables) = 0;
virtual void bindAttributeLocation(GLuint index, const std::string &name) = 0;
......@@ -86,8 +85,6 @@ class ProgramImpl : angle::NonCopyable
virtual void updateSamplerMapping() = 0;
virtual bool validateSamplers(gl::InfoLog *infoLog, const gl::Caps &caps) = 0;
virtual LinkResult compileProgramExecutables(gl::InfoLog &infoLog, int registers) = 0;
virtual gl::Error applyUniforms() = 0;
virtual gl::Error applyUniformBuffers(const gl::Data &data, GLuint uniformBlockBindings[]) = 0;
......
......@@ -1100,7 +1100,6 @@ LinkResult ProgramD3D::link(const gl::Data &data,
gl::InfoLog &infoLog,
gl::Shader *fragmentShader,
gl::Shader *vertexShader,
int *registers,
std::map<int, gl::VariableLocation> *outputVariables)
{
ShaderD3D *vertexShaderD3D = GetImplAs<ShaderD3D>(vertexShader);
......@@ -1127,10 +1126,10 @@ LinkResult ProgramD3D::link(const gl::Data &data,
// Map the varyings to the register file
VaryingPacking packing = {};
*registers = mDynamicHLSL->packVaryings(infoLog, packing, fragmentShaderD3D, vertexShaderD3D,
mData.getTransformFeedbackVaryingNames());
int registers = mDynamicHLSL->packVaryings(infoLog, packing, fragmentShaderD3D, vertexShaderD3D,
mData.getTransformFeedbackVaryingNames());
if (*registers < 0)
if (registers < 0)
{
return LinkResult(false, gl::Error(GL_NO_ERROR));
}
......@@ -1139,7 +1138,7 @@ LinkResult ProgramD3D::link(const gl::Data &data,
std::vector<gl::LinkedVarying> linkedVaryings;
if (!mDynamicHLSL->generateShaderLinkHLSL(
data, infoLog, *registers, packing, mPixelHLSL, mVertexHLSL, fragmentShaderD3D,
data, infoLog, registers, packing, mPixelHLSL, mVertexHLSL, fragmentShaderD3D,
vertexShaderD3D, mData.getTransformFeedbackVaryingNames(), &linkedVaryings,
outputVariables, &mPixelShaderKey, &mUsesFragDepth))
{
......@@ -1159,6 +1158,13 @@ LinkResult ProgramD3D::link(const gl::Data &data,
gatherTransformFeedbackVaryings(linkedVaryings);
LinkResult result = compileProgramExecutables(infoLog, registers);
if (result.error.isError() || !result.linkSuccess)
{
infoLog << "Failed to create D3D shaders.";
return result;
}
return LinkResult(true, gl::Error(GL_NO_ERROR));
}
......
......@@ -68,13 +68,10 @@ class ProgramD3D : public ProgramImpl
gl::Error getVertexExecutableForInputLayout(const gl::InputLayout &inputLayout, ShaderExecutableD3D **outExectuable, gl::InfoLog *infoLog);
ShaderExecutableD3D *getGeometryExecutable() const { return mGeometryExecutable; }
LinkResult compileProgramExecutables(gl::InfoLog &infoLog, int registers);
LinkResult link(const gl::Data &data,
gl::InfoLog &infoLog,
gl::Shader *fragmentShader,
gl::Shader *vertexShader,
int *registers,
std::map<int, gl::VariableLocation> *outputVariables);
void bindAttributeLocation(GLuint index, const std::string &name) override;
......@@ -208,6 +205,8 @@ class ProgramD3D : public ProgramImpl
sh::BlockLayoutEncoder *encoder, std::vector<unsigned int> *blockUniformIndexes,
bool inRowMajorLayout);
LinkResult compileProgramExecutables(gl::InfoLog &infoLog, int registers);
void gatherTransformFeedbackVaryings(const std::vector<gl::LinkedVarying> &varyings);
RendererD3D *mRenderer;
......
......@@ -68,7 +68,6 @@ LinkResult ProgramGL::link(const gl::Data &data,
gl::InfoLog &infoLog,
gl::Shader *fragmentShader,
gl::Shader *vertexShader,
int *registers,
std::map<int, gl::VariableLocation> *outputVariables)
{
// Reset the program state, delete the current program if one exists
......@@ -395,12 +394,6 @@ bool ProgramGL::validateSamplers(gl::InfoLog *infoLog, const gl::Caps &caps)
return true;
}
LinkResult ProgramGL::compileProgramExecutables(gl::InfoLog &infoLog, int registers)
{
//UNIMPLEMENTED();
return LinkResult(true, gl::Error(GL_NO_ERROR));
}
gl::Error ProgramGL::applyUniforms()
{
//UNIMPLEMENTED();
......
......@@ -42,7 +42,6 @@ class ProgramGL : public ProgramImpl
gl::InfoLog &infoLog,
gl::Shader *fragmentShader,
gl::Shader *vertexShader,
int *registers,
std::map<int, gl::VariableLocation> *outputVariables) override;
void bindAttributeLocation(GLuint index, const std::string &name) override;
......@@ -79,8 +78,6 @@ class ProgramGL : public ProgramImpl
void updateSamplerMapping() override;
bool validateSamplers(gl::InfoLog *infoLog, const gl::Caps &caps) override;
LinkResult compileProgramExecutables(gl::InfoLog &infoLog, int registers) override;
void defineUniformBlock(gl::InfoLog &infoLog,
const gl::Shader &shader,
const sh::InterfaceBlock &interfaceBlock,
......
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