added max and min so that more shaders compile; multistage indexing still broken