Преглед изворни кода

Add prc variable to force image bindings as writeonly (#131)

tobspr пре 9 година
родитељ
комит
3fa5b6b4ee

+ 4 - 1
panda/src/glstuff/glShaderContext_src.cxx

@@ -2486,7 +2486,10 @@ update_shader_texture_bindings(ShaderContext *prev) {
           bool has_write = param->has_write_access();
           input._writable = has_write;
 
-          if (has_read && has_write) {
+          if (gl_force_image_bindings_writeonly) {
+            access = GL_WRITE_ONLY;
+
+          } else if (has_read && has_write) {
             access = GL_READ_WRITE;
 
           } else if (has_read) {

+ 5 - 0
panda/src/glstuff/glmisc_src.cxx

@@ -299,6 +299,11 @@ ConfigVariableBool gl_support_shadow_filter
             "cards suffered from a broken implementation of the "
             "shadow map filtering features."));
 
+ConfigVariableBool gl_force_image_bindings_writeonly
+  ("gl-force-image-bindings-writeonly", false,
+   PRC_DESC("Forces all image inputs (not textures!) to be bound as writeonly, "
+            "to read from an image, rebind it as sampler."));
+
 ConfigVariableEnum<CoordinateSystem> gl_coordinate_system
   ("gl-coordinate-system", CS_yup_right,
    PRC_DESC("Which coordinate system to use as the internal "

+ 1 - 0
panda/src/glstuff/glmisc_src.h

@@ -80,6 +80,7 @@ extern ConfigVariableBool gl_fixed_vertex_attrib_locations;
 extern ConfigVariableBool gl_support_primitive_restart_index;
 extern ConfigVariableBool gl_support_sampler_objects;
 extern ConfigVariableBool gl_support_shadow_filter;
+extern ConfigVariableBool gl_force_image_bindings_writeonly;
 extern ConfigVariableEnum<CoordinateSystem> gl_coordinate_system;
 
 extern EXPCL_GL void CLP(init_classes)();