Some drivers can disable the FS unit if there is nothing in the shader code that writes to an output (i.e. color, depth, etc). For drivers that check for these things, this helper function is useful to avoid that optimization in the case that the shader has shader storage space assigned (since it could be writing to it). --- src/mesa/main/mtypes.h | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 48309bf..acacae0 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -4544,6 +4544,13 @@ _mesa_active_fragment_shader_has_atomic_ops(const struct gl_context *ctx) ctx->Shader._CurrentFragmentProgram->_LinkedShaders[MESA_SHADER_FRAGMENT]->NumAtomicBuffers > 0; } +static inline bool +_mesa_active_fragment_shader_has_shader_storage(const struct gl_context *ctx) +{ + return ctx->Shader._CurrentFragmentProgram != NULL && + ctx->Shader._CurrentFragmentProgram->_LinkedShaders[MESA_SHADER_FRAGMENT]->NumShaderStorageBlocks > 0; +} + #ifdef __cplusplus } #endif -- 1.9.1 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev