Commit 72f39c15 by Jamie Madill

Make more Program sampler methods D3D-only.

Several of these methods that deal with the sampler mapping can be made D3D-only quite simply by casting to ProgramD3D in the Renderer. BUG=angleproject:1123 Change-Id: Ia6648d26744f9aa69a4a0facb356209df471fa7b Reviewed-on: https://chromium-review.googlesource.com/293823Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Tested-by: 's avatarJamie Madill <jmadill@chromium.org>
parent d2eaa37d
......@@ -704,22 +704,6 @@ GLint Program::getActiveAttributeMaxLength()
return maxLength;
}
// Returns one more than the highest sampler index used.
GLint Program::getUsedSamplerRange(SamplerType type)
{
return mProgram->getUsedSamplerRange(type);
}
GLint Program::getSamplerMapping(SamplerType type, unsigned int samplerIndex, const Caps &caps)
{
return mProgram->getSamplerMapping(type, samplerIndex, caps);
}
GLenum Program::getSamplerTextureType(SamplerType type, unsigned int samplerIndex)
{
return mProgram->getSamplerTextureType(type, samplerIndex);
}
GLint Program::getFragDataLocation(const std::string &name) const
{
std::string baseName(name);
......@@ -1029,11 +1013,6 @@ bool Program::isValidated() const
return mValidated;
}
void Program::updateSamplerMapping()
{
return mProgram->updateSamplerMapping();
}
GLuint Program::getActiveUniformBlockCount()
{
return static_cast<GLuint>(mProgram->getUniformBlocks().size());
......
......@@ -223,10 +223,6 @@ class Program : angle::NonCopyable
GLint getActiveAttributeMaxLength();
const std::vector<sh::Attribute> &getLinkedAttributes() const { return mLinkedAttributes; }
GLint getSamplerMapping(SamplerType type, unsigned int samplerIndex, const Caps &caps);
GLenum getSamplerTextureType(SamplerType type, unsigned int samplerIndex);
GLint getUsedSamplerRange(SamplerType type);
GLint getFragDataLocation(const std::string &name) const;
void getActiveUniform(GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
......@@ -298,7 +294,6 @@ class Program : angle::NonCopyable
void validate(const Caps &caps);
bool validateSamplers(InfoLog *infoLog, const Caps &caps);
bool isValidated() const;
void updateSamplerMapping();
private:
void unlink(bool destroy = false);
......
......@@ -78,10 +78,6 @@ class ProgramImpl : angle::NonCopyable
// TODO: The following functions are possibly only applicable to D3D backends. The should be carefully evaluated to
// determine if they can be removed from this interface.
virtual GLint getSamplerMapping(gl::SamplerType type, unsigned int samplerIndex, const gl::Caps &caps) const = 0;
virtual GLenum getSamplerTextureType(gl::SamplerType type, unsigned int samplerIndex) const = 0;
virtual GLint getUsedSamplerRange(gl::SamplerType type) const = 0;
virtual void updateSamplerMapping() = 0;
virtual bool validateSamplers(gl::InfoLog *infoLog, const gl::Caps &caps) = 0;
virtual gl::Error applyUniforms() = 0;
......
......@@ -79,11 +79,11 @@ gl::Error RendererD3D::drawElements(const gl::Data &data,
}
gl::Program *program = data.state->getProgram();
ASSERT(program != NULL);
ASSERT(program != nullptr);
ProgramD3D *programD3D = GetImplAs<ProgramD3D>(program);
bool usesPointSize = programD3D->usesPointSize();
bool usesPointSize = GetImplAs<ProgramD3D>(program)->usesPointSize();
program->updateSamplerMapping();
programD3D->updateSamplerMapping();
gl::Error error = generateSwizzles(data);
if (error.isError())
......@@ -168,11 +168,11 @@ gl::Error RendererD3D::drawArrays(const gl::Data &data,
GLsizei count, GLsizei instances)
{
gl::Program *program = data.state->getProgram();
ASSERT(program != NULL);
bool usesPointSize = GetImplAs<ProgramD3D>(program)->usesPointSize();
ASSERT(program != nullptr);
ProgramD3D *programD3D = GetImplAs<ProgramD3D>(program);
bool usesPointSize = programD3D->usesPointSize();
program->updateSamplerMapping();
programD3D->updateSamplerMapping();
gl::Error error = generateSwizzles(data);
if (error.isError())
......@@ -242,14 +242,14 @@ gl::Error RendererD3D::drawArrays(const gl::Data &data,
gl::Error RendererD3D::generateSwizzles(const gl::Data &data, gl::SamplerType type)
{
gl::Program *program = data.state->getProgram();
ProgramD3D *programD3D = GetImplAs<ProgramD3D>(data.state->getProgram());
unsigned int samplerRange = static_cast<unsigned int>(program->getUsedSamplerRange(type));
unsigned int samplerRange = static_cast<unsigned int>(programD3D->getUsedSamplerRange(type));
for (unsigned int i = 0; i < samplerRange; i++)
{
GLenum textureType = program->getSamplerTextureType(type, i);
GLint textureUnit = program->getSamplerMapping(type, i, *data.caps);
GLenum textureType = programD3D->getSamplerTextureType(type, i);
GLint textureUnit = programD3D->getSamplerMapping(type, i, *data.caps);
if (textureUnit != -1)
{
gl::Texture *texture = data.state->getSamplerTexture(textureUnit, textureType);
......@@ -393,13 +393,13 @@ gl::Error RendererD3D::applyShaders(const gl::Data &data)
gl::Error RendererD3D::applyTextures(const gl::Data &data, gl::SamplerType shaderType,
const FramebufferTextureArray &framebufferTextures, size_t framebufferTextureCount)
{
gl::Program *program = data.state->getProgram();
ProgramD3D *programD3D = GetImplAs<ProgramD3D>(data.state->getProgram());
unsigned int samplerRange = program->getUsedSamplerRange(shaderType);
unsigned int samplerRange = programD3D->getUsedSamplerRange(shaderType);
for (unsigned int samplerIndex = 0; samplerIndex < samplerRange; samplerIndex++)
{
GLenum textureType = program->getSamplerTextureType(shaderType, samplerIndex);
GLint textureUnit = program->getSamplerMapping(shaderType, samplerIndex, *data.caps);
GLenum textureType = programD3D->getSamplerTextureType(shaderType, samplerIndex);
GLint textureUnit = programD3D->getSamplerMapping(shaderType, samplerIndex, *data.caps);
if (textureUnit != -1)
{
gl::Texture *texture = data.state->getSamplerTexture(textureUnit, textureType);
......
......@@ -359,29 +359,6 @@ void ProgramGL::getUniformuiv(GLint location, GLuint *params)
mFunctions->getUniformuiv(mProgramID, location, params);
}
GLint ProgramGL::getSamplerMapping(gl::SamplerType type, unsigned int samplerIndex, const gl::Caps &caps) const
{
UNIMPLEMENTED();
return GLint();
}
GLenum ProgramGL::getSamplerTextureType(gl::SamplerType type, unsigned int samplerIndex) const
{
UNIMPLEMENTED();
return GLenum();
}
GLint ProgramGL::getUsedSamplerRange(gl::SamplerType type) const
{
UNIMPLEMENTED();
return GLint();
}
void ProgramGL::updateSamplerMapping()
{
UNIMPLEMENTED();
}
bool ProgramGL::validateSamplers(gl::InfoLog *infoLog, const gl::Caps &caps)
{
//UNIMPLEMENTED();
......
......@@ -71,10 +71,6 @@ class ProgramGL : public ProgramImpl
void getUniformiv(GLint location, GLint *params) override;
void getUniformuiv(GLint location, GLuint *params) override;
GLint getSamplerMapping(gl::SamplerType type, unsigned int samplerIndex, const gl::Caps &caps) const override;
GLenum getSamplerTextureType(gl::SamplerType type, unsigned int samplerIndex) const override;
GLint getUsedSamplerRange(gl::SamplerType type) const override;
void updateSamplerMapping() override;
bool validateSamplers(gl::InfoLog *infoLog, const gl::Caps &caps) override;
void defineUniformBlock(gl::InfoLog &infoLog,
......
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