Commit 43b00426 by Geoff Lang

Optimize texture application in draw calls.

Gather all bound textures and samplers first and then pass them to generateSwizzles and applyTextures to reduce redundant get calls. BUG=260069 Change-Id: I5b10dddb01a6bfd756c58b76218838cfc1fd59b6 Reviewed-on: https://chromium-review.googlesource.com/199343Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Tested-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 45c785d3
......@@ -24,6 +24,7 @@
#include <set>
#include <map>
#include <unordered_map>
#include <array>
#include "common/angleutils.h"
#include "common/RefCountObject.h"
......@@ -464,11 +465,15 @@ class Context
private:
DISALLOW_COPY_AND_ASSIGN(Context);
// TODO: std::array may become unavailable using older versions of GCC
typedef std::array<unsigned int, IMPLEMENTATION_MAX_FRAMEBUFFER_ATTACHMENTS> FramebufferTextureSerialArray;
bool applyRenderTarget(GLenum drawMode, bool ignoreViewport);
void applyState(GLenum drawMode);
void applyShaders(ProgramBinary *programBinary, bool transformFeedbackActive);
void applyTextures(ProgramBinary *programBinary);
void applyTextures(ProgramBinary *programBinary, SamplerType type);
void applyTextures(SamplerType shaderType, Texture *textures[], TextureType *textureTypes, SamplerState *samplers,
size_t textureCount, const FramebufferTextureSerialArray& framebufferSerials,
size_t framebufferSerialCount);
bool applyUniformBuffers();
bool applyTransformFeedbackBuffers();
void markTransformFeedbackUsage();
......@@ -481,10 +486,9 @@ class Context
void detachTransformFeedback(GLuint transformFeedback);
void detachSampler(GLuint sampler);
void generateSwizzles(ProgramBinary *programBinary);
void generateSwizzles(ProgramBinary *programBinary, SamplerType type);
bool getCurrentTextureAndSamplerState(ProgramBinary *programBinary, SamplerType type, int index, Texture **outTexture,
TextureType *outTextureType, SamplerState *outSampler);
void generateSwizzles(Texture *textures[], size_t count);
size_t getCurrentTexturesAndSamplerStates(ProgramBinary *programBinary, SamplerType type, Texture **outTextures,
TextureType *outTextureTypes, SamplerState *outSamplers);
Texture *getIncompleteTexture(TextureType type);
bool skipDraw(GLenum drawMode);
......@@ -492,8 +496,7 @@ class Context
void initExtensionString();
void initRendererString();
typedef std::set<unsigned> FramebufferTextureSerialSet;
FramebufferTextureSerialSet getBoundFramebufferTextureSerials();
size_t getBoundFramebufferTextureSerials(FramebufferTextureSerialArray *outSerialArray);
rx::Renderer *const mRenderer;
......
......@@ -23,6 +23,7 @@ enum
IMPLEMENTATION_MAX_VARYING_VECTORS = 32,
IMPLEMENTATION_MAX_DRAW_BUFFERS = 8,
IMPLEMENTATION_MAX_FRAMEBUFFER_ATTACHMENTS = IMPLEMENTATION_MAX_DRAW_BUFFERS + 2, // 2 extra for depth and/or stencil buffers
IMPLEMENTATION_MAX_VERTEX_SHADER_UNIFORM_BUFFERS = 16,
IMPLEMENTATION_MAX_FRAGMENT_SHADER_UNIFORM_BUFFERS = 16,
......
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