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

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

Issue 2165873002: Validate UniformBlocks being backed by sufficient data (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix a bug Created 4 years, 5 months 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
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 42bf2b02895f3e4d7490cb9877c129673c66dd98..8b9d62f150ff3d3c9c6c6b7723a3504af4dffb28 100644
--- a/gpu/command_buffer/service/program_manager.h
+++ b/gpu/command_buffer/service/program_manager.h
@@ -124,6 +124,10 @@ class GPU_EXPORT Program : public base::RefCounted<Program> {
GLint location;
std::string name;
};
+ struct UniformBlockSizeInfo {
+ uint32_t binding;
+ uint32_t data_size;
+ };
template <typename T>
class ShaderVariableLocationEntry {
@@ -399,6 +403,13 @@ class GPU_EXPORT Program : public base::RefCounted<Program> {
return fragment_output_written_mask_;
}
+ // Update uniform block binding after a successful glUniformBlockBinding().
+ void SetUniformBlockBinding(GLuint index, GLuint binding);
+
+ const std::vector<UniformBlockSizeInfo>& uniform_block_size_info() const {
+ return uniform_block_size_info_;
+ }
+
private:
friend class base::RefCounted<Program>;
friend class ProgramManager;
@@ -436,6 +447,7 @@ class GPU_EXPORT Program : public base::RefCounted<Program> {
void UpdateFragmentInputs();
void UpdateProgramOutputs();
void UpdateFragmentOutputBaseTypes();
+ void UpdateUniformBlockSizeInfo();
// Process the program log, replacing the hashed names with original names.
std::string ProcessLogInfo(const std::string& log);
@@ -542,6 +554,10 @@ class GPU_EXPORT Program : public base::RefCounted<Program> {
// glBindFragDataLocation() and ..IndexedEXT() calls.
LocationIndexMap bind_program_output_location_index_map_;
+ // It's stored in the order of uniform block indices, i.e., the first
+ // entry is the info about UniformBlock with index 0, etc.
+ std::vector<UniformBlockSizeInfo> uniform_block_size_info_;
+
// Fragment output variable base types: FLOAT, INT, or UINT.
// We have up to 16 outputs, each is encoded into 2 bits, total 32 bits:
// the lowest 2 bits for location 0, the highest 2 bits for location 15.
« no previous file with comments | « gpu/command_buffer/service/indexed_buffer_binding_host.cc ('k') | gpu/command_buffer/service/program_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698