Commit 33bb7c42 by Jamie Madill Committed by Commit Bot

ProgramD3D: Use more UniformTypeInfo.

Instead of storing a type GLenum, store a pointer into the type info table. This makes looking up some values a bit easier. Also includes some micro-optimizations. Improves the score of the uniforms micro-benchmark by about 12.4% on a local Windows 10 machine. BUG=angleproject:1390 Change-Id: I35f7f1c7bb3cf2c62d737b494dc56ff61ea2d1fb Reviewed-on: https://chromium-review.googlesource.com/659221 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent a9459dbc
......@@ -36,10 +36,7 @@ class ShaderExecutableD3D;
// register indices.
struct D3DUniform : private angle::NonCopyable
{
D3DUniform(GLenum typeIn,
const std::string &nameIn,
unsigned int arraySizeIn,
bool defaultBlock);
D3DUniform(GLenum type, const std::string &nameIn, unsigned int arraySizeIn, bool defaultBlock);
~D3DUniform();
bool isSampler() const;
......@@ -52,7 +49,7 @@ struct D3DUniform : private angle::NonCopyable
const uint8_t *getDataPtrToElement(size_t elementIndex) const;
// Duplicated from the GL layer
GLenum type;
const gl::UniformTypeInfo &typeInfo;
std::string name;
unsigned int arraySize;
......@@ -379,7 +376,7 @@ class ProgramD3D : public ProgramImpl
void assignSamplerRegisters(D3DUniform *d3dUniform);
static void AssignSamplers(unsigned int startSamplerIndex,
GLenum samplerType,
const gl::UniformTypeInfo &typeInfo,
unsigned int samplerCount,
std::vector<Sampler> &outSamplers,
GLuint *outUsedRange);
......@@ -392,13 +389,10 @@ class ProgramD3D : public ProgramImpl
GLsizei count,
const T *v,
uint8_t *targetData,
const gl::UniformTypeInfo &uniformTypeInfo);
GLenum uniformType);
template <typename T>
void setUniformInternal(GLint location,
GLsizei count,
const T *v,
const gl::UniformTypeInfo &uniformTypeInfo);
void setUniformInternal(GLint location, GLsizei count, const T *v, GLenum uniformType);
template <int cols, int rows>
void setUniformMatrixfvImpl(GLint location,
......
......@@ -1868,7 +1868,7 @@ gl::Error Renderer9::applyUniforms(const ProgramD3D &programD3D,
const GLfloat *f = reinterpret_cast<const GLfloat *>(targetUniform->firstNonNullData());
const GLint *i = reinterpret_cast<const GLint *>(targetUniform->firstNonNullData());
switch (targetUniform->type)
switch (targetUniform->typeInfo.type)
{
case GL_SAMPLER_2D:
case GL_SAMPLER_CUBE:
......
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