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

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

Issue 2142353002: Validate fbo color image format and fragment shader output variable type. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 734e50fc03b5f8cdad588617af8b141725d7d5f4..5c58ec4089425547631463790a474c995a322276 100644
--- a/gpu/command_buffer/service/program_manager.h
+++ b/gpu/command_buffer/service/program_manager.h
@@ -386,6 +386,16 @@ class GPU_EXPORT Program : public base::RefCounted<Program> {
return transform_feedback_buffer_mode_;
}
+ // Return each draw buffer's corresponding fragment shader output variable's
+ // base type: FLOAT, INT, or UINT.
+ // If the draw buffer has no corresponding output variable, its base type
+ // is UNDEFINED_TYPE.
+ // The data are only valid after a successful link.
+ const std::vector<ShaderVariableBaseType>& GetFragmentOutputBaseTypes(
+ ) const {
+ return fragment_output_base_types_;
+ }
+
private:
friend class base::RefCounted<Program>;
friend class ProgramManager;
@@ -422,6 +432,7 @@ class GPU_EXPORT Program : public base::RefCounted<Program> {
void UpdateUniforms();
void UpdateFragmentInputs();
void UpdateProgramOutputs();
+ void UpdateFragmentOutputBaseTypes();
// Process the program log, replacing the hashed names with original names.
std::string ProcessLogInfo(const std::string& log);
@@ -451,6 +462,8 @@ class GPU_EXPORT Program : public base::RefCounted<Program> {
void DetachShaders(ShaderManager* manager);
+ void ResetFragmentOutputBaseTypes();
+
static inline size_t GetUniformLocationIndexFromFakeLocation(
GLint fake_location) {
return static_cast<size_t>(fake_location & 0xFFFF);
@@ -493,8 +506,7 @@ class GPU_EXPORT Program : public base::RefCounted<Program> {
GLuint service_id_;
// Shaders by type of shader.
- scoped_refptr<Shader>
- attached_shaders_[kMaxAttachedShaders];
+ scoped_refptr<Shader> attached_shaders_[kMaxAttachedShaders];
// True if this program is marked as deleted.
bool deleted_;
@@ -528,6 +540,9 @@ class GPU_EXPORT Program : public base::RefCounted<Program> {
// output variable - (location,index) binding map from
// glBindFragDataLocation() and ..IndexedEXT() calls.
LocationIndexMap bind_program_output_location_index_map_;
+
+ // Fragment output variable base types: FLOAT, INT, or UINT.
+ std::vector<ShaderVariableBaseType> fragment_output_base_types_;
};
// Tracks the Programs.
@@ -538,6 +553,7 @@ class GPU_EXPORT ProgramManager {
public:
ProgramManager(ProgramCache* program_cache,
uint32_t max_varying_vectors,
+ uint32_t max_draw_buffers,
uint32_t max_dual_source_draw_buffers,
const GpuPreferences& gpu_preferences,
FeatureInfo* feature_info);
@@ -581,6 +597,8 @@ class GPU_EXPORT ProgramManager {
uint32_t max_varying_vectors() const { return max_varying_vectors_; }
+ uint32_t max_draw_buffers() const { return max_draw_buffers_; }
+
uint32_t max_dual_source_draw_buffers() const {
return max_dual_source_draw_buffers_;
}
@@ -611,6 +629,7 @@ class GPU_EXPORT ProgramManager {
ProgramCache* program_cache_;
uint32_t max_varying_vectors_;
+ uint32_t max_draw_buffers_;
uint32_t max_dual_source_draw_buffers_;
const GpuPreferences& gpu_preferences_;

Powered by Google App Engine
This is Rietveld 408576698