Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1331)

Unified Diff: gpu/command_buffer/service/program_manager.h

Issue 1415763009: command_buffer: Make inactive bound fragment inputs reserve the location (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@binduniformlocation-reserve-location
Patch Set: rebase Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder.cc ('k') | gpu/command_buffer/service/program_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/service/program_manager.h
diff --git a/gpu/command_buffer/service/program_manager.h b/gpu/command_buffer/service/program_manager.h
index daecf4d9a654c3242e9e8dec7fcd6d73941fb954..942659dddb037533ff533f990776686969f30cdc 100644
--- a/gpu/command_buffer/service/program_manager.h
+++ b/gpu/command_buffer/service/program_manager.h
@@ -66,7 +66,6 @@ class GPU_EXPORT Program : public base::RefCounted<Program> {
FragmentInputInfo(GLenum _type, GLuint _location)
: type(_type), location(_location) {}
FragmentInputInfo() : type(GL_NONE), location(0) {}
- bool IsValid() const { return type != GL_NONE; }
GLenum type;
GLuint location;
};
@@ -107,39 +106,44 @@ class GPU_EXPORT Program : public base::RefCounted<Program> {
std::string name;
};
- class UniformLocationEntry {
+ template <typename T>
+ class ShaderVariableLocationEntry {
public:
- UniformLocationEntry() : uniform_(nullptr), inactive_(false) {}
- bool IsUnused() const { return !uniform_ && !inactive_; }
+ ShaderVariableLocationEntry()
+ : shader_variable_(nullptr), inactive_(false) {}
+ bool IsUnused() const { return !shader_variable_ && !inactive_; }
bool IsInactive() const { return inactive_; }
- bool IsActive() const { return uniform_ != nullptr; }
+ bool IsActive() const { return shader_variable_ != nullptr; }
void SetInactive() {
- uniform_ = nullptr;
+ shader_variable_ = nullptr;
inactive_ = true;
}
- void SetActive(UniformInfo* uniform) {
- DCHECK(uniform);
- uniform_ = uniform;
+ void SetActive(T* shader_variable) {
+ DCHECK(shader_variable);
+ shader_variable_ = shader_variable;
inactive_ = false;
}
- const UniformInfo* uniform() const {
+ const T* shader_variable() const {
DCHECK(IsActive());
- return uniform_;
+ return shader_variable_;
}
- UniformInfo* uniform() {
+ T* shader_variable() {
DCHECK(IsActive());
- return uniform_;
+ return shader_variable_;
}
private:
- UniformInfo* uniform_; // Pointer to uniform_info_ vector entry.
+ T* shader_variable_; // Pointer to *_info_ vector entry.
bool inactive_;
};
typedef std::vector<UniformInfo> UniformInfoVector;
- typedef std::vector<UniformLocationEntry> UniformLocationVector;
+ typedef std::vector<ShaderVariableLocationEntry<UniformInfo>>
+ UniformLocationVector;
typedef std::vector<VertexAttrib> AttribInfoVector;
typedef std::vector<FragmentInputInfo> FragmentInputInfoVector;
+ typedef std::vector<ShaderVariableLocationEntry<FragmentInputInfo>>
+ FragmentInputLocationVector;
typedef std::vector<int> SamplerIndices;
typedef std::map<std::string, GLint> LocationMap;
typedef std::vector<std::string> StringVector;
@@ -192,6 +196,8 @@ class GPU_EXPORT Program : public base::RefCounted<Program> {
const FragmentInputInfo* GetFragmentInputInfoByFakeLocation(
GLint fake_location) const;
+ bool IsInactiveFragmentInputLocationByFakeLocation(GLint fake_location) const;
+
// Gets the fake location of a uniform by name.
GLint GetUniformFakeLocation(const std::string& name) const;
@@ -439,6 +445,7 @@ class GPU_EXPORT Program : public base::RefCounted<Program> {
SamplerIndices sampler_indices_;
FragmentInputInfoVector fragment_input_infos_;
+ FragmentInputLocationVector fragment_input_locations_;
// The program this Program is tracking.
GLuint service_id_;
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder.cc ('k') | gpu/command_buffer/service/program_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698