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 @@ ...@@ -24,6 +24,7 @@
#include <set> #include <set>
#include <map> #include <map>
#include <unordered_map> #include <unordered_map>
#include <array>
#include "common/angleutils.h" #include "common/angleutils.h"
#include "common/RefCountObject.h" #include "common/RefCountObject.h"
...@@ -464,11 +465,15 @@ class Context ...@@ -464,11 +465,15 @@ class Context
private: private:
DISALLOW_COPY_AND_ASSIGN(Context); 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); bool applyRenderTarget(GLenum drawMode, bool ignoreViewport);
void applyState(GLenum drawMode); void applyState(GLenum drawMode);
void applyShaders(ProgramBinary *programBinary, bool transformFeedbackActive); void applyShaders(ProgramBinary *programBinary, bool transformFeedbackActive);
void applyTextures(ProgramBinary *programBinary); void applyTextures(SamplerType shaderType, Texture *textures[], TextureType *textureTypes, SamplerState *samplers,
void applyTextures(ProgramBinary *programBinary, SamplerType type); size_t textureCount, const FramebufferTextureSerialArray& framebufferSerials,
size_t framebufferSerialCount);
bool applyUniformBuffers(); bool applyUniformBuffers();
bool applyTransformFeedbackBuffers(); bool applyTransformFeedbackBuffers();
void markTransformFeedbackUsage(); void markTransformFeedbackUsage();
...@@ -481,10 +486,9 @@ class Context ...@@ -481,10 +486,9 @@ class Context
void detachTransformFeedback(GLuint transformFeedback); void detachTransformFeedback(GLuint transformFeedback);
void detachSampler(GLuint sampler); void detachSampler(GLuint sampler);
void generateSwizzles(ProgramBinary *programBinary); void generateSwizzles(Texture *textures[], size_t count);
void generateSwizzles(ProgramBinary *programBinary, SamplerType type); size_t getCurrentTexturesAndSamplerStates(ProgramBinary *programBinary, SamplerType type, Texture **outTextures,
bool getCurrentTextureAndSamplerState(ProgramBinary *programBinary, SamplerType type, int index, Texture **outTexture, TextureType *outTextureTypes, SamplerState *outSamplers);
TextureType *outTextureType, SamplerState *outSampler);
Texture *getIncompleteTexture(TextureType type); Texture *getIncompleteTexture(TextureType type);
bool skipDraw(GLenum drawMode); bool skipDraw(GLenum drawMode);
...@@ -492,8 +496,7 @@ class Context ...@@ -492,8 +496,7 @@ class Context
void initExtensionString(); void initExtensionString();
void initRendererString(); void initRendererString();
typedef std::set<unsigned> FramebufferTextureSerialSet; size_t getBoundFramebufferTextureSerials(FramebufferTextureSerialArray *outSerialArray);
FramebufferTextureSerialSet getBoundFramebufferTextureSerials();
rx::Renderer *const mRenderer; rx::Renderer *const mRenderer;
......
...@@ -23,6 +23,7 @@ enum ...@@ -23,6 +23,7 @@ enum
IMPLEMENTATION_MAX_VARYING_VECTORS = 32, IMPLEMENTATION_MAX_VARYING_VECTORS = 32,
IMPLEMENTATION_MAX_DRAW_BUFFERS = 8, 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_VERTEX_SHADER_UNIFORM_BUFFERS = 16,
IMPLEMENTATION_MAX_FRAGMENT_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