Commit e5df3066 by Olli Etuaho

D3D: Run applyTextures before applyShaders

applyShaders will update uniform data by uploading the constant buffer. In the future uniform data will contain the base level of textures so that shaders can use it to adjust results of texture functions. The most natural place to set the base level in uniform data is applyTextures, so it needs to be run before applyShaders. updateSamplerMapping needs to be called before applyTextures, but genericDraw* functions already do that. Remove redundant updateSamplerMapping call from ProgramD3D::applyUniforms. BUG=angleproject:596 BUG=angleproject:1092 BUG=angleproject:1261 TEST=angle_end2end_tests Change-Id: I1828f7bdc75999872a26941a02cb4b6c6a66094d Reviewed-on: https://chromium-review.googlesource.com/322121Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Tryjob-Request: Olli Etuaho <oetuaho@nvidia.com> Tested-by: 's avatarOlli Etuaho <oetuaho@nvidia.com> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent a7416ff7
......@@ -1553,7 +1553,7 @@ void ProgramD3D::initializeUniformStorage()
gl::Error ProgramD3D::applyUniforms(GLenum drawMode)
{
updateSamplerMapping();
ASSERT(!mDirtySamplerMapping);
gl::Error error = mRenderer->applyUniforms(*this, drawMode, mD3DUniforms);
if (error.isError())
......
......@@ -245,6 +245,8 @@ class ProgramD3D : public ProgramImpl
void updateCachedInputLayout(const gl::State &state);
const gl::InputLayout &getCachedInputLayout() const { return mCachedInputLayout; }
bool isSamplerMappingDirty() { return mDirtySamplerMapping; }
private:
class VertexExecutable
{
......
......@@ -183,13 +183,13 @@ gl::Error RendererD3D::genericDrawElements(const gl::Data &data,
return error;
}
error = applyShaders(data, mode);
error = applyTextures(data);
if (error.isError())
{
return error;
}
error = applyTextures(data);
error = applyShaders(data, mode);
if (error.isError())
{
return error;
......@@ -251,13 +251,13 @@ gl::Error RendererD3D::genericDrawArrays(const gl::Data &data,
return error;
}
error = applyShaders(data, mode);
error = applyTextures(data);
if (error.isError())
{
return error;
}
error = applyTextures(data);
error = applyShaders(data, mode);
if (error.isError())
{
return error;
......@@ -386,11 +386,14 @@ gl::Error RendererD3D::applyShaders(const gl::Data &data, GLenum drawMode)
// For each Direct3D sampler of either the pixel or vertex stage,
// looks up the corresponding OpenGL texture image unit and texture type,
// and sets the texture and its addressing/filtering state (or NULL when inactive).
// Sampler mapping needs to be up-to-date on the program object before this is called.
gl::Error RendererD3D::applyTextures(const gl::Data &data, gl::SamplerType shaderType,
const FramebufferTextureArray &framebufferTextures, size_t framebufferTextureCount)
{
ProgramD3D *programD3D = GetImplAs<ProgramD3D>(data.state->getProgram());
ASSERT(!programD3D->isSamplerMappingDirty());
unsigned int samplerRange = programD3D->getUsedSamplerRange(shaderType);
for (unsigned int samplerIndex = 0; samplerIndex < samplerRange; samplerIndex++)
{
......
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